Simple Personal FastAPI Boilerplate with postgres+postgis, auto generated migrations with alembic, sqlalchemy with async, pytest and docker
- Clone this repo
- Install the requirements:
pip install -r requirements.txt
- Edit
app>core>config.py
to your needs - Write your models in
app>database>repositories
;app>database>tables
andapp>models>schemas
- Write the test (yep, it is important, not for you but for your boss and to feel fashion using TDD)
- Write a new router in
app/api/routes/
- Explore and fix the other things (I'm boring of looking each new thing that I need to do)
Run:
pytest
Run:
uvicorn app.main:app --reload
Run:
ipython -m uvicorn app.main:app --pdb
Or press F5 in vscode
How to get the coverage to pass it on to your Project Manager and avoid stupid questions about your progress 📈
pytest --cov=app
docker-compose up --build
docker-compose run fastapi-core pytest
💡 Important Note: the pytest project was made to avoid interruptions with the real database, the data is ephemeral in each test
💡 Important Note #2: There are some mypy issues to be fixed... someday...