EduHub database design using MongoDB and PyMongo. AltSchool Africa Second Semester Project
# 📚 EduHub MongoDB LMS
EduHub is a **MongoDB-based Learning Management System (LMS)** built to simulate a real-world educational platform. It manages **users, courses, enrollments, assignments, analytics, and recommendations**, providing insights into student engagement and instructor performance.
This project demonstrates **MongoDB schema design, query optimization, aggregation pipelines, schema validation, indexing, and real-time analytics** with Python (PyMongo).
## Entity Relationship Diagram (ERD)
Below is the ERD representing the database schema for **EduHub**:
---
## 🛠️ Project Setup Instructions
### 1. Prerequisites
- Python 3.10+
- MongoDB 5.0+ installed and running locally
- pip for dependency management
### 2. Installation
```bash
git clone
github.com
cd eduhub-mongodb-lms
# Setup environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
```
### 3. Running MongoDB
```bash
mongod --dbpath /path/to/mongodb/data
```
Default URI:
```
mongodb://localhost:27017/
```
### 4. Running the Project
```bash
python main.py
```
---
## đź“‚ Database Schema Documentation
EduHub uses a **document-oriented schema** with **6 main collections**:
### 1. Users
```json
{
"_id": {
"$oid": "68de2afade87aa09a1f6ba94"
},
"userId": "user_1",
"firstname": "Adams",
"lastname": "Barbara",
"role": "student",
"dateJoined": {
"$date": "2025-09-03T08:34:18.823Z"
},
"profile": {
"bio": " ",
"avatar": "
dummyimage.com",
"skills": [
"analysis",
"sql"
]
},
"is_active": false,
"email": "adams.barbara@eduhub.com"
}
```
Indexes:
- `{ email: 1 }` → quick login lookups
### 2. Courses
```json
{
"_id": {
"$oid": "68de2afcde87aa09a1f6baa8"
},
"courseId": "PYT",
"title": "Python",
"description": "Learn Python from scratch",
"instructorId": "user_18",
"category": "Programming",
"level": "intermediate",
"duration": 1680,
"tags": [
"Pytho …