A simple and scalable FastAPI project following the MVC (Model-View-Controller) pattern with elements of a microservices architecture. This application demonstrates core functionalities such as database access, model creation, and automated testing. Below are the steps required to run the database and the application backend locally.
Develop with:
Existing Features: 🚀
✅ Clean Architecture: Well-organized file structure for easy maintenance and scalability.
✅ Ready-to-Use Configuration: Pre-configured for both development and production environments.
✅ SQLAlchemy Database Management: Robust model handling and database operations.
✅ Well-Defined RESTful APIs: Ready-to-use CRUD and authentication endpoints.
✅ Integrated Documentation: Swagger and Redoc for easy API exploration.
The proposed structure is described as follows:/app
__init__.py
main.py
/modules
__init__.py
/module_1/
__init__.py
exceptions.py
dto.py
model.py
repository.py
service.py
views.py
/module_2/
__init__.py
exceptions.py
dto.py
model.py
repository.py
service.py
views.py
/config
__init__.py
/seeds
seed_module_1.py
seed_module_2.py
seeder.py
/tests
.env
.gitignore
docker-compose.yml
Dockerfile
README.md
requirements.txt
Follow the steps below to set up and run the database and backend application locally.
Docker Desktop installed on the environment. (Windows
)
Docker Engine and Compose installed on the environment. (Linux
)
Build project
$ docker-compose up --build -d
http://localhost:4010/v1/api/docs/
http://localhost:4010/v1/api/redoc/
$ docker exec -it api bash
@container $ pytest --capture=no -s -v
$ docker exec -it db bash
@container $ psql -U postgres -p 5432
MIT - Robson Soares - 2024