Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

better-supabase

Latest version: v0.94.0

Overview

Last scanned
30 Nov 2026
Published
30 Nov 2026
npm package Publisher: martijn00, mick340
5 Stars
1 Forks
97 Versions
18.5K Downloads
TypeScript Repo language

Scan summary

better-supabase was last scanned on 30 Nov 2026 at version 0.94.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 97 versions; the latest 5 were published within 4 days (27–30 Nov 2026).
  • Findings: No rules fired in version 0.94.0.
  • Downloads: 18,471 downloads.

Versions

97 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.94.0 LATEST 30 Nov 2026 No rules fired
0.92.0 29 Nov 2026 No rules fired
0.91.1 27 Nov 2026 No rules fired
0.91.0 27 Nov 2026 Not shown
0.90.0 27 Nov 2026 Not shown

No rules fired in 0.94.0

Findings

Findings for v0.94.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.94.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

better-supabase

A typed data layer for Supabase: generated repositories that return Results and run under RLS, auth helpers, framework adapters and a CLI.

npm downloads license TypeScript

Docs · Quickstart · Blocks · Examples · Changelog · GitHub

better-supabase sits on the supabase-js client you already use. You keep your database, your RLS policies, Supabase Auth and Storage. The CLI reads your schema and generates a typed repository for every table, so a query is a typed object instead of a string. It is an independent, MIT-licensed project built on the official Supabase packages, not a Supabase product, and the raw client stays one property away as db.$client.

The same query, typed

With supabase-js, the columns and relations are a string, a filter on a related table needs !inner and a dotted path, and the error is a Postgres or PostgREST code:

const { data, error } = await supabase
  .from("customers")
  .select("id, name, organization(name), notes!inner(kind)")
  .eq("status", "active")
  .eq("notes.kind", "call")
  .order("name")
  .limit(20);
if (error) throw error;

With better-supabase, the same read is an object the compiler checks, the row type follows from select and include, and the call returns a Result instead of throwing:

const result = await db.customers.list({
  select: ["id", "name"],
  where: { status: "active", notes: { some: { kind: "call" } } },
  include: { organization: { select: ["name"] } },
  orderBy: { name: "asc" },
  limit: 20,
});

if (!result.ok) {
  // result.error.kind is "unauthorized", "timeout", "network" and so on
  return Response.json(result.error, { status: result.error.status });
}

result.data; // { id: string; name: string; organization: { name: string } }[]

It is still one PostgREST request, and it runs as the signed-in user, so your RLS policies decide what it can read. Call .orThrow() when you would rather throw. The supabase-js migration guide maps every supabase-js call to its repository equivalent.

What you get

Feature What it does
Stronger generated types gen writes the same database.types.ts as supabase gen types, and adds relationship cardinality, unique keys, CHECK-constraint unions, typed jsonb and per-table flags.
A typed repository list, get and the writes take where, include, orderBy and pagination, and compile to one PostgREST request, or to SQL on the direct-Postgres path.
Results, not exceptions Every call returns a Result with a plain, serializable DbError, safe to return from server actions and RPC handlers.
Queries as the caller connect() runs per request with the user's client, so every query runs under their RLS policies. Rows keep your casing, snake_case or camelCase.
Auth without round trips A valid access token is verified locally and never reaches the Auth server. Refresh happens once, in the proxy.
Caches that follow writes Writes invalidate the cache tags of the tables they touch, and the generated data hooks refetch.
Checks before you ship doctor reports missing RLS, grants and indexes, config and env drift, and the Supabase advisors.
Blocks of SQL you own A block renders tables, policies and functions into your repository for features most apps build by hand.

