compose.yaml overrode the image's own entrypoint to start "tsx watch" and "next dev" with CHOKIDAR_USEPOLLING and WATCHPACK_POLLING enabled. The built dist/ and .next from the image were never used, and the polling watchers kept both containers busy around the clock whether or not anyone used the application. Split the two use cases: compose.yaml now runs node dist/server/index.js and next start with no source mounts and no watchers, and the watching setup moves to compose.dev.yaml. next build writes the rewrite destinations from next.config.mjs into .next/routes-manifest.json, so next start cannot pick up API_INTERNAL_URL at runtime the way next dev does. Pass it as a build argument. Give the web container its own probe. The healthcheck hit "/", which redirects to "/projects", and fetch follows redirects, so every probe rendered two pages every five seconds. "/health" could not serve as the probe because next.config.mjs rewrites it to the API. Add "/web-health" as a route handler, exclude it from the proxy matcher, and relax both intervals to 30s. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
141 lines
4.5 KiB
Markdown
141 lines
4.5 KiB
Markdown
# Leistungsbilanz
|
|
|
|
Leistungsbilanz ist eine Webanwendung für die elektrische Ausführungsplanung. Im
|
|
Mittelpunkt steht ein tabellenähnlicher Stromkreislisten-Editor, der Stromkreise,
|
|
Gerätezeilen und wiederverwendbare Projektgeräte fachlich getrennt behandelt.
|
|
|
|
Das Projekt befindet sich in aktiver Entwicklung. Der lokale Entwicklungsbetrieb
|
|
mit SQLite und Docker Compose ist unterstützt. Ein Produktionsdeployment,
|
|
Mehrbenutzerbetrieb und der Revit-/IFCGUID-Datenaustausch sind noch nicht
|
|
implementiert.
|
|
|
|
## Unterstützter Arbeitsablauf
|
|
|
|
- Projekte, Verteilungen, Etagen und Räume verwalten
|
|
- pro Verteilung geschützte Stromkreisgruppen für Beleuchtung, 1-phasige und
|
|
3-phasige Stromkreise verwalten
|
|
- Hauptschalter, Überspannungsableiter, Gruppenschutz und zusätzliche
|
|
Verteilergeräte in der Stromkreisliste abbilden
|
|
- Schutzgeräte je Stromkreis und optional je Gruppe konfigurieren
|
|
- leere, einzeilige und mehrzeilige Stromkreise abbilden
|
|
- Stromkreise und Gerätezeilen per Drag-and-drop umstrukturieren
|
|
- Projektgeräte einfügen, verknüpfen und kontrolliert synchronisieren
|
|
- komplette Stromkreisblöcke filtern und sortieren
|
|
- BMKs stabil halten und nur auf ausdrücklichen Befehl neu nummerieren
|
|
- Änderungen projektweit und auch nach einem Reload rückgängig machen und wiederholen
|
|
- benannte Sicherungspunkte anlegen, wiederherstellen und Revisionen einsehen
|
|
- automatische Sicherungspunkte mit begrenzter Aufbewahrung nutzen
|
|
|
|
## Technik
|
|
|
|
- Next.js 16, React 19 und TypeScript für das Frontend
|
|
- Express 5 und Zod für die API
|
|
- SQLite, `better-sqlite3` und Drizzle ORM für die Persistenz
|
|
- eigener Spreadsheet-Grid statt eines Bootstrap-Tabellenframeworks
|
|
- Node.js-Test-Runner für Domain-, Grid- und SQLite-Integrationstests
|
|
|
|
## Schnellstart mit Docker
|
|
|
|
Voraussetzungen:
|
|
|
|
- Git
|
|
- Docker Desktop mit Docker Compose
|
|
|
|
```powershell
|
|
git clone <repository-url>
|
|
Set-Location leistungsbilanz-ts
|
|
docker compose up --build --detach
|
|
```
|
|
|
|
Danach:
|
|
|
|
- Frontend: <http://localhost:3001>
|
|
- API-Healthcheck: <http://localhost:3000/health>
|
|
|
|
Der API-Container führt ausstehende Migrationen und die Schemaprüfung beim Start
|
|
automatisch aus. Die SQLite-Datei liegt auf dem Host unter
|
|
`data/leistungsbilanz.db` und bleibt beim Stoppen erhalten.
|
|
|
|
```powershell
|
|
docker compose ps
|
|
docker compose logs --follow
|
|
docker compose down
|
|
```
|
|
|
|
`compose.yaml` startet den Produktionsstand: gebautes `dist/` und `next start`,
|
|
ohne Quellcode-Mounts und ohne Datei-Watcher. Details stehen in
|
|
[Deployment und Betrieb](docs/deployment.md).
|
|
|
|
Für die Entwicklung mit Hot Reload gibt es einen eigenen Stack mit
|
|
Quellcode-Mounts und Watchern:
|
|
|
|
```powershell
|
|
docker compose -f compose.dev.yaml up --build --detach
|
|
docker compose -f compose.dev.yaml logs --follow
|
|
docker compose -f compose.dev.yaml down
|
|
```
|
|
|
|
Die Watcher darin laufen im Polling-Modus, weil Bind-Mounts unter Windows und
|
|
macOS keine inotify-Events durchreichen. Das kostet dauerhaft CPU, auch wenn
|
|
niemand die Anwendung benutzt — deshalb gehört dieser Stack nicht auf einen
|
|
Server.
|
|
|
|
## Direkte lokale Entwicklung
|
|
|
|
Voraussetzungen:
|
|
|
|
- Node.js 24
|
|
- npm
|
|
|
|
```powershell
|
|
npm ci
|
|
npm run db:migrate
|
|
npm run db:verify:circuit-schema
|
|
npm run dev:api
|
|
```
|
|
|
|
In einem zweiten Terminal:
|
|
|
|
```powershell
|
|
npm run dev:web
|
|
```
|
|
|
|
Frontend und API laufen anschließend auf denselben Ports wie im Docker-Setup.
|
|
|
|
## Qualitätssicherung
|
|
|
|
```powershell
|
|
npm test
|
|
npm run build:api
|
|
npm run build:web
|
|
npm run typecheck:scripts
|
|
npx tsc --noEmit -p tsconfig.next.json
|
|
```
|
|
|
|
Wichtige Datenbankbefehle:
|
|
|
|
```powershell
|
|
npm run db:backup
|
|
npm run db:migrate
|
|
npm run db:verify:circuit-schema
|
|
npm run db:generate
|
|
```
|
|
|
|
`db:backup` verwendet die SQLite-Online-Backup-API und prüft das Ergebnis auf
|
|
Integrität und Fremdschlüsselverletzungen. Migration `0000` ist die
|
|
Release-Baseline für eine leere Datenbank; nachfolgende nummerierte Migrationen
|
|
entwickeln diese Baseline additiv weiter. Datenbanken aus Entwicklungsständen
|
|
vor der Baseline werden nicht unterstützt.
|
|
|
|
## Dokumentation
|
|
|
|
- [Dokumentationsübersicht](docs/README.md)
|
|
- [Aktuelle Architektur](docs/current-architecture.md)
|
|
- [Editor-Interaktionen](docs/circuit-list-editor-interactions.md)
|
|
- [API des Stromkreislisten-Editors](docs/circuit-list-editor-api.md)
|
|
- [Entwicklungs- und Contributor-Workflow](docs/development-workflow.md)
|
|
- [Bekannte Einschränkungen](docs/circuit-list-editor-known-limitations.md)
|
|
- [Roadmap](docs/spec/07-implementation-phases-todo.md)
|
|
|
|
Für LLM-gestützte Änderungen enthält [AGENTS.md](AGENTS.md) die verbindlichen
|
|
Domänenregeln, unterstützten Einstiegspunkte und Architekturgrenzen.
|