Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
88a1612
docs: add initial documentation and skills.md
tomaspozo Mar 28, 2026
cc1bf90
docs: apply formatting
tomaspozo Mar 28, 2026
1134757
docs: update SKILL.md to resolve docs from package location and ship …
tomaspozo Mar 28, 2026
7f55809
docs: add missing HTTPException import in error-handling example
tomaspozo Mar 28, 2026
1b2f3eb
docs: fix strictNullChecks issues, duplicate variables, and missing c…
tomaspozo Mar 30, 2026
cc706a5
docs: reframe as runtime-agnostic and add env auto-injection details
tomaspozo Mar 30, 2026
4409565
docs: add SSR frameworks guide and update references
tomaspozo Mar 30, 2026
bf6aabe
docs: add disclaimer of new package
tomaspozo Mar 30, 2026
40021b4
docs: extend explanation on keys env vars
tomaspozo Mar 30, 2026
bb43580
docs: add platform-specific quick starts to SKILL.md
tomaspozo Mar 31, 2026
024bac9
docs: add server-to-server quick starts and allow:always guardrails
tomaspozo Mar 31, 2026
dde85ac
docs: add legacy keys warning, skills install, remove webhook docs
tomaspozo Mar 31, 2026
53e6209
docs: add verify_jwt = false note for non-user auth modes
tomaspozo Mar 31, 2026
d7b1139
docs: add edge function recipes and refactor env vars doc
tomaspozo Mar 31, 2026
463d131
docs: add security doc covering timing-safe comparison, auth model, CORS
tomaspozo Mar 31, 2026
30c834d
docs: link auth-modes timing-safe mentions to security.md
tomaspozo Mar 31, 2026
e8cc9d0
docs: adding 'local cli' to secrets table
kallebysantos Mar 31, 2026
9381547
docs: setting Deno as first installation choice
kallebysantos Mar 31, 2026
1949544
docs: adding 'verify_jwt=false' disclaimer for non-user auth
kallebysantos Mar 31, 2026
539e1bc
docs: split Deno/Supabase runtime section, merge Deno/Node/Bun
tomaspozo Mar 31, 2026
c1ba488
docs(skills): adding legacy code migration example
kallebysantos Mar 31, 2026
aa98ea1
docs(skills): explaining why legacy code should be migrated
kallebysantos Mar 31, 2026
f8f4c3a
docs: rewrite migration section, improve skill description triggers
tomaspozo Mar 31, 2026
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
20 changes: 9 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,20 @@

## [0.1.1](https://github.com/supabase/server/compare/server-v0.1.0...server-v0.1.1) (2026-03-26)


### Features

