Skip to main content

A production-grade FastAPI template with support for PostgreSQL, SQLite, and MySQL.

Project description

FastAPI Server Kit

A production-grade FastAPI template and toolkit with support for PostgreSQL (Sync/Async), SQLite (Async), and MySQL (Async). Built for speed, scalability, and clean architecture.

Features

  • Multi-Database Support: Easily switch between SQLite, PostgreSQL, and MySQL.
  • SQLAlchemy 2.0 (Async): Modern ORM patterns with centralized session management.
  • Clean Architecture: Organized into Core, Models, Repositories, Services, and Routers.
  • Alembic Migrations: Ready-to-use async migration setup.
  • Environment Management: Robust configuration using pydantic-settings.

Installation & Quick Start

The easiest way to start a new project is to use uvx. No installation or pre-existing project is required.

# In an empty directory, run:
uvx fastapi-server-kit@latest

This single command will trigger an interactive setup:

  1. Project Name: Choose your own folder name.
  2. Database Selection: Choose between SQLite, PostgreSQL, or MySQL.
  3. Auto-Initialization: The tool runs uv sync to set up your .venv.
  4. Instant Start: The FastAPI server launches immediately.

CLI Flags (Automation)

For non-interactive use or CI/CD:

uvx fastapi-server-kit@latest my-app --db postgres --no-input

Alternative Installation

If you want to add the kit as a dependency to an existing project:

uv add fastapi-server-kit@latest

Manual Setup

If you prefer to clone the repository or use it as a template:

git clone https://github.com/atnatewoshw/fastapi-starter-template
cd fastapi-starter-template

2. Configure Environment

Create and configure your .env file from .env_example:

cp .env_example .env

3. Install Dependencies

uv sync

4. Running Locally

uv run uvicorn app.main:app --reload

Project Structure

The kit follows a clean, modular directory layout:

fastapi-starter-template/
├── fastapi_server_kit/  # Packaged CLI + templates
├── app/                 # FastAPI application
│   ├── core/            # Configuration and security
│   ├── models/          # SQLAlchemy models
│   ├── repositories/    # Data access layer
│   ├── routers/         # API endpoints
│   ├── schemas/         # Pydantic models
│   └── services/        # Business logic
├── tests/               # Unit and integration tests
├── pyproject.toml       # Project dependencies
└── README.md

Database Migrations

Initialize your database:

uv run alembic upgrade head

Create a new migration:

uv run alembic revision --autogenerate -m "description"

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_server_kit-0.2.3.tar.gz (86.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_server_kit-0.2.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_server_kit-0.2.3.tar.gz.

File metadata

  • Download URL: fastapi_server_kit-0.2.3.tar.gz
  • Upload date:
  • Size: 86.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastapi_server_kit-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2875123e61f4e3b7119f1fa937a075813d857f021f7c631d5356cc0572e3b853
MD5 948c732175d833bf078386c3b7e29f50
BLAKE2b-256 e0baf2f8d6f52d3feff3b2f92ddc86ec068d3d901083040c6755b347dbdd4984

See more details on using hashes here.

File details

Details for the file fastapi_server_kit-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: fastapi_server_kit-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for fastapi_server_kit-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3572c8f815cdd085b852af98c845c3a70c3dfccf591fbdab2ff955d90ceb87f1
MD5 a78e6ad7f7dd07c8d60d6fd8c5b89d37
BLAKE2b-256 88c8beb939cccdb17969371a35579f2b7eb4b1e9f39bc5937f32c8f50c5b48a3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page