2026-04-05 21:53:57 +02:00
|
|
|
|
# CLAUDE.md
|
|
|
|
|
|
|
|
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Verhaltensregeln
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
- Kein erklärender Text bei Routineaufgaben (Commits, Pushes, Branch-Wechsel)
|
|
|
|
|
|
- Bei Fehlern: erst 2x selbst versuchen, dann fragen
|
|
|
|
|
|
- Branches selbstständig wechseln wie benötigt
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Sprache & Konventionen
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
- **Code-Bezeichner, Commit-Messages:** Englisch, Imperativ (`Add`, `Fix`, `Refactor`)
|
|
|
|
|
|
- **Dokumentation & Kommentare:** Deutsch
|
|
|
|
|
|
- **Commit-Format:** `<type>: <short description>` (max. 72 Zeichen)
|
|
|
|
|
|
Types: `feat` | `fix` | `refactor` | `test` | `docs` | `chore`
|
|
|
|
|
|
- Nach jedem Commit sofort pushen
|
|
|
|
|
|
- Keine `console.log`/`print` in Produktionscode, keine auskommentierten Code-Blöcke
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Projektkontext (Schnelleinstieg)
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
**Gartenmanager** – Docker-basierte Gartenverwaltung. Multi-User, Multi-Tenant, Rollensystem.
|
|
|
|
|
|
**Stack:** Vue 3 + PrimeVue → FastAPI (Python 3.11) → PostgreSQL 15
|
|
|
|
|
|
**Phase:** 1 abgeschlossen (Auth, Beete, Pflanzen, Bepflanzung). Phase 2 = Testing & CI/CD.
|
|
|
|
|
|
**Version:** `cat VERSION` | **Branch:** `git branch --show-current`
|
|
|
|
|
|
**Sessionstart:** [.claude/session-context.md](.claude/session-context.md) lesen.
|
|
|
|
|
|
**Modulreferenz:** [docs/project-structure.md](docs/project-structure.md) – vor Quellcode-Reads.
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Scripts (immer diese verwenden)
|
2026-04-05 21:53:57 +02:00
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-04-06 07:56:33 +02:00
|
|
|
|
bash .claude/scripts/git-commit.sh "message" # stage all + commit + push
|
|
|
|
|
|
bash .claude/scripts/git-switch.sh <branch> # branch wechseln
|
|
|
|
|
|
bash .claude/scripts/git-switch.sh <branch> from <base> # neuer branch aus base
|
|
|
|
|
|
bash .claude/scripts/git-pr.sh create <head> <base> "titel" # PR erstellen
|
|
|
|
|
|
bash .claude/scripts/git-pr.sh merge <nr> squash # PR mergen
|
|
|
|
|
|
bash .claude/scripts/git-pr.sh list # offene PRs
|
|
|
|
|
|
bash .claude/scripts/bump.sh [patch|minor] "beschreibung" # version + commit + push
|
|
|
|
|
|
bash .claude/scripts/new-feature.sh [feature|fix] <name> # branch aus develop
|
2026-04-06 07:32:20 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Architektur
|
|
|
|
|
|
|
2026-04-05 22:32:58 +02:00
|
|
|
|
```
|
2026-04-06 07:56:33 +02:00
|
|
|
|
backend/app/
|
|
|
|
|
|
core/config.py – Settings (DATABASE_URL, SECRET_KEY, ...)
|
|
|
|
|
|
core/security.py – JWT (Access 30min / Refresh 7d), Passwort-Hashing
|
|
|
|
|
|
core/deps.py – get_current_user, get_tenant_context, require_min_role()
|
|
|
|
|
|
db/session.py – async Engine + get_session()
|
|
|
|
|
|
models/ – SQLAlchemy ORM (UUID-PKs): User, Tenant, Plant, Bed, BedPlanting
|
|
|
|
|
|
schemas/ – Pydantic v2 Create/Update/Read je Entität
|
|
|
|
|
|
crud/ – CRUDBase + spezialisierte Klassen, nur DB-Zugriff
|
|
|
|
|
|
api/v1/ – Router: auth, plants, beds, plantings
|
|
|
|
|
|
seeds/initial_data.py – 28 Pflanzen + 15 Kompatibilitäten (idempotent)
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/
|
|
|
|
|
|
api/client.js – Axios + JWT-Interceptor + Auto-Refresh bei 401
|
|
|
|
|
|
stores/ – Pinia: auth, beds, plants
|
|
|
|
|
|
router/index.js – Auth-Guard, /login /beete /beete/:id /pflanzen
|
|
|
|
|
|
views/ – LoginView, BedsView, BedDetailView, PlantsView
|
|
|
|
|
|
components/ – AppLayout, BedForm, PlantingForm, PlantForm
|
2026-04-06 07:32:20 +02:00
|
|
|
|
```
|
|
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
**Tenant-Kontext:** Header `X-Tenant-ID` bei allen Nicht-Auth-Requests.
|
|
|
|
|
|
**Rollen:** `READ_ONLY` < `READ_WRITE` < `TENANT_ADMIN` < `is_superadmin`
|
2026-04-06 07:32:20 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Pflichtregeln
|
2026-04-06 07:32:20 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
1. **Nie direkt nach `main`** – nur PR, nur auf Anweisung
|
|
|
|
|
|
2. **Arbeit in `feature/`, `fix/` oder `chore/`** unter `develop`
|
|
|
|
|
|
3. **Nach jeder Änderung:** `bump.sh` ausführen (MINOR bei Features, PATCH bei Fixes)
|
|
|
|
|
|
4. **MAJOR-Version** niemals selbstständig erhöhen
|
|
|
|
|
|
5. **Vor Merge/PR:** CHANGELOG, README, `docs/project-structure.md` prüfen
|
|
|
|
|
|
6. **In `develop` mergen erst** wenn alle Tests grün sind
|
2026-04-06 07:32:20 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Testing
|
2026-04-06 07:32:20 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
- Integrationstests testen gegen echte DB (keine DB-Mocks)
|
|
|
|
|
|
- Backend: pytest in `backend/tests/` | Frontend: Vitest neben Quelldateien oder `__tests__/`
|
|
|
|
|
|
- Run: `docker compose exec backend pytest` / `cd frontend && npm run test`
|
2026-04-06 07:32:20 +02:00
|
|
|
|
|
2026-04-06 07:56:33 +02:00
|
|
|
|
## Build
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
|
docker compose -f docker-compose.dev.yml up # Dev (hot-reload)
|
|
|
|
|
|
docker compose up -d # Prod
|
|
|
|
|
|
docker compose exec backend alembic upgrade head
|
|
|
|
|
|
docker compose exec backend python -m app.seeds.initial_data
|
|
|
|
|
|
cd frontend && npm run dev
|
|
|
|
|
|
```
|