modular-monolith-architecture-FastAPI
Installation
SKILL.md
FastAPI Modular Monolith Architecture — Project Scaffolder
Generate production-ready Modular Monolith projects with FastAPI, featuring proper module boundaries, async-first design, dependency injection, shared kernel, and infrastructure following industry best practices.
Overview
A Modular Monolith is a single deployable application organized into loosely coupled, highly cohesive modules — each representing a bounded context. FastAPI's speed, async capabilities, dependency injection system, and automatic API documentation make it an ideal framework for this architecture.
This skill scaffolds complete FastAPI projects with:
- Module isolation: Each module owns its models, repositories, services, routes, schemas, and dependencies
- Async-first design: All I/O operations use async/await (SQLAlchemy async, aiosmtplib, aiocache)
- FastAPI dependency injection: Loose coupling via
Depends()andAnnotatedtypes - Generic repository pattern: Base CRUD with pagination, filtering, sorting, and soft deletes
- Inter-module communication: Via gateway contracts and domain events (fastapi-events)
- Shared kernel (core): Cross-cutting concerns — base models, config, services, exception handling
- Database-per-module schema: Logical isolation within a single PostgreSQL database via Alembic
- Production-ready: Docker, Redis caching, task queues (Taskiq), structured logging, rate limiting
- Migration-ready boundaries: Modules can be extracted to microservices later
Related skills