Skip to content

paullkw/SimpleTestWeb

Repository files navigation

SimpleTest Web Login

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

1. Install dependencies

npm install

2. Configure environment variables

Create .env.local from .env.example and set values:

MONGODB_URI=mongodb://127.0.0.1:27017
JWT_SECRET=replace_with_a_long_random_secret

MONGODB_URI should point to your MongoDB server. The app always uses database name simpletest.

3. Run the app

npm run dev

Open http://localhost:3000.

API routes

  • POST /api/auth/register
  • POST /api/auth/login
  • GET /api/auth/me
  • POST /api/auth/logout

Dashboard tests source

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)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages