Nextjs Sessionauth Template screenshot

Nextjs Sessionauth Template

Author Avatar Theme by Saasykits
Updated: 20 Jan 2025
529 Stars

Next.js starter template featuring session-based auth, drizzle-orm, tailwind, shadcn ui, stripe, react-email etc.

Categories

Overview:

The Next.js Auth Starter Template provides a flexible alternative to NextAuth.js for implementing authentication in Next.js projects. It is designed to handle Email+Password authentication efficiently, offering more customization options without compromising security. This template serves as a foundation for creating Next.js applications with Lucia authentication.

Features:

  • Authentication: Support for Credential and OAuth authentication.
  • Authorization: Easily manage public and protected routes within the app directory.
  • Email Verification: Verify user identities through email.
  • Password Reset: Streamline password resets by sending email password reset links.
  • Lucia + tRPC: Enables granting access to sessions and user information through tRPC procedures.
  • E2E tests: Comprehensive end-to-end testing to catch issues before users do.
  • Stripe Payment: Seamless setup for user subscriptions with Stripe.
  • Email template with react-email: Customize email templates using React.
  • PostgreSQL Database: Utilize a PostgreSQL database set up using Drizzle for enhanced performance and type safety.
  • Database Migration: Included migration script to extend the database schema according to project needs.

Installation:

  1. Clone this repository to your local machine.
  2. Copy .env.example to .env and fill in the required environment variables.
  3. Run pnpm install to install dependencies.
  4. Uncomment polyfills for webCrypto in src/lib/auth/index.ts for old Node versions.
  5. Update app title, database prefix, and other parameters in src/lib/constants.ts file.
  6. Run pnpm db:push to push your schema to the database.
  7. Execute pnpm dev to start the development server.

Summary:

The Next.js Auth Starter Template offers a customizable solution for implementing authentication in Next.js projects, especially Email+Password authentication. With features like email verification, password reset, and Stripe integration, developers can efficiently set up secure authentication systems. The template also provides flexibility for customization while ensuring comprehensive testing and database management capabilities.