Skip to content

Alafiya766/ThinkIQ-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎓 ThinkIQ — Quiz Application

A full-stack quiz application built using Node.js, Express.js, MySQL, and vanilla HTML, CSS, JavaScript.


🚀 Tech Stack

  • ⚙️ Backend: Node.js, Express.js
  • 🗄️ Database: MySQL
  • 🎨 Frontend: HTML, CSS, JavaScript
  • 🔐 Authentication: express-session, bcryptjs

📁 Project Structure

thinkiq/
├── config/
│   └── db.js
├── routes/
│   ├── auth.js
│   ├── quizzes.js
│   └── results.js
├── public/
│   ├── login.html
│   ├── register.html
│   ├── admindashboard.html
│   ├── userdashboard.html
│   └── style.css
├── database.sql
├── server.js
├── package.json
├── .env.example
└── README.md

⚙️ Setup Instructions

1️⃣ Prerequisites

  • Install Node.js (v16+)
  • Install MySQL Server

2️⃣ Setup Database

Run the SQL file:

source database.sql;

Or manually execute the queries inside database.sql.


3️⃣ Configure Environment Variables

cp .env.example .env

Update .env file:

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=thinkiq
SESSION_SECRET=your_secret_key
PORT=3000

4️⃣ Install Dependencies

npm install

5️⃣ Run the Application

# Production
npm start

# Development
npm run dev

6️⃣ Open in Browser

👉 http://localhost:3000


✨ Features

👨‍💼 Admin

  • Create quizzes
  • Delete quizzes
  • View all user results

👤 User

  • Register & Login
  • Take quizzes
  • View own results

🔌 API Endpoints

🔐 Authentication

Method Endpoint Description
POST /api/auth/register Register user
POST /api/auth/login Login
POST /api/auth/logout Logout
GET /api/auth/me Get current session

📝 Quizzes

Method Endpoint Description
GET /api/quizzes Get all quizzes
GET /api/quizzes/:id Get quiz details
POST /api/quizzes Create quiz (Admin)
DELETE /api/quizzes/:id Delete quiz
POST /api/quizzes/:id/submit Submit answers

📊 Results

Method Endpoint Description
GET /api/results All results (Admin)
GET /api/results/mine User results

🔐 Security

  • 🔑 Passwords hashed using bcryptjs
  • 📦 Session-based authentication using express-session
  • 🛡️ Role-based access control (Admin/User)
  • 🚫 Answers hidden during quiz attempts

📌 Future Improvements

  • 🌐 Deploy to cloud (Render / Railway)
  • 📱 Responsive UI design
  • 📊 Analytics dashboard
  • 🧠 AI-based quiz recommendations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors