Skip to content

Releases: yuting1214/Fullstack-FastAPI

0.1.0

20 Feb 07:23
47f036b

Choose a tag to compare

v0.1.0 — Initial Release

A production-ready fullstack FastAPI template with PostgreSQL, built on modern Python tooling and async-first architecture.

Highlights

  • Fully async from top to bottom — every endpoint, CRUD operation, and database call is non-blocking
  • SQLAlchemy 2.0 with select() queries, DeclarativeBase, Mapped columns, and async_sessionmaker
  • Modern Python packaging with uv and pyproject.toml — no more requirements.txt
  • One-click deploy on Railway and Zeabur with PostgreSQL auto-configuration

What's Inside

API & Performance

  • FastAPI with ORJSONResponse for fast JSON serialization
  • uvloop + httptools for maximum ASGI throughput
  • GZIP compression for responses > 1KB
  • Thread pool increased to 100 (from default 40) for mixed workloads

Database

  • SQLAlchemy 2.0 async engine — fully non-blocking database access
  • Portable Uuid column type (native UUID on PostgreSQL, CHAR(32) on SQLite)
  • Environment-aware: SQLite for local dev, PostgreSQL for production
  • Async table creation on startup, engine disposal on shutdown

Security

  • Session-based authentication protecting /docs, /redoc, and /openapi.json
  • Pure ASGI DocProtectMiddleware (no BaseHTTPMiddleware overhead)
  • Environment-driven SECRET_KEY — no hardcoded secrets
  • .env.example template provided, .env gitignored

Project Structure

src/
├── backend/
│   ├── main.py
│   ├── api/v1/endpoints/
│   ├── core/            # config, lifespan, middleware, routers
│   ├── crud/            # async service layer
│   ├── dependencies/    # database setup
│   ├── models/          # SQLAlchemy ORM
│   ├── schemas/         # Pydantic v2
│   ├── security/
│   └── data/            # seed data
└── frontend/
    └── login/           # templates & static files

Testing & Quality

  • All-async test suite with httpx.AsyncClient + pytest-anyio
  • Shared conftest.py managing DB lifecycle across tests
  • Locust load testing configuration included
  • Ruff linting — zero warnings

Deployment

  • Docker multi-stage build with uv (Python 3.12)
  • Railway template with one-click deploy button
  • Zeabur template configuration included

Quick Start

git clone https://github.com/yuting1214/Fullstack-FastAPI.git
cd Fullstack-FastAPI
uv sync
cp .env.example .env
uv run python -m src.backend.main --mode dev

API Endpoints

Method Path Description
GET / Health check
POST /api/v1/messages/ Create message
GET /api/v1/messages/ List messages
GET /api/v1/messages/{id} Get message
PUT /api/v1/messages/{id} Update message
DELETE /api/v1/messages/{id} Delete message

Acknowledgements

FastAPI best practices informed by Kludex/fastapi-tips and patterns from FastAPI---Strawberry.


Full changelog: CHANGELOG.md