How ajayprataps1/studynotion works
Project Type and Purpose
• This is a full-stack educational platform (“StudyNotion”) built on the MERN stack.
• Frontend: ReactJS + Redux Toolkit for dynamic UI and state management.
• Backend: NodeJS + ExpressJS implementing RESTful APIs.
• Database: MongoDB via Mongoose ODM.
• Additional services: Cloudinary (media storage), Razorpay (payment processing), SMTP/email templates.
File Structure Analysis
• Top level:
• “public” and “src” → React frontend code, assets, components, pages, Redux slices, services.
• “Server” → Express app: config, controllers, models, routes, utils, mail templates.
• Frontend follows a component-based architecture, organized by feature (Auth, Dashboard, Course, etc.).
• Backend follows MVC pattern:
• Models (Mongoose schemas in Server/models)
• Controllers (business logic in Server/controllers)
• Routes (API endpoints in Server/routes)
• Config folder holds integration code for Cloudinary, database, Razorpay.
• Utils and mail templates in Server for image upload, mailing, etc.
Key Components
• Client (React app)
• UI components, Redux store, API connector.
• API Layer (Express server)
• Route handlers mapping to controllers.
• Business Logic (Controllers)
• Auth, Course, Category, Payments, Profile, Rating & Review, Section, SubSection, ResetPassword, courseProgress.
• Data Layer (MongoDB)
• Collections: User, Course, Category, Section, SubSection, OTP, Profile, RatingAndReview, CourseProgress.
• External Services
• Cloudinary (media upload),
• Razorpay (payment gateway),
• Email service (SMTP/email provider using mailSender and templates).
Relationships and Data Flows
• User browsers → React UI
• UI dispatches Redux actions → apiconnector.js → Express endpoints.
• Express receives requests → auth middleware (JWT) → routes → controllers.
• Controllers perform CRUD via Mongoose models → MongoDB.
• For file uploads: controller → imageUploader → Cloudinary.
• For payments: controller → Razorpay config → external payment flow → webhook/confirmation email.
• For emails: controllers invoke mailSender → SMTP provider with email templates.
• Redux store updates UI based on API responses.
Architectural Patterns and Design Principles
• Frontend:
• Component-driven, “container-presentational” split.
• Redux Toolkit slices for state segmentation (authSlice, courseSlice, etc.).
• Hooks for cross-cutting concerns (useOnClickOutside).
• Backend:
• MVC separation: routes, controllers, models.
• Middlewares for authentication and error handling.
• Config-driven integration of third-party services.