Back to Blog
Guide10 min read2026-07-07

Best FastAPI Hosting Platforms in 2026

A practical guide to hosting FastAPI in production in 2026: ASGI servers, container vs. serverless trade-offs, and a fair comparison of the platforms worth your time.

Ajay Kumar
Ajay Kumar
Founder & DevOps, PandaStack

What FastAPI actually needs in production

FastAPI is an ASGI framework, which is the first thing to internalize when choosing a host. You don't "run" FastAPI directly — you run it under an ASGI server, almost always Uvicorn, frequently managed by Gunicorn workers in production:

gunicorn app.main:app \
  -k uvicorn.workers.UvicornWorker \
  -w 4 \
  -b 0.0.0.0:8000

That means a good FastAPI host needs to:

  • Run a long-lived ASGI process (not just a request/response function, unless you deliberately go serverless).
  • Let you control worker count and concurrency.
  • Give you a managed database nearby (Postgres is the usual companion).
  • Handle environment variables, secrets, and HTTPS without ceremony.
  • Support WebSockets if you use them (FastAPI does this well).

Container vs. serverless for FastAPI

There are two deployment philosophies and they have real consequences:

Container (long-lived)Serverless (per-request)
Cold startsMinimal once warmPossible per invocation
WebSocketsNativeOften unsupported/awkward
Background tasksEasyTime-limited
Cost at idlePay for running container (or scale-to-zero)Pay per request
Best forAPIs, realtime, long jobsSpiky, stateless endpoints

For most FastAPI apps with a database and any realtime or background work, the container model is the cleaner fit. Serverless shines for stateless, bursty endpoints where you don't want to pay for idle.

The platforms

Railway and Render

Both are excellent "git push and it runs" PaaS options with strong Python support and managed Postgres. They auto-detect Python apps, and you mostly just declare a start command. They're popular for good reason: low friction, good docs, fair pricing tiers. Check their current pricing pages directly, as both have iterated on plans.

Fly.io

Fly runs your container close to users in many regions and is a great fit if global latency matters. You'll write a fly.toml and think a bit more about machines and volumes, but you get a lot of control. Strong WebSocket support.

The big clouds (AWS/GCP/Azure)

ECS/Fargate, Cloud Run, and Container Apps will all happily run a FastAPI container. Cloud Run in particular is a great serverless-container middle ground with scale-to-zero. The trade-off is operational surface area — you're assembling more pieces yourself.

PandaStack

Full disclosure: this is my platform. PandaStack auto-detects Python apps via buildpacks (or uses your Dockerfile), so a standard FastAPI repo deploys without you writing infra config:

# Dockerfile is optional — buildpacks detect FastAPI/uvicorn automatically.
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["gunicorn", "app.main:app", "-k", "uvicorn.workers.UvicornWorker", "-b", "0.0.0.0:8000"]

What you get: connect the repo, it builds with rootless BuildKit in an ephemeral K8s Job, pushes to a private registry, and deploys via Helm. Add a managed Postgres and DATABASE_URL is injected automatically — no copy-pasting connection strings, which is the single most annoying part of wiring up a FastAPI app. You also get live build/app logs, custom domains with automatic SSL, and cronjobs (handy for scheduled FastAPI maintenance tasks).

Honest limits: PandaStack is newer than the incumbents and the ecosystem is still maturing. Free-tier apps scale to zero on preemptible nodes, so the first request after idle pays a cold start — fine for hobby/staging, something to size up for production traffic.

Compute sizing

FastAPI is light per-request but you'll want headroom for worker processes. A rough starting point:

  • Hobby/low traffic: ~0.25-0.5 vCPU, 512MB-1GB, 2 workers.
  • Production API: 1-2 vCPU, 2-4GB, workers = (2 * cores) + 1 as the classic Gunicorn heuristic.
  • CPU-bound (ML inference in-process): compute-optimized tiers, fewer workers, consider a separate inference service.

Don't over-provision workers on tiny instances — each Uvicorn worker is a full process and you'll exhaust memory before you exhaust CPU.

A production checklist

  • Run behind a process manager (Gunicorn + Uvicorn workers).
  • Set --workers based on cores, not vibes.
  • Use async DB drivers (asyncpg) to avoid blocking the event loop.
  • Put migrations in your deploy step, not app startup, to avoid race conditions across replicas.
  • Enable health checks on a cheap endpoint (/health).
  • Stream logs centrally — debugging an ASGI app without logs is misery.

References

  • [FastAPI deployment docs](https://fastapi.tiangolo.com/deployment/)
  • [Uvicorn deployment guide](https://www.uvicorn.org/deployment/)
  • [Gunicorn documentation](https://docs.gunicorn.org/en/stable/)
  • [Google Cloud Run docs](https://cloud.google.com/run/docs)
  • [Fly.io documentation](https://fly.io/docs/)

---

Want to try the auto-wired-database flow? PandaStack's free tier includes 5 web services and a managed Postgres with DATABASE_URL injected for you. Deploy a FastAPI app at [dashboard.pandastack.io](https://dashboard.pandastack.io).

Ready to deploy?

Start free on PandaStack.

Start free on PandaStack

More in Guide

Browse all Guide articles →

See also