main.py exposing app = FastAPI(...)) and a requirements.txt listing fastapi, an ASGI server (uvicorn), and a Postgres driver (psycopg or psycopg2), plus any ORM or migration tooling you use.
Deploy using the Canvas
Create a project from your repo
Add Postgres from a template
POSTGRES_USER and POSTGRES_DB (both default to postgres) and pre-fills a generated POSTGRES_PASSWORD./var/lib/postgresql/data.Expose the app on HTTPS
8000. Then, in the Public Network section, click Add Endpoint → HTTPS Domain and choose port 8000.Wire DATABASE_URL
DATABASE_URL env var. Set the value to a connection string with an embedded reference to Postgres’s password:{{...}} picker inserts the reference alongside literal text, so the app reads the password from postgres at deploy time without duplicating it. Swap the user and database name if you changed them from the defaults.
Apply to deploy
postgres:5432. Hit the root URL and you’ll see:Deploy using an Agent
To deploy with a coding agent such as Claude Code, Codex, or OpenCode, follow these steps:Connect the Suga MCP
Ask your agent to deploy
Set the sensitive values
POSTGRES_PASSWORD on the postgres container: click the value input and paste a value generated with openssl rand -hex 32. If your app has other secrets (JWT signing keys, API keys), add them to the app container as Sensitive env vars.Apply to deploy
postgres:5432. Hit the root URL and you’ll see:FAQ
Do I need a Dockerfile to deploy FastAPI on Suga?
Do I need a Dockerfile to deploy FastAPI on Suga?
requirements.txt or pyproject.toml and runs the standard install and start flow. If you already have a Dockerfile, you can tell the agent to use it instead; otherwise Suga’s auto-detect handles the common case.Which Python versions does Suga support?
Which Python versions does Suga support?
.python-version, runtime.txt, or your pyproject.toml if present, and falls back to a recent LTS release.What if my app's start command isn't uvicorn main:app?
What if my app's start command isn't uvicorn main:app?
RAILPACK_START_CMD as a build arg on the app container with your exact command, for example uvicorn app.main:app --host 0.0.0.0 --port 8000 or gunicorn -k uvicorn.workers.UvicornWorker app.main:app. The default only works when your entry point matches the standard main:app pattern.How do I run Alembic migrations before the app starts?
How do I run Alembic migrations before the app starts?
RAILPACK_START_CMD=alembic upgrade head && uvicorn main:app --host 0.0.0.0 --port 8000 as a build arg. The migration runs each time a new container boots.Can I use a database other than Postgres?
Can I use a database other than Postgres?
postgres:18-alpine container for a MySQL, MariaDB, or MongoDB image (or any container that runs the database you want). Adjust DATABASE_URL and the driver in your requirements.txt to match.How do I do connection pooling?
How do I do connection pooling?
DATABASE_URL at it instead of postgres directly.What about Postgres backups?
What about Postgres backups?
pg_dump on a schedule from another container, or point the app at a managed Postgres service instead of a container.What does deploying FastAPI plus Postgres cost on Suga?
What does deploying FastAPI plus Postgres cost on Suga?