Skip to content

A ready-to-use template for building backend applications using Python and FastAPI

License

Notifications You must be signed in to change notification settings

devscompass/fastapi-template

FastAPI Template

Build Release License

A starter template for building backend applications with FastAPI, the high-performance Python web framework.

✨ Tech Stack and Features

  • FastAPI, the high-performance Python web framework
  • 🧩 Pydantic for data validation and settings management
  • ⚙️ SQLAlchemy and asyncpg for non-blocking database access
  • 🐘 PostgreSQL as the production-ready relational database
  • 🧳 Alembic for version-controlled database migrations
  • 📂 Defined project structure with ready-to-use pyproject.toml and pydantic settings
  • 🖊️ VS Code settings included
  • 🎨 Ruff for consistent code formatting and linting
  • 📄 .editorconfig for consistent coding styles across editors
  • 🧹 A pre-commit hook for style enforcement
  • 🧪 pytest tests to keep code honest
  • 🐳 Containerization with Dockerfile and docker compose
  • 🦦 Automatic Podman/Docker detection for local dev
  • 🛠️ Makefile targets for format, build, run, and container tasks
  • 🚦 GitHub Actions for CI/CD
  • 🏷️ Artifact versioning based on Git SHA or tag, both in CI/CD and local builds
  • 🤖 Dependabot for automated dependency updates

🚀 Getting started

  • Before you start development on this project, run the init target. This will install a pre-commit hook and install dependencies.

    make init
  • Run the application in dev mode that enables live coding.

    make dev
  • To format the code while developing, you may use for IDE and turn on the auto-formatting on save. You may also use the format target.

    make format

📦 Packaging and running

  1. Build the application

    make build
    
    # OR
    
    make container-build
  2. Run the application

    make run
    
    # OR
    
    make container-run

📄 License

The FastAPI Template is licensed under the terms of the MIT license.

About

A ready-to-use template for building backend applications using Python and FastAPI

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

 
 
 

Contributors 2

  •  
  •