How armin1723/crm-grocery works
Project Type and Purpose
• This is a full-stack web application (“CRM Grocery”) for grocery-store operations: inventory, sales, suppliers, customers.
• It consists of a React/Tailwind frontend (“client/”) and an Express/Node backend (“server/”) talking to MongoDB.
File Structure
• client/ – React SPA
– src/components, pages, hooks, context, redux – UI, state, routing
– public/ – static assets, redirect rules
– config files – tailwind, ESLint, Vite
• server/ – Node/Express API
– controllers/, routes/, models/ – MVC structure
– middleware/ – auth (JWT), error handling
– config/ – Cloudinary, DB connection
– templates/ – email & invoice generation
– crons/ – scheduled jobs (low-stock alerts, cache loads)
• support-backend/ & support-frontend/ – separate support ticket microservice (similar full-stack)
README Insights
• Frontend: React.js + TailwindCSS + Context API + React Router
• Backend: Node.js + Express + MongoDB + JWT
• Features: real-time stock alerts (cron jobs), email notifications, PDF invoices
Main Components & Interactions
a. Frontend (React App)
– UI Components (Inventory, Sales, Reports, Auth)
– State Management: Context API & Redux slices (theme, user)
– Routes: React Router for pages (Auth, Home, Seller)
– HTTP Client (fetch/axios) → REST API
b. Backend (Express API)
– REST Endpoints (auth, inventory, sales, reports, support)
– Controllers → business logic
– Models (Mongoose) → MongoDB collections
– Middleware → JWT auth, error handling, authorization
– Cron jobs → scheduled tasks (inventory alerts, subscription cache)
– Email Service → template rendering → SMTP/third-party
– Cloudinary → media uploads (e.g., product images)
– PDF Generation → invoice templates → temporary storage
c. Database
– MongoDB cluster (Atlas or local)
– Collections: users, products, inventory, sales, purchases, suppliers, customers, support tickets, etc.
d. External Services
– Cloudinary for file storage
– Email provider (SMTP/SendGrid) for notifications
– (Optional) Payment gateway or analytics if integrated
Architectural Patterns & Design Principles
• Frontend: component-based architecture, separation of concerns (shared vs domain-specific components), global vs local state
• Backend: MVC (models, controllers, routes), middleware pipeline, configuration abstraction
• Cron jobs as background workers within the same service
• Separation of concerns between CRM app and support microservice