🎓 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.
|
|
| 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 |
| Consistent, structured error responses |
React 19 · Vite · React Router · Axios · Tailwind CSS v4 · Framer Motion · Lucide React
Node.js · Express · TypeScript · MongoDB + Mongoose · JWT · bcryptjs · Zod · CORS
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
🖥️ 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
git clone <your-repo-url>
cd Scholar-Sync
# Install backend dependencies
cd server && npm install
# Install frontend dependencies
cd ../client && npm installserver/.env
MONGODB_URI=mongodb+srv://<user>:<pass>@<cluster>/<db>
JWT_SECRET=change_this_secret
JWT_EXPIRES_IN=7d
PORT=5001
CLIENT_URL=http://localhost:5173client/.env
VITE_API_BASE_URL=http://localhost:5001/api💡
PORTdefaults to5000if unset — set it to5001to match the Vite proxy config.
# Terminal 1 — Backend
cd server && npm run dev
# Terminal 2 — Frontend
cd client && npm run dev🌐 Open http://localhost:5173 in your browser.
cd server && npm run seed
# Prints sample student + instructor credentials to consoleBase 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 |
| 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 |
| 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 |
server/vercel.json is pre-configured for Vercel Node.js deployment using src/app.ts.
Deploy the Vite build output to any static host (Vercel / Netlify / Cloudflare Pages):
cd client && npm run build
⚠️ EnsureVITE_API_BASE_URLpoints to the deployed backend and the server'sCLIENT_URLmatches your frontend origin.
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
🐛
client/vite.config.jsproxies/api→http://localhost:5001, but the backend defaults to port5000unlessPORTis set explicitly. Fix: AddPORT=5001toserver/.env.
System design and UML documentation are available in the diagrams/ directory.