How hrdpaliwal93/ai-based-learning-management-system works
1. Overall shape
- EduPortal is a two-tier LMS: a React/Vite frontend and a PHP 8 REST API backend, backed by MySQL. The architecture is centered on browser clients calling backend endpoints over HTTP, with the backend mediating all database access, authentication, and AI usage.
2. Frontend boundary
- The frontend lives under frontend/src and is organized by role and workflow rather than by technical layer alone: pages/student, pages/teacher, shared components, global context, and services. This makes the UI split naturally into student and teacher experiences while sharing auth/session state and common layout components.
3. Frontend entry and app shell
- main.jsx, App.jsx, Navbar.jsx, Sidebar.jsx, and ProtectedRoute.jsx define the application shell and route protection. AuthContext.jsx is the main client-side state boundary for session/user identity, while services/api.js is the single API access layer used by pages to talk to the backend.
4. Student-facing workflows
- Student features are concentrated in pages/student: course catalog and details, test-taking, result viewing, and the student dashboard. These screens consume data from course, enrollment, test, result, dashboard, and AI endpoints, forming the student data flow: browse → enroll → consume resources → take test → view scores/recommendations.
5. Teacher-facing workflows
- Teacher functionality is in pages/teacher: course management, resource management, analytics, and test building. These screens map to backend operations for creating/updating courses, uploading course materials, generating or publishing tests, and retrieving performance analytics and feedback.
6. Backend API segmentation
- The backend is organized as a set of functional endpoint groups under backend/api: auth, courses, enrollments, resources, tests, dashboard, and ai. This is a classic REST-style decomposition where each folder represents a bounded feature area with its own CRUD or action-oriented endpoints.
7. Authentication and session model
- backend/api/auth/login.php, register.php, logout.php, and me.php indicate session-based authentication rather than JWT. The frontend likely checks current identity through me.php, stores user state in AuthContext, and gates routes via ProtectedRoute. This makes auth a cross-cutting boundary spanning most UI and API calls.
8. Core data model and persistence
- MySQL is the primary system of record, defined in backend/database/schema.sql and seeded by seed.sql. All durable LMS entities appear to be persisted here: users, courses, enrollments, resources, tests, submissions, results, and feedback. The backend config in backend/api/config/db.php is the database access boundary.
9. Course, enrollment, and resource flow
- Courses are managed through backend/api/courses/*, enrollment through backend/api/enrollments/*, and course materials through backend/api/resources/*. The likely flow is: teacher creates course → course is published/listed → student enrolls → resources become available to enrolled students. This is one of the main domain pipelines in the system.
10. Testing and assessment pipeline
- backend/api/tests/* covers test creation, publishing, submission, feedback, and result retrieval. This subsystem supports both teacher-authored tests and student attempts, with endpoints for individual results, all results, and course-scoped test data. It is the main academic assessment boundary in the system.
11. AI subsystem
- backend/api/ai/chat.php, generate_quiz.php, and recommendations.php form a dedicated AI integration layer. The README identifies Groq AI / Llama 3.3 70B as the model provider, meaning the backend is the AI gateway: the frontend calls these endpoints, and the backend handles prompt construction, provider access, and response shaping. This keeps external AI credentials and logic off the client.
12. Analytics and dashboards
- backend/api/dashboard/student.php and teacher.php aggregate data from multiple tables into role-specific summaries. These endpoints are important diagram nodes because they sit above raw CRUD APIs and produce derived views: progress statistics for students and performance/engagement analytics for teachers.
13. Shared configuration and cross-cutting concerns
- backend/api/config/cors.php controls browser access boundaries, ai.php holds AI-related config, and db.php centralizes database connectivity. These are the main infrastructure-level files that influence how the frontend can call the backend and how the backend reaches external services.
14. Deployment and runtime assumptions
- The project is designed for a local XAMPP-style Apache + MySQL + PHP deployment on the backend and a Vite dev server on the frontend. That means the frontend and backend are separate runtimes during development, connected over HTTP, with PHP acting as the API server and MySQL as the persistent store.
15. Architectural summary for a diagram
- A good diagram should show: browser users split into student and teacher roles; a React frontend with shared auth/state and role-specific pages; a PHP API divided into auth, courses, enrollments, resources, tests, dashboards, and AI; a MySQL database as the system of record; and an external AI provider reached only through backend AI endpoints.
Main entry points: api.js API client · App.jsx App shell · schema.sql MySQL · main.jsx App entry
Components 21
Frontend
React/Vite client for student and teacher workflows
- App entry · Bootstraps the React app and global providers
frontend/src/main.jsx - App shell · Top-level routing and application composition
frontend/src/App.jsx - Auth state · Session and identity state shared across the UI
frontend/src/context/AuthContext.jsx - API client · Single frontend gateway for backend API calls
frontend/src/services/api.js - Nav chrome · Primary navigation and layout controls
frontend/src/components/Navbar.jsx - Sidebar · Secondary navigation for role-based sections
frontend/src/components/Sidebar.jsx - Route guard · Protects authenticated routes in the client
frontend/src/components/ProtectedRoute.jsx - Student UI · Student-facing pages for learning and assessment
frontend/src/pages/student/Dashboard.jsx - Teacher UI · Teacher-facing pages for course and assessment management
frontend/src/pages/teacher/Dashboard.jsx - Login · Client sign-in screen
frontend/src/pages/auth/Login.jsx - Register · Client account creation screen
frontend/src/pages/auth/Register.jsx
Backend
PHP REST API and database layer
- Auth API · Login, register, logout, and current-user session checks
backend/api/auth/login.php - Courses API · Course CRUD and course-specific listings
backend/api/courses/index.php - Enrollments API · Student enrollment and enrollment lookup endpoints
backend/api/enrollments/enroll.php - Resources API · Course material upload, listing, and deletion
backend/api/resources/upload.php - Tests API · Test creation, publishing, submission, feedback, and results
backend/api/tests/create.php - Dashboards · Student and teacher summary endpoints
backend/api/dashboard/student.php - AI API · Chat, quiz generation, and recommendations endpoints
backend/api/ai/chat.php - MySQL · System of record for users, courses, enrollments, resources, tests, and results
backend/database/schema.sql
External
Outside runtime dependencies
- Groq AI · External Llama-based AI provider used through the backend
Other components
- Browser users · Student and teacher users interacting through the web app
Connections 24
- Browser users → App entry: loads · Users open the frontend app
- App entry → App shell: boots · App entry renders the router and providers
- App shell → Auth state: shares session · Routes depend on client auth state
- App shell → Route guard: protects routes · Authenticated sections are wrapped by route guards
- App shell → Nav chrome: renders · Application shell includes global navigation
- App shell → Sidebar: renders · Application shell includes role navigation
- App shell → Login: routes to · Unauthenticated users reach login
- App shell → Register: routes to · Unauthenticated users reach registration
- Student UI → API client: reads data · Student pages call backend endpoints through the API client
- Teacher UI → API client: reads data · Teacher pages call backend endpoints through the API client
- API client → Auth API: calls · Client checks and updates session state
- API client → Courses API: calls · Course browsing and management requests
- API client → Enrollments API: calls · Enrollment actions and lookups
- API client → Resources API: calls · Resource listing and upload actions
- API client → Tests API: calls · Assessment creation, submission, and results
- API client → Dashboards: calls · Dashboard summary requests
- API client → AI API: calls · AI-powered chat, quiz, and recommendation requests
- Auth API → MySQL: persists session data · Authentication reads and updates user records
- Courses API → MySQL: reads/writes · Course data is stored in MySQL
- Enrollments API → MySQL: reads/writes · Enrollment state is stored in MySQL
- Resources API → MySQL: reads/writes · Resource metadata and ownership are stored in MySQL
- Tests API → MySQL: reads/writes · Tests, submissions, feedback, and results are stored in MySQL
- Dashboards → MySQL: aggregates · Dashboard views are computed from persistent data
- AI API → Groq AI: invokes · Backend sends prompts to the external model provider