Skip to content

smirk-dev/student-education-platform-Database-Management-System-Project-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ“ Hybrid Student Learning Portal

A Database Management Systems (DBMS) Course Project demonstrating Polyglot Persistence using MySQL and MongoDB

๐Ÿ“‹ Table of Contents


๐ŸŽฏ Project Overview

The Hybrid Student Learning Portal is a full-stack web application that demonstrates the concept of polyglot persistence by strategically using both relational (MySQL) and NoSQL (MongoDB) databases in a single system.

Purpose

This project showcases:

  • When and why to use different database paradigms
  • Integration of MySQL and MongoDB in a unified backend
  • Real-world application of DBMS concepts (normalization, joins, indexing, etc.)
  • RESTful API design with Express.js
  • Full authentication and authorization flow

๐Ÿค” Why Both Databases?

MySQL (Relational) - For Structured, Transactional Data

Used for:

  • โœ… Users - Strong consistency, authentication
  • โœ… Courses - Relationships with instructors
  • โœ… Enrollments - Many-to-many relationships, foreign keys
  • โœ… Quizzes & Submissions - Marks, grades, aggregations (AVG, SUM)

Why?

  • ACID transactions ensure data integrity
  • Complex JOINs for enrollment and performance queries
  • Foreign key constraints prevent orphaned data
  • Perfect for numerical data and aggregations

MongoDB (NoSQL) - For Flexible, Nested Data

Used for:

  • โœ… Discussions - Nested posts/comments (embedded documents)
  • โœ… Assignments - Submissions with varying fields (file/link/text)
  • โœ… Activity Logs - High-volume, time-series data

Why?

  • Flexible schema for varying submission types
  • Better performance for nested/hierarchical data
  • Horizontal scalability for high-volume logs
  • No need for complex JOINs for embedded data

โœจ Features

Implemented Features

โœ… User Management

  • Registration with role selection (Student/Instructor/Admin)
  • JWT-based authentication
  • Profile management

โœ… Course Management

  • Browse all courses
  • View course details
  • Create courses (Instructor/Admin)
  • Enrollment system with duplicate prevention

โœ… Quiz System (MySQL)

  • Create quizzes for courses
  • Submit quiz answers
  • View marks and performance
  • Aggregate statistics (average, min, max)

โœ… Activity Logging (MongoDB)

  • Automatic logging of all user actions
  • Track logins, enrollments, views, submissions
  • Analytics and reporting capabilities

Demonstrated DBMS Concepts

๐Ÿ“š MySQL Concepts

  • Primary Keys, Foreign Keys, Unique Constraints
  • One-to-Many, Many-to-Many relationships
  • Complex JOINs (INNER, LEFT)
  • Aggregation functions (COUNT, AVG, ROUND)
  • Subqueries
  • Views
  • Stored Procedures
  • Transactions
  • Indexing

๐Ÿ“š MongoDB Concepts

  • Document-oriented storage
  • Embedded vs Referenced documents
  • Compound indexes
  • Aggregation pipelines
  • Flexible schema design
  • Time-series optimization

๐Ÿ› ๏ธ Tech Stack

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • MySQL: mysql2 (with connection pooling)
  • MongoDB: Mongoose
  • Authentication: JWT (jsonwebtoken)
  • Password Hashing: bcryptjs

Frontend

  • HTML5, CSS3, Vanilla JavaScript
  • Simple, minimal UI focusing on API demonstration

Development Tools

  • dotenv (environment management)
  • nodemon (development server)

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚           Frontend (Browser)             โ”‚
โ”‚     HTML/CSS/JavaScript (SPA-like)       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚ HTTP/REST API
                โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚        Express.js Backend Server         โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  Routes & Controllers Layer     โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚  Middleware (Auth, Logging)     โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚                     โ”‚
        โ–ผ                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     MySQL     โ”‚     โ”‚   MongoDB     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค     โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โ€ข users       โ”‚     โ”‚ โ€ข discussions โ”‚
โ”‚ โ€ข courses     โ”‚     โ”‚ โ€ข assignments โ”‚
โ”‚ โ€ข enrollments โ”‚     โ”‚ โ€ข activity_   โ”‚
โ”‚ โ€ข quizzes     โ”‚     โ”‚   logs        โ”‚
โ”‚ โ€ข quiz_       โ”‚     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”‚   submissions โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ—„๏ธ Database Schemas

