A Next.js 14 frontend (App Router, server components by default) talks REST and WebSocket to a FastAPI backend; Postgres with TimescaleDB stores time-series in hypertables alongside relational state; Redis provides hot-read caching and WebSocket fan-out. The backend enforces a strict layering — routers validate and delegate, services own logic, repositories own SQL, adapters own the outside world — and every model or LLM output crosses the safety wrapper before serialization. Shared API types are generated from the backend’s OpenAPI schema, with a CI lane that fails on contract drift, so the frontend cannot quietly disagree with the API about shapes.
FrontendNext.js 14App Router · RSC · TypeScript
BackendFastAPIAsync SQLAlchemy · Pydantic v2
DatabasePostgresTimescaleDB hypertables
Cache / WSRedisHot reads · pub/sub fan-out
ContractsOpenAPIGenerated TS types · drift CI
MigrationsAlembicOne source of DDL truth
IntelligenceClaudeSingle choke point + safety
VerificationCI × 4 lanesHealth · DB · contracts · UI audit
Verification is layered the same way: ~1,000 backend tests and ~430 frontend tests behind a single health gate (lint, typecheck, and tests across both stacks); a database-integration CI lane that runs migrations and isolation tests against a real TimescaleDB container; the contract-drift lane; the drift-lock tests of §03; and a UI audit harness that renders every page at seven viewport widths and fails on overlap, spill, or clipped content — the definition of done for any UI change. Migrations go through Alembic only; observability is a request-ID structured log line, a Prometheus metrics endpoint, and safety-violation alerting.