Commit Graph

26 Commits

Author SHA1 Message Date
bogdantarasenko 3052a6b309 feat: add NestJS adapter (#55)
* feat: add NestJS adapter

Ships `@supabase/server/adapters/nestjs`:

- `withSupabase(opts)` — class guard for `@UseGuards()` and
  `useGlobalGuards()`, supporting Express and Fastify
- `@SupabaseCtx(key?, ...pipes)` — param decorator returning the full
  SupabaseContext or a single field, with NestJS pipes applied to the
  extracted value
- 401s thrown as `HttpException` with `{ message, code }`; the
  underlying `AuthError` is exposed on `cause`

Adds `@nestjs/common` as an optional peer dep (`^10 || ^11`), wires the
new export in package.json / jsr.json / tsdown.config.ts, and enables
`experimentalDecorators` + `emitDecoratorMetadata` in tsconfig. Test
setup uses unplugin-swc via vitest.config.ts so integration tests can
boot a real Nest app on both Express and Fastify.

Docs: README quickstart + docs/adapters/nestjs.md.

* refactor(nestjs): address PR review feedback

- Scope `experimentalDecorators` + `emitDecoratorMetadata` to
  `src/adapters/nestjs/tsconfig.json` (extends root) and exclude the
  adapter from the root project so the options aren't enforced
  repo-wide. `typecheck` now runs both projects.
- Convert `vitest.config.ts` to the `projects` syntax so the
  `unplugin-swc` transform applies only to the nestjs project; the unit
  project runs unchanged with esbuild.
- Throw `HttpException` (500, `unsupported_context`) instead of
  returning true on non-HTTP execution contexts so misuse fails loudly
  on the first request rather than silently no-op'ing on every
  RPC/WebSocket message.
- Remove the "skip if context already set" branch so handler-level
  guards can tighten what a global guard set. Previously the outer
  (global) guard always won under Nest's global → controller → handler
  order, so a stricter handler-level guard could be silently bypassed.
  Tests updated; `@SupabaseCtx` decorator unchanged.
- Drop unused `CanActivate` import from integration.test.ts.

* docs(nestjs): update guard behavior section to match new semantics

The guard no longer skips when a prior context exists — it always
re-evaluates. Rewrite the doc section to match the JSDoc wording and
the inner-rejects/inner-overwrites tests.
2026-05-27 11:03:56 -05:00
supabase-releaser[bot] ad1f888e04 chore(main): release server 1.1.0 (#58)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-05-19 17:40:33 +01:00
Robert Soriano 148169e5f7 feat: add Elysia adapter (#46)
* feat: add Elysia adapter

* chore: remove added property in package.json

* chore: dedupe

* chore: match existing files markdown file location

* chore: match v1 API

* chore: resolve review

* chore: dedupe

* chore: type SupabaseError.cause and simplify constructor

---------

Co-authored-by: Tomas Pozo <tomaspozogarzon@gmail.com>
2026-05-19 10:16:54 -05:00
Katerina Skroumpelou 5721d1fc7a chore: update pnpm to 11.1.2 (#64) 2026-05-15 10:42:31 +03:00
Katerina Skroumpelou 8b9a84a1cb chore(security): harden supply chain and CI workflows (#61)
* chore(security): harden supply chain and CI workflows

* chore(repo): add codeowners
2026-05-12 11:21:49 +02:00
supabase-releaser[bot] 634f239701 chore(main): release server 1.0.0 (#51)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-05-06 12:26:55 +03:00
Katerina Skroumpelou eda6d73f69 docs: setup typedoc and gh pages (#45) 2026-04-30 10:50:20 +03:00
supabase-releaser[bot] 2fb043ea00 chore(main): release server 0.2.0 (#38)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-04-24 15:27:26 -05:00
Robert Soriano 43101427e6 feat: add H3 adapter (#36)
* feat: add H3 adapter

* feat: add handler overload to H3 adapter for Nuxt file routes

* chore: reinstall and dedupe

* refactor: use defineHandler middleware composition for per-route auth

* test: sensible secret key mock
2026-04-23 21:59:25 +01:00
supabase-releaser[bot] b87e89af37 chore(main): release server 0.1.4 (#27)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-04-01 12:22:26 +03:00
supabase-releaser[bot] d2095bbb64 chore(main): release server 0.1.3 (#26)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-04-01 11:07:58 +03:00
Tomás Pozo 10c8780cc2 fix: move SKILL.md into skills/ subdirectory to align with agentskills spec (#24) 2026-04-01 11:04:43 +03:00
supabase-releaser[bot] 7086e82518 chore(main): release server 0.1.2 (#23)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-03-31 20:35:12 -05:00
Tomás Pozo 7c67416f46 refactor: remove @supabase/server/wrappers module (#21)
Webhook signature verification varies too much across providers
to justify a generic helper. Each case should be handled with
the provider's own SDK (e.g., Stripe, GitHub).
2026-03-31 22:31:21 +01:00
Tomás Pozo 661329bb9e docs: add SDK documentation and SKILL.md (#20)
* docs: add initial documentation and skills.md

* docs: apply formatting

* docs: update SKILL.md to resolve docs from package location and ship docs with npm

SKILL.md now instructs agents to find documentation in the installed
@supabase/server package (node_modules or repo root) instead of using
relative paths. Added docs/ and SKILL.md to package.json files array
so they ship with npm installs.

* docs: add missing HTTPException import in error-handling example

* docs: fix strictNullChecks issues, duplicate variables, and missing context in examples

- Add non-null assertions (!) after error guards where TS can't narrow
  destructured result tuples
- Split duplicate variable declarations into separate code blocks
- Add missing imports and show where variables like `auth` come from
- Keep { data, error } destructuring pattern consistent with SDK convention

* docs: reframe as runtime-agnostic and add env auto-injection details

- getting-started: replace Edge Function framing with runtime-neutral
  language, explain module worker pattern works across Deno/Bun/Workers,
  add Runtimes section covering all supported environments
- webhooks: replace Deno.env with process.env for portable examples
- environment-variables: add "Auto-injected in" column distinguishing
  Platform vs Local CLI, reframe section headers
- auth-modes: clean up example key values
- core-primitives: clarify "Integration with frameworks" wording
- types: simplify TSDoc for publishable/secret key descriptions

* docs: add SSR frameworks guide and update references

Add docs/ssr-frameworks.md covering the pattern for using core
primitives in Next.js, SvelteKit, Nuxt, and Remix — cookie extraction,
env bridging, JWKS caching, and a complete Next.js adapter example.

Replace the basic SSR example in core-primitives.md with a pointer
to the new dedicated doc. Add SSR row to SKILL.md routing table.

* docs: add disclaimer of new package

* docs: extend explanation on keys env vars

* docs: add platform-specific quick starts to SKILL.md

Split the single generic example into per-platform sections
(Edge Functions, Cloudflare Workers, Hono, SSR Frameworks) so
AI agents pick the correct import specifier for each runtime.
Adds npm: prefix to all Deno examples and a Deno column to the
entry points table. Also adds createSupabaseContext examples.

* docs: add server-to-server quick starts and allow:always guardrails

Add secret key auth and webhook signature verification quick starts
to SKILL.md. Add explicit decision tree for allow:'always' so AI
agents confirm with the user before leaving endpoints unprotected.

* docs: add legacy keys warning, skills install, remove webhook docs

- Add legacy keys warning to SKILL.md (avoid anon/service_role keys)
- Add AI coding skills install section to README
- Add server-to-server quick start with caller code to README
- Add runtimes, documentation table, and named secret keys to README
- Remove verifyWebhookSignature references from all docs
- Delete docs/webhooks.md (code removal in separate PR)

* docs: add verify_jwt = false note for non-user auth modes

Edge Functions require verify_jwt = false in config.toml when
using allow: public, secret, or always — otherwise the platform
rejects requests before the handler runs.

* docs: add edge function recipes and refactor env vars doc

Add recipes for function-to-function calls, pg_net from database,
Stripe webhooks, and generic webhook signature verification.
Document the @supabase/server/wrappers entry point.
Refactor environment-variables.md into Supabase vs non-Supabase sections.

* docs: add security doc covering timing-safe comparison, auth model, CORS

* docs: link auth-modes timing-safe mentions to security.md

* docs: adding 'local cli' to secrets table

This envs will be injected from cli too

* docs: setting Deno as first installation choice

* docs: adding 'verify_jwt=false' disclaimer for non-user auth

* docs: split Deno/Supabase runtime section, merge Deno/Node/Bun

* docs(skills): adding legacy code migration example

* docs(skills): explaining why legacy code should be migrated

* docs: rewrite migration section, improve skill description triggers

---------

Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com>
2026-03-31 16:14:55 -05:00
supabase-releaser[bot] a59a410cf3 chore(main): release server 0.1.1 (#12)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-03-27 15:37:57 -05:00
Katerina Skroumpelou e850f3db1f chore: bump alpha version (#13) 2026-03-24 13:54:13 +02:00
Katerina Skroumpelou eee605489a ci: change package name and release first alpha (#11)
* ci: change package name and release first alpha

* chore: change package name
2026-03-24 13:46:48 +02:00
supabase-releaser[bot] ee4ff62d06 chore(main): release server 0.1.3 (#7)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-03-20 15:47:21 -05:00
Tomás Pozo d206e5cdb1 feat: implement server-side DX primitives, wrappers, and adapters (#6)
Two-layer architecture:
- Layer 1 (wrappers): withSupabase
- Layer 2 (core): verifyAuth, verifyCredentials,
  extractCredentials, createContextClient,
  createAdminClient, resolveEnv

Features:
- Auth modes: always, public, secret, user
(with named key support).
- CORS handling built into withSupabase.
- Hono middleware adapter.
- JWKS-based JWT verification via jose.

---------

Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com>
2026-03-20 01:36:52 -05:00
supabase-releaser[bot] 13eccc03a2 chore(main): release edge-functions 0.1.2 (#4)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-02-24 19:11:23 +02:00
supabase-releaser[bot] 4206875148 chore(main): release edge-functions 0.1.1 (#3)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-02-24 19:08:22 +02:00
supabase-releaser[bot] fc00cf124e chore(main): release edge-functions 0.1.0 (#2)
Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
2026-02-24 19:07:28 +02:00
Katerina Skroumpelou ea63894622 chore: set up lint and typecheck 2026-02-24 18:34:12 +02:00
Katerina Skroumpelou 6c37086ecf chore: git hooks 2026-02-24 18:25:54 +02:00
Katerina Skroumpelou e2c51541f5 init commit 2026-02-24 18:06:08 +02:00