How codebytarun08/studycart works
Project type and purpose
• StudyCart is a full-stack, monolithic MERN (MongoDB, Express.js, React.js, Node.js) education platform.
• Purpose: allow instructors to create/manage courses and students to browse, enroll, consume, and rate content.
File structure
• Top-level “public” and “src” directories indicate a React front-end.
• “Server” directory holds the Node/Express back-end (REST API, controllers, models).
• “src/components”, “src/pages”, “src/services”, “src/slices”, “src/hooks”, “src/reducer” reveal a client-side architecture using React Router, Redux Toolkit (slices + store), hooks, and service modules for API calls.
• Configuration files: package.json, tailwind.config.js.
• Assets and images under “public” and “src/assets” for UI media.
• Data files (countrycode.json, navbar-links.js) for static lookups.
README for additional insights
• Confirms a client-server architecture: front-end (React + Redux + Tailwind CSS), back-end (Node + Express + Mongoose + JWT + Bcrypt), database (MongoDB).
• External integrations: Cloudinary for media, Razorpay for payments, email/OTP service.
• Describes REST endpoints, data models (Student, Instructor, Course).
• Includes a high-level image (images/architecture.png) showing front-end ↔ back-end ↔ database.
Main components and their relationships
a. Front-end (React App)
• Subcomponents: pages (Home, Catalog, CoursePage, Dashboard, Auth pages), shared UI (Navbar, Footer, Modals), feature components (CourseCard, VideoPlayer, Forms).
• State layer: Redux slices (authSlice, cartSlice, courseSlice, profileSlice, viewCourseSlice), async thunks in services/operations calling REST APIs.
• Routing: React Router with public and PrivateRoute wrappers.
b. Back-end (Node/Express server)
• Controllers/routers for auth, courses, payments, profile, settings.
• Middleware: JWT authentication, error handling.
• Business logic modules: services/operations/*.js, db connection, Cloudinary integration, Razorpay webhook handler.
c. Database (MongoDB)
• Collections: Users (students/instructors), Courses, Orders/Payments, etc.
• Schemas defined via Mongoose models inside “Server”.
d. External services
• Cloudinary for media storage.
• Razorpay for payment processing.
• Email/OTP service (SMTP or third-party).
Architectural patterns and design principles
• Client-server via RESTful API.
• Modular React with feature folders and centralized Redux state.
• MVC-style organization on server (routes → controllers → services → models).
• Secure JWT auth, protected routes both client-side and server-side.
• Separation of concerns: UI vs. state vs. API logic.