Skip to main content
From a FastAPI project on GitHub to a live app at https://<app>.getfloo.app, with managed Postgres, signed-in users, and your own domain. New to floo? Start with the Quickstart.

What your agent controls

floo builds the Dockerfile in your repository and runs that image. It does not detect your framework or pick a runtime, so your agent decides what ships:
  • The base image and the exact Python version.
  • System packages, such as ffmpeg, Chromium for headless browsing, or libpq, each one apt-get install line.
  • The build steps and the start command.
  • More services from the same repository, such as a background worker or a cron job.
Postgres, sign-in, secrets, and domains come from floo.app.toml, so an agent sets up the whole app from two files it can read and edit.

1. Add a Dockerfile

This example uses requirements.txt with fastapi and uvicorn. Export locked dependencies first if your project uses another package manager. The application entry point is app/main.py with an app instance.
Dockerfile
Bind to 0.0.0.0 on $PORT, not 127.0.0.1 on a fixed port. floo sets PORT at runtime and routes only to processes bound to all interfaces. The shell-form CMD expands $PORT.

2. Initialize the floo config

Install the CLI and sign in: curl -fsSL https://getfloo.com/install.sh | bash, then floo auth login. An agent can run the same journey over the HTTP API instead, starting from getfloo.com/agents.md.
For a single-service FastAPI app:
floo.app.toml
After adding Postgres, set migrate_command = "alembic upgrade head" under [services.web] if you use Alembic. Include Alembic and its migrations in the image. It runs as a one-off job with the new image before traffic moves to it. A failed migration stops the deploy. Use expand-then-contract migrations to keep the schema compatible with both old and new code.

3. Connect the repo and deploy

floo builds from your GitHub repository, not local files, so commit first. floo deploy pushes the commit and waits until the dev URL is live. The first time, it stops with one link if the floo GitHub App can’t read the repository yet: a human opens it and installs the App on the account that owns the repository, then you run floo deploy again. See Give floo access to your GitHub repository.
When it’s done:
Your FastAPI app is live at https://my-fastapi-app.getfloo.app.Every git push origin main ships to dev.

4. Add a Postgres database

floo.app.toml
DATABASE_URL is injected into the runtime. With SQLAlchemy 2 and asyncpg installed, preserve TLS verification while converting the URL for the async driver:
app/db.py
If you configured migrate_command, the next deploy runs alembic upgrade head against the new database. Dev and prod each get a separate Postgres database and credentials, with no shared state.

Optional: add file storage

Add [managed.uploads] with type = "storage" and attach it to the web service. Once a service lists managed, it receives only the services listed there, so keep postgres in the list or DATABASE_URL disappears:
floo.app.toml
Then deploy. Configure boto3 in your FastAPI app; see Cloud storage for spending restrictions and file operations.

5. Add per-user auth

Set access_mode = "accounts" and floo handles sign-in:
floo.app.toml
From the next deploy onward, floo’s gateway:
  • 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.
Handlers read the headers, with no auth code, callback handlers, or session storage:
app/main.py
Or build a dependency that requires a signed-in user:
app/auth.py
Use it on any route:
Locally, run floo dev --fixture-user (see section 7) or send the headers yourself with curl -H 'X-Floo-User-Email: you@example.com' .... Access modes and identity headers in full: App sign-in.

6. Add a custom domain

Declare the domain in floo.app.toml:
Commit and push, wait for that commit’s dev deploy to go live, then release it to prod and read the DNS records:
Publish the traffic and certificate CNAME records that show prints, then watch activation:
FastAPI reads Host and X-Forwarded-Host from the request, so it needs no extra config. DNS setup and troubleshooting: Custom domains.

7. Local development with dev credentials

Runs dev_command locally with DATABASE_URL and readable env vars from the app’s dev environment: a real connection to your dev Postgres, with no credentials in your shell history. Write-only secrets are withheld; supply separate local values when needed. Prod credentials never reach a local session. To test signed-in flows, add --fixture-user:
floo dev then puts a proxy in front of each accounts-mode service that injects the same X-Floo-User-* headers floo’s gateway adds in production. The output table shows the raw service URL and the auth-proxied URL; use the auth-proxied one for any path that reads identity headers.

Common gotchas

  • /healthz is reserved. floo’s edge intercepts that exact path. Use /health or /livez.
  • Bind to 0.0.0.0. floo cannot reach 127.0.0.1.
  • Async DB drivers. Use asyncpg for async SQLAlchemy. Use psycopg2-binary for sync. Don’t mix.
  • X-Forwarded-Proto. floo’s edge terminates TLS and forwards X-Forwarded-Proto: https. Build absolute URLs from the forwarded scheme, not request.url.scheme.

Next steps

App sign-in

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.

Production environments

Dev vs prod, promotion, env overrides.