How vignesh81232/agriguard-ai works
AgriGuard is a crop-leaf diagnosis web app. A grower uploads a leaf image, optionally selects a crop or describes symptoms, and receives a model-generated diagnosis with localized disease guidance, severity, care advice, and nearby-store information. Accounts and diagnosis history are stored locally in the browser. The graph follows the shown client-to-server diagnosis path and the app’s documented component wiring; server internals and the store-locator implementation were not excerpted, so uncertain relationships are omitted or marked unverified.
Main entry points: App.tsx App coordinator · CaptureCard.tsx Leaf capture · ResultsDashboard.tsx Results dashboard · index.tsx Language provider
Components 21
App and workflow
- App coordinator
src/App.tsx - Leaf capture
src/components/CaptureCard.tsx - Speech input
src/hooks/useSpeechRecognition.ts - Account screen
src/components/AuthScreen.tsx - Top bar
src/components/TopBar.tsx
Diagnosis and guidance
- Diagnosis client
src/lib/diagnose.ts - Disease guidance
src/data/diseases.ts - Healthy counterpart
src/lib/healthyCounterpart.ts - Store listings
src/data/stores.ts
Local accounts
- Local accounts and history
src/lib/localAccounts.ts - Browser account store
src/lib/localAccounts.ts
Shared presentation
- Diagnosis summary
src/components/ResultsSummary.tsx - Results dashboard
src/components/ResultsDashboard.tsx - Store locator
src/components/StoreLocator.tsx - Language provider
src/i18n/index.tsx - Translations
src/i18n/translations.ts - Icon set
src/components/icons.tsx
Diagnosis service
- Diagnosis API
server.js - Gemini analysis
server/gemini.js
Other components
- Grower
- Gemini service
Connections 28
- Grower → App coordinator: uses
src/App.tsx - App coordinator → Account screen: renders
src/App.tsx - App coordinator → Leaf capture: renders
src/App.tsx - App coordinator → Top bar: renders
src/App.tsx - App coordinator → Diagnosis summary: renders
src/App.tsx - App coordinator → Results dashboard: renders
src/App.tsx - App coordinator → Store locator: renders
src/App.tsx - Leaf capture → Speech input: uses
src/components/CaptureCard.tsx - Leaf capture → Diagnosis client: submits image
src/components/CaptureCard.tsx - Diagnosis client → Diagnosis API: POST diagnosis
src/lib/diagnose.ts - Diagnosis API → Gemini analysis: dispatches
server.js - Gemini analysis → Gemini service: analyzes image
- Diagnosis client → Leaf capture: returns result
src/components/CaptureCard.tsx - App coordinator → Local accounts and history: loads session and history
src/App.tsx - Account screen → Local accounts and history: registers or signs in
src/components/AuthScreen.tsx - Local accounts and history → Browser account store: reads and writes
src/lib/localAccounts.ts - Diagnosis summary → Disease guidance: gets localized guidance
src/components/ResultsSummary.tsx - Results dashboard → Disease guidance: reads guidance
src/components/ResultsDashboard.tsx - Results dashboard → Healthy counterpart: uses comparison
src/components/ResultsDashboard.tsx - Store locator → Store listings: reads listings
src/components/StoreLocator.tsx - Store locator → Grower: shows locations
src/components/StoreLocator.tsx - Account screen → Language provider: uses translations
src/components/AuthScreen.tsx - Leaf capture → Language provider: uses translations
src/components/CaptureCard.tsx - Language provider → Translations: loads dictionaries
src/i18n/index.tsx - App coordinator → Language provider: provides language context
src/App.tsx - Leaf capture → Icon set: renders icons
src/components/CaptureCard.tsx - Diagnosis summary → Icon set: renders icons
src/components/ResultsSummary.tsx - Results dashboard → Icon set: renders icons
src/components/ResultsDashboard.tsx