app/hosts the FastAPI backend; userouters/for HTTP surfaces,services/for business rules,schemas/for Pydantic models, andmiddleware/for cross-cutting policies.tests/mirrors backend domains; shared fixtures live intests/conftest.py(SQLite seeds, feature toggles).admin/contains the Vite + React dashboard (src/components,src/pages,src/lib,src/test).- Data migrations sit in
alembic/(managed viaalembic.ini); seed scripts and utilities reside inscripts/. - Documentation, SDKs, and samples live under
docs/,docs-site/,samples/, andsdks/.
- Backend bootstrap:
python -m venv venv && pip install -r requirements.txt && alembic upgrade head. - Local API:
uvicorn app.main:app --reload. - Backend checks:
coverage run --branch -m pytest -q && coverage report --fail-under=90. - Frontend loop:
cd admin && npm install && npm run dev. - Frontend quality gates:
npm run lint,npm test,npm run build.
- Python: PEP 8, four-space indentation, 79-char width (
black), lint withruff. - Naming: modules/functions in
snake_case, classes and schemas inPascalCase, async endpoints declare explicit return annotations. - TypeScript: components and pages in
PascalCase; hooks begin withuse; shared helpers belong inadmin/src/lib.
- Backend: run
coverage run --branch -m pytest -q; maintain >=90% statements and >=80% branches. Security middleware coverage comes fromtests/test_middleware_security.py. - Fixtures: import from
tests/conftest.py; keepDEMO_MODE=falseandOPENAI_API_KEYunset for deterministic runs. - Frontend:
npm test -- --coverage(Vitest writes results toadmin/coverage/).
- Commits are imperative, e.g.,
Add rule taxonomy and align tests; squash WIP commits before merging. - PRs document scope, database or seed impacts, and list local verification (backend coverage, frontend lint/tests).
- Link related issues and attach UI evidence when relevant; wait for backend, frontend, and security CI jobs.
- Start from
.env.example; never commit secrets. Default toENVIRONMENT=productionto keepDEMO_MODE=false. - Leave
OPENAI_API_KEYblank unless you are testing LLM flows. - After dependency updates, run
bandit -r appandsafety check.
- Harden the API key middleware by removing the
X-API-Key-Prefixresponse header inapp/middleware/api_key_security.pyand backfilling coverage that enforces header expectations. - Document production Redis and queue requirements so the startup checks in
app/main.pydo not fail during deployments; codify in IaC or ops runbooks. - Drop committed bundles under
admin/dist/and ensure the directory stays ignored to avoid stale assets drifting from source. - Close open TODOs in
app/services/version_service.pyaround cloning and audit logging to make version promotions observe full change history. - Hide or complete the marketing placeholder routes (
admin/src/marketing/pages/*) to prevent dead-end navigation in the admin shell.