This guide walks a FastAPI app from local code to a production URL with a database and per-user auth. Every step has runnable Python code. By the end you have a working app atDocumentation Index
Fetch the complete documentation index at: https://getfloo.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
https://<app>.on.getfloo.com with a Postgres sibling service, signed-in users, and (optionally) your own domain.
If you’ve never deployed to floo before, read Golden Path first for the minimal three-command flow.
Before you start
You need:- A FastAPI project (or a fresh
uv init/poetry new). - The project pushed to a GitHub repository. floo pulls source from GitHub — it does not upload local files.
- The floo CLI installed and authenticated (
curl -fsSL https://getfloo.com/install.sh | bashthenfloo auth login). - The floo GitHub App installed on your repo’s org.
1. Add a Dockerfile
Dockerfile
2. Initialize the floo config
floo.app.toml
migrate_command is optional — set it if you use Alembic. It runs after every deploy (against dev) and after every promote (against prod).
3. Connect the repo and deploy
Your FastAPI app is live at
https://my-fastapi-app-dev.on.getfloo.com.Every git push origin main ships to dev. floo releases promote --app my-fastapi-app publishes to https://my-fastapi-app.on.getfloo.com.4. Add a Postgres database
DATABASE_URL is injected into the runtime. Read it with SQLAlchemy:
app/db.py
5. Add per-user auth
floo manages user authentication for you. Setaccess_mode = "accounts" in floo.app.toml:
floo.app.toml
- Redirects unauthenticated requests to a hosted login page.
- Validates the session cookie on every request.
- Injects identity headers into every request that reaches your FastAPI app.
app/main.py
app/auth.py
curl -H 'X-Floo-User-Email: you@example.com' ... or wrap the dependency to return a fixture user when the headers are missing.
For the full reference on access modes and identity headers, see Add User Auth to Your App.
6. Add a custom domain
Host and X-Forwarded-Host headers from the request.
7. Local development with prod data
dev_command locally with DATABASE_URL and other env vars sourced from your dev floo app — real Cloud SQL connection, no credentials in your shell history.
To also test signed-in flows for this accounts-mode app, add --fixture-user:
floo dev then starts a small proxy in front of each service that injects the same X-Floo-User-* headers floo’s gateway adds in production. The output table shows both the raw service URL and the auth-proxied URL — hit the auth-proxied one for any path that reads identity headers.
Common gotchas
/healthzis reserved. Cloud Run’s edge intercepts that exact path. Use/healthor/livez.- Bind to
0.0.0.0.127.0.0.1won’t accept Cloud Run traffic. - Async DB drivers. Use
asyncpgfor async SQLAlchemy. Usepsycopg2-binaryfor sync. Don’t mix. X-Forwarded-Proto. floo’s edge terminates TLS and forwardsX-Forwarded-Proto: https. If you build absolute URLs fromrequest.url.scheme, use the forwarded scheme instead.
What’s next
Add User Auth — full reference
Identity headers, access policies, and access modes in detail.
Managed Services
Postgres, Redis, Storage — what they cost and how isolation works.
Multi-Service Routing
Deploy a React or Next.js frontend alongside FastAPI with shared origin.
Environments
Dev vs prod, promotion, env overrides.