Deploy guide · FastAPI
Deploy FastAPI in minutes.
Connect the repository, Railpack builds it, the service gets a domain with TLS. Databases from templates, usage drawn per minute from a prepaid balance, everything on EU nodes.
$ npm i -g skiffly && skiffly login
$ cd my-fastapi && skiffly init
$ skiffly up
$ skiffly logs -fWhat Railpack detects
Railpack inspects the repository and picks the build for FastAPI; most projects need no configuration. A Dockerfile in the repository always wins.
- requirements.txt / pyproject.toml with
fastapi - main.py exposing
app - .python-version
- Builder
- Railpack (default)
- Start command
- uvicorn main:app --host 0.0.0.0 --port $PORT
Derived by Railpack; override it in Settings → Deploy → Start command.
Port and $PORT
Skiffly injects PORT into every service and routes the public domain to it. Set the port in the service settings when your app listens on a fixed one; the default is 8000 for FastAPI, 8080 when nothing is set.
uvicorn main:app --host 0.0.0.0 --port $PORT- PORT
- 8000
- SKIFFLY_PUBLIC_DOMAIN
- <service>.skiffly.cloud
From a terminal
Install the CLI, link the directory, deploy. skiffly up builds the pushed HEAD of the current branch and streams the build logs; skiffly domain gives the service a *.skiffly.cloud address.
Or describe it once
.skiffly/skiffly.ts declares the service, its databases and the references between them. skiffly config plan shows the diff, skiffly config apply makes it so. The API mirrors railway/iac.
// .skiffly/skiffly.ts
import { defineSkiffly, github, postgres, project, redis, service } from "@skiffly/config";
export default defineSkiffly(() => {
const db = postgres("db");
const cache = redis("cache");
const web = service("api", {
source: github("acme/api"),
start: "uvicorn main:app --host 0.0.0.0 --port $PORT",
port: 8000,
healthcheck: "/",
env: {
DATABASE_URL: db.env.DATABASE_URL,
REDIS_URL: cache.env.REDIS_URL,
},
});
return project("api", { resources: [web, db, cache] });
});Works with the templates you need
Deploy a database next to the FastAPI service and reference its variables: ${{Postgres.DATABASE_URL}} is wired on the private network, no public port.
FastAPI on Skiffly: common questions
How do I set environment variables for FastAPI?
skiffly variables set KEY=value, or in .skiffly/skiffly.ts. Reference other services with ${{Postgres.DATABASE_URL}} and environment-wide values with ${{shared.NAME}}. Secrets are encrypted at rest.Can I change the build or start command?
How do I add Postgres or Redis?
skiffly connect postgres.Do I get preview environments per pull request?
What does a small FastAPI app cost?
Can the FastAPI service sleep when idle?
Deploy your FastAPI app today
Free tier without a card. Hobby from $5 with $5 of usage included.