Railway's project canvas and usage billing against Fly.io's Machines and global regions, compared on deploys, scaling, databases and background work.
Railway and Fly.io are two of the platforms developers pick when they want to deploy a backend without managing a cloud account. Railway is built around a visual project canvas where services and databases are wired together with variables. Fly.io runs your Docker image as Machines, lightweight VMs you can place in regions around the world.
Both get an app online quickly. The differences show up with the second service, the first scheduled job and the first database that needs backups you trust. This comparison covers those, then looks at Encore (infrastructure from code) for teams that want the same workflow in their own AWS or GCP account.
Each option is covered below, starting with Encore.
Encore is infrastructure from code for TypeScript and Go, with a platform that provisions and deploys into your own AWS or GCP account. You push code as you would to Railway, but the database, compute and scheduled jobs are created in your account, as RDS and Fargate on AWS or Cloud SQL and Cloud Run on GCP.

The things you would add on Railway's canvas or in fly.toml are declarations in the service code:
// notes/cleanup.ts
import { api } from "encore.dev/api";
import { CronJob } from "encore.dev/cron";
import { SQLDatabase } from "encore.dev/storage/sqldb";
// RDS on AWS, Cloud SQL on GCP, a local Postgres under encore run.
export const db = new SQLDatabase("notes", { migrations: "./migrations" });
export const purgeExpired = api(
{ expose: false },
async (): Promise<{ deleted: number }> => {
const row = await db.queryRow<{ n: number }>`
WITH d AS (DELETE FROM notes WHERE expires_at < NOW() RETURNING 1)
SELECT COUNT(*)::int AS n FROM d`;
return { deleted: row?.n ?? 0 };
},
);
const _ = new CronJob("purge-expired-notes", {
title: "Purge expired notes",
schedule: "0 3 * * *",
endpoint: purgeExpired,
});
The migration in notes/migrations creates the notes table the queries use:
-- notes/migrations/1_create_notes.up.sql
CREATE TABLE notes (
id BIGSERIAL PRIMARY KEY,
expires_at TIMESTAMPTZ NOT NULL
);
The cron job calls an endpoint inside the running app. encore run starts Postgres locally and applies migrations, and cron jobs can be triggered by hand from the local dashboard since they do not run on a schedule locally. The Railway migration guide and Fly.io migration guide map each platform's concepts to Encore.
The same structure works for coding agents: an agent adds a database or a schedule as code it can run locally.
The cron jobs docs cover scheduled work, which runs without a separate worker service.
Run in your terminal to get started locally.
Railway's strength is how quickly a multi-service project comes together. You add a service from a repository, add Postgres or Redis from a template, and reference ${{Postgres.DATABASE_URL}} in the service's variables. Preview environments per pull request and a capable CLI round it out.
Databases on Railway are templates that run as services with a volume, so backups, version upgrades and tuning are closer to running Postgres yourself than to a managed service. Cron jobs are services with a cron schedule that must exit when done; if a run is still active at the next tick, Railway skips the new run, and schedules must be at least five minutes apart. The Serverless setting sleeps a service after about 5 to 10 minutes without outbound traffic, and an open database connection pool keeps it awake.
Fly.io runs your app as Machines, fast-starting VMs placed in the regions you choose. fly launch writes a fly.toml with autostop and autostart enabled, so idle Machines stop and the next request starts one again, typically in about two seconds from a stopped state. That makes Fly.io a good fit for apps that should run near users in several regions.
With that flexibility you decide how many Machines exist, since autostart never creates new ones. Fly Managed Postgres provides high availability, backups and pgvector, though major version upgrades mean creating a new cluster and copying the data. Volumes are attached to a single Machine, so anything stateful needs planning. Scheduled work runs as scheduled Machines or inside the app.
Both platforms bill compute by usage, and an idle app on either can cost very little. Databases and volumes are billed whether the app is busy or not, so the database is usually the line to watch.
Pick Encore when you want git push deploys and a database, cron jobs and queues declared in code, with everything running in your own AWS or GCP account and the full app running locally. See Encore vs Railway and Encore vs Fly.io for a closer look.
Pick Railway when you want the fastest path from repository to a running multi-service project, with databases you are comfortable operating as services. Pick Fly.io when the app should run in several regions close to users and you are happy to manage Machines and fly.toml directly.
Railway is easier to start with: you connect a repository, add a database from the project canvas and reference its variables from your service. Fly.io asks you to work with fly.toml, Machines and regions from the CLI, which is more to learn but gives more control over where and how the app runs.
Both can. Fly.io stops idle Machines through Fly Proxy autostop and starts them on the next request; fly launch writes these settings by default. Railway's Serverless setting puts a service to sleep after about 5 to 10 minutes without outbound traffic and wakes it on the next request.
Encore offers a git push workflow that deploys into your own AWS or GCP account. You declare infrastructure in TypeScript or Go, such as new SQLDatabase("notes", { migrations: "./migrations" }) and new CronJob("purge-expired-notes", { schedule: "0 3 * * *", endpoint: purgeExpired }), and Encore provisions RDS or Cloud SQL and runs the cron job.
Deploy to your cloud on AWS and Google Cloud
without managing infrastructure
Encore lets developers and agents define application infrastructure directly in code, then automatically provisions it from local development to production in your AWS or GCP account.