How chirag19bca/farm2store works
Project type and purpose
• This is a full-stack web marketplace (“Farm2Store”) that connects farmers (sellers) and retailers (buyers) via a React frontend and an Express/MySQL backend.
• Key features: farmer dashboard, retailer dashboard, admin panel, sales reports (with Chart.js + jsPDF), email notifications (via Nodemailer).
File structure
• Top-level folders:
– backend/ : Node.js + Express REST API, MySQL integration, route handlers, database dump
– frontend/ : Vite-powered React application, component hierarchy, pages, styling, Axios client
– README.md, documentation under Farm2Store Doc/
• backend details:
– api/ folder holds route modules (Admin.js, authRoutes.js, productRoutes.js, etc.).
– config/db.js contains MySQL connection logic.
– server.js sets up Express app, middleware (cors, sessions, multer, cookie-parser), and mounts routes.
– farm2storeXampp.sql is the database schema + seed.
• frontend details:
– src/components/ separated by feature (Admin, FarmerDashboard, RetailerDashboard, shared components).
– src/pages/ routed views (Login, Register, Products, CategoryPage, etc.).
– src/context/AuthContext.jsx provides authentication state via React Context.
– src/utils/axios.js centralizes HTTP client configuration.
– CSS Modules for scoped styling.
README for additional insights
• Confirms tech stack: React.js, Vite, React Router, Axios, Chart.js, jsPDF/html2canvas, Node/Express, MySQL.
• Describes system roles (Farmer, Retailer, Admin) and user flows (register, login, CRUD on products/orders, reporting).
Elements
– Client-side (blue rectangles)
– Server-side modules (green rectangles)
– External services (orange ovals)
• Important middleware and utilities (e.g., “AuthContext,” “axios.js,” “multer,” “express-session”).