feat(02-01): install next-auth@4, configure CredentialsProvider auth

- Add next-auth@4 dependency (stable v4, not beta v5)
- Create src/lib/auth.ts with CredentialsProvider validating ADMIN_EMAIL/ADMIN_PASSWORD env vars
- Create src/app/api/auth/[...nextauth]/route.ts catch-all handler (GET + POST)
- JWT session strategy — stateless, no DB users table
- Custom sign-in page set to /admin/login
- Add NEXTAUTH_URL, NEXTAUTH_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD to .env.local
This commit is contained in:
Simone Cavalli
2026-05-15 10:40:30 +02:00
parent 56dd18b0c2
commit 5d363a633d
4 changed files with 226 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@
"lucide-react": "^1.14.0",
"nanoid": "^5.1.11",
"next": "16.2.6",
"next-auth": "^4.24.14",
"postgres": "^3.4.9",
"react": "19.2.4",
"react-dom": "19.2.4",