# spidey6978/neoagrinext architecture

> Architecture diagram of the GitHub repository spidey6978/neoagrinext, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spidey6978/neoagrinext
- Repository: https://github.com/spidey6978/neoagrinext

## Overview

AgriNext combines an Android farming app with a FastAPI agriculture backend. The principal workflow is farmer input and farm selection, followed by crop recommendations or analysis, then actionable weather, market, satellite, AI, and schedule information presented in the app. The README also describes marketplace and authentication capabilities. Backend excerpts establish several service calls; Android implementation details and some backend wiring were not sampled, so uncertain connections are omitted.

Main entry points: [`app/main.py`](https://github.com/spidey6978/neoagrinext/blob/main/app/main.py) (API endpoints), [`app/src/main/java/com/example/agrinext/ui/screens`](https://github.com/spidey6978/neoagrinext/tree/main/app/src/main/java/com/example/agrinext/ui/screens) (Farm screens), [`app/services/earth_engine.py`](https://github.com/spidey6978/neoagrinext/blob/main/app/services/earth_engine.py) (Earth Engine), [`app/src/main/java/com/example/agrinext/data/FarmRepository.kt`](https://github.com/spidey6978/neoagrinext/blob/main/app/src/main/java/com/example/agrinext/data/FarmRepository.kt) (Farm repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Android app"]
  node_screens["Farm screens"]
  node_repository["Farm repository<br/>[FarmRepository.kt]"]
  node_api_client["API client<br/>[AgriNextApi.kt]"]
end

subgraph group_backend["Backend API"]
  node_backend_api["API endpoints<br/>[main.py]"]
  node_input_schema["Request and response schemas<br/>[input_schema.py]"]
end

subgraph group_insights["Farm insights"]
  node_crop_recommender["Crop recommendations"]
  node_weather["Weather insights<br/>[weather_service.py]"]
  node_market["Market analysis<br/>[market_service.py]"]
  node_ai_advice["AI advice<br/>[gemini_service.py]"]
  node_satellite["Satellite vegetation<br/>[ndvi_service.py]"]
  node_schedule["Crop schedule"]
  node_news["Agriculture news<br/>[news_service.py]"]
end

subgraph group_data["Data and integrations"]
  node_cache[("Response cache<br/>[cache_service.py]")]
  node_earth_engine["Earth Engine<br/>[earth_engine.py]"]
  node_gemini_provider{{"Gemini AI"}}
  node_weather_provider{{"Weather provider"}}
  node_market_sources{{"Market data sources"}}
  node_firebase{{"Firebase services"}}
end

node_farmer(("Farmer"))

node_farmer -->|"uses"| node_screens
node_screens -->|"requests farm data"| node_repository
node_repository -->|"delegates API calls"| node_api_client
node_api_client -->|"sends requests"| node_backend_api
node_backend_api -->|"validates data"| node_input_schema
node_backend_api -->|"requests crops"| node_crop_recommender
node_backend_api -->|"gets weather"| node_weather
node_backend_api -->|"gets market analysis"| node_market
node_backend_api -->|"requests advice"| node_ai_advice
node_backend_api -->|"requests satellite data"| node_satellite
node_backend_api -->|"requests news"| node_news
node_weather -.->|"fetches conditions"| node_weather_provider
node_market -.->|"fetches prices and markets"| node_market_sources
node_ai_advice -.->|"generates advice"| node_gemini_provider
node_news -.->|"generates headlines"| node_gemini_provider
node_satellite -->|"requests imagery"| node_earth_engine
node_earth_engine -.->|"reads Sentinel imagery"| node_earth_engine
node_cache -->|"stores cached data"| node_cache
node_screens -.->|"uses authentication and database"| node_firebase

click node_screens "https://github.com/spidey6978/neoagrinext/tree/main/app/src/main/java/com/example/agrinext/ui/screens"
click node_repository "https://github.com/spidey6978/neoagrinext/blob/main/app/src/main/java/com/example/agrinext/data/FarmRepository.kt"
click node_api_client "https://github.com/spidey6978/neoagrinext/blob/main/app/src/main/java/com/example/agrinext/data/AgriNextApi.kt"
click node_backend_api "https://github.com/spidey6978/neoagrinext/blob/main/app/main.py"
click node_input_schema "https://github.com/spidey6978/neoagrinext/blob/main/app/schemas/input_schema.py"
click node_crop_recommender "https://github.com/spidey6978/neoagrinext/blob/main/app/services/crop_recommender.py"
click node_weather "https://github.com/spidey6978/neoagrinext/blob/main/app/services/weather_service.py"
click node_market "https://github.com/spidey6978/neoagrinext/blob/main/app/services/market_service.py"
click node_ai_advice "https://github.com/spidey6978/neoagrinext/blob/main/app/services/gemini_service.py"
click node_satellite "https://github.com/spidey6978/neoagrinext/blob/main/app/services/ndvi_service.py"
click node_schedule "https://github.com/spidey6978/neoagrinext/blob/main/app/services/schedule_service.py"
click node_news "https://github.com/spidey6978/neoagrinext/blob/main/app/services/news_service.py"
click node_cache "https://github.com/spidey6978/neoagrinext/blob/main/app/services/cache_service.py"
click node_earth_engine "https://github.com/spidey6978/neoagrinext/blob/main/app/services/earth_engine.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_screens,node_repository,node_api_client toneBlue
class node_backend_api,node_input_schema toneAmber
class node_crop_recommender,node_weather,node_market,node_ai_advice,node_satellite,node_schedule,node_news toneMint
class node_cache,node_earth_engine,node_gemini_provider,node_weather_provider,node_market_sources,node_firebase toneRose
class node_farmer toneIndigo
```

## Components

### Android app

- [Farm screens](https://github.com/spidey6978/neoagrinext/tree/main/app/src/main/java/com/example/agrinext/ui/screens): `app/src/main/java/com/example/agrinext/ui/screens`
- [Farm repository](https://github.com/spidey6978/neoagrinext/blob/main/app/src/main/java/com/example/agrinext/data/FarmRepository.kt): `app/src/main/java/com/example/agrinext/data/FarmRepository.kt`
- [API client](https://github.com/spidey6978/neoagrinext/blob/main/app/src/main/java/com/example/agrinext/data/AgriNextApi.kt): `app/src/main/java/com/example/agrinext/data/AgriNextApi.kt`

### Backend API

- [API endpoints](https://github.com/spidey6978/neoagrinext/blob/main/app/main.py): `app/main.py`
- [Request and response schemas](https://github.com/spidey6978/neoagrinext/blob/main/app/schemas/input_schema.py): `app/schemas/input_schema.py`

### Farm insights

- [Crop recommendations](https://github.com/spidey6978/neoagrinext/blob/main/app/services/crop_recommender.py): `app/services/crop_recommender.py`
- [Weather insights](https://github.com/spidey6978/neoagrinext/blob/main/app/services/weather_service.py): `app/services/weather_service.py`
- [Market analysis](https://github.com/spidey6978/neoagrinext/blob/main/app/services/market_service.py): `app/services/market_service.py`
- [AI advice](https://github.com/spidey6978/neoagrinext/blob/main/app/services/gemini_service.py): `app/services/gemini_service.py`
- [Satellite vegetation](https://github.com/spidey6978/neoagrinext/blob/main/app/services/ndvi_service.py): `app/services/ndvi_service.py`
- [Crop schedule](https://github.com/spidey6978/neoagrinext/blob/main/app/services/schedule_service.py): `app/services/schedule_service.py`
- [Agriculture news](https://github.com/spidey6978/neoagrinext/blob/main/app/services/news_service.py): `app/services/news_service.py`

### Data and integrations

- [Response cache](https://github.com/spidey6978/neoagrinext/blob/main/app/services/cache_service.py): `app/services/cache_service.py`
- [Earth Engine](https://github.com/spidey6978/neoagrinext/blob/main/app/services/earth_engine.py): `app/services/earth_engine.py`
- **Gemini AI**
- **Weather provider**
- **Market data sources**
- **Firebase services**

### Other components

- **Farmer**

## Connections

- Farmer → Farm screens: uses
- Farm screens → Farm repository: requests farm data
- Farm repository → API client: delegates API calls
- API client → API endpoints: sends requests
- API endpoints → Request and response schemas: validates data
- API endpoints → Crop recommendations: requests crops
- API endpoints → Weather insights: gets weather
- API endpoints → Market analysis: gets market analysis
- API endpoints → AI advice: requests advice
- API endpoints → Satellite vegetation: requests satellite data
- API endpoints → Agriculture news: requests news
- Weather insights → Weather provider: fetches conditions
- Market analysis → Market data sources: fetches prices and markets
- AI advice → Gemini AI: generates advice
- Agriculture news → Gemini AI: generates headlines
- Satellite vegetation → Earth Engine: requests imagery
- Earth Engine → Earth Engine: reads Sentinel imagery
- Response cache → Response cache: stores cached data
- Farm screens → Firebase services: uses authentication and database
