Introducing @supabase/server
Blog post from Supabase
Supabase has launched a new package, @supabase/server, in public beta to streamline server-side development by eliminating repetitive setup code for Edge Functions, Cloudflare Workers, Hono, and Bun. The package provides a pre-configured SupabaseContext, which includes user-scoped and admin clients, JWT verification, and auth metadata, simplifying the process of setting up authentication and request contexts. Developers can utilize the withSupabase wrapper for automatic handling of auth, client creation, and CORS, enabling them to focus on business logic without managing shared utility files or environment variables. The package supports various runtime environments and offers composable primitives for advanced use cases, facilitating smooth transitions to new API keys and enhancing project security. As a result, developers can implement consistent patterns across functions, making it easier for both humans and AI agents to produce correct code. The package is compatible with multiple frameworks and runtimes, with full documentation available on GitHub, and feedback is encouraged to improve its API surface and address any edge cases.