Introduction
A strongly typed layer over Supabase for apps, APIs, MCP servers and jobs.
better-supabase is one package that removes the glue code every Supabase app
rewrites: auth wiring, typed repositories, pagination, includes, nested
filters, soft delete, timestamps, upserts, cache invalidation, list pages,
storage paths and realtime topics.
Built on Supabase
It is built directly on Supabase's own packages:
@supabase/supabase-jsfor the per-request clients, Storage, Realtime and Edge Functions,@supabase/serverfor local token verification, auth modes and the env shape,@supabase/middlewarefor composable context (ctx.supabase,ctx.postgres),@supabase/ssrfor cookie sessions,@supabase/postgrest-typegenfor thedatabase.types.tsthe CLI writes, the same filesupabase gen typeswrites.
Supabase packages lists every package, how it is
installed and how it relates to the supabase CLI.
What you get
- A CLI that generates stronger types.
better-supabase genwrapssupabase gen typesand adds what it leaves out: relationship cardinality, unique keys, CHECK-constraint unions, typed jsonb, column maps forcamelCaseapps and per-table flags. - A typed repository.
db.customers.findMany({ where, include, orderBy })compiles to a single PostgREST request, or to SQL on the direct-Postgres path. Every call returns aResult;.orThrow()is opt-in. - Auth glue that avoids network calls. Valid access tokens never touch the Auth server. Refresh happens once, in the proxy, and is single-flighted.
- Framework adapters. Next.js, Hono, oRPC, Supabase Edge Functions and a minimal MCP server.
- Frontend helpers. TanStack Query options derived from the query, with table-based invalidation and optimistic updates.
- Standards on request. Standard Schema, JSON Schema, OpenAPI, RFC 9457 problem details, OpenTelemetry, CloudEvents, Standard Webhooks and more.
Next steps
Last updated on