Deploy guide · runtime = "python"
Deploy FastAPI on Percher
FastAPI is the modern async Python web framework — type hints define both validation and OpenAPI schema, uvicorn or uvloop runs it in production, and the dev experience around interactive docs at `/docs` is hard to beat. The bundled `python` template scaffolds exactly this shape.
Why Percher fits
- Long-running container + Python runtime via Nixpacks fits FastAPI's uvicorn-served lifecycle directly — no Lambda-style cold-start workaround for ASGI.
- Native HTTPS outbound proxy means `httpx.AsyncClient()` and `requests` reach external APIs without configuration — `HTTPS_PROXY` is honored automatically.
- FastAPI's auto-generated OpenAPI at `/openapi.json` pairs nicely with Percher's own `/openapi.json` on the platform side — both follow the same discoverability conventions.
Quick start
bunx percher create my-app --template python
cd my-app
bunx percher publishThe first command scaffolds a working FastAPI project plus a `percher.toml`. Publish builds and deploys it; the live URL prints on completion.
percher.toml
The canonical config for a FastAPI app on Percher. `bunx percher init` generates this automatically when it detects FastAPI in your project.
[app]
name = "my-api"
runtime = "python"
framework = "fastapi"
[web]
port = 8000
health = "/health"
Common gotchas
- Run with `uvicorn main:app --host 0.0.0.0 --port ${PORT}` — binding to `localhost` won't be reachable from the container's network namespace, and a hardcoded port won't match Percher's injected `PORT`.
- Add a `@app.get("/health")` returning `{"status": "ok"}` (status 200) — without it the deploy health check fails.
- Percher's Nixpacks Python builder is slower than the native node-build (~60–120 s cold). Use `--no-cache` only when you actually need a fresh build; warm redeploys are much faster.
Related docs
Ready to deploy FastAPI?
Free plan, no credit card. Live in under a minute.
Sign up free