Full reference for what's built into this project: what each feature does, which module implements it, and how to configure it. README.md only lists the headline items — this is the complete picture.
- 🚀 Core — FastAPI, Postgres, Alembic, logging, docs (always included)
- 🔐 Authentication — JWT, Argon2
- 📦 Example domain: Items — a complete CRUD slice to copy from
- 🔒 Security middleware — request logging and the other request middleware
- ⚡ Caching — Redis cache
- ⚙️ Background jobs — Celery
- ☁️ Cloud storage — Google Cloud Storage
- ☁️ Cloud storage — BackBlaze B2
- 🔥 Firebase — Authentication, users, push notifications
- 🔥 Firestore — document database
- 💳 Apple Pay — App Store Server API
- 📧 Email — Resend
- 📧 Email — Brevo
Optional services are chosen when the project is generated: Copier's services question offers minimal (the base, pre-selected in an interactive run), custom (pick services one by one), or full (everything, which copier copy --defaults selects). A chosen service's packages are regular dependencies, so uv sync installs everything the project uses.
Two more parts are optional the same way, and are included by full / --defaults:
- the GitHub extras (CodeQL, Dependabot, issue and pull request templates, CODEOWNERS, SECURITY.md)
- the extra documentation (guides, architecture, API reference, runbooks, strategy)
Always included.
- FastAPI — async web framework. Each API version is its own mounted app with its own interactive docs:
app/api/v1/at/v1(/v1/docs).
- Second API version — an empty scaffold in
app/api/v2/, mounted at/v2with its own docs (/v2/docs).
- Async PostgreSQL — SQLAlchemy 2.0 async engine (
asyncpg) for the app, configured inapp/core/db.pyfromsettings.db_url.
- Sync engine for Celery —
psycopgengine andsession_factoryinapp/core/db_sync.py, fromsettings.db_url_sync.
- Database migrations — Alembic (
app/alembic/), run withalembic upgrade headdirectly.
- Migration helper scripts —
./scripts/alembic.sh(Linux/macOS) and.\scripts\alembic.bat(Windows).
- Clean/layered architecture — repository pattern (
app/repos/) + dependency injection, with module boundaries enforced bytach(seetach.toml):core→models/schemas→repos→services→api/middleware. - Structured logging — Loguru-based (
app/core/logger.py): console and rotating file output, request and process IDs.
- Log shipping — non-blocking, batched shipping to OpenObserve (
app/core/logger.py). Guide: integrations/openobserve.md.
- Automatic API documentation — Swagger UI and ReDoc, generated per API version.
- JWT-based auth — access + refresh tokens, implemented in
app/services/auth_service.py. Password hashing via Argon2 (pwdlib). Guide: integrations/auth.md.
- Token blacklisting — logout revokes the token, backed by Redis (
app/services/cache/token_blacklist.py). Guide: integrations/token-revocation.md.
- Logout — logout returns
revoked: falseand the access token stays valid until it expires (no token blacklist).
- Protected routes — dependency-injected via
app/api/v1/deps/.
This project was generated without the authentication service: it has no User model, no login and no protected routes, so every endpoint is public. Add your own access checks before exposing data that is not public.
A small, complete CRUD slice that shows how the layers fit together. Copy it for your own domain, or delete it.
- Model:
app/models/item.py(Item:name, unique;description;is_active), created by the first Alembic revision. - Schemas:
app/schemas/item.py(ItemCreate,ItemUpdate,ItemResponse). - Repository:
app/repos/item.py(ItemRepo, on top ofBaseRepository). - Service:
app/services/item_service.py(ItemService): the business rules, raising service exceptions. - API:
app/api/v1/endpoints/items.py, wired throughapp/api/v1/deps/items.py: list, read, create, update and delete under/v1/items.
- Access: every
/v1/itemsroute needs a logged-in user (a router-levelget_current_userdependency).
- Access: the
/v1/itemsroutes are public, because this project has no authentication.
- Tests:
tests/services/item_service_test.pyandtests/api/v1/endpoints/items_test.py. - Guide: guides/example-items.md — how a request flows through it, and how to turn it into your own domain.
All in app/middleware/:
- CSRF protection (
csrf.py) — double-submit cookie check (X-CSRF-Tokenheader against thecsrf_tokencookie) on state-changing requests.
- No cross-site request forgery check — this project was generated without that middleware. Add one before you authenticate browser clients with cookies.
- Security headers (
security_headers.py) — OWASP-recommended headers (X-Frame-Options, X-Content-Type-Options, X-XSS-Protection, CSP and more) on every response.
- Rate limiting (
rate_limit.py) — sliding-window algorithm with microsecond precision, Redis-backed. Guide: integrations/rate-limiting.md.
- Request logging (
logging.py)
- Module:
app/services/cache/manager.py(cache_manager),decorators.py(@cache_result). Guide: integrations/caching.md. - Redis caching — shared connection pooling, decorator-based caching helpers.
- Included when the project is generated with
include_redis_cache; Redis (redis, theREDIS_*settings, the compose service) comes with it.
- Module:
app/services/task_queue/. Guide: integrations/celery.md. - Celery with Redis as the broker, and a
pingtask to check that a worker is running.
- Sample scheduled task:
seed_fake_usersinserts fake users every 10s whenENABLE_DATA_SEEDING=true.
- Included when the project is generated with
include_celery;celery[redis]andpsycopgare then regular dependencies. - Start a worker:
./scripts/celery_worker.sh(or.bat) — or directly:celery -A app.services.task_queue worker --loglevel=info --pool=solo - Start the scheduler:
./scripts/celery_beat.sh(or.bat) — or directly:celery -A app.services.task_queue beat --loglevel=info
- BackBlaze B2 —
app/services/back_blaze_b2.py, schemas inapp/schemas/back_blaze_bucket.py. Guide: integrations/backblaze.md.
- Google Cloud Storage —
app/services/gcs.py, schemas inapp/schemas/google_bucket.py. Guide: integrations/gcs.md.
- Included because they were chosen when the project was generated; their SDKs are then regular dependencies.
- Firebase Admin —
app/services/firebase.py— authentication and push notifications. Guide: integrations/firebase.md.
- Firestore —
app/services/firestore.py— Firestore database access. Guide: integrations/firestore.md.
- Credentials: modeled by
FirebaseServiceAccountinapp/core/credentials/firebase.py, from theFIREBASE_*settings. - Included when the project is generated with
include_firebase;firebase-adminis then a regular dependency.
- Module:
app/services/payments/apple_pay.py - App Store Server API integration — in-app purchase and subscription verification.
- Credentials: modeled by
ApplePayStoreCredentialsinapp/core/credentials/apple_pay.py. - Included when the project is generated with
include_apple_pay;app-store-server-libraryis then a regular dependency. Guide: integrations/apple-pay.md. - Configure:
APPLE_PAY_STORE_PRIVATE_KEY_PATH,APPLE_PAY_STORE_ROOT_CERTIFICATE_PATH, plus key/issuer/bundle IDs in.env
- Module:
app/services/email/, providers sharing a common interface (base.py). Guide: integrations/email.md.
- Brevo:
app/services/email/brevo.py, configured withBREVO_API_KEY.
- Resend:
app/services/email/resend.py, configured withRESEND_API_KEY.
- Included when at least one email provider was chosen at generation; each chosen provider's SDK is then a regular dependency.
Always installed via dependency-groups.dev / .test — no extra required.
- pytest with async support (
anyio), coverage reporting (terminal + HTML), and custom markers (unit,integration,slow,websocket). ~90% coverage maintained across modules. - ruff — linting and formatting.
- mypy — static typing, strict on
repos/models/services. - bandit — security static analysis.
- detect-secrets — secret-leak scanning.
- tach — module boundary enforcement (see
tach.toml). - pre-commit — runs all of the above locally before commit;
commitizenadditionally lints commit messages against Conventional Commits.
See Contributing.
- CI — GitHub Actions runs the same lint/type/security suite plus the full test suite against real service containers (Postgres, plus any other service the project uses), with a coverage badge/comment posted per PR (green ≥90%, orange ≥70%).
Always included.
Multi-environment configuration via pydantic-settings (app/core/config.py), reading from .env: local, dev, stg (staging), prd (production). See .env.example for the full variable list.