feat: add Express 5 adapter#66
Open
bogdantarasenko wants to merge 10 commits into
Open
Conversation
…dapter Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…terns Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@supabase/server/adapters/expresstargeting Express 5, mirroring the Hono/H3 adapter contract. Public surface (all fromsrc/adapters/express/index.ts):withSupabase()middleware,requireAuth()guard,withSupabaseRoute()per-route wrapper, and theWithSupabaseExpressConfigtype. Resolved context lives onres.locals.supabaseContextviaExpress.Localsdeclaration merging.onErroroption (default:next(error)— Express-idiomatic). Bridge from Expressreq→ FetchRequestpreserves headers (incl. multi-valueSet-Cookie/Cookie), absolute URL composition undertrust proxy, and forwards bodies for non-GET/HEAD methods. No new runtime deps —express ^5.0.0is an optional peer.package.json#exports,peerDependencies+peerDependenciesMeta,devDependencies,tsdown.config.ts,jsr.json. Docs atdocs/adapters/express.mdplus rows added to top-levelREADME.mdandsrc/adapters/README.mdadapter tables.Test plan
pnpm installresolves the new peer/dev dependenciespnpm typecheckpnpm lintpnpm test— covers everyAuthMode(user/publishable/secret/none), the array form, invalid-JWT / missing-credential failures, theres.locals.supabaseContextshort-circuit path, default and customonError, therequireAuth()guard (present / missing context / mode mismatch), and thewithSupabaseRoute()wrapper (success, auth failure, async-thrown errors)pnpm buildproducesdist/adapters/express/index.{mjs,cjs,d.mts,d.cts}import { withSupabase } from '@supabase/server/adapters/express'resolves from both ESM and CJS consumersapp.set('trust proxy', true)behind a reverse proxy to confirm the bridged URL usesX-Forwarded-*🤖 Generated with Claude Code