Skip to content

About

⚡ Production-grade asynchronous FastAPI starter implementing Clean Architecture, Domain-Driven Design, and Docker Compose.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

⚡ FastAPI Clean Architecture Blueprint

FastAPI Python Version Docker License: MIT

Production-grade, asynchronous backend blueprint engineered with Domain-Driven Design (DDD), Clean Architecture, and non-blocking I/O concurrency.

Maintained by Dato' Samuel F. / Midaz Dev (https://samuel.midaz.dev).


🏛️ Architectural Topology

  ┌────────────────────────────────────────────────────────┐
  │                      API Gateway                       │
  │            (Reverse Proxy / WAF / Nginx)               │
  └───────────────────────────┬────────────────────────────┘
                              │
                              ▼
  ┌────────────────────────────────────────────────────────┐
  │                  Presentation Layer                    │
  │     (FastAPI Routers / Pydantic v2 Request Validation) │
  └───────────────────────────┬────────────────────────────┘
                              │
                              ▼
  ┌────────────────────────────────────────────────────────┐
  │                    Domain Use Cases                    │
  │     (Pure Business Entities & Workflow Orchestration)  │
  └───────────────────────────┬────────────────────────────┘
                              │
                              ▼
  ┌────────────────────────────────────────────────────────┐
  │                  Infrastructure Layer                  │
  │    (Async SQLAlchemy 2.0 / Redis / Connection Pools)   │
  └────────────────────────────────────────────────────────┘

🚀 Key Design Highlights

  • Clean Architecture Separation: Business logic is completely decoupled from frameworks and database ORMs.
  • AsyncIO Non-Blocking Throughput: Sustained capacity exceeding 8,000+ requests per second on standard container nodes.
  • Resilience by Default: Proactive /health probes, graceful teardowns, and structured telemetry.
  • Docker Compose Orchestration: Zero-friction local setup for FastAPI, PostgreSQL 16, and Redis.

⚡ Quickstart

Option 1: Run with Docker Compose

docker compose up --build

The API documentation will be available immediately at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Option 2: Local Python Environment

# 1. Install dependencies
pip install -e .

# 2. Run with Uvicorn
uvicorn app.main:app --reload --port 8000

🧪 Running Unit & Integration Tests

python -m unittest discover -s tests -p "test_*.py"

📜 Standards & Design Principles

  • Clean Architecture (Robert C. Martin)
  • Domain-Driven Design (DDD) concepts
  • 12-Factor App Methodology for cloud-native deployment

📄 License

Distributed under the MIT License. See LICENSE for details.

© 2026 Dato' Samuel F. | Midaz Dev (https://samuel.midaz.dev)

About

⚡ Production-grade asynchronous FastAPI starter implementing Clean Architecture, Domain-Driven Design, and Docker Compose.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages