mirror of
https://github.com/jorenn92/Maintainerr.git
synced 2025-12-19 08:25:47 +01:00
chore: restructure monorepo with apps/ folder (#2178)
--------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: benscobie <944312+benscobie@users.noreply.github.com> Co-authored-by: Ben Scobie <benscobie@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
.git
|
||||
data/
|
||||
docker/nginx-reverse-subfolder/
|
||||
server/dist
|
||||
ui/.next
|
||||
apps/server/dist
|
||||
apps/ui/.next
|
||||
Dockerfile
|
||||
**/*.md
|
||||
21
.github/copilot-instructions.md
vendored
21
.github/copilot-instructions.md
vendored
@@ -9,17 +9,18 @@ Maintainerr is a media management application that helps users automatically man
|
||||
This is a **TypeScript monorepo** managed with **Turborepo** and **Yarn workspaces**:
|
||||
|
||||
```
|
||||
├── server/ # Nest.js backend API
|
||||
├── ui/ # Vite + React Router frontend application
|
||||
├── apps/
|
||||
│ ├── server/ # Nest.js backend API
|
||||
│ └── ui/ # Vite + React Router frontend application
|
||||
├── packages/
|
||||
│ └── contracts/ # Shared TypeScript types, DTOs, and interfaces
|
||||
├── package.json # Root package with Turborepo scripts
|
||||
└── turbo.json # Turborepo configuration
|
||||
│ └── contracts/ # Shared TypeScript types, DTOs, and interfaces
|
||||
├── package.json # Root package with Turborepo scripts
|
||||
└── turbo.json # Turborepo configuration
|
||||
```
|
||||
|
||||
## Technology Stack
|
||||
|
||||
### Backend (`server/`)
|
||||
### Backend (`apps/server/`)
|
||||
|
||||
- **Framework**: Nest.js with TypeScript
|
||||
- **Database**: TypeORM with SQLite
|
||||
@@ -28,7 +29,7 @@ This is a **TypeScript monorepo** managed with **Turborepo** and **Yarn workspac
|
||||
- **Validation**: Zod schemas with nestjs-zod
|
||||
- **Architecture**: Event-driven with schedulers, graceful shutdown support
|
||||
|
||||
### Frontend (`ui/`)
|
||||
### Frontend (`apps/ui/`)
|
||||
|
||||
- **Build System**: Vite 7+ for fast development and production builds
|
||||
- **Framework**: React 19+ with React Router 7+ for client-side routing
|
||||
@@ -133,7 +134,7 @@ yarn workspace @maintainerr/contracts build
|
||||
### Server Structure
|
||||
|
||||
```
|
||||
server/src/
|
||||
apps/server/src/
|
||||
├── modules/ # Feature modules (collections, rules, settings, etc.)
|
||||
├── common/ # Shared utilities, decorators, filters
|
||||
├── database/ # TypeORM entities and migrations
|
||||
@@ -144,7 +145,7 @@ server/src/
|
||||
### UI Structure
|
||||
|
||||
```
|
||||
ui/src/
|
||||
apps/ui/src/
|
||||
├── components/ # Reusable UI components
|
||||
├── hooks/ # Custom React hooks
|
||||
├── pages/ # Page components for routes (DocsPage, PlexLoadingPage)
|
||||
@@ -161,7 +162,7 @@ When modifying existing code, follow these specific refactoring priorities:
|
||||
### Forms and UI Components
|
||||
|
||||
- **React Hook Forms Migration**: Forms that do not use React Hook Form should be refactored to use it, along with their Zod validation schemas and corresponding DTOs from the contracts package. See [PR #1871](https://github.com/Maintainerr/Maintainerr/pull/1871) as a reference example.
|
||||
- **Form Components**: Use existing form components from `ui/src/components/Forms/` (Input, Select, etc.) and create new ones in this directory if necessary, following the same patterns.
|
||||
- **Form Components**: Use existing form components from `apps/ui/src/components/Forms/` (Input, Select, etc.) and create new ones in this directory if necessary, following the same patterns.
|
||||
- **Component Naming**: Component file names should follow the exported type name(s) rather than using generic `index.tsx` files. For example, use `UserSettingsForm.tsx` instead of `index.tsx`.
|
||||
|
||||
### Server-Side Type Safety
|
||||
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -52,7 +52,7 @@
|
||||
"jest.virtualFolders": [
|
||||
{
|
||||
"name": "server",
|
||||
"rootPath": "server"
|
||||
"rootPath": "apps/server"
|
||||
}
|
||||
],
|
||||
"sqltools.useNodeRuntime": true
|
||||
|
||||
4
.vscode/tasks.json
vendored
4
.vscode/tasks.json
vendored
@@ -161,7 +161,7 @@
|
||||
{
|
||||
"label": "Clean Install",
|
||||
"type": "shell",
|
||||
"command": "rm -rf node_modules server/node_modules ui/node_modules packages/*/node_modules && yarn install",
|
||||
"command": "rm -rf node_modules apps/server/node_modules apps/ui/node_modules packages/*/node_modules && yarn install",
|
||||
"problemMatcher": [],
|
||||
"group": "none",
|
||||
"presentation": {
|
||||
@@ -172,7 +172,7 @@
|
||||
{
|
||||
"label": "Clean Build Artifacts",
|
||||
"type": "shell",
|
||||
"command": "rm -rf server/dist ui/.next ui/out packages/*/dist",
|
||||
"command": "rm -rf apps/server/dist apps/ui/.next apps/ui/out packages/*/dist",
|
||||
"problemMatcher": [],
|
||||
"group": "none",
|
||||
"presentation": {
|
||||
|
||||
12
Dockerfile
12
Dockerfile
@@ -11,7 +11,7 @@ COPY . .
|
||||
RUN yarn install --network-timeout 99999999
|
||||
RUN yarn cache clean
|
||||
|
||||
RUN <<EOF cat >> ./ui/.env
|
||||
RUN <<EOF cat >> ./apps/ui/.env
|
||||
VITE_BASE_PATH=/__PATH_PREFIX__
|
||||
EOF
|
||||
|
||||
@@ -22,7 +22,7 @@ RUN yarn workspaces focus --all --production
|
||||
|
||||
# When all packages are hoisted, there is no node_modules folder. Ensure these folders always have a node_modules folder to COPY later on.
|
||||
RUN mkdir -p ./packages/contracts/node_modules
|
||||
RUN mkdir -p ./server/node_modules
|
||||
RUN mkdir -p ./apps/server/node_modules
|
||||
|
||||
FROM base AS runner
|
||||
|
||||
@@ -32,12 +32,12 @@ WORKDIR /opt/app
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/node_modules ./node_modules
|
||||
|
||||
# Copy standalone server
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/server/dist ./server/dist
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/server/package.json ./server/package.json
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/server/node_modules ./server/node_modules
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/apps/server/dist ./apps/server/dist
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/apps/server/package.json ./apps/server/package.json
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/apps/server/node_modules ./apps/server/node_modules
|
||||
|
||||
# copy UI output to API to be served statically
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/ui/dist ./server/dist/ui
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/apps/ui/dist ./apps/server/dist/ui
|
||||
|
||||
# Copy packages/contracts
|
||||
COPY --from=builder --chmod=777 --chown=node:node /app/packages/contracts/dist ./packages/contracts/dist
|
||||
|
||||
@@ -6,7 +6,7 @@ const ormConfig: TypeOrmModuleOptions = {
|
||||
database:
|
||||
process.env.NODE_ENV === 'production'
|
||||
? '/opt/data/maintainerr.sqlite'
|
||||
: '../data/maintainerr.sqlite',
|
||||
: '../../data/maintainerr.sqlite',
|
||||
subscribers: ['./**/*.subscriber{.ts,.js}'],
|
||||
migrations:
|
||||
process.env.NODE_ENV === 'production'
|
||||
@@ -2,7 +2,7 @@ import { DataSource } from 'typeorm';
|
||||
|
||||
const datasource = new DataSource({
|
||||
type: 'better-sqlite3',
|
||||
database: '../data/maintainerr.sqlite',
|
||||
database: '../../data/maintainerr.sqlite',
|
||||
entities: ['./dist/**/*.entities{.ts,.js}'],
|
||||
synchronize: false,
|
||||
migrationsTableName: 'migrations',
|
||||
@@ -11,7 +11,7 @@ import { MaintainerrLogger } from './modules/logging/logs.service';
|
||||
const dataDir =
|
||||
process.env.NODE_ENV === 'production'
|
||||
? '/opt/data'
|
||||
: path.join(__dirname, '../../data');
|
||||
: path.join(__dirname, '../../../data');
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user