Updated Nov 27, 20268 min read

Fly.io vs Vercel for Apps With a Backend

A head-to-head comparison of Fly.io and Vercel for a product with an API, a database and background work: machines against functions, Postgres options, schedules, limits, pricing and when the backend should move to your own cloud account.

Illustration for Fly.io vs Vercel for Apps With a Backend

Fly.io runs your container on Machines, small VMs placed in the regions you pick, and you stay in charge of how the app is packaged and scaled. Vercel started as the place to deploy a Next.js frontend and runs backend code as functions that exist for the length of a request.

They overlap on web apps and part ways on what a backend is: a process that stays up on Fly.io, a function that scales to zero on Vercel.

How do Fly.io and Vercel compare at a glance?

Fly.ioVercel
Backend computeMachines running your container, always on or started on demandFunctions, 300 s on Hobby and up to 800 s on Pro
Long-lived connectionsSupported, the process stays upLimited by function duration
DatabaseManaged Postgres from $4 a month, Machines with volumesPartner databases through the Marketplace
SchedulesMachines started on a fuzzy hourly, daily, weekly or monthly cycleCron jobs, daily on Hobby and per minute on Pro
FrontendAny framework in a containerFramework-aware builds, CDN and preview deployments
RegionsMachines placed in regions you chooseOne region by default, multiple on Pro
Entry pricingNo platform fee, $2.19 a month for the smallest MachineHobby $0, Pro $20 a month with included usage
Own cloud accountNot offeredBYOC in your own AWS account, on Enterprise

Fly.io figures are from its resource pricing page and Managed Postgres docs, and Vercel figures from its pricing page, function limits and cron docs, checked November 27, 2026.

How do the compute models differ?

Fly.io bills Machines by the second while they run, from $2.19 a month for a shared CPU with 256 MB of RAM to $6.70 for 1 GB, and a Machine can be stopped and started on demand to save money. The app is a container, so a WebSocket server, a queue consumer or a process that keeps an in-memory cache works the way it does on any VM, and volumes at $0.15 per GB a month give a Machine local disk.

Vercel runs functions with a 250 MB bundle limit and a duration of 300 seconds on Hobby, with Pro raising the maximum to 800 seconds and an extended 1800 second maximum (beta). That fits request-response APIs, route handlers and server rendering well, and a worker that holds connections open or processes a long export has to be split into steps or moved to another system.

How do databases compare?

Fly.io Managed Postgres starts at a $4 Developer plan with 256 MB of RAM, and every plan includes high availability and backups, with the $38 Basic plan adding connection pooling and support and storage billed at $0.28 per GB on plans above Developer. Major version upgrades are not done in place, so moving from Postgres 16 to 17 means creating a cluster and copying data across.

Vercel does not run databases itself, and Postgres and Redis come from partners in the Vercel Marketplace, billed through Vercel or the partner, while functions that scale out open many short-lived connections, which is why pooled connection strings matter there.

How do schedules and background work compare?

A Fly Machine can be created with a --schedule of hourly, daily, weekly or monthly, and Fly documents the timing as approximate, so a job that must run at an exact minute needs a long-running process with its own scheduler. Vercel cron jobs invoke a function on a cron expression, once a day on Hobby with the hour only approximate, and every minute on Pro.

Neither platform includes a message queue, so retries, fan-out and dead-letter handling are application code, a Redis library on Fly.io or a partner queue on Vercel.

When does each one fit?

Pick Fly.io for an API with workers, WebSockets or a database next to it, deployed in several regions from one container image. Pick Vercel for a Next.js frontend with route handlers and previews on every push, and for APIs that finish within function limits. Vercel also offers Bring Your Own Cloud on Enterprise, which runs functions as Lambda in your own AWS account. Pick neither when you want long-lived services in your own AWS or GCP account.

How does Encore fit next to Fly.io or Vercel?

Encore

Encore is a backend framework with built-in infrastructure, and next to either platform it runs the backend as long-lived services in your own AWS or GCP account, with the database, topics and cron jobs declared in code. The AWS docs list Fargate, RDS and SNS with SQS, and the GCP docs list Cloud Run, Cloud SQL and Pub/Sub. The Vercel 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 reports --example=hello-world$ cd reports && mkdir -p exports/migrations

A report export is the job that outgrows a function first, so this service accepts a request, queues it, builds the result in a subscriber that can run as long as it needs, and cleans up old rows on a schedule:

