# FastAPI hosting in 2026: how to deploy a FastAPI app, and where

> A FastAPI app in production runs on Uvicorn without --reload, listens on 0.0.0.0 and the platform's port, trusts the proxy's headers and runs its migrations before it starts. On Livops a repository with main.py and requirements.txt starts on Uvicorn from a push, for 39 credits a month (39,000 so'm). Here is how Render, Railway, Fly.io and a VPS compare.

Source: https://livops.dev/en/hosting/fastapi-hosting

By Livops team, the people who build and run Livops. Updated 20 November 2026.

A FastAPI app is an ASGI application: on its own it does nothing until a server such as Uvicorn loads it and listens for requests. Hosting it well comes down to running that server the production way, behind a proxy that terminates HTTPS, with a database whose schema is migrated before the app takes traffic. This page covers each, compares Render, Railway, Fly.io and a VPS with each provider's own numbers, and ends with the exact files Livops reads and the command it starts.

## What does a FastAPI app need in production?

### An ASGI server, started without --reload

To run FastAPI on a server you need an ASGI server program, and Uvicorn is the one the `fastapi` command uses; `fastapi[standard]` installs it for you[1]. `--reload` is a development option that uses much more resources and is less stable, and should not be used in production[1]. A server command names the module and the app object, listens on all addresses and on the platform's port:

```sh
uvicorn main:app --host 0.0.0.0 --port $PORT
```

### One process or several

That command starts a single process[1]. `--workers 4` starts four[2], and without the option Uvicorn takes the count from `WEB_CONCURRENCY`, or runs one[4]. When something else already runs and replaces containers for you, FastAPI's own advice for Kubernetes is one Uvicorn process per container[2]; on a single small container, two workers make use of a second core, and each costs a full copy of the app in memory.

### The proxy's headers

A platform puts a proxy in front of your app, which receives HTTPS and forwards plain HTTP. The proxy says what the visitor really used in `X-Forwarded-Proto` and `X-Forwarded-Host`, but the server does not trust those headers until it is told the proxy is trusted[3]. Uvicorn trusts only `127.0.0.1` and `::1` unless `--forwarded-allow-ips` or the `FORWARDED_ALLOW_IPS` variable says otherwise[4]. Until it does, a redirect such as `/items` to `/items/` can point at `http://` instead of your HTTPS address[3]. Trusting every address (`*`) is only safe when nothing but the proxy can reach the app.

### A database and migrations

The usual pair is PostgreSQL and Alembic. Read the database address from an environment variable, and run `alembic upgrade head` before each new version starts, so a request never meets a table that is not there yet.

### Work outside the request

FastAPI's `BackgroundTasks` run inside the same process, after the response is sent: fine for an email, not for an hour of work. Anything long or that must survive a restart goes to a queue and a separate worker process, or to cron.

## The options at a glance

| Option | What it is | Smallest paid always-on web service | PostgreSQL | What you still maintain |
| --- | --- | --- | --- | --- |
| Livops | A platform; servers in Uzbekistan | 39 credits (39,000 so'm) a month | 500 MB free, one per team; 1 GB for 9 credits a month | Your code |
| A VPS in Uzbekistan | A virtual machine with root | 82,000 so'm a month: 1 vCPU, 2 GB, 30 GB HDD (SmartCloud)[5] | Whatever you install | The system, Uvicorn as a service, a reverse proxy, HTTPS, backups, deploys |
| Railway | A platform billed by usage | Hobby plan: $5 a month, including the same amount of usage; then about $10 per GB of RAM and $20 per vCPU a month[6] | A service billed by the same usage, its volume about $0.15 per GB a month[6] | Your code |
| Render | A platform | $7 a month: 0.5 CPU, 512 MB[7] | From $6 a month: 256 MB, plus $0.30 per GB of storage[7] | Your code |
| Fly.io | Virtual machines billed by the second | $2.19 a month for shared-cpu-1x with 256 MB; $3.69 with 512 MB[9] | Managed Postgres from $38 a month (Basic)[9] | Your code |

Other providers' prices are from each provider's own page, read on 20 November 2026; the dates are in Sources below. Livops prices are the ones the cabinet bills today.

## Each option

### Livops

A FastAPI repository is read, not asked about: Livops finds the app object, writes the Uvicorn command and runs Alembic when you have it (details below). There is a ready **FastAPI + PostgreSQL** template, and a **Vite + React and FastAPI** one for a front end beside it. Payment is in so'm through Payme or Click, with no card, and the servers are in Uzbekistan — close to users there, farther from users elsewhere. You do not get root; an app that needs system packages of its own runs from its own `Dockerfile`, or is better on a VPS.

### A VPS

The most control for the money: 82,000 so'm a month for 2 GB at SmartCloud[5], and room for several APIs on one machine. You install Python, run Uvicorn under systemd, put Nginx or Caddy in front for HTTPS, and run the migrations and restarts on every deploy yourself.

### Railway

The Hobby plan is $5 a month including that much usage; then memory is about $10 per GB and CPU about $20 per vCPU a month[6]. It is paid by credit card[6].

### Render

$7 a month for 0.5 CPU and 512 MB, and PostgreSQL from $6[7]: a fixed price that is easy to plan around. Render takes credit and debit cards[7].

### Fly.io

The lowest dollar price for the API itself: $2.19 a month for 256 MB, $3.69 for 512 MB, billed by the second while it runs[9]. Managed Postgres starts at $38 a month[9], so a database usually decides the bill. A card is needed once the trial ends[9].

## VPS or platform: what do you maintain?

On a VPS you are the operations team: the reverse proxy, the certificate, the process manager and the security updates are yours to notice. On a platform you hand over a repository and the platform runs it; you give up root in return. If you like running servers, a VPS gives you the whole machine. If you would rather spend the time on the API, use a platform.

## Where can you host FastAPI for free?

- **Livops** has no free tier for apps. On an account that has not paid yet, the first bot or app runs for 15 minutes on a zero balance, once, so you can call it. One 500 MB database per team is free, and starts once the account has credits.
- **Render** gives free instances to web services and PostgreSQL. A free web service spins down after 15 minutes without inbound traffic and takes about a minute to start again; a free database expires 30 days after it is created[8].
- **Railway** has a Free plan with $1 of usage a month and up to 0.5 GB per service, whose services sleep after 5 to 10 minutes without outbound traffic; a trial gives $5 of credit for 30 days, with no card[6].
- **Fly.io** has no free tier for new organizations; a trial gives $1 of credit for 7 days[9].

## Deploy FastAPI on Livops

1. Push a repository with `main.py` (or `app.py`) and `requirements.txt` listing `fastapi` and `uvicorn`, or `fastapi[standard]`. In the cabinet, click **New project** and choose the repository, upload the folder as a `.zip`, or start from the **FastAPI + PostgreSQL** template.
2. Under **Databases**, add PostgreSQL. `DATABASE_URL` and the `PG*` variables are written into the service by themselves.
3. Put your own keys under **Variables**, marked as secret where they are secrets.
4. Deploy. The log shows the install and the start.

Livops makes it a Python web app when a web framework is among the dependencies, or among the imports when there is no requirements file. It looks for the app in `app.py`, `main.py`, `wsgi.py`, `server.py` and `run.py`, then in `src/main.py`, `src/app.py`, `app/main.py` and `app/app.py`, and reads the line that builds it — `app = FastAPI()`, or any other name. For that line in `main.py` it starts:

```sh
.venv/bin/uvicorn main:app --host 0.0.0.0 --port 3000
```

`PORT` is 3000 unless you change it, and the app has a minute to answer on it. Around that command:

- **Alembic** runs first — `alembic upgrade head` — when the repository has `alembic.ini`, `alembic` is a dependency and a database is connected. A failed migration does not stop the start; the log says it failed.
- **A factory** (`create_app()`) is not guessed: write the start yourself, with Uvicorn's `--factory`.
- **A `Procfile`** with a `web:` line wins over the guess when it listens on `0.0.0.0` and on `$PORT`. If that line names `uvicorn` or `gunicorn` and the requirements do not, the server is installed for you.
- **More workers:** add `WEB_CONCURRENCY` under **Variables**; the command above names no count, so Uvicorn reads it. Memory is a tier of 256, 512, 1024 or 2048 MiB, set with `memory` in `livops.json` when the project is created and in the settings afterwards.
- **Proxy headers:** the platform's proxy sends `X-Forwarded-Proto: https` and `X-Forwarded-Host` with the address the visitor typed. Uvicorn uses them once `FORWARDED_ALLOW_IPS` allows the proxy, as above.
- **If the new version does not start**, the deploy fails and the version that worked keeps serving; if the build fails, the running version is left alone. Recent versions stay in **Deploys** for a one-click rollback.
- **Files** written to `/app/data` (the `DATA_DIR` variable) survive restarts and deploys; the code folder is read-only and `/tmp` is wiped.

To set the start yourself, put `livops.json` in the repository root:

```json
{
  "kind": "web",
  "start": ".venv/bin/uvicorn main:create_app --factory --host 0.0.0.0 --port $PORT",
  "healthPath": "/health"
}
```

`healthPath` is optional: with it, the new version counts as started only once that path answers 2xx or 3xx, within the same minute. A queue consumer or a scheduled script is a service of its own, of type `worker` or `cron`, at 19 credits a month each; see [Cron and workers](https://livops.dev/en/docs/cron-workers).

A FastAPI app is **39 credits a month (39,000 so'm)**. One credit is 1,000 so'm, and bought credits never expire. See [Pricing](https://livops.dev/en/docs/pricing) for plans, which give more credits than they cost, and [Frameworks](https://livops.dev/en/docs/frameworks) for everything `livops.json` accepts.

## Questions

**Which command does Livops start a FastAPI app with?**

Uvicorn, on the app object it finds in your code: .venv/bin/uvicorn main:app --host 0.0.0.0 --port 3000 for app = FastAPI() in main.py. It looks in app.py, main.py, wsgi.py, server.py, run.py, src/main.py, src/app.py, app/main.py and app/app.py, and uses whatever name the app object has.

**Do I need uvicorn in requirements.txt?**

Yes, or fastapi[standard], which brings Uvicorn with it. With FastAPI alone and no server named, Livops writes no Uvicorn command: unless a file starts the server itself under if __name__ == "__main__", you are asked for the start command.

**My app uses an application factory. What then?**

A create_app() factory is not guessed. Write the start yourself in livops.json or in the settings, for example .venv/bin/uvicorn main:create_app --factory --host 0.0.0.0 --port $PORT.

**Are Alembic migrations run?**

Yes, when the repository has alembic.ini, alembic is a dependency and a database is connected: alembic upgrade head runs before every start. If it fails, the app still starts and the log says so.

**How do I run more than one worker?**

Add WEB_CONCURRENCY under Variables. Livops' start command names no worker count, and Uvicorn reads that variable for it. Each worker is another copy of the app in memory, so pick a memory tier to match.

**How much does a FastAPI app cost on Livops?**

39 credits a month, which is 39,000 so'm at 1,000 so'm a credit. One 500 MB PostgreSQL database per team is free. There is no free tier for apps; on an account that has not paid yet, the first app runs for 15 minutes on a zero balance, once.

**Who wrote this comparison?**

The Livops team. Every price and limit of another provider on this page links to that provider's own page, with the day we read it.

## Sources

1. [FastAPI — Run a Server Manually](https://fastapi.tiangolo.com/deployment/manually/). Checked 20 November 2026.
2. [FastAPI — Server Workers](https://fastapi.tiangolo.com/deployment/server-workers/). Checked 20 November 2026.
3. [FastAPI — Behind a Proxy](https://fastapi.tiangolo.com/advanced/behind-a-proxy/). Checked 20 November 2026.
4. [Uvicorn — Settings](https://uvicorn.dev/settings/). Checked 20 November 2026.
5. [SmartCloud — VDS plans](https://smartcloud.uz/cloud-services/vds/). Checked 20 November 2026.
6. [Railway — Pricing](https://railway.com/pricing). Checked 20 November 2026.
7. [Render — Pricing](https://render.com/pricing). Checked 20 November 2026.
8. [Render — Deploy for free](https://render.com/docs/free). Checked 20 November 2026.
9. [Fly.io — Pricing](https://docs.fly.io/about/pricing). Checked 20 November 2026.