MySQL Schema (Relational)

users

user_id (PK, AUTO_INCREMENT)
name
email (UNIQUE)
password_hash
role (ENUM: student, instructor, admin)
created_at

courses

course_id (PK, AUTO_INCREMENT)
course_code (UNIQUE)
course_name
description
instructor_id (FK โ†’ users.user_id)
created_at

enrollments

enrollment_id (PK, AUTO_INCREMENT)
student_id (FK โ†’ users.user_id)
course_id (FK โ†’ courses.course_id)
enrolled_at
status (ENUM: active, dropped, completed)
UNIQUE (student_id, course_id)

quizzes

quiz_id (PK, AUTO_INCREMENT)
course_id (FK โ†’ courses.course_id)
title
max_marks
due_date

quiz_submissions

submission_id (PK, AUTO_INCREMENT)
quiz_id (FK โ†’ quizzes.quiz_id)
student_id (FK โ†’ users.user_id)
marks_obtained
submitted_at

MongoDB Schema (Document)

discussions

{
  course_id: Number,  // References MySQL course_id
  title: String,
  created_by: Number,  // References MySQL user_id
  posts: [
    {
      post_id: Number,
      user_id: Number,
      content: String,
      created_at: Date
    }
  ]
}

assignments

{
  course_id: Number,
  assignment_title: String,
  description: String,
  due_date: Date,
  max_marks: Number,
  submissions: [
    {
      student_id: Number,
      submitted_at: Date,
      submission_type: String,  // file, link, or text
      file_path: String,
      grade: Number,
      feedback: String
    }
  ]
}

activity_logs

{
  user_id: Number,
  action: String,  // LOGIN, VIEW_COURSE, ENROLL_COURSE, etc.
  course_id: Number,
  timestamp: Date,
  metadata: {
    ip_address: String,
    browser: String,
    os: String
  }
}

๐Ÿš€ Setup Instructions

Prerequisites

  1. Node.js (v14 or higher)
  2. MySQL (v8.0 or higher)
  3. MongoDB (v5.0 or higher)

Step 1: Clone and Install Dependencies

# Navigate to project directory
cd student-education-platform-Database-Management-System-Project-

# Install dependencies
npm install

Step 2: Setup MySQL Database

# Login to MySQL
mysql -u root -p

# Run the schema file
source database/mysql/schema.sql

# Or on Windows:
mysql -u root -p < database/mysql/schema.sql

Step 3: Setup MongoDB

# Start MongoDB service (if not running)
net start MongoDB

# MongoDB will automatically create the database on first connection

Step 4: Configure Environment Variables

# Copy example env file
copy .env.example .env

# Edit .env with your credentials
# Use notepad or any text editor
notepad .env

Update these values in .env:

MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=root
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=student_portal

MONGODB_URI=mongodb://localhost:27017/student_portal

PORT=3000
JWT_SECRET=your_secret_key_change_this

Step 5: Initialize and Run

# Test database connections
npm run init-db

# Start the server
npm start

# Or use development mode with auto-reload
npm run dev

Step 6: Access the Application

Open your browser and navigate to:


๐Ÿ“ก API Documentation

Authentication Endpoints

Register

POST /api/auth/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "[email protected]",
  "password": "password123",
  "role": "student"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "[email protected]",
  "password": "password123"
}

Get Profile

GET /api/auth/me
Authorization: Bearer <token>

Course Endpoints

Get All Courses

GET /api/courses

Get Course by ID

GET /api/courses/:id
Authorization: Bearer <token> (optional)

Create Course (Instructor/Admin)

POST /api/courses
Authorization: Bearer <token>
Content-Type: application/json

{
  "course_code": "CS101",
  "course_name": "Introduction to CS",
  "description": "Course description"
}

Enroll in Course (Student)

POST /api/courses/:id/enroll
Authorization: Bearer <token>

Get My Enrolled Courses (Student)

GET /api/courses/my/courses
Authorization: Bearer <token>

๐Ÿ“ Project Structure

