How ishan678-code/grocery-management-system works
Project Type and Purpose
• Full-stack Grocery Management System
• Frontend: React (Vite), handles UI for users and sellers
• Backend: Node.js + Express API, handles routing, business logic, persistence
• Database: MongoDB (via Mongoose)
• External Services: Cloudinary for image hosting, Vercel for deployment
File Structure Analysis
• Top-level separation into “client” and “server” directories
• client/
• public, src (components, pages, context, assets)
• Vite config, ESLint, React entry points
• .env for API base URL or feature flags
• server/
• configs (db connection, multer, Cloudinary)
• routes → controllers → models (MVC-style)
• middleware for user/seller authentication
• server.js as Express app bootstrap
• .env for secrets (DB URI, Cloudinary keys, JWT secrets)
README Insights
• Simple one-line description and live link
• All architectural knowledge comes from directory layout
Main Components and Interactions
a. Client Application (React/Vite)
• Pages & Components consume REST API
• AppContext for global state (cart, user session)
• Login screens for users and sellers
b. API Server (Express)
• Routes layer (addressRoute, cartRoute, etc.)
• Controllers implement business logic (cartController, orderController, etc.)
• Middleware handles JWT checks (authUser, authSeller)
• Config modules for DB and Cloudinary setup
c. Database (MongoDB)
• Collections: users, products, orders, addresses
• Mongoose models for schema definitions
d. External Service (Cloudinary)
• Image upload pipeline via multer → Cloudinary SDK
e. Deployment Platforms
• Vercel hosting for frontend and backend (via serverless functions or separate deployments)
Architectural Patterns and Principles
• MVC-inspired layering on the server
• Clear separation of concerns: UI vs. API vs. persistence
• Context API in React for cross-component state
• Shared environment configuration via .env files
• Stateless RESTful endpoints, JWT auth