How saarang2003/clickcart works
Project type and purpose
• ClickArt is a full-stack MERN (MongoDB, Express.js, React, Node.js) eCommerce application.
• Users browse and purchase art products; admins manage products, orders, users; images uploaded to Cloudinary; payments via PayPal; state managed by Redux.
File structure
• Top-level “client” folder: React app (HTML/CSS/JSX, assets, components, pages, Redux store, Vite config).
• Top-level “server” folder: Express.js backend (controllers split by domain, Mongoose models, routes organized by admin/auth/shop, helper modules for Cloudinary & PayPal, DB utils).
• Shared concerns: environment vars for MongoDB, JWT, Cloudinary, PayPal; ESLint, Tailwind, PostCSS; build scripts in package.json.
Extract key insights from the README
• Uses Redux slices for admin and shop workflows.
• RESTful API endpoints under /api/auth, /api/shop, /api/admin.
• MVC-style controllers/models separation on the server.
• Third-party integrations: Cloudinary for images, PayPal for payments, JWT/bcrypt for auth.
a. Main components
• Frontend (React + Redux + Axios)
• Backend API (Node.js + Express + controllers + Mongoose models)
• Database (MongoDB)
• External Services: Cloudinary, PayPal
• Authentication (JWT & bcrypt)
• Hosting/Deployment (optional: Heroku, Vercel, etc.)
b. Relationships & interactions
• Frontend → Backend: HTTP(S) requests via Axios to REST endpoints (/api/products, /api/orders, /api/auth, etc.)
• Backend → Database: Mongoose ORM interactions with MongoDB collections (Users, Products, Orders, Cart, Reviews, Addresses)
• Backend → Cloudinary: image upload/download via Cloudinary SDK in server/helpers/cloudinary.js
• Backend → PayPal: payment creation/confirmation via server/helpers/paypal.js
• Frontend state management: Redux store dispatches actions → reducers (auth-slice, shop slices, admin slices) → selectors → UI components.
c. Architectural patterns & design principles
• Frontend: Component-based architecture, container/presentational separation (pages vs. components), modular Redux slices.
• Backend: MVC pattern—routes delegate to controllers, controllers coordinate business logic and data persistence via models.
• Separation of concerns: authentication middleware, error handling, helpers.
• RESTful API design.
d. Key technologies & libraries
• Frontend: React, Redux Toolkit, React Router, Vite, Tailwind CSS, Axios
• Backend: Node.js, Express.js, Mongoose (MongoDB), bcrypt, jsonwebtoken
• External: Cloudinary SDK, PayPal REST SDK