# 25pradnyesh/vertifarm-app architecture

> Architecture diagram of the GitHub repository 25pradnyesh/vertifarm-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/25pradnyesh/vertifarm-app
- Repository: https://github.com/25pradnyesh/vertifarm-app

## Overview

VertiFarm is a mobile-first vertical-farming monitor combining farm and sensor management, environmental telemetry, alerts, analytics, and AI plant-health scans. The main user workflow runs from mobile authentication and dashboard screens through client services and the REST API to backend domain services and persistence; telemetry can also stream to the app. The README documents broader IoT and real-time capabilities, but edge-device implementations are not in this tree. Some screen and backend service links are therefore documented at subsystem level rather than inferred from unsampled code.

Main entry points: [`services/apiClient.ts`](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/apiClient.ts) (HTTP client), [`services/sensorService.ts`](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/sensorService.ts) (Sensor service), [`backend/app/db/session.py`](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/db/session.py) (Backend persistence), [`backend/app/api/v1/router.py`](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/api/v1/router.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile experience"]
  node_authscreens["Authentication screens<br/>[login.tsx]"]
  node_dashboard["Farm dashboard<br/>[index.tsx]"]
  node_monitoring["Telemetry views<br/>[&#91;metric&#93;.tsx]"]
  node_farmdevices["Farm and sensors<br/>[index.tsx]"]
  node_alertviews["Alert views<br/>[&#91;id&#93;.tsx]"]
  node_analytics["Trend analytics<br/>[analytics.tsx]"]
  node_aiscreens["AI scan experience<br/>[result.tsx]"]
  node_recommendations["Recommendations"]
end

subgraph group_client["Client services"]
  node_authservice["Authentication service<br/>[authService.ts]"]
  node_sensorservice["Sensor service<br/>[sensorService.ts]"]
  node_alertservice["Alert service<br/>[alertService.ts]"]
  node_aiservice["AI service<br/>[aiService.ts]"]
  node_apiclient["HTTP client<br/>[apiClient.ts]"]
end

subgraph group_backend["Backend platform"]
  node_api["REST API<br/>[router.py]"]
  node_authbackend["Authentication backend<br/>[auth_service.py]"]
  node_telemetrybackend["Telemetry ingestion<br/>[mqtt_service.py]"]
  node_realtime["Realtime publishing"]
  node_ai_backend["AI inference<br/>[ai_service.py]"]
  node_persistence[("Backend persistence<br/>[session.py]")]
  node_domain["Farm domain models<br/>[domain.py]"]
end

subgraph group_presentation["Shared presentation"]
  node_uikit["UI primitives"]
  node_charts["Metric charts"]
end

node_grower(("Grower"))
node_devices{{"Farm edge devices"}}
node_database[("PostgreSQL / Supabase")]

node_grower -->|"signs in"| node_authscreens
node_authscreens -->|"authenticates"| node_authservice
node_dashboard -->|"requests status"| node_sensorservice
node_monitoring -->|"loads metrics"| node_sensorservice
node_farmdevices -->|"manages devices"| node_sensorservice
node_alertviews -->|"loads alert"| node_alertservice
node_aiscreens -->|"submits scan"| node_aiservice
node_analytics -.->|"views trends"| node_sensorservice
node_recommendations -.->|"views guidance"| node_aiservice
node_authservice -->|"sends auth requests"| node_apiclient
node_sensorservice -->|"requests telemetry"| node_apiclient
node_sensorservice -->|"opens telemetry stream"| node_apiclient
node_alertservice -->|"requests alerts"| node_apiclient
node_aiservice -->|"sends scan requests"| node_apiclient
node_apiclient -->|"calls REST endpoints"| node_api
node_api -->|"routes authentication"| node_authbackend
node_api -.->|"routes telemetry"| node_telemetrybackend
node_api -.->|"routes AI scans"| node_ai_backend
node_devices -.->|"publishes telemetry"| node_telemetrybackend
node_telemetrybackend -->|"publishes readings"| node_realtime
node_authbackend -->|"reads and writes"| node_persistence
node_ai_backend -->|"stores scan data"| node_persistence
node_telemetrybackend -->|"stores telemetry"| node_persistence
node_persistence -->|"uses domain models"| node_domain
node_persistence -.->|"persists records"| node_database
node_dashboard -->|"renders with"| node_uikit
node_monitoring -->|"renders chart"| node_charts
node_realtime -.->|"streams updates"| node_apiclient

click node_authscreens "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(auth)/login.tsx"
click node_dashboard "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(tabs)/index.tsx"
click node_monitoring "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/live-data/%5Bmetric%5D.tsx"
click node_farmdevices "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/sensors/index.tsx"
click node_alertviews "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/alerts/%5Bid%5D.tsx"
click node_analytics "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(tabs)/analytics.tsx"
click node_aiscreens "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/ai/result.tsx"
click node_recommendations "https://github.com/25pradnyesh/vertifarm-app/blob/master/app/recommendations.tsx"
click node_authservice "https://github.com/25pradnyesh/vertifarm-app/blob/master/services/authService.ts"
click node_sensorservice "https://github.com/25pradnyesh/vertifarm-app/blob/master/services/sensorService.ts"
click node_alertservice "https://github.com/25pradnyesh/vertifarm-app/blob/master/services/alertService.ts"
click node_aiservice "https://github.com/25pradnyesh/vertifarm-app/blob/master/services/aiService.ts"
click node_apiclient "https://github.com/25pradnyesh/vertifarm-app/blob/master/services/apiClient.ts"
click node_api "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/api/v1/router.py"
click node_authbackend "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/auth_service.py"
click node_telemetrybackend "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/mqtt_service.py"
click node_realtime "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/realtime_service.py"
click node_ai_backend "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/ai_service.py"
click node_persistence "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/db/session.py"
click node_domain "https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/models/domain.py"
click node_uikit "https://github.com/25pradnyesh/vertifarm-app/blob/master/components/ui/ScreenContainer.tsx"
click node_charts "https://github.com/25pradnyesh/vertifarm-app/blob/master/components/charts/SingleMetricChart.tsx"

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_authscreens,node_dashboard,node_monitoring,node_farmdevices,node_alertviews,node_analytics,node_aiscreens,node_recommendations toneBlue
class node_authservice,node_sensorservice,node_alertservice,node_aiservice,node_apiclient,node_database toneAmber
class node_api,node_authbackend,node_telemetrybackend,node_realtime,node_ai_backend,node_persistence,node_domain toneMint
class node_uikit,node_charts toneRose
class node_grower,node_devices toneIndigo
```

## Components

### Mobile experience

- [Authentication screens](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(auth)/login.tsx): `app/(auth)/login.tsx`
- [Farm dashboard](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Telemetry views](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/live-data/%5Bmetric%5D.tsx): `app/live-data/[metric].tsx`
- [Farm and sensors](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/sensors/index.tsx): `app/sensors/index.tsx`
- [Alert views](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/alerts/%5Bid%5D.tsx): `app/alerts/[id].tsx`
- [Trend analytics](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/(tabs)/analytics.tsx): `app/(tabs)/analytics.tsx`
- [AI scan experience](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/ai/result.tsx): `app/ai/result.tsx`
- [Recommendations](https://github.com/25pradnyesh/vertifarm-app/blob/master/app/recommendations.tsx): `app/recommendations.tsx`

### Client services

- [Authentication service](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/authService.ts): `services/authService.ts`
- [Sensor service](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/sensorService.ts): `services/sensorService.ts`
- [Alert service](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/alertService.ts): `services/alertService.ts`
- [AI service](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/aiService.ts): `services/aiService.ts`
- [HTTP client](https://github.com/25pradnyesh/vertifarm-app/blob/master/services/apiClient.ts): `services/apiClient.ts`

### Backend platform

- [REST API](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Authentication backend](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [Telemetry ingestion](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/mqtt_service.py): `backend/app/services/mqtt_service.py`
- [Realtime publishing](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/realtime_service.py): `backend/app/services/realtime_service.py`
- [AI inference](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/services/ai_service.py): `backend/app/services/ai_service.py`
- [Backend persistence](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/db/session.py): `backend/app/db/session.py`
- [Farm domain models](https://github.com/25pradnyesh/vertifarm-app/blob/master/backend/app/models/domain.py): `backend/app/models/domain.py`

### Shared presentation

- [UI primitives](https://github.com/25pradnyesh/vertifarm-app/blob/master/components/ui/ScreenContainer.tsx): `components/ui/ScreenContainer.tsx`
- [Metric charts](https://github.com/25pradnyesh/vertifarm-app/blob/master/components/charts/SingleMetricChart.tsx): `components/charts/SingleMetricChart.tsx`

### Other components

- **Grower**
- **Farm edge devices**
- **PostgreSQL / Supabase**

## Connections

- Grower → Authentication screens: signs in (evidence: `README.md`)
- Authentication screens → Authentication service: authenticates (evidence: `app/(auth)/login.tsx`)
- Farm dashboard → Sensor service: requests status (evidence: `app/(tabs)/index.tsx`)
- Telemetry views → Sensor service: loads metrics (evidence: `app/live-data/[metric].tsx`)
- Farm and sensors → Sensor service: manages devices (evidence: `app/sensors/index.tsx`)
- Alert views → Alert service: loads alert (evidence: `app/alerts/[id].tsx`)
- AI scan experience → AI service: submits scan (evidence: `app/ai/result.tsx`)
- Trend analytics → Sensor service: views trends (evidence: `README.md`)
- Recommendations → AI service: views guidance (evidence: `README.md`)
- Authentication service → HTTP client: sends auth requests (evidence: `services/authService.ts`)
- Sensor service → HTTP client: requests telemetry (evidence: `services/sensorService.ts`)
- Sensor service → HTTP client: opens telemetry stream (evidence: `services/sensorService.ts`)
- Alert service → HTTP client: requests alerts (evidence: `services/alertService.ts`)
- AI service → HTTP client: sends scan requests (evidence: `services/aiService.ts`)
- HTTP client → REST API: calls REST endpoints (evidence: `README.md`)
- REST API → Authentication backend: routes authentication (evidence: `backend/app/api/v1/router.py`)
- REST API → Telemetry ingestion: routes telemetry
- REST API → AI inference: routes AI scans
- Farm edge devices → Telemetry ingestion: publishes telemetry (evidence: `README.md`)
- Telemetry ingestion → Realtime publishing: publishes readings (evidence: `backend/app/services/mqtt_service.py`)
- Authentication backend → Backend persistence: reads and writes (evidence: `backend/app/services/auth_service.py`)
- AI inference → Backend persistence: stores scan data (evidence: `backend/app/services/ai_service.py`)
- Telemetry ingestion → Backend persistence: stores telemetry (evidence: `backend/app/services/mqtt_service.py`)
- Backend persistence → Farm domain models: uses domain models (evidence: `backend/app/db/session.py`)
- Backend persistence → PostgreSQL / Supabase: persists records (evidence: `README.md`)
- Farm dashboard → UI primitives: renders with (evidence: `app/(tabs)/index.tsx`)
- Telemetry views → Metric charts: renders chart (evidence: `app/live-data/[metric].tsx`)
- Realtime publishing → HTTP client: streams updates (evidence: `README.md`)
