Docs / supabase-js compatibility

On this page · 2 sections
Contents

PLANNED

Docker imageAPI referenceMigrating from Supabase

Docs / USE / supabase-js compatibility

supabase-js compatibility

Point supabase-js at your local Megabase URL. A `.select()` read is served when the database is configured. Auth health, settings, signup, logout, and the password and refresh-token grants are served.

docs/supabase-js.md · Built from commit 820e560 · 2026-10-26 · Edit on GitHub ↗

The goal is that an existing supabase-js app can point at Megabase without changing a line of code. That is the target, not the state.

Point the client

ANON_KEY is an HS256 JWT signed with JWT_SECRET (the demo pair is in vendor/supabase/docker/.env.example). Megabase verifies that signature in megabase-core. Logout uses the same verifier. A .select() call is a served read. A chained .eq() is a horizontal filter on that read. The base URL is the Megabase listen address (default http://localhost:8000).

JAVASCRIPT
import { createClient } from '@supabase/supabase-js'
const supabase = createClient('http://localhost:8000', ANON_KEY)
const { data, error } = await supabase.from('todos').select()
// rows of public.todos when DATABASE_URL is set

from('todos').select() is a served read of public.todos when DATABASE_URL is set. Inserts, updates, and deletes on that table are served too. .upsert() sends Prefer resolution and stays 501. Embeds and Prefer stay 501. Level 1 (see the Roadmap) is the REST and Auth email/password target; the Auth routes in Configuration are served.

What “compatible” means

Same endpoints, request syntax, response bodies, status codes, headers, error codes and messages as the pinned upstream stack. The judge — when judge/ exists — is the only scorer. Agents cannot change what it compares against.

Wrong or unfinished? Open an issue or edit docs/supabase-js.md on GitHub.