Early access is open. Migration assistance is included with every plan.

FastAPI hosting

Run FastAPI under Uvicorn with workers sized to your dedicated vCPU, managed PostgreSQL on the private network, and background jobs with no execution time limit.

Build and run

9live detects FastAPI automatically. You can override any default in 9live.toml, or add a Dockerfile and we'll use that instead.
Detected by
fastapi in requirements.txt or pyproject.toml
Build
pip install -r requirements.txt
Start
uvicorn app.main:app --host 0.0.0.0 --port $PORT --workers 4
Dockerfile (optional)
FROM python:3.12-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "4"]

Recommendations

Settings that work well for FastAPI on dedicated hardware.
  • Set the number of Uvicorn workers to match the vCPUs allocated to the web process.
  • asyncpg, or SQLAlchemy in async mode, gives the lowest latency against managed PostgreSQL.
  • Run Celery, RQ or arq workers as a separate process type against managed Redis.
  • Pin the Python version with a .python-version file.
PlanPricevCPUMemoryNVMeDatabasesBackups
Launch$149/mo816 GB160 GB1Daily, kept 7 days
Grow$249/mo1232 GB320 GB2Daily, kept 14 days
Scale$349/mo1648 GB500 GB3, plus a read replicaHourly and daily, kept 30 days
CustomOn requestAs requiredUp to a full serverAs requiredAs requiredAs required

Questions

Can we run machine learning models alongside FastAPI?

CPU inference runs on the dedicated cores, and 32 or 48 GB of memory fits many models. GPU workloads need a Custom plan.

Do we need a Dockerfile to deploy FastAPI?

No. 9live detects FastAPI and builds it with a maintained buildpack. If your repository has a Dockerfile, we use it instead.

How are environment variables managed?

Set them per environment in the dashboard or with the CLI. They are encrypted at rest and injected at runtime. Connection strings for managed databases are added automatically.

What happens when a deploy fails?

If the build fails, or the new release fails its health check, the current release keeps serving traffic. You get a notification with the build or health-check logs.

Talk to an engineer about your setup

Tell us what you run today and where it runs. We reply within one business day with a recommended plan and an estimate for the migration.