Authentication playground built with Next.js 16 (App Router) and NextAuth v5 using Credentials, Prisma, and libSQL/SQLite. Includes login, register, and password reset flows plus a protected route to test redirects and sign-out.
- Next.js 16 + TypeScript (App Router)
- NextAuth v5 with
Credentialsprovider - Prisma +
@prisma/adapter-libsql(SQLite locally or LibSQL/Turso) - Password hashing with
bcrypt-ts - Tailwind CSS 4 and custom styles in
src/app/globals.css
- Node 20+ and pnpm
- Environment variables in
.env
-
Install dependencies
pnpm install -
Copy env vars and set a secret
cp env.example .env
UpdateAUTH_SECRET(e.g.openssl rand -base64 32).DATABASE_URLdefaults tofile:./prisma/dev.dbbut can point to a LibSQL/Turso endpoint. -
Generate Prisma client and create the database
pnpm prisma generate
pnpm prisma db push -
Seed sample data
pnpm db:seed -
Run locally
pnpm dev→ http://localhost:3000
/landing with quick links/logincredentials sign-in/registeruser registration/reset-passwordchange password/protectedguarded route; middleware insrc/proxy.tsredirects when unauthenticated
[email protected]/password123[email protected]/password123
auth.ts: NextAuth config and credentials providersrc/actions/*: Server Actions for login, register, resetlib/prisma.ts: Prisma client with libSQL adapterprisma/schema.prisma:Usermodelsrc/app/**: views and forms for the flows
pnpm devstart in developmentpnpm build/pnpm startproduction build & servepnpm lintrun ESLintpnpm db:seedpopulate demo users