How aashih/studynotionashish works
Project Type and Purpose
• This is a full-stack MERN (MongoDB, Express, React, Node.js) Education Technology web application (“Study Notion”).
• The backend (in the Server/ folder) is an Express.js REST API using MongoDB via Mongoose, JWT for authentication, Razorpay for payments, Cloudinary for image uploads, and Nodemailer for email.
• The frontend (in src/) is a React app with React Router for pages, Redux Toolkit for state management (slices), Tailwind CSS for styling, and client-side logic for authentication, course browsing, enrollment, and progress tracking.
File-Structure Analysis
• Top-level: Server/, public/, src/, configuration files (package.json, tailwind.config.js).
• Server layer follows MVC:
• config/: external service setup (database, Razorpay, Cloudinary)
• models/: Mongoose schemas (User, Course, Category, Section, etc.)
• controllers/: business logic per domain (Auth, Course, Payments, Profile, etc.)
• routers/: route definitions mapping endpoints to controllers
• middlewares/: JWT auth, error handling
• utils/ & mail/templates/: common utilities (image upload, mail sender) and email templates
• Frontend layer:
• src/pages/: top-level routes/views (Home, Catalog, CourseDetails, Dashboard, Auth pages)
• src/components/: reusable UI pieces organized by feature (Common, Auth, Dashboard modules, Course view)
• src/services/: API connector, endpoint definitions, business-oriented operations
• src/slices/: Redux slices for auth, courses, cart, profile, etc.
• src/hooks/, src/utils/: helper hooks and functions
• public/: HTML entrypoint and static assets
Key Architecture Patterns
• Backend: Layered MVC pattern (Routes → Controllers → Models → Database).
• Frontend: Component-based UI, container/presentational separation, global state via Redux Toolkit, async actions in services/operations.
• Authentication: JWT tokens handled by Express middleware and stored in client (e.g., localStorage); protected routes via React Router wrappers (PrivateRoute, OpenRoute).
• Deployment consideration: single origin for API and static files in production or CORS configuration in dev.
Main Components
a. Client (React App)
• Pages/Components
• Redux Store (slices)
• API Connector (axios or fetch wrapper)
b. API Layer (Express Server)
• Routers → Controllers → Services → Models
• Middlewares (Auth, Error Handling)
c. Database
• MongoDB cluster (collections for Users, Courses, Categories, Progress, Reviews, OTPs)
d. External Services
• Razorpay Payment Gateway
• Cloudinary Image Storage
• Email Service (SMTP / Nodemailer)
Relationships & Data-Flow
• User Browser → HTTP(S) Requests → React Router → Components dispatch Redux actions → API Connector →
→ Express Routes → Controllers → Mongoose Models → MongoDB
• Payments flow: React → /payments endpoint → Razorpay SDK/webhook → Controller updates DB & triggers email.
• Media uploads: React form → API → imageUploader util → Cloudinary → URL returned → stored in DB.
• Email notifications: Controller triggers mailSender util → SMTP → user’s inbox.
Technologies & Frameworks to Annotate
• Frontend: React, Redux Toolkit, React Router, Axios (apiConnector), Tailwind CSS
• Backend: Node.js, Express.js, Mongoose, JWT, Razorpay SDK, Cloudinary SDK, Nodemailer
• Database: MongoDB Atlas (or local)
• Dev Tools: nodemon, concurrently (npm run dev), PostCSS CLI