Production-ready starter for full-stack applications with:
- FastAPI API layer
- PostgreSQL + Alembic migrations
- JWT access/refresh auth lifecycle
- OAuth login + account linking (Google, Microsoft, Apple, Facebook, GitHub)
- Redis-backed rate limiting
- Outbox + worker pattern for async delivery
- Observability hooks (metrics, OpenTelemetry, Sentry)
- Baseline frontend for browser-level validation
This template is designed so teams can build any product domain with minimal edits to core infrastructure.
Core platform responsibilities are already handled:
- auth/session lifecycle
- security middleware and error contracts
- rate limiting and readiness behavior
- background job reliability pattern
- observability wiring
Product-specific work should be added in extension areas, not by rewriting the core.
cp .env.example .env
make setup
alembic upgrade head
make devOpen:
- API docs:
http://127.0.0.1:8000/docs - GUI:
http://127.0.0.1:8000/
Keep these stable unless explicitly required:
app/main.pyapp/oauth2.pyapp/oauth_external.pyapp/errors.pyapp/rate_limit.pyapp/observability.py
Build product behavior in:
app/domains/<domain_name>/...tests/...for domain behavior
Routers in app/domains/*/router.py are auto-discovered and mounted under /api/v1.
Scaffold a new domain package:
make scaffold-domain NAME=ordersThis creates:
app/domains/orders/__init__.pyapp/domains/orders/router.py
Then extend that domain with schemas/services/repositories and tests.
For any use case (SaaS, marketplace, internal tool, consumer app):
- Define domain packages (
orders,billing,catalog,admin, etc.). - Add domain data models + Alembic migrations.
- Keep auth and security behavior inherited from the platform core.
- Add frontend pages/components against
/api/v1domain routes. - Add outbox topics for integrations (email, webhooks, analytics, queues).
- Validate with quality gates before shipping.
make dev # local API with reload
make test-fast # fast local confidence loop
make lint
make typecheck
make audit-security
make test # full suite + 100% app coverage gate
make check # lint + typecheck + audit + full testsImportant production settings:
ENVIRONMENT=productionSECRET_KEY(high-entropy, 32+ chars)TOKEN_ISSUERTOKEN_AUDIENCETRUSTED_HOSTSTRUST_PROXY_HEADERSSECURITY_HSTS_ENABLED=trueSECURITY_HTTPS_REDIRECT=trueRATE_LIMIT_FAIL_OPEN=false
OAuth callbacks:
- Configure provider credentials via
OAUTH_*. - Use
OAUTH_PUBLIC_BASE_URLbehind reverse proxies. - Set
OAUTH_FRONTEND_CALLBACK_URLto an allowed frontend origin/path.
This repo includes AI-oriented guardrails:
AGENTS.md: repo-level AI implementation rulesAI_CHANGE_CHECKLIST.md: required validation and documentation gate
Recommended AI workflow:
- Keep core platform files stable.
- Implement feature scope in
app/domains/<domain>. - Add behavior-first tests.
- Run
make check. - Update docs when behavior changes.
Dev stack:
docker compose -f docker-compose-dev.yml up --buildProd baseline:
docker compose -f docker-compose-prod.yml up -dKubernetes examples:
deploy/k8s/api-deployment.yamldeploy/k8s/worker-deployment.yamldeploy/k8s/configmap.example.yamldeploy/k8s/secret.example.yaml
- Architecture:
ARCHITECTURE.md - AI checklist:
AI_CHANGE_CHECKLIST.md - AI agent instructions:
AGENTS.md