Skip to content

feat: add H3 adapter#36

Merged
kallebysantos merged 6 commits intosupabase:mainfrom
wobsoriano:rob/h3-adapter
Apr 23, 2026
Merged

feat: add H3 adapter#36
kallebysantos merged 6 commits intosupabase:mainfrom
wobsoriano:rob/h3-adapter

Conversation

@wobsoriano
Copy link
Copy Markdown
Contributor

@wobsoriano wobsoriano commented Apr 22, 2026

What kind of change does this PR introduce?

Feature

What is the current behavior?

No adapter exists for H3-based frameworks. Users building APIs with Nuxt or Nitro have to wire up Supabase auth manually using core primitives.

What is the new behavior?

Adds @supabase/server/adapters/h3, a first-class middleware adapter for H3 v2. H3 is the server framework underlying both Nuxt and Nitro, so this adapter covers both ecosystems in one addition.

Usage with a plain H3 app:

import { H3 } from 'h3'
import { withSupabase } from '@supabase/server/adapters/h3'

const app = new H3()
app.use(withSupabase({ allow: 'user' }))

app.get('/games', async (event) => {
  const { supabase } = event.context.supabaseContext
  const { data: myGames } = await supabase.from('favorite_games').select()
  return myGames
})

Usage in a Nuxt server route (server/api/games.get.ts):

export default defineHandler({
  middleware: [withSupabase({ allow: 'user' })],
  handler: async (event) => {
    const { supabase } = event.context.supabaseContext
    return supabase.from('favorite_games').select()
  },
})

in a Nuxt server middleware:

export default withSupabase({ allow: 'user' })

// event.context.supabaseContext will be available in all server routes

Additional context

  • Test coverage mirrors the Hono adapter tests.
  • README updated with H3/Nuxt examples, the Exports table, and the Runtimes section.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@36

commit: ee457e7

Comment thread README.md Outdated
@tomaspozo tomaspozo added the enhancement New feature or request label Apr 22, 2026
@kallebysantos
Copy link
Copy Markdown
Member

kallebysantos commented Apr 23, 2026

@wobsoriano thank you so much 💚
I honestly never tried H3 framework, but if you feel this current impl matches the community needs I'll be happy to merge your adapter.

Our intention is let /adapters folder as community place, so anyone is welcome to improve it 🙏

@wobsoriano
Copy link
Copy Markdown
Contributor Author

@wobsoriano thank you so much 💚 I honestly never tried H3 framework, but if you feel this current impl matches the community needs I'll be happy to merge your adapter.

Our intention is let /adapters folder as community place, so feel anyone is welcome to improve it 🙏

amazing! Im confident with the current implementation now 🚀

Question: Will this repo only accept runtimes that expose a fetch handler, or is there appetite for framework middleware adapters that don't follow the export default { fetch } pattern, specifically tanstack start which has middleware but no app.fetch equivalent? (feel free to ignore this question!)

Comment thread src/adapters/h3/middleware.test.ts Outdated
Comment thread package.json
@kallebysantos
Copy link
Copy Markdown
Member

Hey mate, I moved your question to this discussion #39.
Feel free to append more thoughts to it 💚

@kallebysantos kallebysantos merged commit 4310142 into supabase:main Apr 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants