Skip to content

Latest commit

 

History

49 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Typing SVG

MIT License Node.js React TypeScript MongoDB

Vite TailwindCSS Express JWT


🎓 ScholarSync is a full-stack Learning Management System with dedicated student & instructor portals, real-time grading, assignment tracking, and a rich library — all secured with role-based JWT auth.


🌟 Feature Highlights

🧑‍🎓 Student Experience

  • 🔐 Secure signup & login
  • 📖 Browse, search & filter courses
  • ✅ Enroll & track module progress
  • 📝 Submit assignments & view grades
  • 📊 GPA calculator
  • 📚 Library with saved resources & reading progress
  • 🗂️ Personal dashboard with upcoming work

🧑‍🏫 Instructor Experience

  • 🏗️ Create / update / delete courses
  • 📦 Add modules & announcements
  • 📋 Manage assignments & view submissions
  • ✏️ Grade student work
  • 📁 Publish library resources
  • 📈 Instructor analytics dashboard

🔒 Backend Protections

Shield Description
🔑 JWT Authentication Stateless, secure token-based auth
🛡️ Role-Based Authorization Middleware enforcing student/instructor roles
🚦 API Rate Limiting Guards against abuse via Express Rate Limit
⚠️ Centralized Error Handling Consistent, structured error responses

🛠️ Tech Stack

🖥️ Frontend

React Vite TailwindCSS TypeScript

React 19 · Vite · React Router · Axios · Tailwind CSS v4 · Framer Motion · Lucide React

⚙️ Backend

Node.js Express MongoDB TypeScript

Node.js · Express · TypeScript · MongoDB + Mongoose · JWT · bcryptjs · Zod · CORS


📁 Project Structure

Scholar-Sync/
├── 🖥️  client/
│   └── src/
│       ├── 🌐 api/                # Frontend API wrappers
│       ├── 🧩 components/         # Shared UI + route guards
│       ├── 🔄 context/            # Auth context
│       ├── 🗂️  layouts/            # Public / student / instructor layouts
│       ├── 📄 pages/              # Student & public pages
│       └── 📄 pages/instructor/   # Instructor pages
│
├── ⚙️  server/
│   └── src/
│       ├── 🗄️  config/             # DB connection
│       ├── 🎮 controllers/        # Route handlers & business logic
│       ├── 🛡️  middleware/         # Auth, RBAC, error handling
│       ├── 📦 models/             # Mongoose schemas
│       ├── 🛤️  routes/             # API route definitions
│       ├── 🌱 seed/               # Database seeding script
│       ├── 🔧 utils/              # JWT utilities
│       ├── 🚀 app.ts              # Express app config
│       └── 🏁 server.ts           # Server bootstrap
│
└── 📐 diagrams/                   # System design / UML docs

🏗️ Architecture

🖥️  React (Vite)
      ↓
📡  Axios API Client  ──── attaches JWT from localStorage
      ↓
