A head-to-head comparison of Convex and Supabase: a reactive document database with TypeScript functions against Postgres with auth and a generated API, plus realtime, background work, limits, pricing and self-hosting.

Convex is a backend where the database and the server functions are one product, and every query a client subscribes to updates on its own when the data changes. Supabase starts from Postgres and adds auth, a generated REST API, storage, realtime and Edge Functions around it.
Both get a product to a working backend in an afternoon, and the choice mostly comes down to a reactive document store programmed in TypeScript against SQL with row-level security.
Convex details are from its limits page and pricing page, and Supabase details from its Edge Functions limits and pricing page, all checked November 25, 2026.
Convex stores documents in tables, and you define them in schema.ts with validators and indexes, then read and write them only through query and mutation functions. Mutations run as transactions with optimistic concurrency control, so two writes that conflict are retried rather than corrupting a balance, and Convex explains the approach in its OCC docs. There is no SQL, and a query that scans more than 32,000 documents in one transaction fails, so most reads need an index designed up front.
Supabase gives you a full Postgres database, with joins, views, triggers, extensions such as pgvector and any tool that speaks the Postgres protocol. Access control lives in row-level security policies that the generated API checks on every request, which keeps the client code thin and moves the trickiest logic into SQL.
Convex is strongest at realtime: a React component calls useQuery, Convex tracks which documents the query read, and when any of them changes the client receives the new result, consistent with the same database snapshot across every subscription, as the realtime docs describe.
Supabase Realtime streams inserts, updates and deletes from Postgres to subscribed clients. Its Postgres Changes docs note that a change to a table with 100 subscribers means 100 authorization checks and that changes are processed on a single thread, so a busy chat or dashboard usually moves to Broadcast channels or filtered subscriptions.
Convex splits code by what it may do, so queries and mutations are deterministic and may not call the network, with a 1-second limit on user code, while actions call third-party APIs and reach the database through runQuery and runMutation, running for up to 10 minutes on Node.js. A mutation can schedule an action with ctx.scheduler.runAfter, and cron jobs live in crons.ts.
Supabase Edge Functions run on Deno with 2 seconds of CPU time per request and a wall clock limit of 150 seconds on the free plan and 400 seconds on paid plans. Queues and schedules stay in the database through pgmq and pg_cron, which needs few moving parts for light work and pushes heavy jobs onto another platform.
Convex Professional costs $25 per developer a month and includes 25 million function calls and 50 GB of database storage, with usage pricing beyond that. Supabase Pro costs $25 a month per organization, includes $10 of compute credits, and bills compute add-ons per project.
Lock-in takes a different shape on each, since leaving Supabase means moving a Postgres database, which pg_dump handles, and rewriting what depends on its API and policies. Leaving Convex means moving documents out of a Convex-specific data model and rewriting every query and mutation, although the open source backend lets you self-host without a rewrite.
Pick Convex when the product is collaborative or live by nature, such as shared documents, chat or multiplayer state, the team works in TypeScript end to end, and you are happy to design indexes instead of writing SQL. Pick Supabase when you want Postgres, SQL and a large ecosystem of tools, row-level security for authorization and built-in auth, or when the data will later feed analytics and other services.
Encore is a backend framework with built-in infrastructure, and it suits the point where the backend has grown from functions around a database into services with their own queues, schedules and integrations. You write the API endpoints and declare the Postgres database and Pub/Sub topics they use in the same code, and Encore provisions them in your own AWS or GCP account, RDS and SNS with SQS on AWS or Cloud SQL and Pub/Sub on GCP, as the infrastructure docs describe.

Run in your terminal to get started locally.
The pattern Convex handles with a mutation that schedules an action becomes an endpoint that writes in a transaction and publishes an event, and a subscriber that calls the outside API with retries:
// docs/docs.ts
import { api, APIError } from "encore.dev/api";
import { getAuthData } from "~encore/auth";
import { SQLDatabase } from "encore.dev/storage/sqldb";
import { Topic, Subscription } from "encore.dev/pubsub";
const db = new SQLDatabase("docs", { migrations: "./migrations" });
interface DocShared {
docId: number;
email: string;
}
const docShared = new Topic<DocShared>("doc-shared", {
deliveryGuarantee: "at-least-once",
});
// Records the share in a transaction, then publishes the event; the email is sent outside the request.
// Only the document owner can create a share.
export const share = api(
{ expose: true, auth: true, method: "POST", path: "/docs/:docId/shares" },
async ({ docId, email }: { docId: number; email: string }): Promise<{ shared: boolean }> => {
if (!email.includes("@")) throw APIError.invalidArgument("a valid email is required");
const userID = getAuthData()!.userID;
const tx = await db.begin();
try {
const doc = await tx.queryRow<{ id: number }>`
SELECT id FROM docs WHERE id = ${docId} AND owner_id = ${userID} FOR UPDATE`;
if (!doc) throw APIError.notFound("document not found");
await tx.exec`
INSERT INTO doc_shares (doc_id, email) VALUES (${docId}, ${email})
ON CONFLICT (doc_id, email) DO NOTHING`;
await tx.commit();
} catch (err) {
await tx.rollback();
throw err;
}
await docShared.publish({ docId, email });
return { shared: true };
},
);
const _ = new Subscription(docShared, "send-share-email", {
handler: async ({ docId, email }) => {
// Claim the row with a short lease so concurrent redeliveries cannot both send.
// If the lease expired between the claim and the follow-up read, claim again
// in this handler rather than throwing, so a last retry does not dead-letter.
let claimed: { doc_id: number } | null = null;
for (let i = 0; i < 2 && !claimed; i++) {
claimed = await db.queryRow<{ doc_id: number }>`
UPDATE doc_shares SET claimed_at = now()
WHERE doc_id = ${docId} AND email = ${email}
AND notified_at IS NULL
AND (claimed_at IS NULL OR claimed_at < now() - interval '10 minutes')
RETURNING doc_id`;
if (claimed) break;
const row = await db.queryRow<{ notified_at: Date | null; claimed_at: Date | null }>`
SELECT notified_at, claimed_at FROM doc_shares
WHERE doc_id = ${docId} AND email = ${email}`;
if (!row || row.notified_at) return; // already sent, or the share was removed
const leaseActive = row.claimed_at != null && row.claimed_at.getTime() > Date.now() - 10 * 60 * 1000;
// A live lease must not be acknowledged; throw so Pub/Sub retries after backoff.
if (leaseActive) throw new Error("share invitation delivery is already in progress");
}
if (!claimed) throw new Error("share invitation delivery is already in progress");
// Call your email provider here with an idempotency key of `${docId}:${email}`.
// A thrown error is retried with backoff after the lease expires.
await db.exec`
UPDATE doc_shares SET notified_at = now()
WHERE doc_id = ${docId} AND email = ${email}`;
},
retryPolicy: { minBackoff: "10s", maxBackoff: "5m", maxRetries: 8 },
});
-- docs/migrations/1_create_docs.up.sql
CREATE TABLE docs (
id BIGSERIAL PRIMARY KEY,
owner_id TEXT NOT NULL,
title TEXT NOT NULL,
body TEXT NOT NULL DEFAULT '',
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE TABLE doc_shares (
doc_id BIGINT NOT NULL REFERENCES docs (id),
email TEXT NOT NULL,
claimed_at TIMESTAMPTZ,
notified_at TIMESTAMPTZ,
PRIMARY KEY (doc_id, email)
);
// auth/auth.ts
import { createHash } from "crypto";
import { Header, Gateway, APIError } from "encore.dev/api";
import { authHandler } from "encore.dev/auth";
import { SQLDatabase } from "encore.dev/storage/sqldb";
const db = new SQLDatabase("auth", { migrations: "./migrations" });
interface AuthParams {
authorization: Header<"Authorization">;
}
function sessionHash(token: string): string {
return createHash("sha256").update(token).digest("hex");
}
export const auth = authHandler<AuthParams, { userID: string }>(
async (params) => {
const token = params.authorization?.replace(/^Bearer\s+/i, "") ?? "";
if (!token) throw APIError.unauthenticated("missing auth token");
const row = await db.queryRow<{ user_id: string }>`
SELECT user_id FROM sessions
WHERE token_hash = ${sessionHash(token)}
AND expires_at > now()
AND revoked_at IS NULL`;
if (!row) throw APIError.unauthenticated("unknown, expired or revoked session");
return { userID: row.user_id };
},
);
export const gateway = new Gateway({ authHandler: auth });
-- auth/migrations/1_create_sessions.up.sql
CREATE TABLE sessions (
token_hash TEXT PRIMARY KEY,
user_id TEXT NOT NULL,
expires_at TIMESTAMPTZ NOT NULL,
revoked_at TIMESTAMPTZ
);
encore run starts Postgres, applies the migration and runs the topic locally, so the write, the event and the retry can be traced on a laptop before anything is deployed, and the Pub/Sub docs cover retries and the dead-letter queue. Encore has no reactive query layer like Convex, so live screens use streaming APIs over WebSockets or a realtime service on top, and auth plugs in through an auth handler that verifies tokens from Clerk, Auth0 or Supabase Auth.
To deploy, connect your AWS or GCP account as described in Connect your cloud account and push, and the database and queues are created in that account. Teams coming from Supabase can follow the Supabase migration guide.
With the table, the topic and the endpoint in one service, a coding agent asked to add a second notification writes the subscriber and the migration in the same change and runs both locally.
Best fit: Teams whose backend has grown past CRUD and functions, who want Postgres, queues and schedules in their own AWS or GCP account with the infrastructure declared next to the code.
Choose Convex when live, collaborative data is the core of the product and a TypeScript-only document model suits the team, and Supabase when Postgres, SQL and row-level security are what you want to build on. When the backend turns into services with background work, integrations and customers who ask where their data lives, a backend in your own cloud account becomes the better home for it.
Convex is the simpler choice when most screens need live data, because every query function is reactive and clients receive new results automatically when the data they read changes. Supabase Realtime sends Postgres changes to subscribed clients, and its docs note that each change is checked against every subscriber's policies on a single thread, so heavy fan-out needs filters, Broadcast or a separate design.
No. Convex stores JSON-like documents in tables with an optional schema and indexes, and you read and write them through TypeScript query and mutation functions instead of SQL. Supabase is Postgres, so you get SQL, joins, extensions such as pgvector and any Postgres client.
Yes. The Convex backend is open source under the FSL Apache 2.0 license, which converts to Apache 2.0 after two years and forbids building a competing hosted service, and Supabase can be self-hosted with Docker. In both cases you run the database, upgrades and backups yourself.
With Encore you declare the Postgres database, Pub/Sub topics and cron jobs in the backend code next to the API endpoints, run it locally with encore run, and deploy it to your own AWS or GCP account. Encore provisions RDS and SNS with SQS on AWS, or Cloud SQL and Pub/Sub on GCP.
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.