Introducing @supabase/server
@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.
Related posts
- 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-js v2
Supabase mediumAdeptsupabase-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.
- Edge Functions are now available in Supabase
Supabase easyNoviceSupabase Edge Functions run TypeScript globally on the Deno runtime via Deno Deploy across 30+ data centers. Supabase chose functions-as-a-service over containers for simpler developer experience and faster start-ups, and global deployment over a single region, with Postgres-colocated Database Functions covering DB-heavy work. Requests pass through a Relay gateway that verifies JWTs, rate-limits and logs, then maps function metadata to a Deno Deploy deployment ID. Cold starts fetch code and secrets from Supabase, and logs flow through Logflare into the dashboard. Functions are POST-only, and static hosting is ruled out after phishing abuse on Supabase Storage got the domain denylisted.
- Supabase is now compatible with Next.js 14
Supabase mediumAdeptSupabase 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.
- Give your Supabase app its own MCP server
Supabase mediumAdeptSupabase apps can expose their own MCP server so customers use the app from ChatGPT, Claude or other MCP clients, signed in with their existing account. An installable MCP Server block generates an Edge Function with an MCP handler, OAuth middleware and per-file tools. Supabase Auth acts as the OAuth 2.1 server, and `withSupabase({ auth: 'user' })` gives each tool a user-scoped client, so Postgres RLS policies govern what an agent can reach without a service role key. Setup requires asymmetric signing keys, dynamic client registration, a consent page and `verify_jwt = false` on the function; MCP Apps can render reused React components inside the chat.