🛤️  Express Routes  (/api/*)
      ↓
🛡️  Middleware Pipeline  (CORS → JSON → Rate Limit → Auth → RBAC)
      ↓
🎮  Controllers  (business logic)
      ↓
📦  Mongoose Models
      ↓
🗄️  MongoDB

⚡ Getting Started

📋 Prerequisites

Node.js npm MongoDB

1️⃣ Clone & Install

git clone <your-repo-url>
cd Scholar-Sync

# Install backend dependencies
cd server && npm install

# Install frontend dependencies
cd ../client && npm install

2️⃣ Configure Environment Variables

server/.env

MONGODB_URI=mongodb+srv://<user>:<pass>@<cluster>/<db>
JWT_SECRET=change_this_secret
JWT_EXPIRES_IN=7d
PORT=5001
CLIENT_URL=http://localhost:5173

client/.env

VITE_API_BASE_URL=http://localhost:5001/api

💡 PORT defaults to 5000 if unset — set it to 5001 to match the Vite proxy config.

3️⃣ Run the App

# Terminal 1 — Backend
cd server && npm run dev

# Terminal 2 — Frontend
cd client && npm run dev

🌐 Open http://localhost:5173 in your browser.

🌱 Seed Demo Data (optional)

cd server && npm run seed
# Prints sample student + instructor credentials to console

🗺️ API Reference

Base URL: /api

🏥 Health
Method Endpoint Auth
GET /health None
🔐 Auth
Method Endpoint Auth
POST /auth/signup None
POST /auth/login None
POST /auth/instructor/signup None
POST /auth/instructor/login None
GET /auth/me ✅ Required
📚 Courses
Method Endpoint Role
GET /courses 🔐 Auth
GET /courses/instructor/mine 🧑‍🏫 Instructor
GET /courses/:idOrSlug 🔐 Auth
POST /courses 🧑‍🏫 Instructor
PUT /courses/:id 🧑‍🏫 Instructor
DELETE /courses/:id 🧑‍🏫 Instructor
POST /courses/:id/modules 🧑‍🏫 Instructor
POST /courses/:id/announcements 🧑‍🏫 Instructor
📋 Enrollments
Method Endpoint Role
GET /enrollments 🧑‍🎓 Student
POST /enrollments 🧑‍🎓 Student
PUT /enrollments/:id/module-complete 🧑‍🎓 Student
📝 Assignments & Submissions
Method Endpoint Role
GET /assignments 🔐 Auth
GET /assignments/:idOrSlug 🔐 Auth
POST /assignments 🧑‍🏫 Instructor
PUT /assignments/:id 🧑‍🏫 Instructor
DELETE /assignments/:id 🧑‍🏫 Instructor
POST /submissions 🧑‍🎓 Student
GET /submissions 🧑‍🏫 Instructor
GET /submissions/my 🧑‍🎓 Student
🏆 Grades
Method Endpoint Role
GET /grades 🧑‍🎓 Student
GET /grades/gpa 🧑‍🎓 Student
POST /grades 🧑‍🏫 Instructor
📖 Library
Method Endpoint Role
GET /library 🔐 Auth
GET /library/recent 🧑‍🎓 Student
GET /library/saved 🧑‍🎓 Student
POST /library/saved 🧑‍🎓 Student
PUT /library/progress 🧑‍🎓 Student
GET /library/:idOrSlug 🔐 Auth
POST /library 🧑‍🏫 Instructor
📊 Dashboard
Method Endpoint Role
GET /dashboard/overview 🧑‍🎓 Student
GET /dashboard/instructor 🧑‍🏫 Instructor

📜 Scripts

🖥️ Client

Command Description
npm run dev ⚡ Start Vite dev server
npm run build 📦 Production build
npm run preview 👁️ Preview production build
npm run lint 🔍 Run ESLint

⚙️ Server

Command Description
npm run dev 🔄 Start with ts-node-dev (hot reload)
npm run build 🏗️ Compile TypeScript → dist/
npm start 🚀 Run compiled server
npm run seed 🌱 Seed the database

🚀 Deployment

Backend — Vercel

server/vercel.json is pre-configured for Vercel Node.js deployment using src/app.ts.

Frontend — Static Host

Deploy the Vite build output to any static host (Vercel / Netlify / Cloudflare Pages):

cd client && npm run build

⚠️ Ensure VITE_API_BASE_URL points to the deployed backend and the server's CLIENT_URL matches your frontend origin.


🤝 Contributing

1. 🍴 Fork the repo
2. 🌿 Create a feature branch
3. 🛠️  Make your changes in client/ and/or server/
4. ✅ Run lint + build locally
5. 📬 Open a pull request with clear scope and test notes

⚠️ Known Issues

🐛 client/vite.config.js proxies /apihttp://localhost:5001, but the backend defaults to port 5000 unless PORT is set explicitly. Fix: Add PORT=5001 to server/.env.


📐 Diagrams

System design and UML documentation are available in the diagrams/ directory.


Made with ❤️ by the ScholarSync Team

Wave

About

A full-stack Learning Management System built with React, Node.js, TypeScript, and MongoDB. Features role-based dashboards for students and instructors, course management, assignments, grading, and a library — deployed live on Vercel.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages