Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 963 Bytes

README.md

File metadata and controls

37 lines (27 loc) · 963 Bytes

NextAuth v5 - Middleware Authentication

Key Features:

  • Next.js 14
  • Next Auth v5 (Auth.js)
  • Credentials Provider
  • Protected routes & redirect if logged
  • Server Actions
  • Forms
  • useFormState hook
  • Server-side form validation with zod
  • Unit and Integration tests
  • Complete test setup for Next Auth
  • Mocks of server actions and useFormState hook

This repository serves as an example of how to implement an authentication flow with middleware using next-auth v5. this repo also contains the necessary configs to setup a test environment for next-auth v5 using jest/testing-library, also containing examples of how to mock a server action and the useFormState hook.

This repository uses react and react-dom in canary versions.

Cloning the repository

git clone https://github.com/renanleonel/next-auth-v5-middleware.git

Install packages

pnpm i

Start application

pnpm run dev