Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/docs/content/guides/ai-tools/byo-mcp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ Replace the contents of `supabase/functions/mcp/index.ts`. Compared with the pub
import 'jsr:@supabase/functions-js/edge-runtime.d.ts'

import { createMcpHandler, McpServer } from 'npm:@modelcontextprotocol/server@^2.0.0'
import { pipeline } from 'npm:@supabase/middleware@^0.5.0'
import { withOAuthProtectedResource, withSupabase } from 'npm:@supabase/server@^1.6.0'
import { pipeline } from 'npm:@supabase/middleware@1'
import { withOAuthProtectedResource, withSupabase } from 'npm:@supabase/server@1'
import { z } from 'npm:zod@^4.3.6'

import type { Database } from './database.types.ts'
Expand Down Expand Up @@ -254,7 +254,7 @@ Deno.serve(

<Admonition type="note">

Composing `withSupabase` as a `pipeline` entry is alpha and tracks `@supabase/middleware` 0.x. The nested form, `withOAuthProtectedResource(withSupabase({ auth: 'user' }, handler))`, is stable and behaves the same. Both need `@supabase/server` 1.6.0 or later.
The nested form, `withOAuthProtectedResource(withSupabase({ auth: 'user' }, handler))`, behaves the same. Both need `@supabase/server` 1.6.0 or later.

</Admonition>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ When building your own MCP server, integrate with Supabase Auth to authenticate
On Supabase Edge Functions, or any runtime with a `fetch`-style handler, [`@supabase/server`](/docs/reference/server/introduction) does the OAuth plumbing for you. `withOAuthProtectedResource()` publishes the protected resource metadata and the `WWW-Authenticate` challenge that MCP clients use to find your Auth server; `withSupabase({ auth: 'user' })` verifies the token and gives your tools a client scoped to that user:

```ts
import { pipeline } from 'npm:@supabase/middleware@^0.5.0'
import { withOAuthProtectedResource, withSupabase } from 'npm:@supabase/server@^1.6.0'
import { pipeline } from 'npm:@supabase/middleware@1'
import { withOAuthProtectedResource, withSupabase } from 'npm:@supabase/server@1'

Deno.serve(
pipeline(
Expand Down
37 changes: 15 additions & 22 deletions apps/docs/content/guides/database/orioledb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ description: "A storage extension for Postgres which uses Postgres's pluggable s

The [OrioleDB](https://www.orioledb.com/) Postgres extension provides a drop-in replacement storage engine for the default heap storage method. It is designed to improve Postgres' scalability and performance.

OrioleDB addresses Postgres's scalability limitations by removing bottlenecks in the shared memory cache under high concurrency. It also optimizes write-ahead-log (WAL) insertion through row-level WAL logging. These changes lead to significant improvements in the industry standard TPC-C benchmark, which approximates a real-world transactional workload. The following benchmark was performed on a c7g.metal instance and shows OrioleDB's performance outperforming the default Postgres heap method with a 3.3x speedup.
OrioleDB addresses Postgres's scalability limitations by removing bottlenecks in the shared memory cache under high concurrency. It also optimizes write-ahead-log (WAL) insertion through row-level WAL logging. These changes lead to significant improvements in the industry standard TPC-C benchmark, which approximates a real-world transactional workload. The following benchmark was performed on a 8xlarge instance and shows OrioleDB's performance outperforming the default Postgres heap method with a 1.8x speedup.

<Image
alt="TPC-C (warehouses = 500)"
src="/docs/img/database/orioledb-tpc-c-500-warehouse.png"
alt="Line chart of TPC-C throughput at 5120 warehouses, in transactions per minute (tpmC), from 32 to 256 connections. OrioleDB rises to about 112,800 tpmC by 128 connections and holds between about 110,000 and 112,000 from 128 connections onward. Heap stays between about 37,000 and 65,000 across the whole range."
src="/docs/img/database/orioledb-tpc-c-5120-warehouse.png"
className="max-w-[550px] mx-auto! border rounded-md"
width={1000}
height={609}
/>

<Admonition type="note">

OrioleDB is in active development and has [certain limitations](https://www.orioledb.com/docs/usage/getting-started#current-limitations). Native B-tree indexes give the best performance, and an Index Access Method bridge provides experimental support for other index types built for heap storage, including pg_vector's HNSW indexes. In the Supabase OrioleDB image the default storage method has been updated to use OrioleDB, granting better performance out of the box.
OrioleDB is in public beta, and projects that use it have access to the same paid features as other Supabase projects. OrioleDB has [some limitations](https://www.orioledb.com/docs/usage/getting-started#current-limitations) compared to the default heap storage engine, so review them before you choose it for a project. Native B-tree indexes give the best performance, and an Index Access Method bridge provides experimental support for other index types built for heap storage, including pg_vector's HNSW indexes. In the Supabase OrioleDB image the default storage method has been updated to use OrioleDB, granting better performance out of the box.

</Admonition>

Expand All @@ -44,20 +44,12 @@ OrioleDB implements copy-on-write checkpoints to persist data efficiently. This

### Creating OrioleDB project

You can get started with OrioleDB by enabling the extension in your Supabase dashboard.
To get started with OrioleDB you need to [create a new Supabase project](/dashboard/new/_) and choose `OrioleDB Public Alpha` Postgres version.
You choose OrioleDB when you create a project. You can't add OrioleDB to an existing project or remove it later.

<Image
alt="Creating OrioleDB project"
src={{
light: '/docs/img/database/orioledb-creating-project--light.png',
dark: '/docs/img/database/orioledb-creating-project.png',
}}
className="max-w-[550px] mx-auto! border rounded-md"

width={1376}
height={2034}
/>
1. [Create a new Supabase project](/dashboard/new/_).
1. Expand **Advanced Configuration**.
1. Under **Postgres Type**, select **Postgres with OrioleDB**.
1. Finish creating the project.

### Creating tables

Expand Down Expand Up @@ -120,10 +112,11 @@ explain select * from blog_post order by published_at desc limit 10;
-> Index Scan Backward using blog_post_published_at on blog_post (cost=0.15..48.95 rows=320 width=120)

explain select * from blog_post where id = 1;
QUERY PLAN
──────────────────────────────────────────────────────────────────────────────────
Index Scan using blog_post_pkey on blog_post (cost=0.15..8.17 rows=1 width=120)
Index Cond: (id = 1)
QUERY PLAN
───────────────────────────────────────────────────────────────────────
Custom Scan (o_scan) on blog_post (cost=0.15..8.17 rows=1 width=120)
Forward index scan of: blog_post_pkey
Conds: (id = 1)

explain (analyze, buffers) select * from blog_post order by published_at desc limit 10;
QUERY PLAN
Expand Down Expand Up @@ -167,7 +160,7 @@ A smaller set of OrioleDB settings has a `user` [context](/docs/guides/database/

| Setting | Description | Default |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `orioledb.default_compress` | Default compression level for OrioleDB tables. Set to `-1` to disable compression, or `0` or a positive integer to trade write speed for a smaller table on disk. | `-1` |
| `orioledb.default_compress` | Default compression level for OrioleDB tables. Set to `-1` to disable compression, or `0` to `22` to trade write speed for a smaller table on disk. | `-1` |
| `orioledb.default_primary_compress` | Default compression level for the primary index. Accepts the same values as `orioledb.default_compress`. | `-1` |
| `orioledb.default_toast_compress` | Default compression level for TOASTed values. Accepts the same values as `orioledb.default_compress`. | `-1` |
| `orioledb.serializable` | How OrioleDB handles `SERIALIZABLE` transactions. `table_lock` acquires a coarse lock per touched table, `repeatable_read` silently downgrades the isolation level, and `error` rejects `SERIALIZABLE` transactions. | `table_lock` |
Expand Down
12 changes: 6 additions & 6 deletions apps/docs/content/guides/functions/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For how authorization headers and the `verify_jwt` platform check work under the
Functions called by signed-in users — typically through `supabase.functions.invoke` from the client — send the user's session JWT on the `Authorization` header. Keep `verify_jwt = true` (the default) so the platform validates the JWT before your handler runs, then use `auth: 'user'` to get `ctx.supabase` already scoped to the caller's RLS policies.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: 'user' }, async (_req, ctx) => {
Expand All @@ -43,7 +43,7 @@ export default {
Cron jobs, workers, `pg_net`, or another Edge Function make calls with a secret key on the `apikey` header rather than a user JWT. Disable `verify_jwt` and use `auth: 'secret'` to validate the key against any secret key from your [dashboard](/dashboard/project/_/settings/api-keys). You get `ctx.supabaseAdmin` for privileged work.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: 'secret' }, async (_req, ctx) => {
Expand Down Expand Up @@ -71,7 +71,7 @@ verify_jwt = false
```

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: 'none' }, async () => {
Expand All @@ -88,7 +88,7 @@ export default {
External providers like Stripe or GitHub don't send Supabase credentials. They sign the request body with their own shared secret. Use `auth: 'none'` to skip the SDK's credential check, then verify the provider's signature inside the handler. Keep `verify_jwt = false`.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'
import Stripe from 'npm:stripe'

const stripe = new Stripe(Deno.env.get('STRIPE_SECRET_KEY')!)
Expand Down Expand Up @@ -134,7 +134,7 @@ export default {
Functions that answer both users and internal callers take an array on `auth`. Modes are tried in order. The first match wins, and `ctx.authMode` tells you which matched.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: ['user', 'secret'] }, async (req, ctx) => {
Expand All @@ -154,7 +154,7 @@ export default {
To shape the 401 response yourself, use `createSupabaseContext` instead of `withSupabase`. It returns a `{ data, error }` tuple so you stay in control.

```ts
import { createSupabaseContext } from 'npm:@supabase/server'
import { createSupabaseContext } from 'npm:@supabase/server@1'

export default {
fetch: async (req: Request) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/getting-started/api-keys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const supabaseAdmin = createClient(
Don't read the key from the environment inside an Edge Function. Use the [`@supabase/server`](/docs/guides/functions/auth) SDK instead. It verifies the caller's secret key for you and hands back a privileged client on `ctx`, so the key never appears in your code.

```ts supabase/functions/roster/index.ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: 'secret' }, async (_req, ctx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Wrap your existing `Deno.serve` handler with `withSupabase` and declare an `auth
For a function your users call from the client, use `auth: 'user'`. The SDK validates the user's session JWT and gives you a client scoped to their Row Level Security policies.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

Deno.serve(
withSupabase({ auth: 'user' }, async (_req, ctx) => {
Expand All @@ -162,7 +162,7 @@ Deno.serve(
For a function called by your own backend, a worker, or `pg_net`, use `auth: 'secret'`. The SDK validates the secret key and gives you a client that bypasses Row Level Security.

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

Deno.serve(
withSupabase({ auth: 'secret' }, async (_req, ctx) => {
Expand All @@ -177,7 +177,7 @@ To accept a specific named key instead of `default`, add its name after the mode
`withSupabase` returns a standard request handler, so you can also export it as a `fetch` handler instead of passing it to `Deno.serve`:

```ts
import { withSupabase } from 'npm:@supabase/server'
import { withSupabase } from 'npm:@supabase/server@1'

export default {
fetch: withSupabase({ auth: 'user' }, async (_req, ctx) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,36 @@ throw redirect(303, data.url)
**Remix:**

```ts
import { redirect } from "@remix-run/node"; // or cloudflare/deno
// Your server client factory: createServerClient with a setAll that appends
// Set-Cookie to `headers`, returning both. See the PKCE flow's Server example.
import { createClient } from "~/lib/supabase.server";
...
const { supabase, headers } = createClient(request)
const { data } = await supabase.auth.signInWithOAuth({
provider: 'github',
})
import { redirect, type ActionFunctionArgs } from '@remix-run/node'
import { createServerClient, parseCookieHeader, serializeCookieHeader } from '@supabase/ssr'

export async function action({ request }: ActionFunctionArgs) {
const responseHeaders = new Headers()

// Collect every cookie the client sets, so they can be sent with the redirect
const supabase = createServerClient(
process.env.SUPABASE_URL!,
process.env.SUPABASE_PUBLISHABLE_KEY!,
{
cookies: {
getAll() {
return parseCookieHeader(request.headers.get('Cookie') ?? '')
},
setAll(cookiesToSet, cacheHeaders) {
cookiesToSet.forEach(({ name, value, options }) =>
responseHeaders.append('Set-Cookie', serializeCookieHeader(name, value, options))
)
Object.entries(cacheHeaders).forEach(([key, value]) => responseHeaders.set(key, value))
},
},
}
)

const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'github',
})
if (error) throw error

return redirect(data.url, { headers })
return redirect(data.url, { headers: responseHeaders })
}
```
2 changes: 2 additions & 0 deletions apps/docs/public/humans.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ Kevin Brolly
Kevin Grüneberg
Kevin Shaffer-Morrison
Kevin Strong-Holte
Kevin Webb
Kody Jackson
Kostas Botsas
Krishna Sai Vandavasi
Expand All @@ -214,6 +215,7 @@ Manuel Mendez
Manan Gupta
Marcus Weiner
Marija Milicevic
Mario Karuza
Mark Burggraf
Márton Boros
Matthew Hambright
Expand Down
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ title: Introduction

Each middleware can guard the request, edit the response, or contribute typed values to a shared context that later middleware and your handler read. TypeScript checks the composition: a middleware that needs a value from an earlier middleware will not compile unless that middleware runs first.

<Admonition type="caution" title="Alpha">

`@supabase/middleware` is in alpha. APIs may change between 0.x releases.

</Admonition>

This package contains the engine and the framework-neutral middleware: `withCors` and `withFeatureFlag`. Supabase-specific middleware such as `withClaims`, `withSupabaseClient`, `withSupabaseAdminClient`, `withPostgresClient`, and `withPostgresAdminClient` ships in [`@supabase/server`](/docs/reference/server/introduction).

### Trust model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Each example builds one Fetch handler with `pipeline`. Entries run in array orde

Without `withCors`, `withSupabase` answers every `OPTIONS` request itself with `204` and wildcard CORS headers (`Access-Control-Allow-Origin: *`). That is enough when you do not need an origin allowlist. A layer that owns CORS must sit before `withSupabase` in the array. Placed after it, the preflight reaches the auth gate and gets a `401`.

The entry form of `withSupabase` is alpha. It needs `@supabase/server` 1.6.0 or later.
The entry form of `withSupabase` needs `@supabase/server` 1.6.0 or later.

</RefSubLayout.Details>

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/spec/reference/server/v1/partials/frameworks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ Neither entry answers a CORS preflight, and the short-circuits carry no CORS hea

`withSupabase(config, handler)` still does the verify-then-reject work for you, and it is not deprecated. It wraps a fetch handler rather than composing into a framework chain, so it does not slot into a bridge. If an endpoint is already a plain fetch handler, staying on `withSupabase()` is a legitimate end state. It is also the only way to get the full `SupabaseContext`, `userClaims` and `authMode` included, behind an auth gate.

To compose other entries around it, `withSupabase({ auth: 'user' })` with no handler is a `pipeline` entry placed by position. Entries before it run ahead of the auth gate. Entries after it receive the full `SupabaseContext`. Nesting, as in `withSupabase(config, entry(handler))`, still works. The entry form is alpha and needs 1.6.0 or later.
To compose other entries around it, `withSupabase({ auth: 'user' })` with no handler is a `pipeline` entry placed by position. Entries before it run ahead of the auth gate. Entries after it receive the full `SupabaseContext`. Nesting, as in `withSupabase(config, entry(handler))`, still works. The entry form needs 1.6.0 or later.

```ts
import { pipeline } from '@supabase/middleware'
Expand Down
4 changes: 3 additions & 1 deletion apps/docs/spec/sections/generateMgmtApiSections.cts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function extractSectionsFromOpenApi(filePaths: string[], outputPath: string) {
const sectionCate = sections.find((i) => i.title === tag)
sectionCate?.items.push({
id: operationId,
title: slugToTitle(operationId),
title: operationId.match(/^v\d+-(organizations-slug|projects-ref)-.+$/)
? (methods[method].summary ?? slugToTitle(operationId))
: slugToTitle(operationId),
slug: operationId,
type: 'operation',
})
Expand Down
10 changes: 5 additions & 5 deletions apps/lite-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"clean": "rimraf build .react-router .turbo tsconfig.tsbuildinfo"
},
"dependencies": {
"@react-router/fs-routes": "^7.17.0",
"@react-router/node": "^7.17.0",
"@react-router/serve": "^7.17.0",
"@react-router/fs-routes": "^7.18.4",
"@react-router/node": "^7.18.4",
"@react-router/serve": "^7.18.4",
"isbot": "^5.1.36",
"react": "catalog:",
"react-dom": "catalog:",
Expand All @@ -21,14 +21,14 @@
"ui-patterns": "workspace:*"
},
"devDependencies": {
"@react-router/dev": "^7.17.0",
"@react-router/dev": "^7.17.1",
"@tailwindcss/vite": "4.2.4",
"@types/node": "^22",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"config": "workspace:*",
"tailwindcss": "catalog:",
"tsconfig": "workspace:*",
"vite": "^7.3.2"
"vite": "^8.0.0"
}
}
Loading
Loading