Authenticate Next 14 App Router with Lucia Auth

Credential Auth and OAuth Github

Nemesis Blog
10 min readMar 2, 2024

--

This Post will guide you to Authenticate Next 14 App with Credential (Username and Password) or OAuth Github using Lucia Auth, validate form Register and Login using Zod, save data user to Database using DrizzleORM and Neon.

Prerequisite:

  1. Next 14
  2. TailwindCSS
  3. Neon Database
  4. Lucia Auth
  5. Drizzle ORM
  6. Zod

Installation:

To install this prerequisite run this command

// Next App
npx create-next-app@latest

// Lucia Auth
npm i lucia @lucia-auth/adapter-drizzle arctic oslo postgres

// Drizzle
npm i drizzle-orm
npm i -D drizzle-kit

// Neon Database
npm i @neondatabase/serverless

// Zod and Radix Icon
npm i zod @radix-ui/react-icons

Setting Environment:

  • Create new file .env.local on the root folder
  • Create New OAuth Apps Github in here and copy Github ID and Secret Key to GITHUB_ID and…

--

--