How meohoang3017/onlineclassroommanagement works
Main Components
• Frontend: This folder includes all the client-side code built with React (as suggested by the presence of TypeScript, React components, hooks, and pages). It handles the user interface including pages for Authentication, Dashboard, Classroom management, Lesson management, and User management.
• Backend: This contains the server-side code based on Node.js and Express. The backend is structured in an MVC-like pattern with directories for controllers, routes, models, middlewares, and configuration. It supports APIs for authentication, classroom, lessons, file handling, approvals, and OTP operations.
• Database: Although no explicit database files are shown, the presence of backend/src/config/database.js and models implies that a database (likely MongoDB) is used.
• External Services: There are utility modules for handling Google Drive uploads (backend/src/utils/GoogleDrive.js), email notifications (Mailer), JWT handling, and file uploading.
Relationships/Interactions Between Components
• The Frontend communicates with the Backend via API endpoints. The API calls are abstracted through various API files under frontend/src/api which correspond to backend route modules.
• The Backend processes incoming requests through defined routes, passes them to appropriate controllers, and interacts with databases, middleware (like JWT and role checking), and external services.
• The Database stores and serves persistent data, as indicated by models like User, Lesson, Classroom, Approvement, etc.
• External utilities and services like Google Drive integration and mailing services are invoked within the backend flow to provide additional functionality.
Architectural Patterns and Design Principles
• MVC Pattern: The separation of concerns in the backend is clear with models (data structures), controllers (business logic), and routes (HTTP layer).
• Client-Server Architecture: The frontend is entirely separated from backend logic and communicates over RESTful APIs.
• Modularization: Both frontend and backend are divided into modules (e.g., different API modules and controllers) which makes the system extensible and maintainable.
• Use of Middleware: JWT and role-based middleware are used in the backend to secure endpoints.
Relevant Technologies/Frameworks
• Frontend: React with TypeScript, utilizing context providers for state management (e.g., AuthContext, NotyfContext), and routing via custom components (AppRoutes.tsx). Also using Vite for bundling.
• Backend: Node.js with Express, configured with various settings like CORs, passport for authentication, and socket connectivity. It involves utilities for hashing, JWT, mailing, and file uploads.
• Database: Likely MongoDB, as evident from model definitions (although the specific driver isn’t specified, the typical MERN stack would use MongoDB).
• External Integrations: Google Drive and mailing services.
Elements
• Use clear labels for each component (e.g., “Frontend: Login Page”, “Backend: AuthController”, “Database: MongoDB”).
• To denote middleware layers (e.g., JWT authentication) on the request path.
• For Frontend, subdivide into UI Components, API Services, and Contexts.
• For Backend, show the configuration layer, routing layer, controllers, models, middleware, and utilities as interconnected modules.