FastAPI hosting free of charge for the APIs that grew out of a notebook or a laptop: connect the GitHub repository, and SnapDeploy builds a Python image, starts uvicorn on its own HTTPS address, and redeploys on every push.
Free tier: 4 containers, 512 MB each, 100 hours a month, 10 deploys a day. No credit card. Always-On from $12 a month when the API has to answer 24/7.
Last verified 5 November 2026 against the free-tier docs, the build generator and each competitor's own documentation.
Most "deploy FastAPI for free" guides still name Heroku's free tier, which ended in November 2022, or Deta Space, which shut down in October 2024. This table is what each provider's own documentation said when we checked it.
| Host | Free tier for a FastAPI server | RAM / CPU | Sleeps after | Card at sign-up | Cheapest 24/7 |
|---|---|---|---|---|---|
| SnapDeploy | 4 containers, 100 container-hours/month, 10 deploys/day; no expiry; uvicorn started for you | 512 MB / 0.25 vCPU | 15 min idle, wakes in ~60 s | No | Always-On Small $12/month |
| Render | 750 instance-hours/month per workspace; 5 GB bandwidth on the Hobby workspace since April 2026 | 512 MB / 0.1 CPU | 15 min idle, wakes in about a minute | No | Starter $7/month |
| Railway | $5 one-time trial credit for 30 days, then a Free plan with $1/month of credit | 1 GB / shared vCPU on the trial | Opt-in only; credit runs out instead | No for the trial | Hobby $5/month minimum usage |
| Koyeb | 1 free web service, Frankfurt or Washington only | 512 MB / 0.1 vCPU | 1 h idle, wakes in 1–5 s | Yes, $29 hold since Feb 2026 | eco-nano $1.61/month |
| PythonAnywhere | 1 web app on a pythonanywhere.com subdomain; ASGI/FastAPI only via the beta CLI; 100 CPU-seconds/day; the app expires after a month unused | 512 MB | No sleep, CPU quota instead | No | Hacker $5/month |
| Fly.io | No free tier since October 2024; trial of 2 machine-hours or 7 days, then apps stop | Up to 2 vCPU / 4 GB on the trial | Stops at the end of the trial | Card or $25 prepaid to keep running | shared-cpu-1x $1.94/month |
| Vercel Hobby | FastAPI runs as a serverless function, not a long-running server; non-commercial use only | Function memory, no container | Every request is a cold or warm function | No | Pro $20/month per user |
Isolation: every SnapDeploy container, free tier included, runs as its own AWS Fargate task with a reserved 0.25 vCPU and 512 MB, so your FastAPI process never shares a kernel with another customer's app.
Sources: render.com/docs/free, render.com/docs/compute-plans and the 23 April 2026 plan changelog; docs.railway.com free-trial and plans pages; koyeb.com docs (reference/instances, reference/organizations) and pricing; help.pythonanywhere.com (ASGI command line) and the plans page; fly.io free-trial and pricing pages; vercel.com/docs/functions and the Hobby fair-use guidelines. Checked 26 September 2026 and re-read 5 November 2026; if a provider changes its plan, this table will be behind until the next check.
Read from the build generator, not from a brochure. Every step below runs on AWS CodeBuild for ARM64, and the image is pushed to a private registry.
requirements.txt, pyproject.toml or setup.py makes it a Python project; the word fastapi in requirements.txt selects the FastAPI start command. The build then checks that an entry file exists: main.py, app.py, server.py, run.py, asgi.py or similar.runtime.txt, .python-version or the requires-python line in pyproject.toml; 3.11 is the default and comes from the platform's own image mirror. Other versions are pulled from the official Python image.pip install -r requirements.txt on a slim image with gcc available for packages that compile; a pyproject-only project gets pip install . instead. Poetry and uv lockfiles are honoured.PORT=8000 in the environment and the port exposed, on a Small container (512 MB, 0.25 vCPU) on the free tier.uvicorn main:app --host 0.0.0.0 --port 8000, one worker. If your app object is not app in main.py, enter the start command yourself in the deploy form (Advanced options → Start command) and the generated one is replaced./actuator/health, /health, /healthz, /api/health and then /, accepting any 2xx or 3xx. Once it passes, HTTPS traffic flows to <name>.containers.snapdeploy.app and the build and runtime logs are in the dashboard.Three files, the same ones in the sample repository AAR-Labs/fastapi-on-snapdeploy, built and run on ARM64 before this page was written.
# main.py
from fastapi import FastAPI
app = FastAPI()
@app.get("/health")
def health():
return {"status": "ok"}
@app.get("/")
def root():
return {"message": "Hello from FastAPI on SnapDeploy"}
No if __name__ == "__main__" block is needed: uvicorn imports main:app and binds 0.0.0.0:8000 for you. A server started on 127.0.0.1 in your own code would pass its tests and fail the health check in the cloud; this is the most common first-deploy failure in the build logs.
fastapi==0.115.6
uvicorn[standard]==0.34.0
The build reads the word fastapi here to pick the uvicorn start command. No Dockerfile is required; if you commit one it is used as written, with a two-stage limit on Small containers. A multi-stage example is on the Docker hosting page.
Sign in with email or GitHub, choose Deploy from GitHub, pick the repository and branch, and add environment variables in the dashboard rather than in the code: DATABASE_URL, API keys, ALLOWED_ORIGINS for CORS. Values whose names look like secrets are masked. The first build takes one to five minutes.
Every push to the linked branch rebuilds and redeploys; a failed build never replaces the running version. FastAPI's interactive documentation is at https://<name>.containers.snapdeploy.app/docs from the first deploy.
A uvicorn process that never exits costs the host money every hour it runs, so every free tier that is still alive either sleeps the process or meters it. SnapDeploy sleeps a free container after about 15 minutes without traffic and wakes it in about 60 seconds on the next browser visit; sleeping time does not count against the 100 hours. Render sleeps after 15 minutes, Koyeb after an hour, PythonAnywhere meters CPU seconds instead.
For a portfolio API, a class project or a backend that a few people open a few times a day, that is fine. For an API that a mobile app, a cron job or another service calls around the clock, it is not: those callers do not trigger the wake, and they will see a 503 wake page while the container is asleep. That API belongs on Always-On, from $12 a month per container, which also removes the deploy limit and turns on WebSockets and custom domains.
Two more things a free container cannot do: keep files between restarts (the filesystem resets on redeploy, restart and wake, so SQLite is for demos only) and run a background worker without an HTTP port. Keep state in a database add-on or an external database, and give workers a small FastAPI health route.
Detection is by requirements.txt and an entry file, so most repositories deploy as they are. The best hosting for FastAPI depends less on the framework than on whether the process must stay up, which is the free-versus-Always-On question.
The default layout: app = FastAPI() in main.py, started as uvicorn main:app. Nothing to configure.
Enter the start command in the deploy form, for example uvicorn app.main:app --host 0.0.0.0 --port 8000, and keep an __init__.py in the package.
Honoured by the build. Keep fastapi and uvicorn in the dependencies, and add a requirements.txt if you want the FastAPI start command picked automatically.
Small (512 MB, 0.25 vCPU) serves one async uvicorn worker well. Use async def routes with async database drivers, and cap the connection pool at a handful of connections.
Managed PostgreSQL, MySQL, MariaDB, MongoDB, Redis and RabbitMQ add-ons, each with a $1 12-hour trial; or an external database through DATABASE_URL. SQLAlchemy async and asyncpg both work.
Both come with Always-On: your domain with a certificate issued for you, and FastAPI WebSocket routes held open.
Yes. SnapDeploy's free tier runs up to 4 containers with 100 container-hours a month and 10 deploys a day, and sign-up needs only an email address or a GitHub account. Render's free web services also need no card. Koyeb has required a card with a $29 hold since February 2026, and Fly.io has had no free tier since October 2024.
No. When requirements.txt lists fastapi, the platform builds a Python 3.11 image, installs the requirements, and starts uvicorn main:app --host 0.0.0.0 --port 8000. Keep the FastAPI() instance in main.py at the repository root, or set your own start command in the deploy form. If you commit a Dockerfile it is used as written.
The generated start command is uvicorn main:app. If your app object lives in app.py or in a package such as app/main.py, either rename it to main.py at the root or enter the start command yourself, for example uvicorn app.main:app --host 0.0.0.0 --port 8000. The app must bind 0.0.0.0 and listen on the PORT variable, 8000 by default.
Python 3.11 by default. The version is read from runtime.txt, .python-version or pyproject.toml; 3.11 comes from the platform's own image mirror, other versions from the official Python image. pip with requirements.txt, Poetry, uv and pyproject-only projects are all supported.
Not on any free tier we checked. Free containers sleep after about 15 minutes without traffic and wake in about 60 seconds on the next browser visit. An API that other services call around the clock needs Always-On, from $12 a month per container, which also removes the deploy limit and allows WebSockets and a custom domain.
One. A Small container has 512 MB of RAM and 0.25 vCPU; a single async worker serves a typical FastAPI app well there. Medium (2 GB) and Large (4 GB) containers run on Always-On.
Managed PostgreSQL, MySQL, MariaDB, MongoDB, Redis and RabbitMQ are paid add-ons wired into the container's environment, each with a $1 12-hour trial. An external database such as Neon or Supabase works too: put its connection string in DATABASE_URL.
Not strictly. The health check tries /actuator/health, /health, /healthz, /api/health and then /, accepting any 2xx or 3xx response. A one-line @app.get("/health") route makes the check unambiguous and costs nothing.
Free tier, no credit card, no Dockerfile needed. Always-On from $12 a month when the API must answer 24/7.
Deploy Free TodayThe first managed container PaaS to offer a one-time 24-hour Always-On pass under $5. Everything in Always-On Small for one Small (512 MB) container — runs 24/7, no daily deploy limit, WebSockets & real-time apps. No subscription, no auto-renewal.
Need a managed database too? DB Sprint Pack — $1 / 12h for Postgres, MySQL, MariaDB, Mongo, Redis, or RabbitMQ.