// exports/exports.go package exports import ( "context" "errors" "strings" "time" "encore.dev/beta/errs" "encore.dev/cron" "encore.dev/pubsub" "encore.dev/storage/sqldb" ) var db = sqldb.NewDatabase("exports", sqldb.DatabaseConfig{Migrations: "./migrations"}) type ExportRequested struct { ID int64 `json:"id"` } var requested = pubsub.NewTopic[*ExportRequested]("export-requested", pubsub.TopicConfig{ DeliveryGuarantee: pubsub.AtLeastOnce, }) type RequestParams struct { Account string `json:"account"` } type RequestResponse struct { ID int64 `json:"id"` } // Request queues an export and returns straight away. // //encore:api public method=POST path=/exports func Request(ctx context.Context, p *RequestParams) (*RequestResponse, error) { if strings.TrimSpace(p.Account) == "" { return nil, &errs.Error{Code: errs.InvalidArgument, Message: "account is required"} } var id int64 err := db.QueryRow(ctx, ` INSERT INTO exports (account) VALUES ($1) RETURNING id`, p.Account).Scan(&id) if err != nil { return nil, err } if _, err := requested.Publish(ctx, &ExportRequested{ID: id}); err != nil { return nil, err } return &RequestResponse{ID: id}, nil } type Export struct { ID int64 `json:"id"` Status string `json:"status"` Rows int64 `json:"rows"` } //encore:api public method=GET path=/exports/:id func Get(ctx context.Context, id int64) (*Export, error) { var e Export err := db.QueryRow(ctx, `SELECT id, status, rows FROM exports WHERE id = $1`, id). Scan(&e.ID, &e.Status, &e.Rows) if errors.Is(err, sqldb.ErrNoRows) { return nil, &errs.Error{Code: errs.NotFound, Message: "export not found"} } if err != nil { return nil, err } return &e, nil } var _ = pubsub.NewSubscription(requested, "build-export", pubsub.SubscriptionConfig[*ExportRequested]{ Handler: func(ctx context.Context, m *ExportRequested) error { // Only one delivery can move the row from queued to running. res, err := db.Exec(ctx, ` UPDATE exports SET status = 'running' WHERE id = $1 AND status = 'queued'`, m.ID) if err != nil { return err } if res.RowsAffected() == 0 { return nil } _, err = db.Exec(ctx, ` UPDATE exports SET status = 'done', finished_at = now(), rows = (SELECT count(*) FROM sales WHERE sales.account = exports.account) WHERE id = $1`, m.ID) return err }, RetryPolicy: &pubsub.RetryPolicy{MinBackoff: 10 * time.Second, MaxBackoff: 5 * time.Minute, MaxRetries: 5}, }) //encore:api private func Purge(ctx context.Context) error { _, err := db.Exec(ctx, ` DELETE FROM exports WHERE status = 'done' AND finished_at < now() - interval '30 days'`) return err } var _ = cron.NewJob("purge-exports", cron.JobConfig{ Title: "Delete exports older than 30 days", Schedule: "0 3 * * *", Endpoint: Purge, })
-- exports/migrations/1_create_exports.up.sql CREATE TABLE sales ( id BIGSERIAL PRIMARY KEY, account TEXT NOT NULL, cents BIGINT NOT NULL ); CREATE TABLE exports ( id BIGSERIAL PRIMARY KEY, account TEXT NOT NULL, status TEXT NOT NULL DEFAULT 'queued', rows BIGINT NOT NULL DEFAULT 0, finished_at TIMESTAMPTZ, created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE INDEX sales_account_idx ON sales (account);

encore run starts Postgres locally, applies the migration and runs the topic and its subscriber in process, so requesting an export and polling it works on a laptop. Cron jobs do not run locally, so the purge is tested by calling the endpoint from the local development dashboard. The Pub/Sub docs cover retries and the dead-letter queue, and the cron docs cover schedules.

To deploy, connect your AWS or GCP account as described in Connect your cloud account and push, then point the Vercel app or the Fly.io proxy at the backend URL. When an AI coding agent adds a second export type, the table change, the topic and the handler arrive in one diff that it can run locally before review.

Best fit: Teams that keep their frontend on Vercel or Fly.io and want the backend, its database and its jobs to run as services in their own AWS or GCP account.

Which should you choose?

Choose Fly.io for a backend that has to stay up, close to users in several regions, and Vercel for a frontend-led product whose API fits within function limits. When the backend outgrows both, keep the frontend where it is and run the backend as long-running services in your own cloud account.

Frequently asked questions

Is Fly.io or Vercel better for a backend API?

Fly.io is the more direct fit for an always-on API with workers and WebSockets, since it runs your container as a Machine that stays up. Vercel fits an API that lives next to a Next.js frontend and can run as functions, with a maximum duration of 800 seconds on Pro.

Is Fly.io cheaper than Vercel?

Yes. For a small backend it usually is, since the smallest always-on Fly Machine is $2.19 a month and there is no platform fee. Vercel Pro is $20 a month with included usage, which suits a frontend with moderate traffic better than a database-heavy backend.

Does Vercel have a database like Fly.io Managed Postgres?

No. Vercel does not offer its own database product. It connects databases from Marketplace partners to a project, while Fly.io offers Managed Postgres at $4 a month for the Developer plan and $38 for the Basic plan, which adds connection pooling and support.

How do I run a Fly.io or Vercel 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 Vercel 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