How stephismily/electiveportal works
PSG Tech Elective Portal supports student registration and constrained elective submission, admin faculty onboarding, and faculty review, search, and Excel export. Browser pages call role-specific API routes; controllers validate requests and read or update MongoDB-backed account and selection records. JWT middleware authenticates protected routes. The README documents the frontend capabilities and API surface; source excerpts establish server, route, controller, model, and database wiring. Frontend request-level wiring was not excerpted, so those API links are documented rather than source-verified.
Main entry points: middleware/auth.js JWT role access · server.js Express server · authController.js Account access · routes/auth.js Authentication routes
Components 23
Web client
- Portal shell
frontend/index.html - Routing and theme
frontend/js/app.js - API and token helper
frontend/js/api.js - Login and registration
frontend/js/auth.js - Admin dashboard
frontend/js/admin.js - Faculty dashboard
frontend/js/faculty.js - Elective selection
frontend/js/student.js
API and access
- Express server
backend/server.js - Authentication routes
backend/routes/auth.js - Admin routes
backend/routes/admin.js - Faculty routes
backend/routes/faculty.js - Student routes
backend/routes/student.js - JWT role access
backend/middleware/auth.js
Portal workflows
- Account access
backend/controllers/authController.js - Faculty onboarding
backend/controllers/adminController.js - Faculty reporting
backend/controllers/facultyController.js - Elective submission
backend/controllers/studentController.js
Persistence
- Admin account
backend/models/Admin.js - Faculty account
backend/models/Faculty.js - Student and electives
backend/models/Student.js - MongoDB connection
backend/config/db.js
Other components
- Student, faculty, admin
- MongoDB
Connections 30
- Student, faculty, admin → Portal shell: opens portal
README.md - Portal shell → Routing and theme: loads client
README.md - Login and registration → Authentication routes: uses auth API
README.md - Admin dashboard → Admin routes: uses admin API
README.md - Faculty dashboard → Faculty routes: uses faculty API
README.md - Elective selection → Student routes: uses student API
README.md - Express server → MongoDB connection: connects database
backend/server.js - Express server → Authentication routes: mounts routes
backend/server.js - Express server → Admin routes: mounts routes
backend/server.js - Express server → Faculty routes: mounts routes
backend/server.js - Express server → Student routes: mounts routes
backend/server.js - Authentication routes → Account access: dispatches to
backend/routes/auth.js - Authentication routes → JWT role access: protects profile
backend/routes/auth.js - Admin routes → Faculty onboarding: dispatches to
backend/routes/admin.js - Admin routes → JWT role access: protects routes
backend/routes/admin.js - Faculty routes → Faculty reporting: dispatches to
backend/routes/faculty.js - Faculty routes → JWT role access: protects routes
backend/routes/faculty.js - Student routes → Elective submission: dispatches to
backend/routes/student.js - Student routes → JWT role access: protects routes
backend/routes/student.js - Account access → Admin account: queries accounts
backend/controllers/authController.js - Account access → Faculty account: queries accounts
backend/controllers/authController.js - Account access → Student and electives: creates and queries
backend/controllers/authController.js - Faculty onboarding → Faculty account: manages faculty
backend/controllers/adminController.js - Faculty reporting → Faculty account: updates password
backend/controllers/facultyController.js - Faculty reporting → Student and electives: queries selections
backend/controllers/facultyController.js - Elective submission → Student and electives: reads and updates
backend/controllers/studentController.js - JWT role access → Admin account: loads account
backend/middleware/auth.js - JWT role access → Faculty account: loads account
backend/middleware/auth.js - JWT role access → Student and electives: loads account
backend/middleware/auth.js - MongoDB connection → MongoDB: connects
backend/config/db.js