Skip to content

Repository files navigation

FastAPI Postgres Template 🚀

A production-ready, highly opinionated FastAPI and PostgreSQL template designed to save you 2 weeks of boilerplate setup at the start of your next project.

It enforces good practices like Dependency Injection, clean architecture, and modern configuration management using CUE.


💡 Note: The codebase in this repository was entirely written by a human. The README documentation itself was generated by AI.


✨ Features

  • Modern Tooling & Quality: Uses uv for blazing-fast dependency management, just as a modern command runner, and pre-commit hooks to keep your code clean automatically.
  • Type Checking: Uses ty instead of mypy for fast, seamless static type checking.
  • Config Generation with CUE: Automatically generate .env files, NGINX configs, and docker-compose YAMLs for different environments (dev, e2e, prod) using CUE.
  • Clean Architecture: Built-in Dependency Injection containers.py. SQLAlchemy tables in tables.py mapped cleanly to domain models in models.py.
  • Ready-to-use Auth: Simple, pre-built login.py and register.py endpoints out of the box, powered by JWTTokenService.
  • Database & Migrations: PostgreSQL setup with Alembic migrations running seamlessly in containers.
  • Dockerized: Extremely small Dockerfile optimized for fast builds and deployments.
  • Testing: E2E testing setup (test_endpoints) and integration tests powered by pytest.

🛠️ Prerequisites

Before you start, make sure you have the following installed:

🚀 Getting Started

1. Generate configurations and environments:

just export-cue

2. Run the application locally: (it runs db and migrations)

just run

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages