How mohammadkhizer/campus_hub_v2 works
Campus Hub is a role-based institutional LMS: users authenticate, reach role-specific dashboards, and use learning, assessment, and governance features that operate on MongoDB-backed records. The README documents student course discovery and timed, one-attempt assessments, teacher course and assessment management, and administrator/superadmin oversight. Source-index references and excerpts support several action-to-model and auth-to-session links; other feature wiring is represented only where the README documents it, since many routes and actions were not sampled.
Main entry points: auth.ts Authentication actions · courses.ts Course operations · login/page.tsx Sign-in & signup · dashboard/page.tsx Role dashboards
Components 29
Identity & access
- Sign-in & signup
src/app/login/page.tsx - Authentication actions
src/app/actions/auth.ts - Session context
src/context/auth-context.tsx - Role dashboards
src/app/dashboard/page.tsx - Profile management
src/app/actions/profile.ts
Learning & assessment
- Course operations
src/app/actions/courses.ts - Course discovery & control
src/app/courses/[id]/page.tsx - Quiz operations
src/app/actions/quizzes.ts - Quiz attempts & review
src/app/quizzes/[id]/page.tsx - AI learning tools
src/ai/flows/student-ai.ts
Institutional governance
- Classroom operations
src/app/actions/classrooms.ts - Administrator operations
src/app/admin/dashboard/page.tsx - Platform governance
src/app/actions/superadmin.ts - Student services
src/app/actions/student.ts
Shared platform services
- Action security wrapper
src/lib/action-factory.ts - Traffic protection
src/middleware.ts - Database connection
src/lib/mongoose.ts - Structured logging
src/lib/logger.ts
Persistent domain data
- Course records
src/models/Course.ts - Quiz records
src/models/Quiz.ts - Attempt records
src/models/Attempt.ts - User records
src/models/User.ts - Classroom records
src/models/Classroom.ts
Other components
- Student
- Teacher
- Administrator
- Super admin
- MongoDB
- Google GenAI
Connections 42
- Student → Sign-in & signup: signs in
- Teacher → Sign-in & signup: signs in
- Administrator → Sign-in & signup: signs in
- Super admin → Sign-in & signup: signs in
- Sign-in & signup → Authentication actions: authenticates through
- Session context → Authentication actions: fetches session
src/context/auth-context.tsx - Authentication actions → User records: reads users
src/app/actions/auth.ts - Authentication actions → Database connection: connects database
src/app/actions/auth.ts - Authentication actions → Action security wrapper: wraps protected actions
src/app/actions/auth.ts - Session context → Role dashboards: provides session to
- Student → Role dashboards: views progress
- Teacher → Role dashboards: opens teaching tools
- Administrator → Role dashboards: opens oversight
- Super admin → Role dashboards: opens governance
- Student → Course discovery & control: discovers courses
- Teacher → Course discovery & control: manages courses
- Course discovery & control → Course operations: requests course operations
- Course operations → Authentication actions: checks session
src/app/actions/courses.ts - Course operations → Course records: reads and writes
src/app/actions/courses.ts - Course operations → Classroom records: reads classrooms
src/app/actions/courses.ts - Student → Quiz attempts & review: takes timed quizzes
- Teacher → Quiz attempts & review: creates assessments
- Quiz attempts & review → Quiz operations: submits attempts
- Quiz operations → Quiz records: reads quizzes
src/app/actions/quizzes.ts - Quiz operations → Attempt records: records attempts
src/app/actions/quizzes.ts - Quiz operations → Authentication actions: checks session
src/app/actions/quizzes.ts - Teacher → AI learning tools: uses AI assistance
- Student → AI learning tools: uses learning assistance
- AI learning tools → Google GenAI: generates content
- Administrator → Administrator operations: governs institution
- Administrator operations → Course operations: establishes courses
src/app/admin/dashboard/page.tsx - Administrator operations → Classroom operations: manages classrooms
src/app/admin/dashboard/page.tsx - Classroom operations → Classroom records: reads and writes
src/app/actions/classrooms.ts - Super admin → Platform governance: governs platform
- Platform governance → User records: manages roles
- Super admin → Student services: oversees student services
- Student → Profile management: updates profile
- Action security wrapper → Database connection: connects database
src/lib/action-factory.ts - Action security wrapper → Authentication actions: loads session
src/lib/action-factory.ts - Action security wrapper → Structured logging: logs failures
src/lib/action-factory.ts - Traffic protection → MongoDB: limits incoming traffic
- Database connection → MongoDB: connects