Template for microservices repositories based in Clean Arch
The main objective is to provide a template for repositories that can be used as a starting point for new projects. This architecture is based on the Clean Architecture, and it was based in many other projects and books, articles that were mixed by the students of Mauรก Institute of Technology, from the academic group Dev. Community Mauรก.
The project aims to help developers to start new projects with a good architecture, and with a good structure, so that anybody can create good applications.
The purpose of the project is to learn and create a Clean Architecture for microservices stateless with AWS Lambda which is a way of structuring the code in layers, each of which has a specific responsibility. This architecture is based on the principles of SOLID and books like "Clean Architecture: A Craftsman's Guide to Software Structure and Design" by Robert C. Martin.
We also tried to explain for new programmers in the mos intuitive way and you can see the explanation here: Clean Architecture Figma
Our folder structure was developed specially for our projects.
.
โโโ iac
โโโ src
โย ย โโโ modules
โย ย โย ย โโโ create_user
โย ย โย ย โย ย โโโ app
โย ย โย ย โโโ delete_user
โย ย โย ย โย ย โโโ app
โย ย โย ย โโโ get_user
โย ย โย ย โย ย โโโ app
โย ย โย ย โโโ update_user
โย ย โย ย โโโ app
โย ย โโโ shared
โย ย โโโ domain
โย ย โย ย โโโ entities
โย ย โย ย โโโ enums
โย ย โย ย โโโ repositories
โย ย โโโ helpers
โย ย โย ย โโโ enum
โย ย โย ย โโโ errors
โย ย โย ย โโโ functions
โย ย โย ย โโโ http
โย ย โโโ infra
โย ย โโโ dto
โย ย โโโ external
โย ย โโโ repositories
โโโ tests
โโโ modules
โย ย โโโ create_user
โย ย โย ย โโโ app
โย ย โโโ delete_user
โย ย โย ย โโโ app
โย ย โโโ get_user
โย ย โย ย โโโ app
โย ย โโโ update_user
โย ย โโโ app
โโโ shared
โโโ domain
โย ย โโโ entities
โโโ helpers
โโโ infra
- Files have the same name as the classes
- snake_case ๐ (ex:
./app/create_user_controller.py
)
-
- CamelCase ๐ซ๐ช
-
- Interface starts with "I" -->
IUserRepository
,ISelfieRepository
๐ - Repository have the same name as interface, without the "I" and the type in final (ex:
UserRepositoryMock
,SelfieRepositoryDynamo
) ๐ฅฌ - Controller ends with "Controller" -->
CreateUserController
,GetSelfieController
๐ฎ - Usecase ends with "Usecase" -->
CreateUserUsecase
,GetSelfieUsecase
๐ - Viewmodel ends with "Viewmodel" -->
CreateUserViewmodel
,GetSelfieViewmodel
๐ - Presenter ends with "Presenter" -->
CreateUserPresenter
,GetSelfiePresenter
๐
- Interface starts with "I" -->
- snake_case ๐
- Try associate with a verb (ex:
create_user
,get_user
,update_selfie
)
- snake_case ๐
- Avoid verbs
- SNAKE_CASE ๐
- File name ends with "ENUM" (ex: "STATE_ENUM")
- snake_case ๐
- "test" follow by class name (ex:
test_cadastrar_usuario_valido
,test_cadastrar_usuario_sem_email
)- The files must start with "test" to pytest recognition
- Start with verb
- Ends with emoji ๐
Clone the repository using template
python -m venv venv
virtualenv -p python3.9 venv
venv\Scripts\activate
source venv/bin/activate
pip install -r requirements-dev.txt
pytest
STAGE = TEST
- Bruno Vilardi - Brvilardi ๐ทโโ๏ธ
- Hector Guerrini - hectorguerrini ๐งโโ๏ธ
- Joรฃo Branco - JoaoVitorBranco ๐
- Vitor Soller - VgsStudio โ
- Lucas Duez - Lucasdvs10 ๐คก
- Rodrigo Morales - RodrigoM2004 ๐
- Lucas Milani - LucasKiller ๐ช
- Rafael Rubio - Rubiozito ๐ธ