How dinraj910/smart-farming-assistant works
NatureSync is a Kerala-focused precision-agriculture mobile app backed by a FastAPI service. Farmers sign in, manage field profiles, and use those details for AI advice; separate app flows provide crop recommendations, leaf-disease diagnosis, weather, and market intelligence. The sampled source confirms app navigation, authentication requests, backend router registration, and the agent’s tool dispatch. Several product screens and API handlers were not sampled, so their relationships are shown only where the README documents them; database and third-party integrations are likewise represented at the documented level.
Main entry points: main.py FastAPI gateway · MainTabNavigator.tsx Feature tabs · orchestrator.py Agent orchestrator · App.tsx App navigation
Components 30
Mobile experience
- App navigation
mobile/App.tsx - Feature tabs
mobile/src/navigation/MainTabNavigator.tsx - Farm management
mobile/src/screens/FarmsScreen.tsx - Field details
mobile/src/screens/FieldDetailScreen.tsx - AI chat
mobile/src/screens/AgentChatScreen.tsx - Crop advice
mobile/src/screens/HomeScreen.tsx - Leaf Doctor
mobile/src/screens/LeafDoctorScreen.tsx - Weather view
mobile/src/screens/WeatherScreen.tsx - Market view
mobile/src/screens/MarketScreen.tsx - API client
mobile/src/api/client.ts
Backend API
- FastAPI gateway
backend/main.py - Authentication API
backend/app/routers/auth.py - Farm API
backend/app/routers/farm.py - Crop API
backend/app/routers/crop.py - Disease API
backend/app/routers/disease.py - Market API
backend/app/routers/market.py - Agent API
backend/app/routers/agent.py
Agricultural intelligence
- Agent orchestrator
backend/app/agent/orchestrator.py - Conversation memory
backend/app/agent/memory.py - Crop classifier
backend/app/ml/crop_model.py - Agronomy tools
backend/app/agent/tools - KAU knowledge search
backend/app/agent/tools/kau_search_tool.py - Query embeddings
backend/app/rag/embed_utils.py
Identity and state
- Auth state
mobile/src/store/authStore.ts - Password and tokens
backend/app/auth/security.py
Other components
- Farmer
- KAU vector store
- Weather data service
- Agmarknet
- Disease classifier
Connections 30
- Farmer → App navigation: uses
- App navigation → Auth state: checks sign-in
mobile/App.tsx - App navigation → Feature tabs: opens
mobile/App.tsx - Feature tabs → Farm management: routes to
mobile/src/navigation/MainTabNavigator.tsx - Feature tabs → AI chat: routes to
mobile/src/navigation/MainTabNavigator.tsx - Feature tabs → Crop advice: routes to
mobile/src/navigation/MainTabNavigator.tsx - Feature tabs → Leaf Doctor: routes to
mobile/src/navigation/MainTabNavigator.tsx - Feature tabs → Weather view: routes to
mobile/src/navigation/MainTabNavigator.tsx - Feature tabs → Market view: routes to
mobile/src/navigation/MainTabNavigator.tsx - Farm management → Field details: opens field
- Auth state → API client: sends auth requests
mobile/src/store/authStore.ts - API client → FastAPI gateway: calls REST API
- FastAPI gateway → Authentication API: mounts
backend/main.py - FastAPI gateway → Farm API: mounts
backend/main.py - FastAPI gateway → Crop API: mounts
backend/main.py - FastAPI gateway → Disease API: mounts
backend/main.py - FastAPI gateway → Market API: mounts
backend/main.py - FastAPI gateway → Agent API: mounts
backend/main.py - Authentication API → Password and tokens: uses
backend/app/routers/auth.py - FastAPI gateway → Crop classifier: loads model
backend/main.py - Agent API → Agent orchestrator: invokes
backend/app/routers/agent.py - Agent orchestrator → Conversation memory: uses
backend/app/agent/orchestrator.py - Agent orchestrator → Agronomy tools: dispatches tools
backend/app/agent/orchestrator.py - Agent orchestrator → KAU knowledge search: dispatches search
backend/app/agent/orchestrator.py - KAU knowledge search → Query embeddings: embeds query
backend/app/agent/tools/kau_search_tool.py - KAU knowledge search → KAU vector store: queries vectors
backend/app/agent/tools/kau_search_tool.py - Agronomy tools → Weather data service: fetches forecasts
- Agronomy tools → Agmarknet: fetches prices
- Disease API → Disease classifier: classifies image
- Market API → Agmarknet: fetches mandi rates