
@supabase/middleware lets TypeScript developers write per-request logic once, then reuse it across Fetch runtimes and frameworks.
Supabase shipped the free, MIT-licensed package on 2 October 2026 at Supabase Select. According to the launch post, it works anywhere that supports the Web Fetch API, including Cloudflare Workers, Deno and Bun.
The same middleware can run inside Hono, H3, Elysia, NestJS and TanStack Start. Each framework needs a short bridge file copied into the project.
How @supabase/middleware Builds a Request Pipeline
Middleware is added to an ordered pipeline in front of the Fetch handler. Each entry handles one part of the request, such as CORS, identity checks or Supabase client setup. The pipeline stops when an error occurs rather than continuing into the handler.
The package also works with @supabase/server. Supabase launched that package in May to give each handler a client scoped to the caller, an admin client, and verified identity and claims. The new middleware package puts that setup and additional request checks into the same ordered list.
| Request task | Middleware role | What reaches the handler |
|---|---|---|
| CORS | Applies cross-origin request rules | A request that has passed the configured CORS checks |
| JWT verification | Verifies identity and required claims | Verified identity and claims |
| Supabase setup | Creates the Supabase client context | A client scoped to the caller |
Developers can also define their own middleware for request-level jobs such as checking a feature flag. Each piece can be composed with the others in the order the application needs.
Moving Logic Between Runtimes
Before this release, logic layered on top of @supabase/server stayed inside the original handler. Moving to another runtime meant rewriting it. Adopting a framework meant converting it to that framework’s middleware format. A second project often meant another copied implementation.
@supabase/middleware separates that logic from the runtime and framework. The same middleware can sit in a standard Fetch handler or connect to a supported framework through its bridge file. Its types also build the request context as the pipeline runs, so later middleware and the final handler can use the context added by earlier steps.
The package is aimed at TypeScript developers writing Fetch handlers. It is available now under the MIT licence.
Frequently asked questions
What is @supabase/middleware?
It is Supabase’s type-safe middleware library for Web Fetch handlers. It lets developers compose request logic once and run it across Fetch runtimes or inside supported TypeScript frameworks.
Is @supabase/middleware free?
Yes. The package is free and released under the MIT licence.
Which runtimes and frameworks support @supabase/middleware?
It runs on Fetch-compatible runtimes including Cloudflare Workers, Deno and Bun. Supabase lists Hono, H3, Elysia, NestJS and TanStack Start as supported frameworks, connected through a short bridge file.
Sources
3 checkedHow we cover tool news: Create With's tool desk drafts these reports with AI from the sources listed above and checks them against those sources before publishing.








