PitchHut logo
supabase-auth-starter
Effortless authentication for Next.js with Supabase and Google OAuth.
Pitch

Supabase Auth Starter provides a reusable template for Next.js applications, enabling seamless email/password and Google OAuth authentication. Featuring modern UI with Tailwind CSS and TypeScript support, this template simplifies authentication setup with protected routes and a password reset flow, making it the ideal solution for developers.

Description

Supabase Auth Starter

The Supabase Auth Starter is a robust authentication template designed for Next.js applications, seamlessly integrating Supabase for backend functionalities. It offers a streamlined setup for implementing both email/password authentication and Google OAuth, making it ideal for developers looking to quickly establish secure user authentication in their projects.

Key Features

  • Email/Password Authentication: Fully supports user sign-up, login, and password reset flows.
  • Google OAuth: Simplifies the sign-in experience with one-click authentication for users.
  • Protected Routes: Implements middleware for safeguarding user routes, ensuring only authenticated users can access certain parts of your application.
  • Tailored User Interface: Features a modern, responsive UI built with Tailwind CSS, enhanced by shadcn/ui components.
  • TypeScript Support: Ensures type safety throughout your code, reducing potential errors.
  • Next.js 16 Compatibility: Fully supports Next.js 16 with the App Router, allowing for improved routing capabilities.

Project Structure

The repository is organized with a clear structure to facilitate easy navigation and customization:

app/
├── auth/
│   ├── login/         # Login page with OAuth
│   ├── sign-up/       # Sign up page with OAuth
│   ├── confirm/       # OAuth callback handler
│   ├── forgot-password/# Password reset
│   └── error/         # Authentication error page
├── protected/         # Example protected route
components/
├── login-form.tsx     # Login form with Google OAuth
├── sign-up-form.tsx   # Sign up form with Google OAuth
lib/
└── supabase/
    ├── client.ts      # Client-side Supabase interaction
    └── server.ts      # Server-side Supabase integration
middleware.ts          # Handles route protection

Customization Options

The template allows for extensive customization, including:

  • Adding More OAuth Providers: Easily incorporate additional authentication methods by modifying the login and sign-up forms.
  • Changing Redirect URLs: Adjust redirect settings in the authentication functions for tailored user experiences.
  • Modifying Protected Routes: Customize middleware conditions for various access levels.
  • UI Personalization: Utilize the components folder to change the look and feel, aligning it with branding requirements.
  • Branding Changes: Edit layout files to reflect the desired aesthetics of your application.

Environment Variable Management

To utilize the Supabase service effectively, specific environment variables must be configured, ensuring proper API access:

VariableDescriptionLocation
NEXT_PUBLIC_SUPABASE_URLYour Supabase project URLSupabase Dashboard → Settings → API
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYSupabase anon/public keySupabase Dashboard → Settings → API
SUPABASE_SERVICE_ROLE_KEYService role key for admin operationsSupabase Dashboard → Settings → API

Technical Stack

  • Next.js 16: A powerful React framework facilitating server-side rendering.
  • Supabase: A valuable BaaS (Backend as a Service) combining database and authentication functionalities.
  • TypeScript: Enhances the project with static type validation.
  • Tailwind CSS: Provides a utility-first CSS framework for styling.
  • shadcn/ui: Integrated UI components to enhance user experience.

Rapid Deployment

Setting up this authentication template takes approximately 10 minutes, allowing any new project to quickly establish an authentication system, whether for web applications or more complex platforms.

This template represents a comprehensive solution for developers needing fast, reliable, and customizable authentication for Next.js applications.

0 comments

No comments yet.

Sign in to be the first to comment.