A CLI tool to create a FastAPI project.
Project description
Clean Architecture Template for FastAPI Applications
This template provides a clean and well-structured foundation for building FastAPI applications using Clean Architecture principles. It uses SQLModel as the ORM and PostgreSQL as the database. It clearly separates business logic, use cases, infrastructure, and the API layer to ensure maintainability, testability, and scalability. With an explicit project structure and built-in testing strategy, it serves as a solid starting point for developing professional and production-ready backends.
Requirements
- Python 3.10 or higher
- PostgreSQL
- uv for managing virtual environments and dependencies
- justfile for command runner
Todo
| Description | Status |
|---|---|
| Setup project structure | ✅ |
| Create database models and implement database connection | ✅ |
| Test with real database (e.g., PostgreSQL, MySQL) | ✅ |
| Setup migration (alembic) | ✅ |
| Test on real project | ☕ |
| Implement end-to-end tests setup | ⛔ |
| Implement integration tests setup | ⛔ |
Setup
- Create project with
uvx create-modern-fastapi - Navigate to the project directory:
- Install dependencies:
uv sync - Run the application:
just start
Flow
flowchart LR
ENTRY[Entry Point]
PRESENTATION[Presentation]
APPLICATION[Application]
INFRASTRUCTURE[Infrastructure]
DOMAIN[Domain]
ENTRY --> PRESENTATION
PRESENTATION --> APPLICATION
PRESENTATION --> INFRASTRUCTURE
PRESENTATION --> DOMAIN
APPLICATION --> DOMAIN
INFRASTRUCTURE --> DOMAIN
Project Structure
In progress...
Testing
To run tests, use the following command:
- Run unit tests:
just test-unit - Run tests with coverage:
just test-coverage - Run test for clean architecture dependency rules:
just test-clean
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file create_modern_fastapi-0.4.1.tar.gz.
File metadata
- Download URL: create_modern_fastapi-0.4.1.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e074c24b0d26cdc881ade5d71d4a591732050c342ca5a9a7694ca61f85f96f6
|
|
| MD5 |
d479d4e5ffaa35176a4bcbc034298229
|
|
| BLAKE2b-256 |
d952ee290d42acc803c3c84fa9f78f477b624f6e7f3e1782a181785f8609953a
|
File details
Details for the file create_modern_fastapi-0.4.1-py3-none-any.whl.
File metadata
- Download URL: create_modern_fastapi-0.4.1-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21b3ef4c5ff565765903d897af6b271a40e4ad6ddce12cf70ec5ea149eb71e9b
|
|
| MD5 |
5a65ceed7f3bd88b4aac7e09a0354000
|
|
| BLAKE2b-256 |
8f954f8075ecca091807a85ed348df84c395f58612a0ded2cd9a0773b323d094
|