Skip to content

Commit 407342b

Browse files
Merge pull request #129 from IncludeLuisFerreira/issue8-base
feat(backend): scaffold FastAPI + Poetry do SaaS Backend (issue #8)
2 parents ffcb847 + fb10d14 commit 407342b

11 files changed

Lines changed: 3359 additions & 14 deletions

File tree

.github/workflows/saas-backend.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: SaaS Backend CI
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "saas_backend/**"
7+
- ".github/workflows/saas-backend.yml"
8+
push:
9+
branches:
10+
- main
11+
- develop
12+
paths:
13+
- "saas_backend/**"
14+
- ".github/workflows/saas-backend.yml"
15+
16+
env:
17+
PYTHON_VERSION: "3.13"
18+
POETRY_VERSION: "2.4.1"
19+
20+
jobs:
21+
lint:
22+
name: Lint & Type Check
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
working-directory: saas_backend
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Install Poetry
32+
run: pipx install "poetry==${POETRY_VERSION}"
33+
34+
- name: Set up Python
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: ${{ env.PYTHON_VERSION }}
38+
cache: poetry
39+
40+
- name: Install dependencies
41+
run: poetry install
42+
43+
- name: Black (format check)
44+
run: poetry run black --check src tests
45+
46+
- name: isort (import order check)
47+
run: poetry run isort --check-only src tests
48+
49+
- name: Flake8 (lint)
50+
run: poetry run flake8 src tests
51+
52+
- name: Mypy (type check)
53+
run: poetry run mypy src tests
54+
55+
test:
56+
name: Tests & Coverage
57+
runs-on: ubuntu-latest
58+
defaults:
59+
run:
60+
working-directory: saas_backend
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v4
64+
65+
- name: Install Poetry
66+
run: pipx install "poetry==${POETRY_VERSION}"
67+
68+
- name: Set up Python
69+
uses: actions/setup-python@v5
70+
with:
71+
python-version: ${{ env.PYTHON_VERSION }}
72+
cache: poetry
73+
74+
- name: Install dependencies
75+
run: poetry install
76+
77+
- name: Pytest (cobertura >= 70%)
78+
run: poetry run pytest --cov=src --cov-report=term-missing --cov-fail-under=70

.gitignore

Lines changed: 217 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,226 @@ configNode.h
1111
nvs_secrets.h
1212

1313
# === Build / Compilação ===
14-
node_modules/
15-
*.o
16-
*.a
17-
*.elf
18-
*.bin
19-
*.hex
20-
*.eep
21-
*.map
22-
*.out
23-
.pio/
24-
.pioenvs/
25-
.piolibdeps/
14+
# Byte-compiled / optimized / DLL files
15+
__pycache__/
16+
*.py[codz]
17+
*$py.class
18+
19+
# C extensions
20+
*.so
21+
22+
# Distribution / packaging
23+
.Python
2624
build/
25+
develop-eggs/
2726
dist/
28-
out/
29-
__pycache__/
27+
downloads/
28+
eggs/
29+
.eggs/
30+
lib/
31+
lib64/
32+
parts/
33+
sdist/
34+
var/
35+
wheels/
36+
share/python-wheels/
37+
*.egg-info/
38+
.installed.cfg
39+
*.egg
40+
MANIFEST
41+
42+
# PyInstaller
43+
# Usually these files are written by a python script from a template
44+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
45+
*.manifest
46+
*.spec
47+
48+
# Installer logs
49+
pip-log.txt
50+
pip-delete-this-directory.txt
51+
52+
# Unit test / coverage reports
53+
htmlcov/
54+
.tox/
55+
.nox/
56+
.coverage
57+
.coverage.*
58+
.cache
59+
nosetests.xml
60+
coverage.xml
61+
*.cover
62+
*.py.cover
63+
*.lcov
64+
.hypothesis/
65+
.pytest_cache/
66+
cover/
67+
68+
# Translations
69+
*.mo
70+
*.pot
71+
72+
# Django stuff:
73+
*.log
74+
local_settings.py
75+
db.sqlite3
76+
db.sqlite3-journal
77+
78+
# Flask stuff:
79+
instance/
80+
.webassets-cache
81+
82+
# Scrapy stuff:
83+
.scrapy
84+
85+
# Sphinx documentation
86+
docs/_build/
87+
88+
# PyBuilder
89+
.pybuilder/
90+
target/
91+
92+
# Jupyter Notebook
93+
.ipynb_checkpoints
94+
95+
# IPython
96+
profile_default/
97+
ipython_config.py
98+
99+
# pyenv
100+
# For a library or package, you might want to ignore these files since the code is
101+
# intended to run in multiple environments; otherwise, check them in:
102+
# .python-version
103+
104+
# pipenv
105+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
106+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
107+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
108+
# install all needed dependencies.
109+
# Pipfile.lock
110+
111+
# UV
112+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
113+
# This is especially recommended for binary packages to ensure reproducibility, and is more
114+
# commonly ignored for libraries.
115+
# uv.lock
116+
117+
# poetry
118+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
119+
# This is especially recommended for binary packages to ensure reproducibility, and is more
120+
# commonly ignored for libraries.
121+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
122+
# poetry.lock
123+
# poetry.toml
124+
125+
# pdm
126+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
127+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
128+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
129+
# pdm.lock
130+
# pdm.toml
131+
.pdm-python
132+
.pdm-build/
133+
134+
# pixi
135+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
136+
# pixi.lock
137+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
138+
# in the .venv directory. It is recommended not to include this directory in version control.
139+
.pixi/*
140+
!.pixi/config.toml
141+
142+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
143+
__pypackages__/
144+
145+
# Celery stuff
146+
celerybeat-schedule*
147+
celerybeat.pid
148+
149+
# Redis
150+
*.rdb
151+
*.aof
152+
*.pid
153+
154+
# RabbitMQ
155+
mnesia/
156+
rabbitmq/
157+
rabbitmq-data/
158+
159+
# ActiveMQ
160+
activemq-data/
161+
162+
# SageMath parsed files
163+
*.sage.py
164+
165+
# Environments
166+
.env
167+
.envrc
168+
.venv
169+
env/
170+
venv/
171+
ENV/
172+
env.bak/
173+
venv.bak/
174+
175+
# Spyder project settings
176+
.spyderproject
177+
.spyproject
178+
179+
# Rope project settings
180+
.ropeproject
181+
182+
# mkdocs documentation
183+
/site
184+
185+
# mypy
186+
.mypy_cache/
187+
.dmypy.json
188+
dmypy.json
189+
190+
# Pyre type checker
191+
.pyre/
192+
193+
# pytype static type analyzer
194+
.pytype/
195+
196+
# Cython debug symbols
197+
cython_debug/
198+
199+
# PyCharm
200+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
201+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
202+
# and can be added to the global gitignore or merged into this file. For a more nuclear
203+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
204+
# .idea/
205+
206+
# Abstra
207+
# Abstra is an AI-powered process automation framework.
208+
# Ignore directories containing user credentials, local state, and settings.
209+
# Learn more at https://abstra.io/docs
210+
.abstra/
211+
212+
# Visual Studio Code
213+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
214+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
215+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
216+
# you could uncomment the following to ignore the entire vscode folder
217+
# .vscode/
218+
# Temporary file for partial code execution
219+
tempCodeRunnerFile.py
220+
221+
# Ruff stuff:
222+
.ruff_cache/
223+
224+
# PyPI configuration file
225+
.pypirc
226+
227+
# Marimo
228+
marimo/_static/
229+
marimo/_lsp/
230+
__marimo__/
30231

232+
# Streamlit
233+
.streamlit/secrets.toml
31234
# === IDE / Editor ===
32235
.vscode/
33236
.idea/

0 commit comments

Comments
 (0)