A simple FastAPI boilerplate using ArchiPy's clean architecture principles.
This project implements a clean architecture approach with FastAPI, providing a structured and maintainable codebase. It leverages ArchiPy to organize code into distinct layers with clear separation of concerns.
- Clean Architecture implementation via ArchiPy
- FastAPI for high-performance API development
- Dependency injection with dependency-injector
- SQLAlchemy ORM with async support
- Layered architecture (controllers, logics, repositories)
- Comprehensive linting and type checking
- Python 3.13+
- Poetry (for dependency management)
- Make (optional, for using Makefile commands)
-
Setup the environment
# Install prerequisites make setup # Install project dependencies make install # Or for development dependencies: make install-dev
-
Configure your environment
Create environment configuration as needed. The project uses RuntimeConfig for configuration management.
-
Run the application
# Start the application python manage.pyThe API will be available at http://localhost:8000 by default.
-
API Documentation
Once running, access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
src/
├── configs/ # Configuration management
├── controllers/ # API endpoints and request handling
├── logics/ # Business logic layer
├── models/ # Data models and schemas
│ ├── dtos/ # Data Transfer Objects
│ ├── entities/ # Domain entities
│ └── types/ # Type definitions
├── repositories/ # Data access layer with adapters
└── utils/ # Utility functions
# Format code
make format
# Run linters
make lint
# Run behavioral tests
make behave
# Run pre-commit hooks
make pre-commit
# Clean build artifacts
make cleanPlease read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the UnLicense - see the LICENSE file for details.