# luenkai/tanimtech architecture

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

- Interactive diagram: https://gitdiagram.com/luenkai/tanimtech
- Repository: https://github.com/luenkai/tanimtech

## Overview

TanimTech is a Philippine crop-planning website and Flask API. Farmers enter field conditions, browse crop information, and receive explainable crop-fit rankings; signed-in users can save profiles and plans, and soil-photo screening is optional. The graph keeps rule-based fit, advisory ranking, soil context, crop discovery, and persistence distinct. Several route modules and browser-to-API details were not excerpted, so those connections are left unasserted; optional integrations are shown separately.

Main entry points: [`backend/tanimtech/__init__.py`](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/__init__.py) (Flask application), [`js/site.js`](https://github.com/luenkai/tanimtech/blob/main/js/site.js) (Website UI), [`backend/tanimtech/routes/profiles.py`](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/profiles.py) (Profile routes), [`backend/tanimtech/routes/plants.py`](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/plants.py) (Plant routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_website["Website UI<br/>[site.js]"]
  node_cropguide["Crop guides<br/>[crop-guide.js]"]
  node_plantbrowser["Plant browser<br/>[plants.js]"]
  node_access["Access gate<br/>[access-gate.js]"]
end

subgraph group_api["API workflows"]
  node_flask["Flask application<br/>[__init__.py]"]
  node_authroutes["Auth routes<br/>[auth.py]"]
  node_profileroutes["Profile routes<br/>[profiles.py]"]
  node_recroutes["Recommendation routes<br/>[recommendations.py]"]
  node_plantroutes["Plant routes<br/>[plants.py]"]
  node_soilroutes["Soil routes<br/>[soil.py]"]
  node_otheroutes["Other API routes"]
  node_auth["Auth sessions<br/>[auth.py]"]
end

subgraph group_analysis["Crop analysis"]
  node_scoring["Rule-based scoring<br/>[scoring.py]"]
  node_mlrank["ML advisory ranking"]
  node_soilref["Soil references<br/>[soil_analysis.py]"]
  node_soilimage["Soil photo review"]
  node_soilgrids["SoilGrids lookup<br/>[soilgrids.py]"]
  node_calendar["Planting calendar"]
end

subgraph group_data["Data and integrations"]
  node_store[("Local profile store<br/>[store.py]")]
  node_catalog[("Edible crop catalog<br/>[plant_catalog.py]")]
  node_trefle["Trefle plant data<br/>[trefle.py]"]
  node_supabase["Supabase browser auth<br/>[supabase-config.js]"]
end

node_farmer(("Farmer"))
node_vision["Vision service"]
node_nasa["NASA POWER"]
node_supabase_service["Supabase service"]
node_manus["Manus OAuth"]

node_farmer -->|"uses"| node_website
node_website -.->|"opens guides"| node_cropguide
node_website -.->|"browses plants"| node_plantbrowser
node_website -.->|"gates access"| node_access
node_flask -->|"registers"| node_authroutes
node_flask -->|"registers"| node_profileroutes
node_flask -->|"registers"| node_recroutes
node_flask -->|"registers"| node_plantroutes
node_flask -->|"registers"| node_soilroutes
node_flask -->|"registers"| node_otheroutes
node_authroutes -->|"calls"| node_auth
node_auth -->|"reads users"| node_store
node_profileroutes -->|"reads and writes"| node_store
node_profileroutes -->|"requests rankings"| node_scoring
node_profileroutes -->|"requests calendars"| node_calendar
node_recroutes -->|"requests rankings"| node_scoring
node_recroutes -->|"reads saved data"| node_store
node_scoring -->|"ranks advisory"| node_mlrank
node_scoring -->|"checks soil fit"| node_soilref
node_plantroutes -->|"searches catalog"| node_catalog
node_plantroutes -->|"fetches plant data"| node_trefle
node_soilroutes -->|"requests soil data"| node_soilgrids
node_soilroutes -->|"requests analysis"| node_soilref
node_soilroutes -.->|"requests screening"| node_soilimage
node_soilimage -.->|"sends image"| node_vision
node_soilgrids -.->|"fetches context"| node_nasa
node_plantroutes -.->|"supplies plant data"| node_plantbrowser
node_website -.->|"requests API"| node_flask
node_supabase -.->|"authenticates"| node_supabase_service
node_auth -->|"exchanges identity"| node_manus
node_flask -.->|"optional client"| node_supabase_service

click node_website "https://github.com/luenkai/tanimtech/blob/main/js/site.js"
click node_cropguide "https://github.com/luenkai/tanimtech/blob/main/js/crop-guide.js"
click node_plantbrowser "https://github.com/luenkai/tanimtech/blob/main/js/plants.js"
click node_access "https://github.com/luenkai/tanimtech/blob/main/js/access-gate.js"
click node_flask "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/__init__.py"
click node_authroutes "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/auth.py"
click node_profileroutes "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/profiles.py"
click node_recroutes "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/recommendations.py"
click node_plantroutes "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/plants.py"
click node_soilroutes "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/soil.py"
click node_otheroutes "https://github.com/luenkai/tanimtech/tree/main/backend/tanimtech/routes"
click node_auth "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/auth.py"
click node_store "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/store.py"
click node_scoring "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/scoring.py"
click node_mlrank "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/crop_suitability.py"
click node_catalog "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/plant_catalog.py"
click node_soilref "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soil_analysis.py"
click node_soilimage "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soil_image_classifier.py"
click node_soilgrids "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soilgrids.py"
click node_calendar "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/planting_calendar.py"
click node_trefle "https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/trefle.py"
click node_supabase "https://github.com/luenkai/tanimtech/blob/main/js/supabase-config.js"

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_website,node_cropguide,node_plantbrowser,node_access toneBlue
class node_flask,node_authroutes,node_profileroutes,node_recroutes,node_plantroutes,node_soilroutes,node_otheroutes,node_auth toneAmber
class node_scoring,node_mlrank,node_soilref,node_soilimage,node_soilgrids,node_calendar toneMint
class node_store,node_catalog,node_trefle,node_supabase toneRose
class node_farmer,node_vision,node_nasa,node_supabase_service,node_manus toneIndigo
```

## Components

### Web experience

- [Website UI](https://github.com/luenkai/tanimtech/blob/main/js/site.js): `js/site.js`
- [Crop guides](https://github.com/luenkai/tanimtech/blob/main/js/crop-guide.js): `js/crop-guide.js`
- [Plant browser](https://github.com/luenkai/tanimtech/blob/main/js/plants.js): `js/plants.js`
- [Access gate](https://github.com/luenkai/tanimtech/blob/main/js/access-gate.js): `js/access-gate.js`

### API workflows

- [Flask application](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/__init__.py): `backend/tanimtech/__init__.py`
- [Auth routes](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/auth.py): `backend/tanimtech/routes/auth.py`
- [Profile routes](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/profiles.py): `backend/tanimtech/routes/profiles.py`
- [Recommendation routes](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/recommendations.py): `backend/tanimtech/routes/recommendations.py`
- [Plant routes](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/plants.py): `backend/tanimtech/routes/plants.py`
- [Soil routes](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/routes/soil.py): `backend/tanimtech/routes/soil.py`
- [Other API routes](https://github.com/luenkai/tanimtech/tree/main/backend/tanimtech/routes): `backend/tanimtech/routes`
- [Auth sessions](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/auth.py): `backend/tanimtech/auth.py`

### Crop analysis

- [Rule-based scoring](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/scoring.py): `backend/tanimtech/scoring.py`
- [ML advisory ranking](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/crop_suitability.py): `backend/tanimtech/crop_suitability.py`
- [Soil references](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soil_analysis.py): `backend/tanimtech/soil_analysis.py`
- [Soil photo review](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soil_image_classifier.py): `backend/tanimtech/soil_image_classifier.py`
- [SoilGrids lookup](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/soilgrids.py): `backend/tanimtech/soilgrids.py`
- [Planting calendar](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/planting_calendar.py): `backend/tanimtech/planting_calendar.py`

### Data and integrations

- [Local profile store](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/store.py): `backend/tanimtech/store.py`
- [Edible crop catalog](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/plant_catalog.py): `backend/tanimtech/plant_catalog.py`
- [Trefle plant data](https://github.com/luenkai/tanimtech/blob/main/backend/tanimtech/trefle.py): `backend/tanimtech/trefle.py`
- [Supabase browser auth](https://github.com/luenkai/tanimtech/blob/main/js/supabase-config.js): `js/supabase-config.js`

### Other components

- **Farmer**
- **Vision service**
- **NASA POWER**
- **Supabase service**
- **Manus OAuth**

## Connections

- Farmer → Website UI: uses (evidence: `README.md`)
- Website UI → Crop guides: opens guides
- Website UI → Plant browser: browses plants
- Website UI → Access gate: gates access
- Flask application → Auth routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Flask application → Profile routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Flask application → Recommendation routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Flask application → Plant routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Flask application → Soil routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Flask application → Other API routes: registers (evidence: `backend/tanimtech/__init__.py`)
- Auth routes → Auth sessions: calls (evidence: `backend/tanimtech/routes/auth.py`)
- Auth sessions → Local profile store: reads users (evidence: `backend/tanimtech/auth.py`)
- Profile routes → Local profile store: reads and writes (evidence: `backend/tanimtech/routes/profiles.py`)
- Profile routes → Rule-based scoring: requests rankings (evidence: `backend/tanimtech/routes/profiles.py`)
- Profile routes → Planting calendar: requests calendars (evidence: `backend/tanimtech/routes/profiles.py`)
- Recommendation routes → Rule-based scoring: requests rankings (evidence: `backend/tanimtech/routes/recommendations.py`)
- Recommendation routes → Local profile store: reads saved data (evidence: `backend/tanimtech/routes/recommendations.py`)
- Rule-based scoring → ML advisory ranking: ranks advisory (evidence: `backend/tanimtech/scoring.py`)
- Rule-based scoring → Soil references: checks soil fit (evidence: `backend/tanimtech/scoring.py`)
- Plant routes → Edible crop catalog: searches catalog (evidence: `backend/tanimtech/routes/plants.py`)
- Plant routes → Trefle plant data: fetches plant data (evidence: `backend/tanimtech/routes/plants.py`)
- Soil routes → SoilGrids lookup: requests soil data (evidence: `backend/tanimtech/routes/soil.py`)
- Soil routes → Soil references: requests analysis (evidence: `backend/tanimtech/routes/soil.py`)
- Soil routes → Soil photo review: requests screening
- Soil photo review → Vision service: sends image
- SoilGrids lookup → NASA POWER: fetches context
- Plant routes → Plant browser: supplies plant data
- Website UI → Flask application: requests API
- Supabase browser auth → Supabase service: authenticates (evidence: `README.md`)
- Auth sessions → Manus OAuth: exchanges identity (evidence: `backend/tanimtech/auth.py`)
- Flask application → Supabase service: optional client
