1.0.3 • Published 6 months ago
create-copycoder-auth v1.0.3
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 install
Create a Supabase project at https://supabase.com
Copy
.env.local.example
to.env.local
and update with your Supabase credentials:cp .env.local.example .env.local
Update the environment variables in
.env.local
:NEXT_PUBLIC_SUPABASE_URL=your-project-url NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
Run the development server:
npm run dev
Open 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/login
page - 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