This app includes a complete user authentication flow with:
- Web login/register UI in
app/page.tsx - Post-login dashboard in
app/dashboard/page.tsx - MongoDB user storage in database
simpletest - Secure password hashing with
bcryptjs - HTTP-only cookie sessions signed with JWT
npm installCreate .env.local from .env.example and set values:
MONGODB_URI=mongodb://127.0.0.1:27017
JWT_SECRET=replace_with_a_long_random_secretMONGODB_URI should point to your MongoDB server.
The app always uses database name simpletest.
npm run devOpen http://localhost:3000.
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/mePOST /api/auth/logout
After login, users are redirected to /dashboard, which displays all documents from the MongoDB collection tests in database simpletest.
Optional fields used by the UI per test document:
title(string)description(string)durationMinutes(number)questionsCount(number)