This is a template to create simple fastapi web apps.
It powered by traefik, both dev and prod.
To run code, just type:
docker-compose -f docker-compose.dev.yml up
and then go to http://api.localhost .
The uvicorn will automatically update and restart after changes in files.
To manage dependencies, use poetry .
To add dependencies, just type
poetry add <dep_name>
# or
poetry add <dep_name> --dev
For manual installation and using in shell, use
poetry install
poetry shell
You can export requirements manually, using
poetry export -f requirements.txt --output requirements.txt
For adding enviroment variables, edit .env
file. It's recommended to add this file to .gitignore
to prevent leak of secret variables into repository. For big projects, use vault and hvac library.
For VSCode users, select virtual enviroment created by poetry. Mypy and flake8 will be there.