# shehri07/ghanmi architecture

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

- Interactive diagram: https://gitdiagram.com/shehri07/ghanmi
- Repository: https://github.com/shehri07/ghanmi

## Overview

Ghanmi is a sheep-farm management frontend for herd records, husbandry, sales, expenses, and operational oversight. A user enters through the routed app, views the dashboard or a resource screen, and can search and maintain records. Resource operations pass through a data service that selects browser-local demo storage or an API client; the dashboard has a separate mock/API data path. The README also describes breeding, health, feeding, finance, reports, and system administration; some specialized screens are explicitly placeholders. Evidence is limited to the README and sampled/indexed files.

Main entry points: [`src/App.tsx`](https://github.com/shehri07/ghanmi/blob/main/src/App.tsx) (Route dispatcher), [`src/services/dataService.ts`](https://github.com/shehri07/ghanmi/blob/main/src/services/dataService.ts) (Data service), [`src/pages/Dashboard.tsx`](https://github.com/shehri07/ghanmi/blob/main/src/pages/Dashboard.tsx) (Farm dashboard), [`src/components/ResourcePage.tsx`](https://github.com/shehri07/ghanmi/blob/main/src/components/ResourcePage.tsx) (Resource records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_entry["App bootstrap<br/>[main.tsx]"]
  node_router["Route dispatcher<br/>[App.tsx]"]
  node_shell["Navigation shell<br/>[Layout.tsx]"]
end

subgraph group_operations["Farm Operations"]
  node_resource_ui["Resource records<br/>[ResourcePage.tsx]"]
  node_catalog["Resource definitions<br/>[resources.ts]"]
  node_special["Specialized screens<br/>[SpecialPages.tsx]"]
end

subgraph group_data["Data Access"]
  node_data_service["Data service<br/>[dataService.ts]"]
  node_local_store[("Browser record store<br/>[localStore.ts]")]
  node_mock_records["Sample records<br/>[mock.ts]"]
  node_resource_api["Resource API<br/>[resources.ts]"]
  node_http_client["HTTP client<br/>[client.ts]"]
  node_config["Data mode config<br/>[config.ts]"]
end

subgraph group_insights["Insights And Administration"]
  node_dashboard["Farm dashboard<br/>[Dashboard.tsx]"]
  node_stat_card["Metric cards<br/>[StatCard.tsx]"]
end

node_farmer(("Farm manager"))

node_farmer -->|"opens app"| node_entry
node_entry -->|"renders"| node_router
node_router -->|"routes through"| node_shell
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_resource_ui
node_router -->|"routes to"| node_special
node_router -->|"looks up resource"| node_catalog
node_resource_ui -->|"requests records"| node_data_service
node_resource_ui -->|"renders fields"| node_catalog
node_special -->|"renders resource"| node_resource_ui
node_dashboard -->|"renders metrics"| node_stat_card
node_dashboard -->|"fetches dashboard"| node_http_client
node_dashboard -->|"checks mock mode"| node_config
node_data_service -->|"checks mock mode"| node_config
node_data_service -->|"uses local CRUD"| node_local_store
node_local_store -->|"seeds records"| node_mock_records
node_data_service -->|"uses API CRUD"| node_resource_api
node_resource_api -->|"uses client"| node_http_client

click node_entry "https://github.com/shehri07/ghanmi/blob/main/src/main.tsx"
click node_router "https://github.com/shehri07/ghanmi/blob/main/src/App.tsx"
click node_shell "https://github.com/shehri07/ghanmi/blob/main/src/layouts/Layout.tsx"
click node_resource_ui "https://github.com/shehri07/ghanmi/blob/main/src/components/ResourcePage.tsx"
click node_catalog "https://github.com/shehri07/ghanmi/blob/main/src/data/resources.ts"
click node_special "https://github.com/shehri07/ghanmi/blob/main/src/pages/SpecialPages.tsx"
click node_dashboard "https://github.com/shehri07/ghanmi/blob/main/src/pages/Dashboard.tsx"
click node_stat_card "https://github.com/shehri07/ghanmi/blob/main/src/components/StatCard.tsx"
click node_data_service "https://github.com/shehri07/ghanmi/blob/main/src/services/dataService.ts"
click node_local_store "https://github.com/shehri07/ghanmi/blob/main/src/services/localStore.ts"
click node_mock_records "https://github.com/shehri07/ghanmi/blob/main/src/data/mock.ts"
click node_resource_api "https://github.com/shehri07/ghanmi/blob/main/src/api/resources.ts"
click node_http_client "https://github.com/shehri07/ghanmi/blob/main/src/api/client.ts"
click node_config "https://github.com/shehri07/ghanmi/blob/main/src/config.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_entry,node_router,node_shell toneBlue
class node_resource_ui,node_catalog,node_special toneAmber
class node_data_service,node_local_store,node_mock_records,node_resource_api,node_http_client,node_config toneMint
class node_dashboard,node_stat_card toneRose
class node_farmer toneIndigo
```

## Components

### Application Shell

- [App bootstrap](https://github.com/shehri07/ghanmi/blob/main/src/main.tsx): `src/main.tsx`
- [Route dispatcher](https://github.com/shehri07/ghanmi/blob/main/src/App.tsx): `src/App.tsx`
- [Navigation shell](https://github.com/shehri07/ghanmi/blob/main/src/layouts/Layout.tsx): `src/layouts/Layout.tsx`

### Farm Operations

- [Resource records](https://github.com/shehri07/ghanmi/blob/main/src/components/ResourcePage.tsx): `src/components/ResourcePage.tsx`
- [Resource definitions](https://github.com/shehri07/ghanmi/blob/main/src/data/resources.ts): `src/data/resources.ts`
- [Specialized screens](https://github.com/shehri07/ghanmi/blob/main/src/pages/SpecialPages.tsx): `src/pages/SpecialPages.tsx`

### Data Access

- [Data service](https://github.com/shehri07/ghanmi/blob/main/src/services/dataService.ts): `src/services/dataService.ts`
- [Browser record store](https://github.com/shehri07/ghanmi/blob/main/src/services/localStore.ts): `src/services/localStore.ts`
- [Sample records](https://github.com/shehri07/ghanmi/blob/main/src/data/mock.ts): `src/data/mock.ts`
- [Resource API](https://github.com/shehri07/ghanmi/blob/main/src/api/resources.ts): `src/api/resources.ts`
- [HTTP client](https://github.com/shehri07/ghanmi/blob/main/src/api/client.ts): `src/api/client.ts`
- [Data mode config](https://github.com/shehri07/ghanmi/blob/main/src/config.ts): `src/config.ts`

### Insights And Administration

- [Farm dashboard](https://github.com/shehri07/ghanmi/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Metric cards](https://github.com/shehri07/ghanmi/blob/main/src/components/StatCard.tsx): `src/components/StatCard.tsx`

### Other components

- **Farm manager**

## Connections

- Farm manager → App bootstrap: opens app (evidence: `README.md`)
- App bootstrap → Route dispatcher: renders (evidence: `src/main.tsx`)
- Route dispatcher → Navigation shell: routes through (evidence: `src/App.tsx`)
- Route dispatcher → Farm dashboard: routes to (evidence: `src/App.tsx`)
- Route dispatcher → Resource records: routes to (evidence: `src/App.tsx`)
- Route dispatcher → Specialized screens: routes to (evidence: `src/App.tsx`)
- Route dispatcher → Resource definitions: looks up resource (evidence: `src/App.tsx`)
- Resource records → Data service: requests records (evidence: `src/components/ResourcePage.tsx`)
- Resource records → Resource definitions: renders fields (evidence: `src/App.tsx`)
- Specialized screens → Resource records: renders resource (evidence: `src/pages/SpecialPages.tsx`)
- Farm dashboard → Metric cards: renders metrics (evidence: `src/pages/Dashboard.tsx`)
- Farm dashboard → HTTP client: fetches dashboard (evidence: `src/pages/Dashboard.tsx`)
- Farm dashboard → Data mode config: checks mock mode (evidence: `src/pages/Dashboard.tsx`)
- Data service → Data mode config: checks mock mode (evidence: `src/services/dataService.ts`)
- Data service → Browser record store: uses local CRUD (evidence: `src/services/dataService.ts`)
- Browser record store → Sample records: seeds records (evidence: `src/services/localStore.ts`)
- Data service → Resource API: uses API CRUD (evidence: `src/services/dataService.ts`)
- Resource API → HTTP client: uses client (evidence: `src/api/resources.ts`)
