How sakshikukreja04/supplylink works
Project Type and Purpose
• SupplyLink is a full-stack MERN (MongoDB, Express, React, Node.js) application.
• It connects vendors with suppliers for raw-materials procurement, offering real-time updates, location-based filtering, voice search, order management, payment integration, and reviews.
High-Level File Structure Analysis
• Top-level:
• client/ → React + TypeScript front-end
• server/ → Node.js + Express back-end
• client/src: UI components, pages, contexts (Auth, Socket), hooks, utilities, Firebase integration.
• server: controllers (business logic), routes (REST API), models (Mongoose schemas), middleware, services (e.g., keyword extraction, translation), setup (websocket, database, Firebase Admin), utils.
Key Architecture Insights from README
• Front-end: React 18, Vite, Tailwind CSS, Leaflet (maps), Web Speech API, Socket.IO client, Firebase Auth.
• Back-end: Express.js, MongoDB/Mongoose, Socket.IO server, Firebase Admin SDK, OpenStreetMap proxy, Razorpay integration for payments.
a. Client-side
• Browser (React SPA)
• Voice Search Module (Web Speech API)
• Module (Leaflet + OpenStreetMap)
• Socket.IO Client
• Firebase Auth SDK
b. Server-side
• Express REST API
• Socket.IO Server
• Controllers & Services (search, order, review, geocoding, payment)
• Middleware (auth, CORS, token verification)
• Mongoose Models (User, Supplier, Vendor, Order, Review, etc.)
• Firebase Admin SDK
• OpenStreetMap Proxy Service
• Razorpay Payment Gateway
c. Database
• MongoDB Cluster (Atlas or local)
d. External Services
• Firebase Authentication
• OpenStreetMap Nominatim (geocoding)
• Razorpay (payment)
Relationships and Data Flows
• User actions in Browser → React components invoke REST API (HTTP)
• Socket.IO handshake over WebSocket for real-time events (order updates, notifications)
• REST API calls → Express routes → Controllers → MongoDB via Mongoose
• Authentication: React uses Firebase Auth SDK → issues ID Token → sent in HTTP headers → server verifies via Firebase Admin SDK
• Geocoding: server forwards /api/geocode requests to OpenStreetMap → returns coordinates
• Payment: on order payment, server calls Razorpay API → processes transaction → updates Order model → emits Socket.IO event back to client
• Database updates trigger notifications via Socket.IO to relevant clients
Architectural Patterns & Design Principles
• Layered (Presentation → API Layer → Business Logic → Data Access)
• MVC-style separation: routes → controllers → models
• Event-driven communication with Socket.IO
• Single Page Application (SPA) on front-end, micro-module components
• Role-based access: vendor vs supplier, enforced via protected routes & middleware
• Third-party integration via adapter/service modules