nextjs-app-router-nextauth icon indicating copy to clipboard operation
nextjs-app-router-nextauth copied to clipboard

NextJs 14 Boilerplate with NextAuth Library

NextJs 14 App Router and NextAuth Boilerplate

NextJs 14 App Router and NextAuth

Demo Link

This is a NextJs 14 App Router boilerplate that uses the NextAuth library.

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

If you just want to implement the OAuth provider only, this OAuth branch is for you.

Latest Implementation

  • 04 May, 2024 - Add Database Adapter on the Custom Page

Pages

  • [x] Protected Page
  • [x] NextJs Middleware
  • [x] 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=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

DISCORD_CLIENT_ID=
DISCORD_CLIENT_SECRET=

HASURA_PROJECT_ENDPOINT=
HASURA_ADMIN_SECRET=