FastAPI scaffold managed by Poetry.
- Python 3.10 or newer
- Poetry installed (
pipx install poetryor seehttps://python-poetry.org/docs/#installation)
- Install dependencies:
poetry install
- Activate the virtualenv (optional; you can also prefix commands with
poetry run):poetry shell
poetry run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000- Open
http://localhost:8000for a basic status message. - Open
http://localhost:8000/docsfor interactive Swagger docs.
app/
__init__.py
main.py # FastAPI application entrypoint (ASGI: app.main:app)
pyproject.toml # Poetry configuration and dependencies
.gitignore
README.md
- Add a dependency:
poetry add <package>
- Add a dev-only dependency:
poetry add --group dev <package>
- Run a script inside the venv:
poetry run <command>
- Root:
GET /returns a simple status - Health:
GET /healthreturns{"status": "healthy"}
- The ASGI app is
app.main:app. - For production, remove
--reloadand configure a process manager or container.