student-education-platform-Database-Management-System-Project-/
โ”‚
โ”œโ”€โ”€ database/
โ”‚   โ””โ”€โ”€ mysql/
โ”‚       โ”œโ”€โ”€ schema.sql          # MySQL table definitions & sample data
โ”‚       โ””โ”€โ”€ queries.sql         # Sample queries & views
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”œโ”€โ”€ mysql.js            # MySQL connection pool
โ”‚   โ”‚   โ””โ”€โ”€ mongodb.js          # MongoDB connection
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”œโ”€โ”€ Discussion.js       # Mongoose model
โ”‚   โ”‚   โ”œโ”€โ”€ Assignment.js       # Mongoose model
โ”‚   โ”‚   โ””โ”€โ”€ ActivityLog.js      # Mongoose model
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ controllers/
โ”‚   โ”‚   โ”œโ”€โ”€ authController.js   # Auth logic
โ”‚   โ”‚   โ””โ”€โ”€ courseController.js # Course logic
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ routes/
โ”‚   โ”‚   โ”œโ”€โ”€ authRoutes.js       # Auth endpoints
โ”‚   โ”‚   โ””โ”€โ”€ courseRoutes.js     # Course endpoints
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ middleware/
โ”‚   โ”‚   โ”œโ”€โ”€ auth.js             # JWT verification
โ”‚   โ”‚   โ””โ”€โ”€ activityLogger.js   # MongoDB logging
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ scripts/
โ”‚   โ”‚   โ””โ”€โ”€ initDatabase.js     # DB initialization
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ server.js               # Express app entry point
โ”‚
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ index.html              # Frontend HTML
โ”‚   โ”œโ”€โ”€ styles.css              # Frontend CSS
โ”‚   โ””โ”€โ”€ app.js                  # Frontend JavaScript
โ”‚
โ”œโ”€โ”€ .env.example                # Environment template
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ package.json
โ””โ”€โ”€ README.md

๐Ÿ” Demo Credentials

After running the schema.sql, you can use these pre-created accounts:

Admin

Instructor

Student


๐Ÿ“Š ER Diagram

MySQL Entities and Relationships

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         instructs        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  users  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ถโ”‚ courses  โ”‚
โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜                          โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜
     โ”‚                                    โ”‚
     โ”‚ enrolls                            โ”‚ has
     โ”‚                                    โ”‚
     โ–ผ                                    โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ enrollments  โ”‚                    โ”‚ quizzes โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
                                         โ”‚
                                         โ”‚ has
                                         โ–ผ
                                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                   โ”‚ quiz_submissions โ”‚
                                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Relationships:

  • users โ†’ courses: One-to-Many (instructor teaches many courses)
  • users โ†’ enrollments: One-to-Many (student enrolls in many courses)
  • courses โ†’ enrollments: One-to-Many (course has many students)
  • courses โ†’ quizzes: One-to-Many (course has many quizzes)
  • quizzes โ†’ quiz_submissions: One-to-Many (quiz has many submissions)
  • users โ†’ quiz_submissions: One-to-Many (student submits many quizzes)

๐Ÿ”ฎ Future Enhancements

Phase 2 Features

  • Complete quiz and assignment management UI
  • Discussion forum with real-time updates
  • File upload for assignments
  • Grading interface for instructors
  • Student analytics dashboard
  • Course search and filtering

Phase 3 Features

  • Email notifications
  • Real-time chat (Socket.io)
  • Mobile responsive design
  • Export reports (PDF/Excel)
  • Course materials management
  • Attendance tracking

๐ŸŽ“ Learning Outcomes

This project demonstrates:

  1. Database Design

    • Normalization (3NF)
    • ER modeling
    • Choosing between SQL and NoSQL
  2. SQL Skills

    • Complex JOINs
    • Aggregations and subqueries
    • Views and stored procedures
    • Transactions and ACID properties
  3. MongoDB Skills

    • Document modeling
    • Embedding vs referencing
    • Aggregation pipelines
    • Indexing strategies
  4. Full-Stack Development

    • RESTful API design
    • JWT authentication
    • MVC architecture
    • Error handling
  5. System Integration

    • Polyglot persistence
    • Cross-database operations
    • Maintaining referential integrity across databases

๐Ÿ“ License

This project is for educational purposes as part of a DBMS course.


๐Ÿ‘ฅ Contributors

Your Name - DBMS Course Project


๐Ÿ™ Acknowledgments

  • Built as a Database Management Systems course project
  • Demonstrates real-world database design principles
  • Showcases modern web development practices

Happy Coding! ๐Ÿš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published