Loading repository dataโฆ
Loading repository dataโฆ
joaoflaviosantos / repository
A fully asynchronous FastAPI boilerplate. Built for extensibility and speed, it incorporates FastAPI, SQLModel, Alembic, PostgreSQL, Redis, Celery and Locust. ๐
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
This FastAPI boilerplate for high-performance APIs leverages async programming alongside libraries such as SQLModel, Redis, Celery, Locust, NGINX, and Docker. It follows a Clean Architecture utilizing the Repository and Service Patterns on top of a Django-inspired modular folder structure. Key areas like system/tiers, system/users and blog/posts showcase an optimal balance between modularity, clarity, and separation of concerns. The project also includes an independent Locust load testing suite (locust/) with its own virtual environment for performance and stress testing.
It aims to provide a robust structure while serving as an excellent tool for quick POC (Proof of Concept) validations and MVP (Minimum Viable Product) launches. Crafted to attract enthusiasts who appreciate how Django operates but demand the decoupling of modern architectural patterns, this project offers a solid foundation for API development, incorporating a blend of cutting-edge technologies and architectural best practices.
This project seeks to provide a strong foundation for API development, incorporating a blend of cutting-edge technologies and structural principles:
pytest-asyncio and testcontainers for isolated PostgreSQL instances.setup.py extension).Before you begin, ensure you have the following prerequisites installed and configured:
Poetry is a dependency manager for Python. Follow the steps below to install Poetry version 1.7.1 (required):
Open a terminal.
Run the following command to install Poetry using pip:
pip install poetry==1.7.1
Verify the installation by running:
poetry --version
This should display Poetry (version 1.7.1). If you have a different version installed, please uninstall and reinstall the correct version:
pip uninstall poetry
pip install poetry==1.7.1
If you prefer to use Docker containers for development, you can easily set up PostgreSQL and Redis using Docker Compose:
Ensure you have Docker and Docker Compose installed on your system.
From the root directory of the project, run the following command to start PostgreSQL and Redis containers:
docker compose --env-file backend/.env -f development/compose/infra-only/docker-compose.yml \
--project-name fastapi-async-sqlmodel-boilerplate up -d
Verify the services are running:
docker compose --project-name fastapi-async-sqlmodel-boilerplate ps
To stop the services:
docker compose --project-name fastapi-async-sqlmodel-boilerplate down
Note: The command uses environment variables from backend/.env, so ensure that file is properly configured before running the containers.
Now that the prerequisites are met, you can begin working on your project. Choose either the manual setup or Docker Compose based on your preference.
For a complete overview of all development modes, see the Development Guide.
To streamline the usage of this boilerplate, we've provided a convenient CLI tool. From the root project directory, execute the following steps:
git clone https://github.com/joaoflaviosantos/fastapi-async-sqlmodel-boilerplate.git
cd fastapi-async-sqlmodel-boilerplate
python3 setup.py
This command automates various setup tasks, making it easier to get started with the project.
For more details for a manual setup, please refer to the Backend README section.
For more details about load testing setup and usage, please refer to the Locust Guide.
| Guide | Description |
|---|---|
| Development Guide | All local development modes (Docker, native, infra-only) |
| Deployment Guide | All production deployment modes (Docker Compose, PaaS, native) |
| Database Migration Guide | Alembic workflow for schema changes |
| Celery Guide | Celery worker setup and Windows-specific notes |
| Testing Guide | Running the test suite with pytest |
| Uvicorn Guide | Uvicorn configuration options |
| Locust Guide | Load testing with Locust |
Feel free to use this boilerplate as a starting point for your own projects, and adapt it based on your specific requirements and use cases. Happy coding! ๐