How manojyadav2005/kishan-sathi works
1. Overall shape
- This repository is a hybrid farming app: a mostly static frontend in frontend/ plus a Node.js backend in backend/.
- The frontend delivers the product experience directly in the browser, while the backend mainly supports account/auth-related server functions and persistence.
2. Frontend presentation layer
- frontend/ is organized as multiple standalone HTML pages rather than a single SPA.
- Key pages include index.html, weather.html, market-price.html, crop-planner.html, education.html, ploughing-services.html, store.html, my-areastore.html, loan-calculator.html, comparison.html, and auth pages like login.html, register.html, forgot-password.html, reset-password.html, profile.html.
- style.css acts as the shared design system across the pages.
3. Frontend client-side logic
- frontend/api.js is the shared browser-side API client for talking to backend endpoints.
- frontend/auth.js handles user auth flows in the browser.
- frontend/nav.js centralizes navigation behavior, and frontend/i18n.js suggests language/localization support.
- This implies a page-driven UI where shared JS modules coordinate cross-page behavior.
4. Browser-only feature set
- Several parts of the app are meant to work without the backend, using browser APIs and local state.
- The README describes weather data, mandi prices, store/forum data, and other utilities that can run with external APIs or localStorage.
- This creates a split architecture: some features are server-backed, while others are client-only or can degrade gracefully offline.
5. Backend service boundary
- backend/server.js is the application entry point and likely mounts the Express app, middleware, and routes.
- backend/routes/authRoutes.js and backend/controllers/authController.js define the authentication boundary.
- Based on the file tree, the backend snapshot is focused on auth and user-account functionality rather than the full marketplace/forum feature set described in the README.
6. Data model layer
- backend/models/User.js is the primary account model.
- backend/models/Notification.js suggests server-side notification records.
- backend/models/PloughingService.js indicates a domain model for service listings.
- These models form the persistence boundary for backend-managed entities.
7. Persistence
- The repository includes db/kisan_sathi.db plus SQLite WAL files (.db-shm, .db-wal), which indicates the current snapshot uses a local SQLite database.
- This is an important architectural detail because it differs from the README’s MongoDB/Mongoose description.
- For diagrams, the durable store should be shown as a local database file under db/, not as a remote database service.
8. Email and notification flow
- backend/utils/sendEmail.js handles outgoing email, likely for password reset or account-related notifications.
- The auth controller and notification model together imply a flow where user actions on the frontend can trigger backend-side email and notification side effects.
9. Uploads and file handling
- backend/uploads/avatars/ is the visible upload area in the repo, suggesting profile-image storage on disk.
- The README also mentions other upload folders, but only avatars are present in the tree.
- This means the backend has a filesystem-based asset boundary in addition to database persistence.
10. Domain features surfaced in the UI
- The frontend pages map to user-facing product areas: weather intelligence, market prices, crop planning, education, community, store browsing, local agricultural services, comparison tools, and loan calculation.
- Some of these are likely self-contained visual/educational tools; others rely on backend data or browser storage.
- For an architecture diagram, these should be shown as separate frontend feature areas with only some connected to the backend.
11. External integrations
- The README explicitly references OpenWeatherMap and data.gov.in for weather and mandi prices.
- These are external API dependencies from the frontend, not from the backend tree shown here.
- They matter because they bypass the application server for key live-data features.
12. Repository caveat
- The README describes a broader full-stack system with forum, store, and order APIs, but the checked-in backend tree does not include those route/controller files.
- So the safest architecture read is: a frontend-heavy app, a focused auth backend, SQLite persistence, disk-based uploads, and direct browser calls to third-party data providers.
Main entry points: authController.js Auth controller · api.js API client · index.html Frontend app · server.js Server
Components 22
Frontend
Browser-facing pages and shared client scripts
- Frontend app · Multi-page browser UI for the farming product
frontend/index.html - Auth pages · Login, registration, password reset, and profile screens
frontend/login.html - Agri tools · Weather, market price, crop planning, and loan tools
frontend/weather.html - Marketplace · Store, area store, ploughing services, and comparison views
frontend/store.html - Learning pages · Education and guide-oriented browser content
frontend/education.html - Community chat · Standalone browser chat surface
frontend/chat.html - Shared style · Common visual system across pages
frontend/style.css - API client · Shared browser-side client for backend requests
frontend/api.js - Auth logic · Browser authentication and session flow handling
frontend/auth.js - Navigation · Cross-page navigation behavior
frontend/nav.js - i18n · Language and localization support
frontend/i18n.js
Backend
Express entrypoint, auth flow, models, and server utilities
- Server · Backend application bootstrap and routing entrypoint
backend/server.js - Auth routes · Authentication-related API endpoints
backend/routes/authRoutes.js - Auth controller · Login, register, reset, and account actions
backend/controllers/authController.js - User model · Primary account record
backend/models/User.js - Notification model · Server-side notification records
backend/models/Notification.js - Service model · Ploughing service listing records
backend/models/PloughingService.js - Email sender · Outward email delivery for account flows
backend/utils/sendEmail.js
Persistence
Local database and disk-based assets
- SQLite DB · Durable application data stored on disk
db/kisan_sathi.db - Avatar uploads · Disk-based uploaded profile images
backend/uploads/avatars
External APIs
Third-party live data providers used from the browser
- Weather API · Live weather data provider used by browser features
- Price API · Live mandi or market-price data source
Connections 21
- Frontend app → Shared style: uses · Shared presentation across pages
- Frontend app → Navigation: shares · Navigation behavior across pages
- Frontend app → i18n: shares · Localized UI text
- Auth pages → Auth logic: uses · Browser authentication flow support
- Auth pages → API client: calls · Account actions sent to backend
- Agri tools → Weather API: fetches · Browser calls to live weather data
- Agri tools → Price API: fetches · Browser calls to live price data
- Marketplace → API client: reads · Shared client data access where needed
- Community chat → API client: syncs · Uses shared API client for application data
- API client → Server: requests · Browser-to-server API boundary
- Server → Auth routes: mounts · Registers authentication routes
- Auth routes → Auth controller: delegates · Route handlers forward to controller logic
- Auth controller → User model: persists · Account records
- Auth controller → Notification model: writes · Notification side effects
- Auth controller → Service model: persists · Service listing records
- Auth controller → Email sender: sends · Password reset and account emails
- User model → SQLite DB: stored in · Primary durable persistence
- Notification model → SQLite DB: stored in · Notification persistence
- Service model → SQLite DB: stored in · Service listing persistence
- Server → Avatar uploads: serves · Filesystem upload boundary
- Auth controller → Avatar uploads: writes · Profile image uploads