Quick start

  1. Install the package, and the two optional peers the CLI loads:

    pnpm add better-supabase @supabase/supabase-js
    pnpm add -D pg @supabase/postgrest-typegen@0.8.1
  2. Write the config, src/lib/supabase and the glue for the frameworks it finds:

    pnpm better-supabase init
  3. Start the local stack, write its URL and keys to .env.local, and generate the types:

    supabase start
    pnpm better-supabase dev env
    pnpm better-supabase gen
  4. Define the app once, and create the server instance for your framework. On Next.js:

    import { createSupabase } from "better-supabase";
    
    import { schema } from "./generated-schema.ts";
    
    export const betterSupabase = createSupabase(schema);
    import "server-only";
    import { createNext } from "better-supabase/next";
    
    import { betterSupabase } from "./index";
    
    export const bsb = createNext(betterSupabase);
  5. Query as the caller from a Server Component, route handler or server action:

    const { db } = await bsb.context();
    
    const customers = await db.customers
      .list({ where: { status: "active" }, limit: 20 })
      .orThrow();

Run better-supabase gen --check in CI to fail when the schema and the generated files drift apart. The Quickstart has each step in full.

Requirement Version
Node.js 24 or later for the CLI
Runtimes The runtime entries import no Node built-ins and run on every WinterTC runtime; cli, node, nestjs, postgres and testing need Node
TypeScript 6 and 7, with nodenext or bundler module resolution
Module format ESM only
Peers @supabase/supabase-js; every other peer is optional and listed per subpath on Peers

Add it to an existing app

Every step is optional and reversible, and you can stop on any of them:

  1. better-supabase init writes a config with no blocks and no SQL, and changes nothing in the database.
  2. better-supabase gen types the tables you already have: repositories, validators and hooks.
  3. better-supabase table <t> enable <feature> turns on realtime, audit, search or subjects for one table, through a tag in its comment.
  4. better-supabase add <block> --over <table> renders a block's files over a table you own.
  5. better-supabase add --preset <name> installs whole products next to your tables.

Old supabase.from() calls keep working next to the repositories, so you can move one query at a time. See Existing apps.

Use it where you run

An adapter runs in the framework's own middleware or hook. It verifies the access token locally against the project's JWKS, which it fetches once and caches. While the token is valid it writes no cookies, and an expiring session is refreshed once, in the proxy. Every route, loader and action then gets a db for the caller.

Where you run Adapters
Supported Next.js, Hono, Expo Router, SvelteKit, TanStack Start, React Router
Community Astro, Edge Functions, Elysia, H3, Nuxt, NestJS, Node, SolidStart
APIs and agents oRPC, MCP servers, WebMCP, any other framework
In the browser The client, React, React Native, Vue, Solid, Svelte
On the device PowerSync, SQLite, TanStack DB and live queries

Supported adapters get the full test matrix, an example app and every guide. Community adapters get a smoke test and a docs page, and fixes may lag. Frameworks explains the tiers.

The CLI

One command per job. bsb is the short name.

pnpm better-supabase init                    # config, client and framework glue
pnpm better-supabase gen                     # types and data hooks
pnpm better-supabase gen --check             # exit 1 in CI when the schema drifted
pnpm better-supabase table invoices enable realtime
pnpm better-supabase add queue               # a block's SQL into supabase/schemas
pnpm better-supabase add --preset crm        # every block a product needs
pnpm better-supabase doctor                  # RLS, grants, indexes and Supabase advisors
pnpm better-supabase mcp                     # the CLI as an MCP server for your coding agent

The CLI reference lists every command and flag.

Blocks and presets

A block is a feature most apps build by hand, such as organizations and invitations, comments, a job queue, a pipeline or invoices. better-supabase add renders its tables, policies and functions into files in your repository, which you review, commit and change like the rest of your schema. When the block has a TypeScript side, the app calls it on db.

pnpm better-supabase add comments --over public.invoices
pnpm better-supabase add --preset crm
pnpm better-supabase doctor

The block catalog covers organizations and identity, the database, collaboration, work, CRM, commerce, content, AI, automation, developer tools, growth, and people and scheduling. A preset installs the blocks for a whole product, such as a CRM, a helpdesk or a CMS, and blocks can run over your own tables.

Integrations

Each integration is an optional peer, loaded only from its own subpath.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm better-supabase

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Critical Apache HTTP Server Flaw Exposes Web Servers to RCE (1)
CVE

CVE-2026-119618: Critical Apache HTTP Server Flaw Exposes Web Servers to Remote Code Execution

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229