Fly.io runs your AlabJS app in Docker containers placed close to your users across 30+ regions. It's a good fit for apps that need persistent volumes, private networking, or close control over the deployment region.
Prerequisites
Install the Fly CLI:
curl -L https://fly.io/install.sh | sh
fly auth loginLaunch
From your project root:
fly launchFly detects Node.js and generates a Dockerfile and fly.toml automatically. Accept the defaults or customise the region and machine size.
fly.toml
A minimal config for AlabJS:
app = "my-alabjs-app"
primary_region = "sin" # Singapore — change to your closest region
[build]
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
[[vm]]
memory = "512mb"
cpu_kind = "shared"
cpus = 1auto_stop_machines = true shuts down idle machines to save cost. auto_start_machines = true starts them again on the next request (cold start ~500 ms on Fly).
Environment variables
Set secrets with the Fly CLI — they are encrypted and injected at runtime:
fly secrets set NODE_ENV=production
fly secrets set PUBLIC_URL=https://my-alabjs-app.fly.dev
fly secrets set DATABASE_URL=postgres://...
fly secrets set ALAB_REVALIDATE_SECRET=your-secretDeploy
fly deployFly builds the Docker image remotely and rolls it out to all regions. Subsequent deploys use layer caching and are typically faster.
Custom domain
fly certs create yourdomain.comFly provisions a TLS certificate automatically via Let's Encrypt. Add the CNAME or A record shown in the output to your DNS provider.
Persistent volumes
AlabJS is stateless by default. If you need persistent storage (e.g. for SQLite), attach a Fly volume:
fly volumes create data --region sin --size 1# fly.toml
[mounts]
source = "data"
destination = "/data"Multi-region
Fly supports deploying to multiple regions simultaneously. Add regions and scale replicas:
fly regions add nrt lax # add Tokyo and Los Angeles
fly scale count 3 # run 3 machines totalAlabJS routes users to the nearest machine automatically via Fly's Anycast network.