Dashboard
Next.js Supabase Authentication Starter
A complete, production-ready authentication starter template built with Next.js 15, Supabase, Tailwind CSS, and Shadcn/ui. This project provides a solid foundation for building web applications with secure user authentication and modern UI components.

โจ Features
๐ Complete Authentication Flow
- User registration with email verification
- Secure login/logout functionality
- Password reset and recovery
- Protected route middleware
- Session management
๏ฟฝ๏ฟฝ Modern UI/UX
- Beautiful, responsive design with Tailwind CSS
- Supabase UI - Official React components built on shadcn/ui
- Shadcn/ui components for consistent styling
- Toast notifications with Sonner
- Dark/light theme support
- Mobile-first responsive design
๐ Next.js 15 Features
- App Router with TypeScript
- Server-side rendering (SSR)
- Middleware for route protection
- Turbopack for fast development
๐ Security & Best Practices
- Supabase authentication with SSR support
- Environment variable management
- Type-safe development
- ESLint configuration
๐๏ธ Project Structure
nextjs-supabase-v1/ โโโ app/ # Next.js App Router โ โโโ (public)/ # Public routes โ โโโ auth/ # Authentication pages โ โ โโโ actions/ # Auth server actions โ โ โโโ components/ # Auth UI components โ โ โโโ login/ # Login page โ โ โโโ sign-up/ # Registration page โ โ โโโ forgot-password/ # Password reset โ โ โโโ ... # Other auth flows โ โโโ dashboard/ # Protected dashboard โ โโโ protected/ # Protected routes โ โโโ layout.tsx # Root layout โโโ components/ # Reusable UI components โ โโโ ui/ # Shadcn/ui components โโโ lib/ # Utility libraries โ โโโ supabase/ # Supabase configuration โโโ middleware.ts # Route protection middleware โโโ types/ # TypeScript type definitions
๐ Quick Start
Prerequisites
- Node.js 18+
- npm, yarn, or pnpm
- Supabase account and project
1. Clone the Repository
git clone <your-repo-url>
cd nextjs-supabase-v1
2. Install Dependencies
npm install
# or
yarn install
# or
pnpm install
3. Set Up Supabase
- Create a new project at supabase.com
- Go to Settings โ API to get your project credentials
- Create a
.env
file in the root directory (rename from.env.local
if needed):
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
4. Run the Development Server
npm run dev
# or
yarn dev
# or
pnpm dev
Open http://localhost:3000 in your browser to see the application.
๐ง Available Scripts
npm run dev
- Start development server with Turbopacknpm run build
- Build for productionnpm run start
- Start production servernpm run lint
- Run ESLint
๐ฏ Authentication Features
User Registration
- Email-based signup with verification
- Form validation and error handling
- Success/error notifications
User Login
- Secure authentication with Supabase
- Session persistence
- Automatic redirects
Password Management
- Forgot password functionality
- Secure password reset via email
- Password update for authenticated users
Route Protection
- Middleware-based authentication checks
- Automatic redirects for unauthenticated users
- Protected dashboard and routes
๐จ UI Components
This project uses the official Supabase UI library built on top of Shadcn/ui and Radix UI primitives. Supabase UI provides pre-built components that seamlessly connect your frontend to your Supabase backend.
Why Supabase UI?
- ๐ Official Integration - Built and maintained by the Supabase team
- ๐ Backend Connected - Components automatically connect to your Supabase project
- ๐ฏ Production Ready - Battle-tested components used in real applications
- ๐ฑ Responsive Design - Mobile-first components with modern UX patterns
Available Supabase UI Blocks:
- Authentication (Password-based & Social)
- File uploads and management
- Realtime features (cursors, chat, avatars)
- Infinite queries and data fetching
- User management and profiles
Shadcn/ui Components:
- Button - Various button styles and variants
- Card - Content containers with consistent styling
- Dialog - Modal dialogs and overlays
- Input - Form input fields
- Label - Accessible form labels
- Badge - Status indicators and tags
- Toast - Notification system with Sonner
๐ Security Features
- Supabase SSR - Server-side rendering support for authentication
- Middleware Protection - Route-level security with automatic redirects
- Environment Variables - Secure credential management
- Type Safety - Full TypeScript support for better development experience
๐ Deployment
Vercel (Recommended)
- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically on push
Other Platforms
The project can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
๐ฑ Responsive Design
- Mobile-first approach
- Responsive breakpoints for all screen sizes
- Touch-friendly interface elements
- Optimized for both desktop and mobile devices
๐จ Customization
Styling
- Modify
app/globals.css
for global styles - Update Tailwind configuration in
tailwind.config.js
- Customize component themes in
components.json
Components
- Add new Shadcn/ui components:
npx shadcn@latest add [component]
- Modify existing components in
components/ui/
- Create custom components in
components/
Authentication
- Extend auth flows in
app/auth/
- Modify middleware behavior in
middleware.ts
- Add custom Supabase functions in
lib/supabase/
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ License
This project is open source and available under the MIT License.
๐ Support
If you encounter any issues or have questions:
- Check the Supabase documentation
- Review Next.js documentation
- Open an issue in this repository
๐ Acknowledgments
- Next.js - React framework
- Supabase - Backend as a service
- Shadcn/ui - UI component library
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Unstyled UI primitives
Happy coding! ๐