Starter template for a Python monorepo with FastAPI services in apps/ and shared libraries in packages/.
Create a repo from this template on GitHub.
If you prefer to do it manually with a clean git history:
npx degit elonehoo-starter/python my-python-app
cd my-python-appIf you use uv for dependency management (recommended):
uv sync- apps/ — FastAPI services (executables)
- packages/ — Shared libraries reused by apps
- scripts/ — Dev helper (
dev.py) that bootstraps monorepo src paths - .vscode/ — Ready-to-use VS Code tasks and settings
- pyproject.toml — Root config (formatters, pytest) and uv workspace members
Example modules included:
apps/example-service: a FastAPI app that mounts routers frompackages/base-apiand usespackages/example-util.packages/base-api: common FastAPI routers (e.g./health,/info).packages/example-util: a tiny utility library exposinggreet(name).
apps/
example-service/
pyproject.toml
src/example_service/
main.py
run.py
tests/
packages/
base-api/
pyproject.toml
src/routers/
health.py
info.py
example-util/
pyproject.toml
src/shared.py
__init__.py
core.py
tests/
scripts/
dev.py
.vscode/
settings.json
tasks.json
pyproject.toml
Run the FastAPI dev server (hot reload):
uv run python scripts/dev.py -m example_service.runOpen the docs:
Health check:
curl -sS http://127.0.0.1:8000/healthRun tests:
uv run pytest -qVS Code tasks:
- Dev server (uvicorn) — start the dev server with reload
- Test all — run all tests
- HTTP: GET /health — quick health probe
- Managing dependencies in packages (uv): see
docs/managing-dependencies.md
- Create a folder:
packages/your-lib/src/your_lib - Add
packages/your-lib/pyproject.toml(use hatchling or your builder) - Write code and tests in
packages/your-lib/tests/ - Apps can import it directly (uv workspace + dev helper make imports work during development)
- Create a folder:
apps/your-service/src/your_service - Add dependencies in
apps/your-service/pyproject.toml - Build APIs with FastAPI and import shared packages as needed
When you use this template, follow the checklist to update your info properly:
- Change the author information in
apps/*/pyproject.tomlandpackages/*/pyproject.toml - Rename projects in
pyproject.tomlfiles to your own names - Update this
README.mdwith your project description - Remove example modules (
example-service,example-util,base-api) if you don't need them
Enjoy and build great services!