Skip to main content
From a Go module 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. Add one that specifies the runtime for your app:
  • The Go version that compiles the binary and the base image it runs on.
  • System packages in the final image, such as ffmpeg or Chromium, each one apk add line.
  • The build flags and the start command.
  • More services from the same repository, such as a background worker or a cron job.
Declare services, managed Postgres, sign-in, and domains in floo.app.toml. Store secrets outside git.

1. Add a Dockerfile

The module builds a single binary from the repository root. Match the golang image to the go line in go.mod: an older image fails with go.mod requires go >= ....
Dockerfile
The final image holds the binary and CA certificates, which the TLS connection to Postgres needs. Add any system package your app runs, such as apk add --no-cache ffmpeg, on the same RUN line. Read PORT and listen on all interfaces:
main.go
":"+port binds every interface. A bind to 127.0.0.1 or localhost makes the container unreachable and the deploy fails with port_mismatch.

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 Go app:
floo.app.toml
After adding Postgres, give the binary a migrate subcommand (for example with goose and SQL files embedded with embed), then set migrate_command = "/server migrate" under [services.web]. 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.
No GitHub repository? floo deploy --hosted has floo host the repository. See Deploy without GitHub. When it’s done:
Your Go app is live at https://my-go-app.getfloo.app.Every git push origin main ships to dev.

4. Add a Postgres database

floo.app.toml
Preflight warns MANAGED_CREDS_TO_WEB because the web service receives the database credentials. That is expected when the web service queries the database. DATABASE_URL is injected into the runtime. pgx reads it as is, TLS settings included:
main.go
pgxpool.New connects on first use, so the server starts and answers while Postgres wakes. Dev and prod each get a separate Postgres database and credentials, with no shared state.

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 Go server.
Handlers read the headers, with no auth code, callback handlers, or session storage. Add encoding/json to the imports:
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: Replace owner/repo with your GitHub repository. For a floo-hosted project, see Environments.
Wait for the prod deploy to finish, then read the DNS records:
Publish the traffic and certificate CNAME records that show prints, then watch activation:
net/http serves every host by default. If you build absolute URLs, read the host from X-Forwarded-Host. 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. The database exists after the first deploy that declares [managed.default]. Before that deploy, floo dev starts without DATABASE_URL. 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.
  • Listen on ":"+port. floo cannot reach 127.0.0.1.
  • CGO_ENABLED=0 for a static binary. A cgo build links against the build image’s glibc and fails to start on Alpine. If you need cgo, run the final stage on debian:bookworm-slim instead.
  • CA certificates in the final image. Without them, TLS to Postgres and outbound HTTPS calls fail with x509: certificate signed by unknown authority.
  • X-Forwarded-Proto. floo’s edge terminates TLS and forwards X-Forwarded-Proto: https. r.TLS is always nil inside the container.

Next steps

App sign-in

Identity headers, access policies, and access modes in detail.

Cron jobs

Run a subcommand of the same binary on a schedule.

Dockerfiles

Layer order for fast pushes and recommended multi-stage builds.

Production environments

Dev vs prod, promotion, env overrides.