1.0.1 • Published 11 months ago
create-next-supabase-auth v1.0.1
Next.js Supabase Auth Boilerplate
This is a boilerplate for Next.js applications with Supabase authentication. It includes a complete authentication flow with protected routes and middleware.
Features
- 🔐 Authentication with Supabase
- 🛡️ Protected routes with middleware
- 🎨 Styled with Tailwind CSS
- 📱 Responsive design
- 🔄 Type-safe with TypeScript
Getting Started
- Clone this repository
Install dependencies:
npm installCreate a Supabase project at https://supabase.com
Copy
.env.local.exampleto.env.localand update with your Supabase credentials:cp .env.local.example .env.localUpdate the environment variables in
.env.local:NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-keyRun the development server:
npm run devOpen http://localhost:3000 with your browser to see the result.
Project Structure
/app- Next.js 13 app directory/auth- Authentication pages (login, callback)/dashboard- Protected dashboard page
/lib- Utility functions and configurationssupabase.ts- Supabase client configuration
Authentication Flow
- Users can sign in/up through the
/auth/loginpage - After successful authentication, they are redirected to
/dashboard - Protected routes are handled by the middleware
- Unauthenticated users are redirected to the login page
- Authenticated users are redirected away from auth pages
Technologies Used
1.0.1
11 months ago