How avidhanorkar/code_sprinters works
Main Components
• Frontend Application: Built with React; includes pages, shared UI components, context providers (for auth), and routing. It’s responsible for the user interface, offline support (using service workers), and calls to APIs.
• Backend Server/API: An Express.js server that handles API endpoints for authentication (both admin and user), course content (CRUD), quizzes, certificate generation, leaderboards, admin operations, and chatbot integration.
• Database: MongoDB (accessed via Mongoose models – User, Admin, Quiz, Course) that stores user data, courses, quizzes, results, and leaderboard-related data.
• External Services & Integrations:
• AI Chatbot: Integration with the Gemini AI API for personalized Q&A.
• Video Service: YouTube links for hosting videos.
• Certificate Generation: Libraries like pdfkit and node-html-pdf.
• Cloudinary: For media asset management (as seen in the cloudinaryConfig.js).
• Community Tools: Socket.io integration and Discourse for discussion forums.
• Offline Syncing: PouchDB and Workbox (Service Workers) for offline capabilities.
Relationships & Interactions
• The Frontend interacts with the Backend via RESTful API calls (authentication, courses, quizzes, certificates, leaderboard data).
• The Backend uses middleware (JWT-based auth, role checks) to secure routes and responds with data from the MongoDB database.
• The Backend communicates with external services for additional functionalities such as AI assistance, video delivery, certificate generation, and community features.
• Offline support is implemented in the Frontend (using service workers and possibly PouchDB) to allow download of lessons and later synchronization.
• Data flows from user actions (e.g., signing up, enrolling in courses, taking quizzes) through the API layer where requests are processed by controllers and potentially trigger interactions with external services.
Architectural Patterns & Design Principles
• Separation of Concerns: The project clearly segregates frontend UI logic, backend business logic (controllers, route handlers), and data models.
• Modular Design: Both the frontend and backend are organized in modular directories (components, pages, models, controllers, etc.) making it easier to identify independent subsystems.
• Microservices/Decoupled Integrations: Although it’s a monorepo, external integrations (chatbot, video, certificate generation) are abstracted in dedicated modules.
• Secure API Communication: JWT-based authentication coupled with middleware ensures fine-grained control over access (role-based security).
Technologies and Frameworks
• Frontend: React, Vite, TailwindCSS.
• Backend: Express.js, Node.js, Passport.js, JWT, bcrypt.
• Database: MongoDB with Mongoose.
• Third-Party/External: Gemini AI API, YouTube, Cloudinary, pdfkit, node-html-pdf, PouchDB/Workbox, Socket.io, and Discourse.