L'admin etait une 2e app front Vite independante (apps/admin-web, port 5174,
Dockerfile nginx, service compose dedie, job CI propre) non demandee. Toute
l'UI passe dans apps/web sous le prefixe /admin ; seul le frontend est
fusionne, l'authentification admin reste entierement separee.
Front (apps/web/src) :
- pages -> pages/admin/{login,dashboard,monitoring,corrections,catalog}/,
layout -> layouts/AdminLayout.tsx, contexte + garde -> features/admin/.
- client API -> api/admin-client.ts : classe AdminApiError (evite la
collision avec ApiError), lit VITE_API_URL (plus de VITE_ADMIN_API_URL).
- routes /admin/* dans App.tsx, enveloppees d'AdminAuthProvider +
RequireAdmin -> le probe GET /admin/auth/me ne tourne que sous /admin.
- reutilise l'i18n, lib/zod-errors, services/error-message.service et le
theme SCSS de apps/web ; bloc i18n admin.* fusionne dans la locale fr
(les cles errors etaient deja toutes presentes).
- corrige une race dans CatalogPage (reponse d'un onglet precedent qui
ecrasait l'onglet courant, exposee par le double-mount StrictMode) via
un ref requestSeq.
Auth admin inchangee : table AdminUser, cookie admin_session,
ADMIN_JWT_SECRET, script create-admin.ts.
Infra :
- docker-compose : service admin-web + ADMIN_WEB_PORT supprimes (l'app
`app` sert deja le front construit).
- ADMIN_CORS_ORIGIN retire (meme origine) : env.ts, app.ts, .env.example.
- job CI "Run admin-web E2E tests" supprime ; les specs admin-* tournent
dans le job web (apps/web/cypress/e2e/admin-*.{cy.ts,feature}).
- apps/api/.env.example : ajout ADMIN_JWT_SECRET / ADMIN_INITIAL_*.
- recharts ajoute a apps/web ; pnpm-lock regenere.
- specs/backend-architecture.md : section admin mise a jour.
Verifie : biome + tsc -b (web/api) + pnpm -r build verts ; Cypress web
102/103 (l'unique echec est le flake pre-existant recipe-form.feature
"Preloads ..." de clipping headless, sans rapport) ; 16/16 specs admin ;
45/45 composants.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
61 lines
3.1 KiB
Text
61 lines
3.1 KiB
Text
# Used by docker-compose.yml to provision the local Postgres container.
|
|
# Pick your own values — do not reuse these across environments, and never
|
|
# commit the real .env (it's git-ignored).
|
|
POSTGRES_USER=changeme
|
|
POSTGRES_PASSWORD=changeme
|
|
POSTGRES_DB=batchcooking
|
|
POSTGRES_PORT=5432
|
|
|
|
# Used by docker-compose.yml's "app" service (Docker-only — the native
|
|
# `pnpm dev:api` workflow reads apps/api/.env instead, set both when using
|
|
# both workflows). Required, no default on purpose — generate your own.
|
|
JWT_SECRET=changeme-generate-a-real-random-secret-at-least-32-chars
|
|
|
|
# Optional — host port for the Docker review stack's single app container
|
|
# (docker-compose.yml), serving both the API and the built frontend.
|
|
# APP_PORT=3000
|
|
|
|
# --- Admin surface (apps/web's /admin/* routes + the /admin/* API) --------
|
|
# All optional: an instance that doesn't run the admin app needs none of
|
|
# these. `requireAdmin` fails closed when ADMIN_JWT_SECRET is unset, so
|
|
# leaving it out simply disables every /admin/* route. The admin UI is
|
|
# served by the same app/container as the rest of the frontend — no
|
|
# separate origin, so no CORS entry of its own.
|
|
#
|
|
# Secret for the admin session JWT — MUST be different from JWT_SECRET so an
|
|
# end-user token can never be replayed against /admin/*. Generate your own
|
|
# the same way as JWT_SECRET above.
|
|
# ADMIN_JWT_SECRET=changeme-generate-a-real-random-secret-at-least-32-chars
|
|
# Optional — read only by `src/scripts/create-admin.ts` when its --email /
|
|
# --password / --name flags are omitted (e.g. to bootstrap the first admin
|
|
# from inside the container). Never read by the running server.
|
|
# ADMIN_INITIAL_EMAIL=ops@example.com
|
|
# ADMIN_INITIAL_PASSWORD=changeme-at-least-8-chars
|
|
# ADMIN_INITIAL_NAME=Ops
|
|
|
|
# Optional — only set this to false if THIS deployment is served over
|
|
# plain HTTP (no TLS in front of it). Left unset, the session cookie
|
|
# requires HTTPS (Secure attribute) as it should for a real deployment;
|
|
# over plain HTTP a Secure cookie is silently never sent back by the
|
|
# browser, so login "succeeds" but every subsequent request 401s.
|
|
# COOKIE_SECURE=false
|
|
|
|
# Required — secret shared between "app" and "tech-step-intent-service"
|
|
# (docker-compose.yml, apps/api/src/config/env.ts). Unlike
|
|
# INTERNAL_WORKER_SECRET below, there's no "leave it unset" escape hatch:
|
|
# tech-step-intent-service is a core dependency, not an optional background
|
|
# job — without it, no recipe step can have its techniques detected at all.
|
|
# Generate your own the same way as JWT_SECRET above.
|
|
INTENT_SERVICE_SECRET=changeme-generate-a-real-random-secret-at-least-32-chars
|
|
|
|
# Only needed to run the optional `tech-step-llm-worker` service — shared
|
|
# between it and "app" (docker-compose.yml). Generate your own the same
|
|
# way as JWT_SECRET above; leave both this and the service commented
|
|
# out/unset to run without it.
|
|
# INTERNAL_WORKER_SECRET=changeme-generate-a-real-random-secret-at-least-32-chars
|
|
|
|
# Optional — cron expression (node-cron syntax) the worker wakes up on to
|
|
# run its audit/feedback-loop jobs. Default: weekly, Sunday 03:00 — a
|
|
# provisional floor, not a calibrated value (see
|
|
# services/tech-step-llm-worker/README.md).
|
|
# TECH_STEP_WORKER_CRON=0 3 * * 0
|