docs: update CLAUDE.md with admin blueprint, dual docker-compose setup
Align documentation with current codebase state: add admin blueprint to client architecture, document dev (Nginx) vs prod (Traefik) compose files, fix blueprint count in test section. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,7 +11,8 @@ Monorepo con **server FastAPI** (backend API, porta 8000) e **client Flask** (fr
|
||||
|
||||
### Avvio servizi (Docker)
|
||||
```bash
|
||||
docker compose up -d # Avvia tutto
|
||||
docker compose -f docker-compose.dev.yml up -d # Sviluppo (Nginx, porta 80)
|
||||
docker compose up -d # Produzione (Traefik, SSL)
|
||||
docker compose logs -f server # Log server
|
||||
docker compose logs -f client # Log client
|
||||
docker compose ps # Stato servizi
|
||||
@@ -91,7 +92,7 @@ Il client Flask è un frontend server-side che comunica col backend via REST API
|
||||
|
||||
### Client (Flask) — `client/`
|
||||
- **app.py**: factory pattern `create_app()`, CSRF (`WTF_CSRF_TIME_LIMIT=3600`), Babel i18n (`default_locale="it"`)
|
||||
- **blueprints/**: auth (login/logout/session), maker (editor ricette con Fabric.js), measure (esecuzione misurazioni), statistics (dashboard SPC con Plotly.js)
|
||||
- **blueprints/**: auth (login/logout/session), maker (editor ricette con Fabric.js), measure (esecuzione misurazioni), statistics (dashboard SPC con Plotly.js), admin (gestione utenti CRUD, cambio password, toggle attivo — solo `is_admin`)
|
||||
- **services/api_client.py**: singleton `APIClient` — wrapper HTTP (get/post/put/delete) con gestione errori normalizzata, timeout 30s, header X-API-Key da session
|
||||
- **templates/**: Jinja2 con `{{ _('string') }}` per i18n. Context processor inietta `current_user`, `current_theme`, `current_language`, `company_logo` in tutti i template
|
||||
- **static/js/**: Alpine.js 3.x (CDN), Fabric.js 5.3.1 (CDN), locales JSON (it.json, en.json), alpine-init.js (theme store). Componenti specializzati: `numpad.js` (input numerico touch con rilevamento burst USB HID), `caliper.js` (monitor calibro USB passivo), `barcode.js` (scanner QR/barcode con camera via html5-qrcode), `csv-export.js` (export CSV con locale italiano: `;` separatore, `,` decimale), `spc-charts.js` (grafici SPC con Plotly.js), `annotation-editor.js` / `annotation-viewer.js` (editor/viewer annotazioni Fabric.js)
|
||||
@@ -194,17 +195,21 @@ Upload in `uploads/{recipe_id}/{version_id}/`. Tipi ammessi: JPEG, PNG, GIF, Web
|
||||
- Client httpx: `AsyncClient` con `ASGITransport(app=app)`, override di `get_db` dependency
|
||||
|
||||
### Client (`client/tests/conftest.py`)
|
||||
- `api_client` patchato in tutti i 4 blueprint (auth, maker, measure, statistics)
|
||||
- `api_client` patchato in tutti i 5 blueprint (auth, maker, measure, statistics, admin)
|
||||
- `logged_in_client` fixture pre-popola session con user dict + api_key
|
||||
- CSRF disabilitato nei test: `WTF_CSRF_ENABLED=False`
|
||||
|
||||
## Docker
|
||||
|
||||
Container: `tmflow-mysql`, `tmflow-server`, `tmflow-client`, `tmflow-nginx`. Network: `tmflow-net`. Volumes: `mysql_data`, `upload_data`.
|
||||
Due file compose:
|
||||
- **`docker-compose.dev.yml`**: sviluppo locale con Nginx reverse proxy. 4 servizi: mysql, server, client, nginx. Porta `${NGINX_PORT:-80}`.
|
||||
- **`docker-compose.yml`**: produzione con Traefik (SSL auto via Let's Encrypt). 3 servizi: mysql, server, client. Richiede rete esterna `root_default` (Traefik).
|
||||
|
||||
Container: `tmflow-mysql`, `tmflow-server`, `tmflow-client` (+`tmflow-nginx` solo dev). Network: `tmflow-net`. Volumes: `mysql_data`, `upload_data`.
|
||||
|
||||
Il server esegue Alembic migrations automaticamente all'avvio (`CMD` include `alembic upgrade head && uvicorn`). Il client compila Babel translations e TailwindCSS nel Dockerfile build. Entrambi usano Python 3.11-slim, Gunicorn con 2 workers.
|
||||
|
||||
Nginx: gzip abilitato, `client_max_body_size 50M`, `proxy_read_timeout 120s`, cache statica 7d, security headers duplicati a livello proxy.
|
||||
Nginx (dev): gzip abilitato, `client_max_body_size 50M`, `proxy_read_timeout 120s`, cache statica 7d, security headers duplicati a livello proxy.
|
||||
|
||||
## Convenzioni Codice
|
||||
- Python 3.11+, type hints ovunque
|
||||
|
||||
Reference in New Issue
Block a user