# farmassistx/farmassist architecture

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

- Interactive diagram: https://gitdiagram.com/farmassistx/farmassist
- Repository: https://github.com/farmassistx/farmassist

## Overview

Farmassist is a Flutter smart-farming app whose user-facing workflows cover authentication, farm records and information, IoT telemetry, and on-device plant-disease detection. The README documents the backend services and major capabilities; Dart source was not excerpted, so edges describe documented relationships rather than unverified implementation calls.

Main entry points: [`lib/data/authentication/repositories/authentication_repository.dart`](https://github.com/farmassistx/farmassist/blob/master/lib/data/authentication/repositories/authentication_repository.dart) (Auth Repository), [`lib/ui/farm`](https://github.com/farmassistx/farmassist/tree/master/lib/ui/farm) (Farm Records), [`lib/main.dart`](https://github.com/farmassistx/farmassist/blob/master/lib/main.dart) (App Entry), [`lib/ui/login/login_page.dart`](https://github.com/farmassistx/farmassist/blob/master/lib/ui/login/login_page.dart) (Login and Signup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Shell"]
  node_app_entry["App Entry<br/>[main.dart]"]
  node_app_shell["App Shell<br/>[app.dart]"]
end

subgraph group_auth["Authentication"]
  node_auth_ui["Login and Signup<br/>[login_page.dart]"]
  node_auth_state["Auth State"]
  node_auth_repo["Auth Repository"]
  node_profile["User Profile"]
  node_firebase_auth["Firebase Auth"]
end

subgraph group_farm["Farm Management"]
  node_farm_ui["Farm Records"]
  node_plant_store["Planting Storage<br/>[storeData.dart]"]
  node_harvest_store["Harvest Storage"]
  node_news_ui["Agricultural News<br/>[news_home.dart]"]
  node_news_api["News API<br/>[newsAPI.dart]"]
  node_weather_ui["Farm Weather<br/>[weatherHome.dart]"]
  node_weather_api["Weather API"]
end

subgraph group_iot["IoT Monitoring"]
  node_iot_ui["Telemetry Views"]
  node_telemetry_repo["Telemetry Repository"]
  node_realtime_db[("Realtime Database")]
  node_cloud_functions["Cloud Functions"]
  node_messaging["Cloud Messaging"]
end

subgraph group_disease["Disease Detection"]
  node_disease_ui["Disease Diagnosis"]
  node_classifier["Disease Classifier<br/>[classifier.dart]"]
  node_tflite_model["TFLite Model<br/>[model.tflite]"]
end

node_farmer(("Farmer"))
node_firestore[("Cloud Firestore")]

node_farmer -.->|"opens app"| node_app_entry
node_app_entry -.->|"starts"| node_app_shell
node_farmer -->|"signs in"| node_auth_ui
node_auth_ui -->|"uses Bloc"| node_auth_state
node_auth_state -->|"authenticates"| node_auth_repo
node_auth_repo -->|"uses"| node_firebase_auth
node_auth_repo -->|"stores profile"| node_firestore
node_farmer -.->|"views profile"| node_profile
node_farmer -->|"manages farm"| node_farm_ui
node_farm_ui -.->|"manages planting"| node_plant_store
node_farm_ui -.->|"manages harvests"| node_harvest_store
node_plant_store -->|"stores records"| node_firestore
node_harvest_store -->|"stores records"| node_firestore
node_farmer -->|"views news"| node_news_ui
node_news_ui -->|"fetches headlines"| node_news_api
node_farmer -->|"checks weather"| node_weather_ui
node_weather_ui -->|"requests weather"| node_weather_api
node_farmer -->|"views telemetry"| node_iot_ui
node_iot_ui -.->|"reads telemetry"| node_telemetry_repo
node_telemetry_repo -->|"synchronizes data"| node_realtime_db
node_realtime_db -->|"triggers on updates"| node_cloud_functions
node_cloud_functions -->|"sends alerts"| node_messaging
node_farmer -->|"submits plant image"| node_disease_ui
node_disease_ui -.->|"detects disease"| node_classifier
node_classifier -->|"uses model"| node_tflite_model

click node_app_entry "https://github.com/farmassistx/farmassist/blob/master/lib/main.dart"
click node_app_shell "https://github.com/farmassistx/farmassist/blob/master/lib/app.dart"
click node_auth_ui "https://github.com/farmassistx/farmassist/blob/master/lib/ui/login/login_page.dart"
click node_auth_state "https://github.com/farmassistx/farmassist/blob/master/lib/bloc/authentication/bloc/authentication_bloc.dart"
click node_auth_repo "https://github.com/farmassistx/farmassist/blob/master/lib/data/authentication/repositories/authentication_repository.dart"
click node_profile "https://github.com/farmassistx/farmassist/blob/master/lib/ui/profile/user_profile_page.dart"
click node_farm_ui "https://github.com/farmassistx/farmassist/tree/master/lib/ui/farm"
click node_plant_store "https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/repositories/storeData.dart"
click node_harvest_store "https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/repositories/harvest_storeData.dart"
click node_news_ui "https://github.com/farmassistx/farmassist/blob/master/lib/ui/farm/news/news_home.dart"
click node_news_api "https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/resources/newsAPI.dart"
click node_weather_ui "https://github.com/farmassistx/farmassist/blob/master/lib/ui/farm/weather/weatherHome.dart"
click node_weather_api "https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/api/openweathermap_weather_api.dart"
click node_iot_ui "https://github.com/farmassistx/farmassist/blob/master/lib/ui/IoT/IoT_monitoring_page.dart"
click node_telemetry_repo "https://github.com/farmassistx/farmassist/blob/master/lib/data/IoT/repositories/telemetry_data_repository.dart"
click node_disease_ui "https://github.com/farmassistx/farmassist/blob/master/lib/ui/diseases/disease_detection_page.dart"
click node_classifier "https://github.com/farmassistx/farmassist/blob/master/lib/data/diseases/classifier.dart"
click node_tflite_model "https://github.com/farmassistx/farmassist/blob/master/assets/model.tflite"

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_app_entry,node_app_shell toneBlue
class node_auth_ui,node_auth_state,node_auth_repo,node_profile,node_firebase_auth,node_firestore toneAmber
class node_farm_ui,node_plant_store,node_harvest_store,node_news_ui,node_news_api,node_weather_ui,node_weather_api toneMint
class node_iot_ui,node_telemetry_repo,node_realtime_db,node_cloud_functions,node_messaging toneRose
class node_disease_ui,node_classifier,node_tflite_model,node_farmer toneIndigo
```

## Components

### App Shell

- [App Entry](https://github.com/farmassistx/farmassist/blob/master/lib/main.dart): `lib/main.dart`
- [App Shell](https://github.com/farmassistx/farmassist/blob/master/lib/app.dart): `lib/app.dart`

### Authentication

- [Login and Signup](https://github.com/farmassistx/farmassist/blob/master/lib/ui/login/login_page.dart): `lib/ui/login/login_page.dart`
- [Auth State](https://github.com/farmassistx/farmassist/blob/master/lib/bloc/authentication/bloc/authentication_bloc.dart): `lib/bloc/authentication/bloc/authentication_bloc.dart`
- [Auth Repository](https://github.com/farmassistx/farmassist/blob/master/lib/data/authentication/repositories/authentication_repository.dart): `lib/data/authentication/repositories/authentication_repository.dart`
- [User Profile](https://github.com/farmassistx/farmassist/blob/master/lib/ui/profile/user_profile_page.dart): `lib/ui/profile/user_profile_page.dart`
- **Firebase Auth**

### Farm Management

- [Farm Records](https://github.com/farmassistx/farmassist/tree/master/lib/ui/farm): `lib/ui/farm`
- [Planting Storage](https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/repositories/storeData.dart): `lib/data/farm/repositories/storeData.dart`
- [Harvest Storage](https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/repositories/harvest_storeData.dart): `lib/data/farm/repositories/harvest_storeData.dart`
- [Agricultural News](https://github.com/farmassistx/farmassist/blob/master/lib/ui/farm/news/news_home.dart): `lib/ui/farm/news/news_home.dart`
- [News API](https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/resources/newsAPI.dart): `lib/data/farm/resources/newsAPI.dart`
- [Farm Weather](https://github.com/farmassistx/farmassist/blob/master/lib/ui/farm/weather/weatherHome.dart): `lib/ui/farm/weather/weatherHome.dart`
- [Weather API](https://github.com/farmassistx/farmassist/blob/master/lib/data/farm/api/openweathermap_weather_api.dart): `lib/data/farm/api/openweathermap_weather_api.dart`

### IoT Monitoring

- [Telemetry Views](https://github.com/farmassistx/farmassist/blob/master/lib/ui/IoT/IoT_monitoring_page.dart): `lib/ui/IoT/IoT_monitoring_page.dart`
- [Telemetry Repository](https://github.com/farmassistx/farmassist/blob/master/lib/data/IoT/repositories/telemetry_data_repository.dart): `lib/data/IoT/repositories/telemetry_data_repository.dart`
- **Realtime Database**
- **Cloud Functions**
- **Cloud Messaging**

### Disease Detection

- [Disease Diagnosis](https://github.com/farmassistx/farmassist/blob/master/lib/ui/diseases/disease_detection_page.dart): `lib/ui/diseases/disease_detection_page.dart`
- [Disease Classifier](https://github.com/farmassistx/farmassist/blob/master/lib/data/diseases/classifier.dart): `lib/data/diseases/classifier.dart`
- [TFLite Model](https://github.com/farmassistx/farmassist/blob/master/assets/model.tflite): `assets/model.tflite`

### Other components

- **Farmer**
- **Cloud Firestore**

## Connections

- Farmer → App Entry: opens app
- App Entry → App Shell: starts
- Farmer → Login and Signup: signs in (evidence: `README.md`)
- Login and Signup → Auth State: uses Bloc (evidence: `README.md`)
- Auth State → Auth Repository: authenticates (evidence: `README.md`)
- Auth Repository → Firebase Auth: uses (evidence: `README.md`)
- Auth Repository → Cloud Firestore: stores profile (evidence: `README.md`)
- Farmer → User Profile: views profile
- Farmer → Farm Records: manages farm (evidence: `README.md`)
- Farm Records → Planting Storage: manages planting
- Farm Records → Harvest Storage: manages harvests
- Planting Storage → Cloud Firestore: stores records (evidence: `README.md`)
- Harvest Storage → Cloud Firestore: stores records (evidence: `README.md`)
- Farmer → Agricultural News: views news (evidence: `README.md`)
- Agricultural News → News API: fetches headlines (evidence: `README.md`)
- Farmer → Farm Weather: checks weather (evidence: `README.md`)
- Farm Weather → Weather API: requests weather (evidence: `README.md`)
- Farmer → Telemetry Views: views telemetry (evidence: `README.md`)
- Telemetry Views → Telemetry Repository: reads telemetry
- Telemetry Repository → Realtime Database: synchronizes data (evidence: `README.md`)
- Realtime Database → Cloud Functions: triggers on updates (evidence: `README.md`)
- Cloud Functions → Cloud Messaging: sends alerts (evidence: `README.md`)
- Farmer → Disease Diagnosis: submits plant image (evidence: `README.md`)
- Disease Diagnosis → Disease Classifier: detects disease
- Disease Classifier → TFLite Model: uses model (evidence: `README.md`)
