Skip to content

Setup

Everything you need before deploying to Fly.io: the alchemy package, a Fly organization, and an API token stored in a profile.

Sign in at fly.io/dashboard. A personal org is created with the account. Tokens are scoped to an org — the org slug is what Fly.App uses when you omit orgSlug (Alchemy reads it from the current token).

In the dashboard:

  1. Open AccountAccess Tokens (or run fly tokens create org if you have flyctl).
  2. Create an organization token with permission to manage Apps and Machines.
  3. Copy the token — Fly shows it only once.

The official environment variable is FLY_API_TOKEN. That token is enough for Apps, Machines, Services, Sprites, Postgres, Redis, and Tigris. Alchemy mints a Sprites bearer from it when you deploy a Sprite.

Terminal window
mkdir my-app && cd my-app && bun init -y
Terminal window
bun add "alchemy@latest" "effect@rc" "@effect/platform-bun@rc" "@effect/platform-node@rc"

There is no separate credentials step. The first time you run alchemy deploy (or plan, dev, destroy) on a stack that uses Fly.providers(), alchemy walks you through an interactive login with two options:

  • API Token — paste the token you generated above. It’s verified against the Machines API and saved under ~/.alchemy/credentials/<profile>/.
  • Environment Variables — reads FLY_API_TOKEN from the environment on every run (plus an optional FLY_API_HOSTNAME to override the Machines API root, default https://api.machines.dev/v1). This is the method for CI — when alchemy detects CI=true it skips the prompt and uses the environment automatically.

Either choice is saved to your default profile and reused on every subsequent command.

To re-run the setup later (e.g. to rotate the token, or configure a separate prod profile):

Terminal window
alchemy login --configure
alchemy login --profile prod --configure

Inspect what’s stored (secrets are redacted):

Terminal window
alchemy profile show

Fly has no object-storage state backend of its own, so pick one of:

  • Alchemy.localState() — state on disk under .alchemy/ next to your code. Zero setup; right for solo projects and trying things out.
  • A cloud state store — if you also use Cloudflare or AWS, pass Cloudflare.state() or AWS.state() so state is shared with your team and CI. See State Store.