stadtwerke/innungsapp
Timo Knuth 873c5e53af feat: Implement Next.js middleware for subdomain-based tenant routing and authentication, create the admin application's main page, and add Google site verification. 2026-03-02 23:01:21 +01:00
..
apps feat: Implement Next.js middleware for subdomain-based tenant routing and authentication, create the admin application's main page, and add Google site verification. 2026-03-02 23:01:21 +01:00
packages/shared feat: Add initial project setup including superadmin seeding, a Docker entrypoint for the admin app, and a comprehensive README. 2026-02-27 21:33:40 +01:00
.dockerignore push 2026-02-27 15:19:24 +01:00
.env.example push 2026-02-27 15:19:24 +01:00
.env.production.example push 2026-02-27 15:19:24 +01:00
.gitignore Rebuild as InnungsApp project: replace stadtwerke analysis with full documentation 2026-02-18 19:03:37 +01:00
CLAUDE.md feat: Implement mobile application and lead processing utilities. 2026-02-19 14:21:51 +01:00
README.md feat: Add initial project setup including superadmin seeding, a Docker entrypoint for the admin app, and a comprehensive README. 2026-02-27 21:33:40 +01:00
build_output.txt feat: Implement Next.js middleware for subdomain-based tenant routing and authentication, create the admin application's main page, and add Google site verification. 2026-03-02 23:01:21 +01:00
dev_detailed.txt push 2026-02-27 15:19:24 +01:00
dev_output.txt push 2026-02-27 15:19:24 +01:00
docker-compose.yml Fehler beheben 2026-03-02 18:03:27 +01:00
package.json feat: Set up initial monorepo structure for admin and mobile applications with core configurations and database integration. 2026-02-20 12:58:54 +01:00
pnpm-lock.yaml push 2026-02-27 15:19:24 +01:00
pnpm-workspace.yaml Rebuild as InnungsApp project: replace stadtwerke analysis with full documentation 2026-02-18 19:03:37 +01:00
turbo.json Rebuild as InnungsApp project: replace stadtwerke analysis with full documentation 2026-02-18 19:03:37 +01:00

README.md

InnungsApp

Digitale Plattform fuer Innungen mit Admin-Dashboard (Next.js) und Mobile App (Expo).

Stack

Layer Technology
Monorepo pnpm Workspaces + Turborepo
Admin Dashboard Next.js 15 (App Router)
Mobile App Expo + React Native
API tRPC v11
Auth better-auth (magic links + credential login)
Database SQLite + Prisma ORM
Styling Tailwind CSS (admin), NativeWind (mobile)

Projektstruktur

innungsapp/
|-- apps/
|   |-- admin/
|   `-- mobile/
|-- packages/
|   `-- shared/
|       `-- prisma/
|-- docker-compose.yml
`-- README.md

Local Setup

Voraussetzungen

  • Node.js >= 20
  • pnpm >= 9
  • SMTP-Zugang (fuer Einladungen und Magic Links)

1. Abhaengigkeiten installieren

pnpm install

2. Umgebungsvariablen setzen (Admin lokal)

cp .env.example apps/admin/.env.local

Danach apps/admin/.env.local anpassen (mindestens BETTER_AUTH_SECRET, SMTP-Werte).

3. DB vorbereiten (lokal)

pnpm db:generate
pnpm db:push

Optional Demo-Daten:

pnpm db:seed

4. Entwicklung starten

pnpm --filter @innungsapp/admin dev
pnpm --filter @innungsapp/mobile dev

Oder parallel:

pnpm dev

Production Deployment (Docker, Admin)

Dieser Abschnitt ist der verbindliche Weg fuer den Productive-Server.

Voraussetzungen

  • Linux Server mit Docker + Docker Compose
  • DNS-Eintrag auf den Server
  • SMTP-Zugangsdaten
  • Reverse Proxy (z. B. Nginx) fuer HTTPS

1. Repository klonen

git clone <repo-url>
cd innungsapp

2. Production-Env anlegen

cp .env.production.example .env

Pflichtwerte in .env:

  • BETTER_AUTH_SECRET (mindestens 32 Zeichen)
  • BETTER_AUTH_URL (z. B. https://app.deine-innung.de)
  • NEXT_PUBLIC_APP_URL (gleich wie BETTER_AUTH_URL)
  • EMAIL_FROM
  • SMTP_HOST
  • SMTP_PORT
  • SMTP_SECURE
  • SMTP_USER
  • SMTP_PASS

3. Container bauen und starten

docker compose up -d --build

Hinweis zum DB-Start:

  • Wenn Prisma-Migrationen vorhanden sind, wird prisma migrate deploy ausgefuehrt.
  • Wenn keine Migrationen vorhanden sind, wird einmalig prisma db push ausgefuehrt.

4. Healthcheck und Logs pruefen

docker compose logs -f admin
curl -fsS http://localhost:3000/api/health

Erwartet: JSON mit status: "ok".

5. Superadmin anlegen (nur beim ersten Start)

docker compose exec -w /app admin node packages/shared/prisma/seed-superadmin.js

Default Login:

  • E-Mail: superadmin@innungsapp.de
  • Passwort: demo1234

Passwort direkt nach dem ersten Login aendern.

6. HTTPS (Reverse Proxy)

Nginx sollte auf localhost:3000 weiterleiten und TLS terminieren. Beispiel:

server {
  listen 80;
  server_name app.deine-innung.de;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl;
  server_name app.deine-innung.de;

  ssl_certificate /etc/letsencrypt/live/app.deine-innung.de/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/app.deine-innung.de/privkey.pem;

  location / {
    proxy_pass http://localhost:3000;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

7. Updates einspielen

git pull
docker compose up -d --build
docker compose logs -f admin

8. Backup und Restore (Docker Volumes)

Vorher die exakten Volumenamen pruefen:

docker volume ls | grep db_data
docker volume ls | grep uploads_data

Backup:

mkdir -p backups
docker run --rm \
  -v innungsapp_db_data:/volume \
  -v "$(pwd)/backups:/backup" \
  alpine sh -c "tar czf /backup/db_data_$(date +%F_%H%M).tar.gz -C /volume ."

Restore (nur bei gestoppter App):

docker compose down
docker run --rm \
  -v innungsapp_db_data:/volume \
  -v "$(pwd)/backups:/backup" \
  alpine sh -c "rm -rf /volume/* && tar xzf /backup/<backup-file>.tar.gz -C /volume"
docker compose up -d

Mobile Release (EAS)

cd apps/mobile
eas build --platform all --profile production
eas submit --platform all

Wichtig:

  • In apps/mobile/eas.json sind Submit-Placeholders vorhanden und muessen ersetzt werden.
  • Fuer Production darf keine API-URL auf localhost zeigen.

Troubleshooting

migrate deploy oder db push fehlschlaegt

  • DATABASE_URL pruefen
  • Rechte auf /app/data pruefen
  • Logs: docker compose logs -f admin

Healthcheck liefert Fehler

  • Containerstatus: docker compose ps
  • App-Logs lesen
  • Reverse Proxy testweise umgehen und direkt localhost:3000 pruefen

Login funktioniert nicht nach Seed

  • Seed-Command erneut ausfuehren
  • In DB pruefen, ob user und account Eintraege fuer superadmin@innungsapp.de existieren

Weiterfuehrende Doku

  • Produkt-Roadmap: ../ROADMAP.md
  • Architektur: ../ARCHITECTURE.md
  • API Design: ../API_DESIGN.md