Updated Nov 30, 20267 min read

Netlify vs Railway for Apps With a Backend

A head-to-head comparison of Netlify and Railway for a product with an API, a database and scheduled work: functions against always-on services, Postgres options, cron limits, pricing and when the backend should move to your own cloud account.

Illustration for Netlify vs Railway for Apps With a Backend

Netlify started as the place to deploy a static site from git and now runs server-side code as functions, with a Postgres database and blob storage attached. Railway deploys a service from a repository or container image and bills the CPU and memory it uses.

The choice matters once the product has a worker, a schedule or a shared database, since Netlify models the backend as events and Railway as processes.

How do Netlify and Railway compare at a glance?

NetlifyRailway
Backend computeFunctions, background functions up to 15 minutesServices running your code or container continuously
Long-lived connectionsFunctions are short lived, Netlify Server is in Early Access and is the documented option for a long-lived processSupported, the service stays up
DatabaseNetlify Database, a platform-managed PostgresA Postgres service deployed from a template onto a volume
SchedulesScheduled functions, 30 second limitCron services, at least 5 minutes apart, in UTC
FrontendFramework-aware builds, CDN and deploy previewsAny framework in a service
Entry pricingFree, Personal $9, Pro $20 a month with creditsFree, Hobby $5, Pro $20 a month with included usage
Where the backend runsNetlify's platformRailway's platform

Netlify figures are from its pricing page, background functions docs and scheduled functions docs, and Railway figures from its plans reference and cron docs, checked November 30, 2026.

How do the compute models differ?

A Netlify function receives a request or a platform event, runs in an ephemeral environment and returns a response. The functions overview points teams building a backend to Netlify Server, a long-lived server in Early Access that holds connections open, and keeps functions for individual tasks, scheduled jobs and events. Background functions return a 202 straight away and keep running for up to 15 minutes, retrying after one minute and again after two when an invocation fails.

Railway runs the process itself, so a service keeps its memory between requests, a worker can sit on a queue consumer, and the resource limits on the Hobby plan reach 48 GB of RAM and 48 vCPU per service. Usage is billed at $10 per GB of RAM and $20 per vCPU a month, so an idle service still costs what it reserves, and HTTP requests through the public domain end after 15 minutes at most.

How do databases compare?

Netlify Database is a Postgres database integrated with the project, with isolated database branches for deploy previews and migrations that the platform applies on production deploys, as the Netlify Database docs describe. It removes the connection wiring for a project that already lives on Netlify.

Railway runs Postgres as a service deployed from an SSL-enabled image onto a volume in your project, which keeps the database as one more service in the project, next to the app that uses it. Volume storage is $0.15 per GB a month.

How do schedules and background work compare?

Netlify scheduled functions run on a cron expression and stop after 30 seconds, so a nightly job that sends reminders for every overdue invoice has to fan out into background functions. Railway cron jobs start your service on a schedule and expect it to exit, at intervals no shorter than 5 minutes and with no guarantee of the exact minute.

Neither includes a message queue, so retries and dead-letter handling are application code on top of a Redis library or a partner service.

When does each one fit?

Pick Netlify for a frontend-led product where the backend is a handful of endpoints, forms and short jobs, and deploy previews with a database branch on every pull request matter. Pick Railway for an API with workers, a queue consumer or WebSockets that should stay up, with a Postgres you manage next to it. Pick neither when the backend has to run as services in your own AWS or GCP account, since both run it on their own platforms.

How does Encore fit next to Netlify or Railway?

Encore

Encore is a backend framework with built-in infrastructure, and next to either platform it runs the API, its database, topics and cron jobs as long-lived services in your own AWS or GCP account. The AWS docs list Fargate, RDS and SNS with SQS, and the GCP docs list Cloud Run, Cloud SQL and Pub/Sub. The Netlify frontend keeps deploying from git and calls the backend through a typed client from encore gen client.

Application code passes through Encore and infrastructure guardrails to resources provisioned in your own AWS or GCP account.

Set up the app

Get started
brew install encoredev/tap/encore &&
encore app create
Copy

Run in your terminal to get started locally.

~
$ encore app create reminders --example=ts/hello-world$ cd reminders && mkdir -p billing/migrations

An overdue invoice reminder is the job that does not fit a 30 second scheduled function, so the service stores invoices, finds the overdue ones on a schedule and sends each reminder from a subscriber that retries on its own. The billing folder also needs an encore.service.ts that exports new Service("billing"):

