How ngtrnhao/obeyclothing works
Main Components
• Frontend:
• That it uses React.js, CSS Modules, and React Router.
• Backend:
● Controllers (for example, auth, product, order, voucher, user, etc.)
● Routes linking to each controller module (e.g., /api/auth, /api/products, etc.)
● Middleware (e.g., JWT authentication, file upload via Multer, and role-based access control).
● Models representing MongoDB collections (User, Product, Order, etc.)
● Services and utilities (PDF generation, email service, cron jobs, state factories for order and delivery states).
• Database:
• A “Database” component representing MongoDB.
• External Services:
• Integrations with third-party services such as:
● Cloudinary (for image uploads).
● PayPal (for payment processing).
● Email Service (likely for authentication and notifications).
● Possibly a file storage mechanism for uploads.
Relationships & Data Flow
● Routes invoke Controllers.
● Controllers use Services to perform business logic.
● Models are used by services/controllers to retrieve and store data in the Database.
Architectural Patterns & Design Principles
• The separation of Frontend and Backend indicates a clear separation-of-concerns.
• The use of controllers, routes, models, middleware, and services suggests an MVC (or layered) architecture on the backend.
• The modular file layout in the frontend (components, contexts, pages, layouts) supports a component-based architecture driven by React.
• Cloud integration and external API usage are design decisions worth noting.
Relevant Technologies and Frameworks
• Frontend: React, React Router, Axios, CSS Modules.
• Backend: Node.js, Express, MongoDB, Mongoose, JWT, Multer, PDFKit, Node-cron.
• DevOps: Git, npm, and deployment configurations (vercel.json files).