# 0xganadhish/tare architecture

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

- Interactive diagram: https://gitdiagram.com/0xganadhish/tare
- Repository: https://github.com/0xganadhish/tare

## Overview

Tare combines a public Monad yield-risk feed with wallet-facing tools and a permissionless Guardian. The main workflow is vault monitoring, Jev judgment, onchain verdict publication, optional user-protective exits, and delayed public grading through the Ledger. The graph includes the documented product branches—Advisor, pool exploration, position scanning and watching, Pulse, token launches, and admin controls. Several backend and contract relationships come from the README; their implementation files are not in the supplied excerpts or tree, so those links are documented rather than source-verified.

Main entry points: [`backend/src/watcher.ts`](https://github.com/0xganadhish/tare/blob/main/backend/src/watcher.ts) (Vault watcher), [`app/(app)/app/explore/page.tsx`](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/explore/page.tsx) (Market explorer), [`app/api/advise/route.ts`](https://github.com/0xganadhish/tare/blob/main/app/api/advise/route.ts) (Advice endpoint), [`components/advisor/AdvisorClient.tsx`](https://github.com/0xganadhish/tare/blob/main/components/advisor/AdvisorClient.tsx) (Yield Advisor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and user tools"]
  node_market_view["Market explorer<br/>[page.tsx]"]
  node_field_chart["Yield field chart<br/>[FieldChart.tsx]"]
  node_advisor["Yield Advisor<br/>[AdvisorClient.tsx]"]
  node_advisor_api["Advice endpoint<br/>[route.ts]"]
  node_scan["Position scan<br/>[page.tsx]"]
  node_watch["Position Watch<br/>[page.tsx]"]
  node_wallet["Wallet and deposits<br/>[WalletPane.tsx]"]
  node_launch["Token launches<br/>[LaunchPage.tsx]"]
  node_pulse["Risk Pulse<br/>[page.tsx]"]
  node_admin["Admin controls<br/>[AdminPanel.tsx]"]
  node_network["Network selection"]
end

subgraph group_risk["Risk and monitoring"]
  node_judge["Jev judgment<br/>[index.ts]"]
  node_intent["Intent parsing<br/>[intent.ts]"]
  node_watcher["Vault watcher<br/>[watcher.ts]"]
  node_indexer["Vault flow indexer<br/>[flows.ts]"]
  node_worker["Exit operator<br/>[index.ts]"]
end

subgraph group_chain["Onchain protection"]
  node_oracle[("Tare risk oracle")]
  node_guardian["Guardian exits"]
end

subgraph group_data["Public data and scoring"]
  node_pool_api["Pool market API<br/>[api.ts]"]
  node_grading["Verdict sampling and grading<br/>[crons.ts]"]
  node_backend_api["Public backend API<br/>[api.ts]"]
  node_ledger["Public Ledger<br/>[page.tsx]"]
  node_ledger_score["Brier score<br/>[score.ts]"]
  node_state_archive["Verdict state archive"]
end

node_user(("Wallet user"))

node_user -->|"explores pools"| node_market_view
node_market_view -->|"renders market"| node_field_chart
node_market_view -.->|"loads pools"| node_pool_api
node_user -->|"requests advice"| node_advisor
node_advisor -.->|"submits intent"| node_advisor_api
node_advisor_api -->|"reads market"| node_pool_api
node_advisor_api -.->|"returns recommendations"| node_advisor
node_user -->|"scans position"| node_scan
node_user -->|"views positions"| node_watch
node_watch -->|"loads events"| node_backend_api
node_user -->|"deposits funds"| node_wallet
node_wallet -->|"sets exit rule"| node_guardian
node_user -.->|"creates token"| node_launch
node_user -.->|"views risk trends"| node_pulse
node_user -.->|"manages system"| node_admin
node_network -->|"configures network"| node_wallet
node_watcher -->|"reads vault flows"| node_indexer
node_watcher -->|"judges positions"| node_judge
node_watcher -->|"posts verdict"| node_oracle
node_judge -->|"uses typed answers"| node_intent
node_oracle -->|"supplies risk verdict"| node_guardian
node_guardian -->|"redeems to owner"| node_user
node_worker -->|"submits exit"| node_guardian
node_grading -->|"samples and resolves"| node_oracle
node_grading -->|"archives shown state"| node_state_archive
node_backend_api -.->|"serves verdicts"| node_oracle
node_ledger -->|"loads ledger data"| node_backend_api
node_ledger -->|"shows score"| node_ledger_score

click node_market_view "https://github.com/0xganadhish/tare/blob/main/app/(app)/app/explore/page.tsx"
click node_field_chart "https://github.com/0xganadhish/tare/blob/main/components/field/FieldChart.tsx"
click node_advisor "https://github.com/0xganadhish/tare/blob/main/components/advisor/AdvisorClient.tsx"
click node_advisor_api "https://github.com/0xganadhish/tare/blob/main/app/api/advise/route.ts"
click node_scan "https://github.com/0xganadhish/tare/blob/main/app/(app)/app/scan/%5Baddress%5D/page.tsx"
click node_watch "https://github.com/0xganadhish/tare/blob/main/app/(app)/app/watch/page.tsx"
click node_wallet "https://github.com/0xganadhish/tare/blob/main/components/wallet/WalletPane.tsx"
click node_launch "https://github.com/0xganadhish/tare/blob/main/components/launch/LaunchPage.tsx"
click node_pulse "https://github.com/0xganadhish/tare/blob/main/app/(app)/app/pulse/page.tsx"
click node_admin "https://github.com/0xganadhish/tare/blob/main/components/admin/AdminPanel.tsx"
click node_network "https://github.com/0xganadhish/tare/blob/main/components/network/NetworkProvider.tsx"
click node_pool_api "https://github.com/0xganadhish/tare/blob/main/lib/api.ts"
click node_judge "https://github.com/0xganadhish/tare/blob/main/lib/judge/index.ts"
click node_intent "https://github.com/0xganadhish/tare/blob/main/lib/intent.ts"
click node_watcher "https://github.com/0xganadhish/tare/blob/main/backend/src/watcher.ts"
click node_indexer "https://github.com/0xganadhish/tare/blob/main/indexer/src/flows.ts"
click node_worker "https://github.com/0xganadhish/tare/blob/main/worker/index.ts"
click node_grading "https://github.com/0xganadhish/tare/blob/main/backend/src/crons.ts"
click node_backend_api "https://github.com/0xganadhish/tare/blob/main/backend/src/api.ts"
click node_ledger "https://github.com/0xganadhish/tare/blob/main/app/(app)/app/ledger/page.tsx"
click node_ledger_score "https://github.com/0xganadhish/tare/blob/main/shared/score.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_market_view,node_field_chart,node_advisor,node_advisor_api,node_scan,node_watch,node_wallet,node_launch,node_pulse,node_admin,node_network,node_user toneBlue
class node_judge,node_intent,node_watcher,node_indexer,node_worker toneAmber
class node_oracle,node_guardian toneMint
class node_pool_api,node_grading,node_backend_api,node_ledger,node_ledger_score,node_state_archive toneRose
```

## Components

### App and user tools

- [Market explorer](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/explore/page.tsx): `app/(app)/app/explore/page.tsx`
- [Yield field chart](https://github.com/0xganadhish/tare/blob/main/components/field/FieldChart.tsx): `components/field/FieldChart.tsx`
- [Yield Advisor](https://github.com/0xganadhish/tare/blob/main/components/advisor/AdvisorClient.tsx): `components/advisor/AdvisorClient.tsx`
- [Advice endpoint](https://github.com/0xganadhish/tare/blob/main/app/api/advise/route.ts): `app/api/advise/route.ts`
- [Position scan](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/scan/%5Baddress%5D/page.tsx): `app/(app)/app/scan/[address]/page.tsx`
- [Position Watch](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/watch/page.tsx): `app/(app)/app/watch/page.tsx`
- [Wallet and deposits](https://github.com/0xganadhish/tare/blob/main/components/wallet/WalletPane.tsx): `components/wallet/WalletPane.tsx`
- [Token launches](https://github.com/0xganadhish/tare/blob/main/components/launch/LaunchPage.tsx): `components/launch/LaunchPage.tsx`
- [Risk Pulse](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/pulse/page.tsx): `app/(app)/app/pulse/page.tsx`
- [Admin controls](https://github.com/0xganadhish/tare/blob/main/components/admin/AdminPanel.tsx): `components/admin/AdminPanel.tsx`
- [Network selection](https://github.com/0xganadhish/tare/blob/main/components/network/NetworkProvider.tsx): `components/network/NetworkProvider.tsx`

### Risk and monitoring

- [Jev judgment](https://github.com/0xganadhish/tare/blob/main/lib/judge/index.ts): `lib/judge/index.ts`
- [Intent parsing](https://github.com/0xganadhish/tare/blob/main/lib/intent.ts): `lib/intent.ts`
- [Vault watcher](https://github.com/0xganadhish/tare/blob/main/backend/src/watcher.ts): `backend/src/watcher.ts`
- [Vault flow indexer](https://github.com/0xganadhish/tare/blob/main/indexer/src/flows.ts): `indexer/src/flows.ts`
- [Exit operator](https://github.com/0xganadhish/tare/blob/main/worker/index.ts): `worker/index.ts`

### Onchain protection

- **Tare risk oracle**
- **Guardian exits**

### Public data and scoring

- [Pool market API](https://github.com/0xganadhish/tare/blob/main/lib/api.ts): `lib/api.ts`
- [Verdict sampling and grading](https://github.com/0xganadhish/tare/blob/main/backend/src/crons.ts): `backend/src/crons.ts`
- [Public backend API](https://github.com/0xganadhish/tare/blob/main/backend/src/api.ts): `backend/src/api.ts`
- [Public Ledger](https://github.com/0xganadhish/tare/blob/main/app/(app)/app/ledger/page.tsx): `app/(app)/app/ledger/page.tsx`
- [Brier score](https://github.com/0xganadhish/tare/blob/main/shared/score.ts): `shared/score.ts`
- **Verdict state archive**

### Other components

- **Wallet user**

## Connections

- Wallet user → Market explorer: explores pools (evidence: `README.md`)
- Market explorer → Yield field chart: renders market (evidence: `app/(app)/app/explore/page.tsx`)
- Market explorer → Pool market API: loads pools
- Wallet user → Yield Advisor: requests advice (evidence: `README.md`)
- Yield Advisor → Advice endpoint: submits intent
- Advice endpoint → Pool market API: reads market (evidence: `app/api/advise/route.ts`)
- Advice endpoint → Yield Advisor: returns recommendations
- Wallet user → Position scan: scans position (evidence: `README.md`)
- Wallet user → Position Watch: views positions (evidence: `README.md`)
- Position Watch → Public backend API: loads events (evidence: `app/(app)/app/watch/page.tsx`)
- Wallet user → Wallet and deposits: deposits funds (evidence: `README.md`)
- Wallet and deposits → Guardian exits: sets exit rule (evidence: `README.md`)
- Wallet user → Token launches: creates token
- Wallet user → Risk Pulse: views risk trends
- Wallet user → Admin controls: manages system
- Network selection → Wallet and deposits: configures network (evidence: `components/wallet/WalletPane.tsx`)
- Vault watcher → Vault flow indexer: reads vault flows (evidence: `README.md`)
- Vault watcher → Jev judgment: judges positions (evidence: `README.md`)
- Vault watcher → Tare risk oracle: posts verdict (evidence: `README.md`)
- Jev judgment → Intent parsing: uses typed answers (evidence: `lib/judge/index.ts`)
- Tare risk oracle → Guardian exits: supplies risk verdict (evidence: `README.md`)
- Guardian exits → Wallet user: redeems to owner (evidence: `README.md`)
- Exit operator → Guardian exits: submits exit (evidence: `README.md`)
- Verdict sampling and grading → Tare risk oracle: samples and resolves (evidence: `README.md`)
- Verdict sampling and grading → Verdict state archive: archives shown state (evidence: `README.md`)
- Public backend API → Tare risk oracle: serves verdicts
- Public Ledger → Public backend API: loads ledger data (evidence: `app/(app)/app/ledger/page.tsx`)
- Public Ledger → Brier score: shows score (evidence: `app/(app)/app/ledger/page.tsx`)
