Skip to content

Commit a8121f2

Browse files
authored
Initialize homolog
0 parents  commit a8121f2

139 files changed

Lines changed: 4023 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CD.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
name: CD
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
workflow_dispatch:

.github/workflows/CI.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
testApp:
10+
uses: maua-dev/ci_workflows_reusable/.github/workflows/pytest_ci.yml@V1.0

.gitignore

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
/pytest_html_report.html
131+
/output.json
132+
/archive/
133+
134+
/.vscode/
135+
/.idea/

README.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# clean_mss_template 🌡🍽
2+
3+
Template for microservices repositories based in Clean Arch
4+
5+
## The Project 📽
6+
7+
### Introduction and Objectives ⁉
8+
9+
The main objective is to provide a template for repositories that can be used as a starting point for new projects. This
10+
architecture is based on the Clean Architecture, and it was based in many other projects and books, articles that were
11+
mixed by the students of Mauá Institute of Technology, from the academic group Dev. Community Mauá.
12+
13+
### Reasons 1️⃣3️⃣
14+
15+
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.
16+
17+
### Clean Architecture 🧼🏰
18+
19+
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
20+
the code in layers, each of which has a
21+
specific responsibility. This architecture is based on the principles of SOLID and books like "Clean Architecture: A
22+
Craftsman's Guide to Software Structure and Design" by Robert C. Martin.
23+
24+
We also tried to explain for new programmers in the mos intuitive way and you can see the explanation here: [Clean Architecture Figma](https://www.figma.com/file/CmfQcH2xbZyIszPX0iOxPp/Clean-Arch---HackaBeckas?node-id=0%3A1&t=B38vNfX3VSv6qtU7-1)
25+
26+
27+
### Folder Structure 🎄🌴🌲🌳
28+
29+
Our folder structure was developed specially for our projects.
30+
31+
32+
```bash
33+
.
34+
├── iac
35+
├── src
36+
│   ├── modules
37+
│   │   ├── create_user
38+
│   │   │   └── app
39+
│   │   ├── delete_user
40+
│   │   │   └── app
41+
│   │   ├── get_user
42+
│   │   │   └── app
43+
│   │   └── update_user
44+
│   │   └── app
45+
│   └── shared
46+
│   ├── domain
47+
│   │   ├── entities
48+
│   │   ├── enums
49+
│   │   └── repositories
50+
│   ├── helpers
51+
│   │   ├── enum
52+
│   │   ├── errors
53+
│   │   ├── functions
54+
│   │   └── http
55+
│   └── infra
56+
│   ├── dto
57+
│   ├── external
58+
│   └── repositories
59+
└── tests
60+
├── modules
61+
│   ├── create_user
62+
│   │   └── app
63+
│   ├── delete_user
64+
│   │   └── app
65+
│   ├── get_user
66+
│   │   └── app
67+
│   └── update_user
68+
│   └── app
69+
└── shared
70+
├── domain
71+
│   └── entities
72+
├── helpers
73+
└── infra
74+
75+
```
76+
77+
78+
## Name Format 📛
79+
### Files and Directories 📁
80+
81+
- Files have the same name as the classes
82+
- snake_case 🐍 (ex: `./app/create_user_controller.py`)
83+
84+
### Classes 🕴
85+
- #### Pattern 📟
86+
87+
- CamelCase 🐫🐪
88+
89+
- #### Types 🧭
90+
91+
- **Interface** starts with "I" --> `IUserRepository`, `ISelfieRepository` 😀
92+
- **Repository** have the same name as interface, without the "I" and the type in final (ex: `UserRepositoryMock`, `SelfieRepositoryDynamo`) 🥬
93+
- **Controller** ends with "Controller" --> `CreateUserController`, `GetSelfieController` 🎮
94+
- **Usecase** ends with "Usecase" --> `CreateUserUsecase`, `GetSelfieUsecase` 🏠
95+
- **Viewmodel** ends with "Viewmodel" --> `CreateUserViewmodel`, `GetSelfieViewmodel` 👀
96+
- **Presenter** ends with "Presenter" --> `CreateUserPresenter`, `GetSelfiePresenter`🎁
97+
98+
### Methods 👨‍🏫
99+
100+
- snake_case 🐍
101+
- Try associate with a verb (ex: `create_user`, `get_user`, `update_selfie`)
102+
103+
### Variables 🅰
104+
105+
- snake_case 🐍
106+
- Avoid verbs
107+
108+
### Enums
109+
110+
- SNAKE_CASE 🐍
111+
- File name ends with "ENUM" (ex: "STATE_ENUM")
112+
113+
### Tests 📄
114+
115+
- snake_case 🐍
116+
- "test" follow by class name (ex: `test_cadastrar_usuario_valido`, `test_cadastrar_usuario_sem_email`)
117+
- The files must start with "test" to pytest recognition
118+
119+
### Commit 💢
120+
121+
- Start with verb
122+
- Ends with emoji 😎
123+
124+
125+
## Architecture Diagram 🏗
126+
![img.png](docs/architecture_diagram.png)
127+
128+
129+
130+
131+
## Installation 👩‍💻
132+
133+
Clone the repository using template
134+
135+
### Create virtual ambient in python (only first time)
136+
137+
###### Windows
138+
139+
python -m venv venv
140+
141+
###### Linux
142+
143+
virtualenv -p python3.9 venv
144+
145+
### Activate the venv
146+
147+
###### Windows:
148+
149+
venv\Scripts\activate
150+
151+
###### Linux:
152+
153+
source venv/bin/activate
154+
155+
### Install the requirements
156+
157+
pip install -r requirements-dev.txt
158+
159+
### Run the tests
160+
161+
pytest
162+
163+
### To run local set .env file
164+
165+
STAGE = TEST
166+
167+
168+
## Contributors 💰🤝💰
169+
170+
- Bruno Vilardi - [Brvilardi](https://github.com/Brvilardi) 👷‍♂️
171+
- Hector Guerrini - [hectorguerrini](https://github.com/hectorguerrini) 🧙‍♂️
172+
- João Branco - [JoaoVitorBranco](https://github.com/JoaoVitorBranco) 😎
173+
- Vitor Soller - [VgsStudio](https://github.com/VgsStudio) 🐱‍💻
174+
- Lucas Duez - [Lucasdvs10](https://github.com/Lucasdvs10) 🐱‍👤
175+
176+
## Especial Thanks 🙏
177+
178+
- [Dev. Community Mauá](https://www.instagram.com/devcommunitymaua/)
179+
- [Clean Architecture: A Craftsman's Guide to Software Structure and Design](https://www.amazon.com.br/Clean-Architecture-Craftsmans-Software-Structure/dp/0134494164)
180+
- [Institute Mauá of Technology](https://www.maua.br/)
181+
182+
183+

docs/architecture_diagram.drawio

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mxfile host="app.diagrams.net" modified="2022-12-22T19:27:58.038Z" agent="5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" version="20.7.4" etag="NAoIXk07P8TbAl3MBS6V" type="device"><diagram id="eBJmNtJBMSUI8nN_yHKL" name="Página-1">7Vpbc9o4FP41PJbxFZvHAKHtDjubbTqz233JCKwYbWWLyiLA/vo9smWwLiRkG5p2S5tJ0KerzznfJ+mYXjgutm85Wi1/ZRmmvcDLtr1w0guCoR/CbwnsGiD20wbIOckayD8At+QfrEBPoWuS4UprKBijgqx0cMHKEi+EhiHO2UZvds+oPusK5dgCbheI2ugfJBPLBk2D5IC/wyRftjP7g2FTU6C2sXqSaokytulA4XUvHHPGRPOp2I4xlbZr7dL0mx6p3S+M41Kc0mHm/e7Nol9uN39tbj9Fs/fR8rf0TdCM8oDoWj3wB5wTVqoli11rhxUjpahtGY/gB6Yae70Yasay1A9iAzDLiQ74dkmOoQNmOdEB3xzeN+b3zQV2AKukDe8Z83udBcJPOGJrQUmJx/uo8wDMOcoIeGPMKOOAlawE642WoqBQ8uHjZkkEvl2hhbTqBggD2D0rhYp7P2jLyvByVIhsgWAursaoPYH59QNuHNK0oRStKjL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3pU6fmkCeUBS1NKDv5fc9L9SRjEO7zkEeSjB2H7vt+pznHlp/nTzrWXeGBZYpw30BdMQ4j30igs1Ol5h3KM6KwGfEQk/ulfUWY+pZm7bVm2or9j6Ur6VkPXgPNR4FnH7ySbyoz4avITEcy/FiXjMEwekIynBphOPA7kYz2FPudv6dol9lh8WRXooJNwELex/pM/XJny6+4IDvPllm91Ltsbp8qg+skHKXHT5XfiPZhYkjzIDnpdHG2lPXA8ve7jx9vAPmAv6xxJV5DFE7gYvsW9SnaRSeyLn5N0kWO075hdT2rOHFlgDoGtIiz/26KRU1S1F+Qaf9OSJHDM1Ayh9+IUoKzO4EprgicN6YLVqzWMOIdKiXMCwJulRWgwZV08d1YtehXD/mpNHr8Hb4/0BkTDNM6R2iQJk76/tDmTZL0z8Wc4dNeuySGNeySGP4/J4Yfp3E01GkcvvZ7Hfu6cqHvD0TfYRRPpsHz6Btfhd4o/mnoW2EOC4S9u3ohCptn1xOvrMnzKQzFwxdnmwzF4dvH4fW/</diagram></mxfile>

docs/architecture_diagram.png

26.4 KB
Loading

iac/.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.swp
2+
package-lock.json
3+
__pycache__
4+
.pytest_cache
5+
.venv
6+
*.egg-info
7+
lambda_layer_out_temp/
8+
9+
# CDK asset staging directory
10+
.cdk.staging
11+
cdk.out

0 commit comments

Comments
 (0)