Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Supabase 5 min read Release mediumAdept

supabase-js v2

supabase-js v2 brings incremental quality-of-life changes over v1. Types are now generated from the database via the CLI and set once on the client. signIn() is split into signInWithPassword() and signInWithOtp(), server-side auth moves to auth.admin, and the auth library is now async to fix a multi-tab token refresh race condition that logged users out. insert/update/upsert no longer return data unless select() is appended, which avoids surprise failures under Row Level Security. Constructor config is scoped per sub-library, each sub-library gets typed errors, Edge Function invocations auto-detect content type, and a new channel() API replaces from().on() for realtime and Postgres change subscriptions. v1 gets security and maintenance patches for three months.

Assumes: JavaScript async/awaitSupabase basics

Related posts

  • Introducing @supabase/server

    Supabase mediumAdept

    @supabase/server, now in public beta, replaces the repeated setup code found across 25,000 analyzed Edge Functions: client creation, JWT verification, claims parsing, CORS and auth wiring. A withSupabase wrapper (or createSupabaseContext for custom error handling) takes a declarative auth mode such as 'user', 'none', 'secret', 'publishable' or a combination. It rejects unauthorized requests before the handler runs and supplies a context with a user-scoped RLS client, a service-role admin client and verified claims. It handles the new asymmetric JWT signing keys and API keys internally, so migrating needs no jose or JWKS setup. It returns a standard Request-to-Response handler that runs on Edge Functions, Vercel, Cloudflare Workers, Bun and Hono, and exposes lower-level primitives for per-route auth.

  • Supabase Auth: SSO, Mobile, and Server-side support

    Supabase mediumAdept

    Supabase Auth adds SAML 2.0 single sign-on, a PKCE authorization flow for server-side rendering and mobile apps, and native Sign in with Apple on iOS. SSO providers are managed with new `supabase sso` CLI commands, and the provider identifier in the JWT can drive Postgres Row Level Security policies for multi-tenant isolation. PKCE replaces the implicit grant flow, which exposed tokens in URL fragments that servers can't read and that malicious mobile apps could intercept. It does this with a hashed code verifier and challenge, so an intercepted authorization code is useless on its own. Enabling it means setting `flowType: 'pkce'` in supabase-js, and a Next.js callback route exchanges the code for a session.

  • Supabase Middleware: composable, reusable middleware for Web Fetch handlers

    Supabase mediumAdept

    `@supabase/middleware` is an MIT-licensed, type-safe middleware engine for Web Fetch handlers. Per-request logic such as CORS, JWT claim verification, feature flags, RLS-scoped Supabase/Postgres clients and MCP OAuth discovery is composed as an ordered pipeline that each adds a typed key to a shared ctx, can short-circuit with a Response, or modify the response on the way out. The pipeline is a plain fetch handler, so it runs on Edge Functions, Vercel, Cloudflare Workers, Deno, Bun and Node 22+. Copy-in bridge files reuse the same entries in Hono, H3, Elysia, NestJS and TanStack Start. Custom middleware is written with `defineMiddleware`, whose type parameters make duplicate keys or misordered dependencies fail to compile (TypeScript 5.4+). The pg-based clients don't work on Workers because they need TCP sockets.

  • Supabase is now compatible with Next.js 14

    Supabase mediumAdept

    Supabase works across every Next.js 14 rendering context, including App Router Client and Server Components, Route Handlers, Server Actions and Middleware, plus the Pages Router data-fetching functions. Now that Server Actions are stable, auth and mutations can run entirely server-side next to the Server Components that fetch data. supabase-js stores sessions in localStorage by default, which doesn't exist on the server, so it has to be configured with cookie-based storage on both server and browser. The new @supabase/ssr package and a create-next-app starter template (`-e with-supabase`) wrap that boilerplate.

  • Supabase CLI v1 and Management API Beta

    Supabase mediumAdept

    Supabase CLI v1 leaves beta with commands to manage organizations, projects and Edge Functions, plus database migration tooling, CI/CD workflows and TypeScript type generation. Schema diffing adds an experimental migra backend (`db diff --use-migra`), which runs faster and emits more concise DDL than the previous PgAdmin-based approach, which mishandled default privileges in role grants. Local database branching lets developers test manual migrations without data loss, and `db push` plus a GitHub Actions example cover releasing to staging and production. A beta REST Management API, already used by the CLI, exposes project and organization management for automation and future Terraform/Pulumi integrations.

The quest for software engineering knowledge.

Look:
Layout: