This is a template project that should be forked to create your own FastAPI application.
The application includes:
- FastAPI
- Postgres support
- SQLModel
- AsyncPG
- Alembic
- PGAdmin
- Poetry - package management
- Docker-Compose
- Prod DockerFile
- Dev DockerFile
- Prod Traefik DockerFile
- Dev Traefik DockerFile
- Traefik - proxy server
- PyTest
- Black - for linting
To setup this application, one must have installed:
- Python 3.10 or above
- Docker
- Postgres
Note
The recommended Approach is to use Brew
Using Brew:
brew install python@3.10
Using official website:
https://www.python.org/downloads/
Engine:
https://docs.docker.com/engine/install/
Compose:
https://docs.docker.com/compose/install/
Note
Optionally install Docker Desktop
Install Docker Desktop:
https://docs.docker.com/desktop/#download-and-install
https://www.postgresql.org/download/
Note
WIP
Always create a new branch before working on your changes
To bring down containers
docker-compose down -v
To build the containers and bring them up again
docker-compose up --build
To generate a new migration to ballot_db. Don't forget to add your model to /app/alembic/env.py
docker-compose exec web alembic revision --autogenerate -m <message>
To apply migration
docker-compose exec web alembic upgrade head
- For features:
feature/feature-name
- For bugs:
bug/bug-name
Super charge your development by installing PyCharm.
https://www.jetbrains.com/pycharm/ Make your editor auto-lint with black by following the steps here:
https://black.readthedocs.io/en/stable/integrations/editors.html