Skip to main content
Percher is still being built, but you can try it out with a free account right now!
← All deploy guides
Deploy guide · runtime = "python"

Ship FastAPI in ~2 minutes.

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 publish

The first command scaffolds a working FastAPI project plus a percher.toml. Publish builds and deploys it, then prints the live URL.

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?

Start on the Free plan. No credit card, live in ~2 minutes.

Sign up free →