Hey everyone!
I've been using the Next.js App Router + Supabase stack a lot lately. It’s a fantastic combo, but honestly, setting up middleware.ts, auth hooks, and Server Actions error handling from scratch every single time gets exhausting.
So, I decided to bundle the utilities I use most into a tiny open-source package: next-supa-utils
The core features are simple but hopefully save you a ton of time:
withSupaAuth: Turn your route protection in Middleware into a single line of code.
useSupaUser & useSupaSession: Clean, type-safe hooks for your Client Components.
actionWrapper: Automatically handles try-catch and standardizes error responses for Server Actions.
It's fully written in TypeScript. If you're currently building with Next.js and Supabase, I'd love for you to try it out!
npm i next-supa-utils
If you find it helpful, a star or any feedback would mean a lot!
Happy coding!
The user 'lvthan' has created an open-source package called 'next-supa-utils' to simplify the integration of Next.js and Supabase. This package includes utilities for route protection, hooks for client components, and error handling for server actions, all written in TypeScript. The user invites others to try it and provide feedback.
La solución no es adaptarse a la dependencia de servicios de terceros sino crear tus propias soluciones, entre más dependas de servicios de terceros más vulnerable serás
Curious what parts of this we could fold into supabase.com/ui
Use three separate Supabase clients: (1) browser client for client components, (2) server client for Server Components and API routes (uses cookies), (3) admin client with service role key for operations that bypass RLS. The server client is the one most people miss — you need it to maintain the auth session in Server Components.