/nextjs-app-router-authjs

NextJs 15 Boilerplate with Auth.js (NextAuth) Library

Primary LanguageTypeScript

NextJs 15 App Router and Auth.js (Next Auth) Boilerplate

NextJs 15 App Router and Auth.js (Next Auth)

Demo Link

This is a NextJs 15 App Router boilerplate that uses the Auth.js (Next Auth) library.

The current repository includes a database adapter, which increases the complexity of the code.

Latest Implementation

  • 14-03-2025 - Upgrade package ESLint 9, TailwindCSS 4, etc
  • 18-01-2025 - Upgrade to NextJs 15 and Auth.js (Next Auth)
  • 29-08-2024 - Add Auth0 Provider
  • 08-06-2024 - Add login credential on Custom Login
  • 04-05-2024 - Add database adapter on Custom Login
  • 06-03-2024 - Update the Landing Page and Custom Login Page
  • 06-03-2024 - Upgrade NPM Package to Latest Version

Features

  • Providers
    • Google
    • Discord
    • Auth0
  • Protected Page
  • NextJs Middleware
  • Database Adapter (PostgreSQL and Hasura)

How to Use?

Clone this repository.

Copy the .env.example and rename it as .env . Insert the value to respective field

Run the following command to generate NEXTAUTH_SECRET, openssl rand -base64 32.

NEXTAUTH_URL=
NEXTAUTH_SECRET=

AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=

AUTH_DISCORD_ID=
AUTH_DISCORD_SECRET=

AUTH_AUTH0_ID=
AUTH_AUTH0_SECRET=
AUTH_AUTH0_ISSUER=

AUTH_HASURA_GRAPHQL=
AUTH_HASURA_SECRET=

Reference