41 lines
1.5 KiB
Markdown
41 lines
1.5 KiB
Markdown
# Backend Workspace
|
|
|
|
NestJS Backend fuer das Boilerplate. Der Workspace wird normalerweise ueber die
|
|
Root-Scripts gesteuert.
|
|
|
|
## Befehle
|
|
|
|
```bash
|
|
npm --workspace apps/backend run start:dev
|
|
npm --workspace apps/backend run build
|
|
npm --workspace apps/backend run typecheck
|
|
npm --workspace apps/backend run test
|
|
npm --workspace apps/backend run migration:status
|
|
npm --workspace apps/backend run migration:run
|
|
npm --workspace apps/backend run migration:generate
|
|
```
|
|
|
|
Root-Aliase fuer die wichtigsten Befehle stehen in `../../package.json`.
|
|
|
|
## Struktur
|
|
|
|
- `src/main.ts`: Bootstrap, Security Header, CORS, Swagger, Static Assets
|
|
- `src/app.module.ts`: globale Guards, Filter, Rate Limiting und Feature-Module
|
|
- `src/auth`: OIDC Login, Callback, Public Decorator und Guards
|
|
- `src/sessions`: serverseitige Sessions und CSRF
|
|
- `src/roles`: Rollen und Code-definierte Permissions
|
|
- `src/users`: lokale Benutzer und Einstellungen
|
|
- `src/items`: Beispiel-Fachmodul
|
|
- `src/database`: TypeORM-Konfiguration, Entities, Migrationen und Healthcheck
|
|
- `src/common`: Fehlerformat, Validierung, Request ID und Hilfsdienste
|
|
|
|
## Entwicklungsregeln
|
|
|
|
Controller verwenden keine TypeORM-Repositories direkt. Fachlogik gehoert in
|
|
Services, Datenbankzugriff in Repository-Klassen oder klar benannte
|
|
Persistence-Services. Neue Endpunkte muessen mit Permissions geschuetzt werden,
|
|
sofern sie nicht explizit public sind.
|
|
|
|
Migrationen werden nicht automatisch beim normalen App-Start ausgefuehrt. Nutze
|
|
`npm run migration:run` aus dem Root oder den Workspace-Befehl oben.
|