An open API service indexing awesome lists of open source software.

https://github.com/weehongkoh/nextjs-app-router-authjs

NextJs 15 Boilerplate with Auth.js (NextAuth) Library
https://github.com/weehongkoh/nextjs-app-router-authjs

authjs nextauth nextjs-app-router nextjs-boilerplate nextjs14 nextjs15 nextjs15-typescript

Last synced: 3 months ago
JSON representation

NextJs 15 Boilerplate with Auth.js (NextAuth) Library

Awesome Lists containing this project

README

        

# 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.

If you just want to implement the OAuth provider only, this [OAuth branch](https://github.com/weehongayden/nextjs-app-router-nextauth/tree/oauth-provider) is for you.

## 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
- [x] Google
- [x] Discord
- [x] Auth0
- [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=

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
- [Auth.js](https://authjs.dev/getting-started/installation?framework=Next.js)
- [YouTube | How To Set Up Next Auth 5 in Next.js 15 [ project code included ] ](https://www.youtube.com/watch?v=xHQQ5I7E_H8&t=322s)