No description
Find a file
Grovy311 cd89c4a499 Add buildings above floors and a building structure page
Projects with several buildings could not be structured: floors and rooms
hung directly off the project. Floors can now belong to a building
(migration 0009: table buildings, nullable floors.building_id). Rooms and
distribution boards keep their floor; their building follows from it.
Existing floors stay without a building.

Buildings use the location-structure command store with
project-building.insert/.update/.delete, inverses and persistent Undo/Redo;
deleting a building with assigned floors is rejected. Floor commands carry
buildingId since command version 2. Version 1 floor commands from existing
history predate buildings and are upgraded with buildingId = null before
they are executed and persisted, so forward and inverse keep one version.

Project snapshot schema 7 stores buildings and floor.buildingId; versions
1-6 are upgraded without buildings. Restore and portable transfer include
buildings, and the transfer remaps building ids.

Buildings, floors and rooms move from the project overview to their own
page /projects/:id/struktur with three columns (Gebäude -> Etagen -> Räume)
that filter each other, and a sidebar entry. Floor selects in the board and
room dialogs are grouped by building. Unchanged dialogs close without a
command. Details in docs/building-structure.md; see issue #6.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 12:52:34 +02:00
docs Add buildings above floors and a building structure page 2026-09-26 12:52:34 +02:00
dynamo Add Revit Dynamo diagnostic scripts 2026-08-23 23:13:35 +02:00
scripts Add buildings above floors and a building structure page 2026-09-26 12:52:34 +02:00
src Add buildings above floors and a building structure page 2026-09-26 12:52:34 +02:00
tests Add buildings above floors and a building structure page 2026-09-26 12:52:34 +02:00
.dockerignore Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
.gitignore Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
AGENTS.md Add buildings above floors and a building structure page 2026-09-26 12:52:34 +02:00
compose.dev.yaml Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
compose.yaml Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
Dockerfile Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
drizzle.config.ts first commit 2026-04-30 18:22:10 +02:00
next-env.d.ts Update generated Next.js types 2026-07-22 23:08:32 +02:00
next.config.mjs Add local uris to nextjs config 2026-08-06 18:58:56 +02:00
package-lock.json Upgrade project to Node 24 2026-08-23 18:05:50 +02:00
package.json Run the Docker stack on built output instead of dev servers 2026-08-23 18:25:06 +02:00
README.md Harden the container runtime and shut down cleanly 2026-09-16 11:04:34 +02:00
tsconfig.json Add configurable structured logging 2026-08-06 19:45:39 +02:00
tsconfig.next.json Add configurable structured logging 2026-08-06 19:45:39 +02:00
tsconfig.scripts.json Add configurable structured logging 2026-08-06 19:45:39 +02:00

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
git clone <repository-url>
Set-Location leistungsbilanz-ts
docker compose up --build --detach

Danach:

Die Express-API ist nicht mehr auf dem Host veröffentlicht. Sie hat keine Authentifizierung und ist nur innerhalb des Compose-Netzes erreichbar; der Zugriff läuft über den Rewrite im Web-Dienst.

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.

Das Laufzeit-Image läuft als Benutzer node (UID 1000), nicht als root. Ein data/-Verzeichnis, das ein früherer root-Container angelegt hat, braucht deshalb einmalig sudo chown -R 1000:1000 data auf dem Host.

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, mit Speichergrenzen und ohne root-Rechte im Container. Details stehen in Deployment und Betrieb.

Für die Entwicklung mit Hot Reload gibt es einen eigenen Stack mit Quellcode-Mounts und Watchern:

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
npm ci
npm run db:migrate
npm run db:verify:circuit-schema
npm run dev:api

In einem zweiten Terminal:

npm run dev:web

Frontend und API laufen anschließend auf denselben Ports wie im Docker-Setup.

Qualitätssicherung

npm test
npm run build:api
npm run build:web
npm run typecheck:scripts
npx tsc --noEmit -p tsconfig.next.json

Wichtige Datenbankbefehle:

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

Für LLM-gestützte Änderungen enthält AGENTS.md die verbindlichen Domänenregeln, unterstützten Einstiegspunkte und Architekturgrenzen.