https://github.com/ottojimb/fastapi-boilerplate
Simple Personal FastAPI Boilerplate with postgres+postgis, auto generated migrations with alembic, sqlalchemy with async, pytest and docker
https://github.com/ottojimb/fastapi-boilerplate
alembic async docker fastapi postgis postgres pytest sqlalchemy
Last synced: about 2 months ago
JSON representation
Simple Personal FastAPI Boilerplate with postgres+postgis, auto generated migrations with alembic, sqlalchemy with async, pytest and docker
- Host: GitHub
- URL: https://github.com/ottojimb/fastapi-boilerplate
- Owner: ottojimb
- License: mit
- Created: 2022-12-06T21:47:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T19:53:12.000Z (over 3 years ago)
- Last Synced: 2025-08-23T15:13:18.959Z (10 months ago)
- Topics: alembic, async, docker, fastapi, postgis, postgres, pytest, sqlalchemy
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI Boilerplate
Simple Personal FastAPI Boilerplate with postgres+postgis, auto generated migrations with alembic, sqlalchemy with async, pytest and docker
## How to use
1. Clone this repo
2. Install the requirements: `pip install -r requirements.txt`
3. Edit `app>core>config.py` to your needs
4. Write your models in `app>database>repositories`; `app>database>tables` and `app>models>schemas`
5. Write the test (yep, it is important, not for you but for your boss and to feel fashion using TDD)
6. Write a new router in `app/api/routes/`
7. Explore and fix the other things (I'm boring of looking each new thing that I need to do)
## Util commands
### How to test ๐งช
Run:
```
pytest
```
### How to live code ๐จโ๐ป/๐ฉโ๐ป
Run:
```
uvicorn app.main:app --reload
```
### How to debug ๐
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
```
### How to build everything with docker-compose ๐๐ฆ
```
docker-compose up --build
```
### How to run the test in the docker compose (for CI/CD) ๐งช
```
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...