* add `supabaseOptions` and refactor client creation to options objects ([#19](https://github.com/supabase/server/issues/19)) ([5a10099](https://github.com/supabase/server/commit/5a100995a1b6254f92768c82c74b1c754c29b3b2))
* implement server-side DX primitives, wrappers, and adapters ([#6](https://github.com/supabase/server/issues/6)) ([d206e5c](https://github.com/supabase/server/commit/d206e5cdb102bf96e0c501b72e7f161cbf9fba0c))
* passing down Database generic type to `createClient` ([#16](https://github.com/supabase/server/issues/16)) ([4053f6d](https://github.com/supabase/server/commit/4053f6d8db89201a239190a025b08cf19083acb4))
* set initial release version ([8352bda](https://github.com/supabase/server/commit/8352bda35c5967a6692f0a21744d30793e10709a))
* standardize error response ([#18](https://github.com/supabase/server/issues/18)) ([a7ddb74](https://github.com/supabase/server/commit/a7ddb74bfbbe4565d461be7df7f01e64854f6c06))

- add `supabaseOptions` and refactor client creation to options objects ([#19](https://github.com/supabase/server/issues/19)) ([5a10099](https://github.com/supabase/server/commit/5a100995a1b6254f92768c82c74b1c754c29b3b2))
- implement server-side DX primitives, wrappers, and adapters ([#6](https://github.com/supabase/server/issues/6)) ([d206e5c](https://github.com/supabase/server/commit/d206e5cdb102bf96e0c501b72e7f161cbf9fba0c))
- passing down Database generic type to `createClient` ([#16](https://github.com/supabase/server/issues/16)) ([4053f6d](https://github.com/supabase/server/commit/4053f6d8db89201a239190a025b08cf19083acb4))
- set initial release version ([8352bda](https://github.com/supabase/server/commit/8352bda35c5967a6692f0a21744d30793e10709a))
- standardize error response ([#18](https://github.com/supabase/server/issues/18)) ([a7ddb74](https://github.com/supabase/server/commit/a7ddb74bfbbe4565d461be7df7f01e64854f6c06))

### Bug Fixes

* key name resolution for client creation ([#9](https://github.com/supabase/server/issues/9)) ([e17bd4e](https://github.com/supabase/server/commit/e17bd4ecb1c46d0dc1468f363c884090d78ae86a))
* remove provenance until repo is public ([2ebbc71](https://github.com/supabase/server/commit/2ebbc71e214c4bbae62c6af203a039801b5e3d4d))
* removing `core` lib exports from root index ([#17](https://github.com/supabase/server/issues/17)) ([5e53e3c](https://github.com/supabase/server/commit/5e53e3c14fcc7c198f1c0bbec9089b4aedd91473))
* support bare array format for SUPABASE_JWKS ([#8](https://github.com/supabase/server/issues/8)) ([6bd2e4d](https://github.com/supabase/server/commit/6bd2e4dfc1b60ce4cc8a1b59435b87797e1cb017))
- key name resolution for client creation ([#9](https://github.com/supabase/server/issues/9)) ([e17bd4e](https://github.com/supabase/server/commit/e17bd4ecb1c46d0dc1468f363c884090d78ae86a))
- remove provenance until repo is public ([2ebbc71](https://github.com/supabase/server/commit/2ebbc71e214c4bbae62c6af203a039801b5e3d4d))
- removing `core` lib exports from root index ([#17](https://github.com/supabase/server/issues/17)) ([5e53e3c](https://github.com/supabase/server/commit/5e53e3c14fcc7c198f1c0bbec9089b4aedd91473))
- support bare array format for SUPABASE_JWKS ([#8](https://github.com/supabase/server/issues/8)) ([6bd2e4d](https://github.com/supabase/server/commit/6bd2e4dfc1b60ce4cc8a1b59435b87797e1cb017))

## 0.1.0 (2026-03-24)

Expand Down
79 changes: 73 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,22 @@ One import. One line of config. Auth is validated, clients are scoped, CORS is h
## Installation

```bash
# Deno
import { withSupabase } from "npm:@supabase/server";

# npm
npm install @supabase/server

# pnpm
pnpm add @supabase/server

# Deno / Supabase Edge Functions (no install — import directly)
import { withSupabase } from "npm:@supabase/server";
```

### AI coding skills

Install the skill so your AI coding agent (Claude Code, Cursor, etc.) knows how to use this package:

```bash
npx skills add supabase/server
```

## Quick Start
Expand Down Expand Up @@ -84,6 +95,34 @@ export default {
}
```

### Server-to-server

```ts
// Only accept the "automations" named secret key
export default {
fetch: withSupabase({ allow: 'secret:automations' }, async (req, ctx) => {
const body = await req.json()
const { data } = await ctx.supabaseAdmin
.from('scheduled_tasks')
.insert({ name: body.taskName })
return Response.json({ success: true, data })
}),
}
```

The caller sends the secret key in the `apikey` header:

```ts
await fetch('https://<project>.supabase.co/functions/v1/my-function', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
apikey: 'sb_secret_...', // the "automations" secret key
},
body: JSON.stringify({ taskName: 'cleanup' }),
})
```

## Auth Modes

| Mode | Credential | Use case |
Expand All @@ -95,7 +134,14 @@ export default {

Array syntax (`allow: ["user", "secret"]`) accepts multiple auth methods — first match wins.

Named key validation: `allow: "public:web_app"` validates against a specific named key in `SUPABASE_PUBLISHABLE_KEYS`.
Named key validation: `allow: "public:web_app"` or `allow: "secret:automations"` validates against a specific named key in `SUPABASE_PUBLISHABLE_KEYS` or `SUPABASE_SECRET_KEYS`.

> **Supabase Edge Functions:** By default, the platform requires a valid JWT on every request. If your function uses `allow: 'public'`, `allow: 'secret'`, or `allow: 'always'`, disable the platform-level JWT check in `supabase/config.toml`:
>
> ```toml
> [functions.my-function]
> verify_jwt = false
> ```

## Context

Expand Down Expand Up @@ -281,17 +327,38 @@ Also supported (for local dev, self-hosted, or other runtimes):

When both singular and plural forms are set, plural takes priority.

For other environments, pass overrides via the `env` config option or `resolveEnv()`.
For other environments, pass overrides via the `env` config option or `resolveEnv()`. See [`docs/environment-variables.md`](docs/environment-variables.md) for details.

## Runtimes

- **Supabase Edge Functions** — environment variables are auto-injected. Zero config.
- **Deno / Bun** — works out of the box with the `export default { fetch }` pattern.
- **Node.js** — use the [Hono adapter](#hono) or [core primitives](#primitives) with your framework of choice.
- **Cloudflare Workers** — enable `nodejs_compat` in `wrangler.toml` or pass env overrides via the `env` config option.
- **Next.js / Nuxt / SvelteKit / Remix** — use core primitives to build a cookie-based auth adapter. See [`docs/ssr-frameworks.md`](docs/ssr-frameworks.md).

## Exports

| Export | What's in it |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `@supabase/server` | `withSupabase`, `createSupabaseContext` |
| `@supabase/server/core` | `verifyAuth`, `verifyCredentials`, `extractCredentials`, `createContextClient`, `createAdminClient`, `resolveEnv` |
| `@supabase/server/wrappers` | `verifyWebhookSignature` |
| `@supabase/server/adapters/hono` | `withSupabase` (Hono middleware) |

## Documentation

| Question | Doc file |
| -------------------------------------------------------- | ---------------------------------------------------------------- |
| How do I create a basic endpoint? | [`docs/getting-started.md`](docs/getting-started.md) |
| What auth modes are available? Array syntax? Named keys? | [`docs/auth-modes.md`](docs/auth-modes.md) |
| How do I use this with Hono? | [`docs/hono-adapter.md`](docs/hono-adapter.md) |
| How do I use low-level primitives for custom flows? | [`docs/core-primitives.md`](docs/core-primitives.md) |
| How do environment variables work across runtimes? | [`docs/environment-variables.md`](docs/environment-variables.md) |
| How do I handle errors? What codes exist? | [`docs/error-handling.md`](docs/error-handling.md) |
| How do I get typed database queries? | [`docs/typescript-generics.md`](docs/typescript-generics.md) |
| How do I use this in Next.js, Nuxt, SvelteKit, or Remix? | [`docs/ssr-frameworks.md`](docs/ssr-frameworks.md) |
| What's the complete API surface? | [`docs/api-reference.md`](docs/api-reference.md) |

## Development

```bash
Expand Down
Loading
Loading