Skip to content

Online13/create_modern_fastapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Architecture Template for FastAPI Applications

SQLModel SQLModel

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

  1. Create project with
    uvx create-modern-fastapi
  2. Navigate to the project directory:
  3. Install dependencies:
    uv sync
  4. 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
Loading

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

About

Clean and structured FastAPI template, designed for maintainable, testable, and scalable production-ready backends.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors