Projets
Voir sur GitHub
jujumilk3/fastapi-clean-architecture
À propos
Projet de base FastAPI pour créer des API générales.
Développement web et applicatifProgression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- +1
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Originalfastapi-clean-architecture
description
Base FastAPI project for applying general RestAPI Application cases.

concept
- Minimal functionality.
- Convincing architecture.
- Easy to read.
- Compatibility.
- Versatility.
base models
- user
- post [user (1 : n) post]
- tag [post (n : n) tag]
integrated with
- Python3.9+
- Fastapi 0.78.0
- Database
- MySQL5.7+
- Migration with alembic
- pytest with real DB
- Load with two ways (eager, lazy)
- Modeling with schema (1:1, 1:n, n:n)
- dependency-injector
- service-repository pattern
- JWT authentication
- role separation each endpoint
- Deployment
- container environment(k8s, docker)
- raw WAS(Web Application Server)
commands
- db(alembic)
alembic upgrade head: apply every migrationsalembic downgrade base: rollback every migrationsalembic revision --autogenerate -m "revision_name": create new migrationalembic history: get alembic revision history
- How to migration
- Create or modify models from
app/model/*.py alembic -x ENV=[dev|stage|prod] revision --autogenerate -m "revision_name"- Check auto generated migration file from
app/migrations/versions/*.py alembic -x ENV=[dev|stage|prod] upgrade head
If ENV does not exist, it will be applied to the test.
- Create or modify models from
- server
uvicorn app.main:app --reload: base- options
- host:
--host 0.0.0.0 - port:
--port 8000
- host:
- test
pytest: basepytest --cov=app --cov-report=term-missing: coverage with stdoutpytest --cov=app --cov-report=html: coverage with html
sample env
# mysql case
ENV=dev
DB=mysql
DB_USER=root
DB_PASSWORD=qwer1234
DB_HOST=localhost
DB_PORT=3306
# postgres case
ENV=dev
DB=postgresql
DB_USER=gyu
DB_PASSWORD=
DB_HOST=localhost
DB_PORT=5432
references
Explorer des projets similaires
Chargement…