# venkatchaitanya7/cropstress-compass architecture

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

- Interactive diagram: https://gitdiagram.com/venkatchaitanya7/cropstress-compass
- Repository: https://github.com/venkatchaitanya7/cropstress-compass

## Overview

Cropstress Compass is a browser-based crop-stress forecasting and intervention simulator, not a connected farm-sensor or weather-data service. A user selects a crop, scenario inputs, and an intervention; the home route uses a local model to produce a 14-day forecast, recovery estimates, risk metrics, and a comparison against an image-only baseline. The route also displays a simulated backtest. Server-side rendering and error handling support the application. The README describes the research goal, while sampled code shows synthetic in-browser modeling; unsampled advice, weather, and reporting modules are not assumed to participate in this workflow.

Main entry points: [`src/routes/index.tsx`](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routes/index.tsx) (Forecast dashboard), [`src/routeTree.gen.ts`](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routeTree.gen.ts) (Route tree), [`src/server.ts`](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/server.ts) (SSR server), [`src/router.tsx`](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/router.tsx) (App router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_router["App router<br/>[router.tsx]"]
  node_route_tree["Route tree<br/>[routeTree.gen.ts]"]
  node_home["Forecast dashboard<br/>[index.tsx]"]
end

subgraph group_model["Forecast model"]
  node_forecast["Stress forecast<br/>[stress-model.ts]"]
  node_recovery["Intervention recovery<br/>[stress-model.ts]"]
  node_benchmark["Model backtest<br/>[stress-model.ts]"]
end

subgraph group_runtime["Runtime and errors"]
  node_ssr["SSR server<br/>[server.ts]"]
  node_root["Root shell<br/>[__root.tsx]"]
  node_error_capture["Error capture<br/>[error-capture.ts]"]
  node_error_page["Error page<br/>[error-page.ts]"]
  node_error_reporting["Error reporting"]
end

node_farmer(("Farmer"))

node_farmer -.->|"opens app"| node_router
node_router -->|"configures routes"| node_route_tree
node_route_tree -->|"registers root"| node_root
node_route_tree -->|"registers home"| node_home
node_home -->|"builds forecast"| node_forecast
node_home -->|"simulates recovery"| node_recovery
node_home -->|"runs backtest"| node_benchmark
node_ssr -->|"captures errors"| node_error_capture
node_ssr -->|"renders failures"| node_error_page
node_root -->|"reports errors"| node_error_reporting

click node_router "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/router.tsx"
click node_route_tree "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routeTree.gen.ts"
click node_home "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routes/index.tsx"
click node_forecast "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts"
click node_recovery "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts"
click node_benchmark "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts"
click node_ssr "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/server.ts"
click node_root "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routes/__root.tsx"
click node_error_capture "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/error-capture.ts"
click node_error_page "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/error-page.ts"
click node_error_reporting "https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/lovable-error-reporting.ts"

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_router,node_route_tree,node_home toneBlue
class node_forecast,node_recovery,node_benchmark toneAmber
class node_ssr,node_root,node_error_capture,node_error_page,node_error_reporting toneMint
class node_farmer toneIndigo
```

## Components

### Application

- [App router](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/router.tsx): `src/router.tsx`
- [Route tree](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Forecast dashboard](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routes/index.tsx): `src/routes/index.tsx`

### Forecast model

- [Stress forecast](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts): `src/lib/stress-model.ts`
- [Intervention recovery](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts): `src/lib/stress-model.ts`
- [Model backtest](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/stress-model.ts): `src/lib/stress-model.ts`

### Runtime and errors

- [SSR server](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/server.ts): `src/server.ts`
- [Root shell](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/routes/__root.tsx): `src/routes/__root.tsx`
- [Error capture](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/error-capture.ts): `src/lib/error-capture.ts`
- [Error page](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/error-page.ts): `src/lib/error-page.ts`
- [Error reporting](https://github.com/venkatchaitanya7/cropstress-compass/blob/main/src/lib/lovable-error-reporting.ts): `src/lib/lovable-error-reporting.ts`

### Other components

- **Farmer**

## Connections

- Farmer → App router: opens app
- App router → Route tree: configures routes (evidence: `src/router.tsx`)
- Route tree → Root shell: registers root (evidence: `src/routeTree.gen.ts`)
- Route tree → Forecast dashboard: registers home (evidence: `src/routeTree.gen.ts`)
- Forecast dashboard → Stress forecast: builds forecast (evidence: `src/routes/index.tsx`)
- Forecast dashboard → Intervention recovery: simulates recovery (evidence: `src/routes/index.tsx`)
- Forecast dashboard → Model backtest: runs backtest (evidence: `src/routes/index.tsx`)
- SSR server → Error capture: captures errors (evidence: `src/server.ts`)
- SSR server → Error page: renders failures (evidence: `src/server.ts`)
- Root shell → Error reporting: reports errors (evidence: `src/routes/__root.tsx`)
