How vigneshssuvarna/marketwatch works
MarketWatch tracks mandi commodity prices, lets users browse market history and forecasts, maintain watchlists, and manage price alerts; administrators can import CSV price data. The principal workflow runs from authenticated frontend pages through service calls and backend routes/controllers to MongoDB, with forecasting delegated to the ML service. The README identifies the three services and major capabilities; the graph uses indexed references and shown excerpts for internal links, while cross-service HTTP wiring is not fully sampled and is marked unverified where appropriate.
Main entry points: App.jsx Routes and providers · server.js Express API · api.js HTTP client · Commodity.js Commodity records
Components 34
Web application
- Routes and providers
frontend/src/App.jsx - Authentication state
frontend/src/context/AuthContext.jsx - Dashboard
frontend/src/pages/DashboardPage.jsx - Commodity detail
frontend/src/pages/CommodityDetailPage.jsx - Alert management
frontend/src/pages/AlertsPage.jsx - Admin import
frontend/src/pages/AdminPage.jsx - Profile
frontend/src/pages/ProfilePage.jsx - Commodity cards
frontend/src/components/CommodityCard.jsx - Price visualizations
frontend/src/components/PriceChart.jsx - Navigation
frontend/src/components/Navbar.jsx - Commodity client
frontend/src/services/commodityService.js - Auth client
frontend/src/services/authService.js - Alert client
frontend/src/services/alertService.js - Forecast client
frontend/src/services/forecastService.js - HTTP client
frontend/src/services/api.js
API and data
- Express API
backend/server.js - Auth routes
backend/routes/authRoutes.js - Commodity routes
backend/routes/commodityRoutes.js - Alert routes
backend/routes/alertRoutes.js - Admin routes
backend/routes/adminRoutes.js - Forecast routes
backend/routes/forecastRoutes.js - Accounts and watchlists
backend/controllers/authController.js - Commodity queries
backend/controllers/commodityController.js - Alert evaluation
backend/controllers/alertController.js - CSV ingestion
backend/controllers/adminController.js - Forecast requests
backend/controllers/forecastController.js - Authentication guard
backend/middleware/authMiddleware.js - Commodity records
backend/models/Commodity.js - User records
backend/models/User.js - Alert records
backend/models/Alert.js - Price CSV parser
backend/utils/parsePriceCsv.js - ML service client
backend/services/mlServiceClient.js
Forecasting service
- Prediction API
ml-service/app.py
Other components
- User
Connections 44
- User → Routes and providers: uses
frontend/src/App.jsx - Routes and providers → Authentication state: provides auth
frontend/src/App.jsx - Routes and providers → Dashboard: routes
frontend/src/App.jsx - Routes and providers → Commodity detail: routes
frontend/src/App.jsx - Routes and providers → Alert management: routes
frontend/src/App.jsx - Routes and providers → Admin import: routes
frontend/src/App.jsx - Routes and providers → Profile: routes
frontend/src/App.jsx - Dashboard → Commodity client: requests data
frontend/src/pages/DashboardPage.jsx - Dashboard → Commodity cards: renders
frontend/src/pages/DashboardPage.jsx - Commodity detail → Commodity client: requests data
frontend/src/pages/CommodityDetailPage.jsx - Commodity detail → Forecast client: requests forecasts
frontend/src/pages/CommodityDetailPage.jsx - Commodity detail → Price visualizations: renders
frontend/src/pages/CommodityDetailPage.jsx - Alert management → Alert client: manages alerts
frontend/src/pages/AlertsPage.jsx - Alert management → Commodity client: loads commodities
frontend/src/pages/AlertsPage.jsx - Admin import → HTTP client: sends requests
frontend/src/pages/AdminPage.jsx - Authentication state → Auth client: authenticates
frontend/src/context/AuthContext.jsx - Commodity client → HTTP client: sends requests
frontend/src/services/commodityService.js - Auth client → HTTP client: sends requests
frontend/src/services/authService.js - Alert client → HTTP client: sends requests
frontend/src/services/alertService.js - HTTP client → Express API: HTTP requests
- Express API → Auth routes: mounts
backend/server.js - Express API → Commodity routes: mounts
backend/server.js - Express API → Forecast routes: mounts
backend/server.js - Express API → Admin routes: mounts
backend/server.js - Express API → Alert routes: mounts
backend/server.js - Auth routes → Accounts and watchlists: dispatches
backend/routes/authRoutes.js - Auth routes → Authentication guard: guards
backend/routes/authRoutes.js - Commodity routes → Commodity queries: dispatches
backend/routes/commodityRoutes.js - Alert routes → Alert evaluation: dispatches
backend/routes/alertRoutes.js - Alert routes → Authentication guard: guards
backend/routes/alertRoutes.js - Admin routes → CSV ingestion: dispatches
backend/routes/adminRoutes.js - Admin routes → Authentication guard: guards
backend/routes/adminRoutes.js - Forecast routes → Forecast requests: dispatches
backend/routes/forecastRoutes.js - Authentication guard → User records: loads user
backend/middleware/authMiddleware.js - Accounts and watchlists → User records: reads and writes
backend/controllers/authController.js - Accounts and watchlists → Commodity records: reads
backend/controllers/authController.js - Commodity queries → Commodity records: queries
backend/controllers/commodityController.js - Alert evaluation → Alert records: reads and writes
backend/controllers/alertController.js - Alert evaluation → Commodity records: reads prices
backend/controllers/alertController.js - CSV ingestion → Price CSV parser: parses upload
backend/controllers/adminController.js - CSV ingestion → Commodity records: updates prices
backend/controllers/adminController.js - Forecast requests → Commodity records: reads commodity
backend/controllers/forecastController.js - Forecast requests → ML service client: requests forecast
backend/controllers/forecastController.js - ML service client → Prediction API: HTTP request