This repository contains a full-stack e-learning platform with a Node.js/Express backend API and a React frontend application.
elearning/- Latest backend API server (Node.js/Express)elearning-app/- Latest Frontend web application (React/Vite)database/- Sample data backup files for MongoDB databasequery/- query files for Task 5 and Task 6documentation/- Documentation files for milestone3: Task 7 ~ Task 8.
- Node.js v14+ and npm
- MongoDB (v4.4+)
- Git
Update for Milestone 2
- The database is hosted on MongoDB Atlas, and the connection string should be stored in the
.envfile. - The
.envfile should be created in the root directory of the backend project:elearning/. - Please find the environment variable in the comment of the submission on CANVAS. The connection string is not included in the repository for security reasons. When you run the program, please create a
.envfile in theelearning/directory, and copy the connection string from the comment to the.envfile. Thank you! - The database name is
elearning, and the collections areuser,course,enrollment,assignment, andquiz.
-
Navigate to the backend directory:
cd elearning -
Start the server:
npm start
The API will be available at http://localhost:4000/api
-
Navigate to the frontend directory:
cd elearning-app -
Install dependencies:
npm install -
Start the development server:
npm run dev
The web application will be available at http://localhost:5173
-
Navigate to the query directory after running the backend server:
cd elearning/query -
Run the query files for Task 5 using the following command:
node runQuery.js getInstructorCourseLoad node runQuery.js getStudentPerformanceAnalytics node runQuery.js getCourseContentAnalysis node runQuery.js getDepartmentAnalytics -
To run the index optimization script (Task 6), first make sure you are in the
elearning/querydirectory and have the required MongoDB connection string in your.envfile. -
Then run the index optimization operations:
# To create indexes: node runIndexOptimization.js create-indexes # To run performance benchmarks: node runIndexOptimization.js benchmark # To generate query explain plans: node runIndexOptimization.js explain -
The results will be printed in the console.
The backend provides the following main API endpoints:
- Users:
/api/users - Courses:
/api/courses - Enrollments:
/api/enrollments - Assignments:
/api/assignments - Quizzes:
/api/quizzes
- Backend code is organized by feature (user, course, enrollment, etc.)
- Each feature has its own directory with model, schema, DAO (Data Access Object), and routes
- Frontend uses React with React Router for navigation and Axios for API communication
- Admin:
- Username: admin_johnson
- Password: defaultPassword123
- Faculty:
- Username: prof_williams
- Password: defaultPassword123
- Student:
- Username: emma_smith
- Password: defaultPassword123