// billing/billing.ts import { api, APIError } from "encore.dev/api"; import { CronJob } from "encore.dev/cron"; import { Subscription, Topic } from "encore.dev/pubsub"; import { SQLDatabase } from "encore.dev/storage/sqldb"; const db = new SQLDatabase("billing", { migrations: "./migrations" }); interface Overdue { id: number; } const overdue = new Topic<Overdue>("invoice-overdue", { deliveryGuarantee: "at-least-once", }); interface CreateRequest { customer: string; cents: number; dueOn: string; } export const createInvoice = api( { expose: true, method: "POST", path: "/invoices" }, async (req: CreateRequest): Promise<{ id: number }> => { if (!req.customer.trim()) throw APIError.invalidArgument("customer is required"); if (!Number.isInteger(req.cents) || req.cents <= 0) { throw APIError.invalidArgument("cents must be a positive integer"); } const row = await db.queryRow<{ id: number }>` INSERT INTO invoices (customer, cents, due_on) VALUES (${req.customer}, ${req.cents}, ${req.dueOn}::date) RETURNING id`; return { id: row!.id }; }, ); export const sweep = api({}, async (): Promise<{ queued: number }> => { let queued = 0; for await (const row of db.query<{ id: number }>` SELECT id FROM invoices WHERE status = 'open' AND reminded_at IS NULL AND due_on < current_date LIMIT 500`) { await overdue.publish({ id: row.id }); queued++; } return { queued }; }); const _sweepJob = new CronJob("overdue-sweep", { title: "Queue reminders for overdue invoices", schedule: "0 8 * * *", endpoint: sweep, }); const _remind = new Subscription(overdue, "send-reminder", { handler: async ({ id }) => { const row = await db.queryRow<{ customer: string; cents: number }>` SELECT customer, cents FROM invoices WHERE id = ${id} AND status = 'open' AND reminded_at IS NULL`; if (!row) return; // Call your email provider here, with `invoice-${id}` as the idempotency key. console.log(`reminder for invoice ${id}: ${row.customer} owes ${row.cents}`); await db.exec`UPDATE invoices SET reminded_at = now() WHERE id = ${id}`; }, retryPolicy: { minBackoff: "10s", maxBackoff: "5m", maxRetries: 5 }, });
-- billing/migrations/1_create_invoices.up.sql CREATE TABLE invoices ( id BIGSERIAL PRIMARY KEY, customer TEXT NOT NULL, cents BIGINT NOT NULL CHECK (cents > 0), due_on DATE NOT NULL, status TEXT NOT NULL DEFAULT 'open', reminded_at TIMESTAMPTZ, created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE INDEX invoices_overdue_idx ON invoices (due_on) WHERE status = 'open' AND reminded_at IS NULL;

encore run starts Postgres locally, applies the migration and runs the topic and its subscriber in process. Creating an invoice with a past due date and calling the sweep endpoint from the local development dashboard is how you exercise that path: sweep publishes each overdue invoice and the in-process subscriber logs a reminder and records reminded_at. Cron jobs do not run locally, which is why the schedule only points at an endpoint that can be called by hand. The Pub/Sub docs cover retries and the dead-letter queue, and the cron docs cover schedules, which the Encore platform manages.

To deploy, follow Connect your cloud account and push, then point the Netlify site or the Railway service at the backend URL. An AI coding agent adding a second reminder tier edits the query, the topic payload and the handler in a single diff that it can run locally before review.

Best fit: Teams that keep the frontend on Netlify or the first services on Railway and want the API, its database and its schedules to run in their own AWS or GCP account.

Which should you choose?

Choose Netlify when the product is a frontend with a thin backend and previews matter most, and Railway when the backend has to stay running next to a database you control. When the backend needs its own cloud account, keep the frontend where it is and move the API to long-running services there.

Frequently asked questions

Is Netlify or Railway better for a backend API?

Railway is the more direct fit for an always-on API with workers, since a service is a container that keeps running and can hold connections open. Netlify fits an API that lives next to a frontend and can run as functions, with background functions covering work that takes up to 15 minutes.

Can Netlify run cron jobs?

Yes, through scheduled functions, which run on a cron expression and are limited to 30 seconds of execution. Work that takes longer has to be handed to a background function, which can run for up to 15 minutes.

How often can a Railway cron job run?

Scheduled runs on Railway must be at least 5 minutes apart, the schedule is in UTC, and Railway does not guarantee execution to the minute. A task that needs to run more often has to be a long-running service with its own scheduler.

How do I run a Netlify or Railway backend in my own AWS account?

Build the backend with Encore, declaring its database, topics and cron jobs in code, and deploy it to your own AWS or GCP account as long-running services. A Netlify frontend keeps deploying from git and calls the backend through a generated, typed client.

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.

~/orders — claude
Claude Code
Claude Code v2.1.180Opus 5.5~/orders