# jenzylove/tifo architecture

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

- Interactive diagram: https://gitdiagram.com/jenzylove/tifo
- Repository: https://github.com/jenzylove/tifo

## Overview

Tifo is a matchday-commerce product: sellers describe stock and terms, an AI agent plans a promotion, buyers purchase through wallet or funding options, and an agent settles refunds and seller payouts against match results. The seller dashboard exposes books, autopilot controls, briefings and decision records. The graph preserves these documented capabilities and the sampled checkout, planning, wallet and chain-reading layers. Several runtime modules were not excerpted, so their relationships are shown only where the README documents them.

Main entry points: [`web/components/Checkout.tsx`](https://github.com/jenzylove/tifo/blob/main/web/components/Checkout.tsx) (Checkout), [`web/components/manage/Launch.tsx`](https://github.com/jenzylove/tifo/blob/main/web/components/manage/Launch.tsx) (Drop launch), [`web/lib/agent.ts`](https://github.com/jenzylove/tifo/blob/main/web/lib/agent.ts) (Drop management), [`web/lib/promos.ts`](https://github.com/jenzylove/tifo/blob/main/web/lib/promos.ts) (Promotion contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planning["Seller planning"]
  node_launch["Drop launch<br/>[Launch.tsx]"]
  node_import["Post import<br/>[route.ts]"]
  node_planner["Agent planning<br/>[sellerAgent.ts]"]
  node_matchdata["Matches and odds<br/>[matches.ts]"]
  node_coremath["Offer calculations<br/>[index.ts]"]
end

subgraph group_commerce["Buyer commerce"]
  node_checkout["Checkout<br/>[Checkout.tsx]"]
  node_purchase["Digital delivery<br/>[Purchase.tsx]"]
  node_deliveryform["Shipping details<br/>[DeliveryForm.tsx]"]
  node_timeslots["Booking slots<br/>[TimePicker.tsx]"]
  node_bridge["Cross-chain top-up<br/>[BridgeTopUp.tsx]"]
  node_card["Card top-up<br/>[CardTopUp.tsx]"]
  node_naira["Naira top-up<br/>[NairaTopUp.tsx]"]
end

subgraph group_agent["Agent operations"]
  node_agenttick["Agent cycle<br/>[route.ts]"]
  node_agentlogic["Drop management<br/>[agent.ts]"]
  node_results["Result settlement<br/>[results.ts]"]
  node_brief["Seller briefing<br/>[brief.ts]"]
  node_chat["Agent chat<br/>[route.ts]"]
end

subgraph group_wallets["Wallets and chain"]
  node_account["Seller account<br/>[tifoAccount.ts]"]
  node_promo[("Promotion contracts<br/>[promos.ts]")]
  node_chain["Arc connectivity<br/>[chain.ts]"]
  node_circle["Passkey wallets<br/>[circleWallet.ts]"]
  node_google["Google wallets<br/>[googleWallet.ts]"]
end

subgraph group_seller["Seller operations"]
  node_dashboard["Seller dashboard<br/>[Manager.tsx]"]
  node_books["Sales books<br/>[Books.tsx]"]
  node_autopilot["Autopilot controls<br/>[Autopilot.tsx]"]
  node_managerdata["Contract book reader<br/>[manager.ts]"]
  node_proof["Agent decision log<br/>[agentLog.ts]"]
end

node_seller(("Seller"))
node_buyer(("Buyer"))
node_bridgekit{{"Circle Bridge"}}
node_onramp{{"Circle Onramp"}}
node_sports{{"Sports result sources"}}

node_seller -->|"configures drop"| node_launch
node_launch -.->|"requests plan"| node_planner
node_launch -.->|"imports post"| node_import
node_planner -->|"queries matches"| node_matchdata
node_matchdata -->|"normalizes odds"| node_coremath
node_launch -->|"opens account"| node_account
node_launch -->|"opens promotion"| node_promo
node_launch -->|"signs launch"| node_circle
node_buyer -->|"places order"| node_checkout
node_checkout -->|"connects wallet"| node_circle
node_checkout -->|"buys from drop"| node_promo
node_checkout -->|"collects address"| node_deliveryform
node_checkout -->|"reveals product"| node_purchase
node_checkout -->|"selects slot"| node_timeslots
node_checkout -->|"offers bridge"| node_bridge
node_checkout -->|"offers card funding"| node_card
node_checkout -->|"offers naira funding"| node_naira
node_bridge -->|"moves USDC"| node_bridgekit
node_card -.->|"funds wallet"| node_onramp
node_naira -.->|"funds wallet"| node_onramp
node_agenttick -.->|"runs agent"| node_agentlogic
node_agentlogic -->|"settles outcomes"| node_results
node_results -->|"checks results"| node_sports
node_agentlogic -->|"records decisions"| node_promo
node_agentlogic -->|"pays seller"| node_account
node_agentlogic -->|"writes briefing"| node_brief
node_chat -->|"answers questions"| node_agentlogic
node_dashboard -->|"loads books"| node_managerdata
node_managerdata -->|"reads drop data"| node_promo
node_managerdata -->|"reads account"| node_account
node_dashboard -->|"shows books"| node_books
node_dashboard -->|"shows controls"| node_autopilot
node_promo -->|"reads contracts"| node_chain
node_account -->|"reads account state"| node_chain
node_circle -.->|"submits transactions"| node_chain
node_google -.->|"signs transactions"| node_chain
node_seller -->|"reviews decisions"| node_proof

click node_launch "https://github.com/jenzylove/tifo/blob/main/web/components/manage/Launch.tsx"
click node_import "https://github.com/jenzylove/tifo/blob/main/web/app/api/import/route.ts"
click node_planner "https://github.com/jenzylove/tifo/blob/main/web/lib/sellerAgent.ts"
click node_matchdata "https://github.com/jenzylove/tifo/blob/main/web/lib/matches.ts"
click node_coremath "https://github.com/jenzylove/tifo/blob/main/packages/core/src/index.ts"
click node_checkout "https://github.com/jenzylove/tifo/blob/main/web/components/Checkout.tsx"
click node_purchase "https://github.com/jenzylove/tifo/blob/main/web/components/Purchase.tsx"
click node_deliveryform "https://github.com/jenzylove/tifo/blob/main/web/components/DeliveryForm.tsx"
click node_timeslots "https://github.com/jenzylove/tifo/blob/main/web/components/TimePicker.tsx"
click node_bridge "https://github.com/jenzylove/tifo/blob/main/web/components/BridgeTopUp.tsx"
click node_card "https://github.com/jenzylove/tifo/blob/main/web/components/CardTopUp.tsx"
click node_naira "https://github.com/jenzylove/tifo/blob/main/web/components/NairaTopUp.tsx"
click node_agenttick "https://github.com/jenzylove/tifo/blob/main/web/app/api/tick/route.ts"
click node_agentlogic "https://github.com/jenzylove/tifo/blob/main/web/lib/agent.ts"
click node_results "https://github.com/jenzylove/tifo/blob/main/web/lib/results.ts"
click node_brief "https://github.com/jenzylove/tifo/blob/main/web/lib/brief.ts"
click node_chat "https://github.com/jenzylove/tifo/blob/main/web/app/api/chat/route.ts"
click node_account "https://github.com/jenzylove/tifo/blob/main/web/lib/tifoAccount.ts"
click node_promo "https://github.com/jenzylove/tifo/blob/main/web/lib/promos.ts"
click node_chain "https://github.com/jenzylove/tifo/blob/main/web/lib/chain.ts"
click node_circle "https://github.com/jenzylove/tifo/blob/main/web/lib/circleWallet.ts"
click node_google "https://github.com/jenzylove/tifo/blob/main/web/lib/googleWallet.ts"
click node_dashboard "https://github.com/jenzylove/tifo/blob/main/web/components/manage/Manager.tsx"
click node_books "https://github.com/jenzylove/tifo/blob/main/web/components/manage/Books.tsx"
click node_autopilot "https://github.com/jenzylove/tifo/blob/main/web/components/manage/Autopilot.tsx"
click node_managerdata "https://github.com/jenzylove/tifo/blob/main/web/lib/manager.ts"
click node_proof "https://github.com/jenzylove/tifo/blob/main/web/lib/agentLog.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_launch,node_import,node_planner,node_matchdata,node_coremath toneBlue
class node_checkout,node_purchase,node_deliveryform,node_timeslots,node_bridge,node_card,node_naira toneAmber
class node_agenttick,node_agentlogic,node_results,node_brief,node_chat toneMint
class node_account,node_promo,node_chain,node_circle,node_google toneRose
class node_dashboard,node_books,node_autopilot,node_managerdata,node_proof,node_seller,node_buyer,node_bridgekit,node_onramp,node_sports toneIndigo
```

## Components

### Seller planning

- [Drop launch](https://github.com/jenzylove/tifo/blob/main/web/components/manage/Launch.tsx): `web/components/manage/Launch.tsx`
- [Post import](https://github.com/jenzylove/tifo/blob/main/web/app/api/import/route.ts): `web/app/api/import/route.ts`
- [Agent planning](https://github.com/jenzylove/tifo/blob/main/web/lib/sellerAgent.ts): `web/lib/sellerAgent.ts`
- [Matches and odds](https://github.com/jenzylove/tifo/blob/main/web/lib/matches.ts): `web/lib/matches.ts`
- [Offer calculations](https://github.com/jenzylove/tifo/blob/main/packages/core/src/index.ts): `packages/core/src/index.ts`

### Buyer commerce

- [Checkout](https://github.com/jenzylove/tifo/blob/main/web/components/Checkout.tsx): `web/components/Checkout.tsx`
- [Digital delivery](https://github.com/jenzylove/tifo/blob/main/web/components/Purchase.tsx): `web/components/Purchase.tsx`
- [Shipping details](https://github.com/jenzylove/tifo/blob/main/web/components/DeliveryForm.tsx): `web/components/DeliveryForm.tsx`
- [Booking slots](https://github.com/jenzylove/tifo/blob/main/web/components/TimePicker.tsx): `web/components/TimePicker.tsx`
- [Cross-chain top-up](https://github.com/jenzylove/tifo/blob/main/web/components/BridgeTopUp.tsx): `web/components/BridgeTopUp.tsx`
- [Card top-up](https://github.com/jenzylove/tifo/blob/main/web/components/CardTopUp.tsx): `web/components/CardTopUp.tsx`
- [Naira top-up](https://github.com/jenzylove/tifo/blob/main/web/components/NairaTopUp.tsx): `web/components/NairaTopUp.tsx`

### Agent operations

- [Agent cycle](https://github.com/jenzylove/tifo/blob/main/web/app/api/tick/route.ts): `web/app/api/tick/route.ts`
- [Drop management](https://github.com/jenzylove/tifo/blob/main/web/lib/agent.ts): `web/lib/agent.ts`
- [Result settlement](https://github.com/jenzylove/tifo/blob/main/web/lib/results.ts): `web/lib/results.ts`
- [Seller briefing](https://github.com/jenzylove/tifo/blob/main/web/lib/brief.ts): `web/lib/brief.ts`
- [Agent chat](https://github.com/jenzylove/tifo/blob/main/web/app/api/chat/route.ts): `web/app/api/chat/route.ts`

### Wallets and chain

- [Seller account](https://github.com/jenzylove/tifo/blob/main/web/lib/tifoAccount.ts): `web/lib/tifoAccount.ts`
- [Promotion contracts](https://github.com/jenzylove/tifo/blob/main/web/lib/promos.ts): `web/lib/promos.ts`
- [Arc connectivity](https://github.com/jenzylove/tifo/blob/main/web/lib/chain.ts): `web/lib/chain.ts`
- [Passkey wallets](https://github.com/jenzylove/tifo/blob/main/web/lib/circleWallet.ts): `web/lib/circleWallet.ts`
- [Google wallets](https://github.com/jenzylove/tifo/blob/main/web/lib/googleWallet.ts): `web/lib/googleWallet.ts`

### Seller operations

- [Seller dashboard](https://github.com/jenzylove/tifo/blob/main/web/components/manage/Manager.tsx): `web/components/manage/Manager.tsx`
- [Sales books](https://github.com/jenzylove/tifo/blob/main/web/components/manage/Books.tsx): `web/components/manage/Books.tsx`
- [Autopilot controls](https://github.com/jenzylove/tifo/blob/main/web/components/manage/Autopilot.tsx): `web/components/manage/Autopilot.tsx`
- [Contract book reader](https://github.com/jenzylove/tifo/blob/main/web/lib/manager.ts): `web/lib/manager.ts`
- [Agent decision log](https://github.com/jenzylove/tifo/blob/main/web/lib/agentLog.ts): `web/lib/agentLog.ts`

### Other components

- **Seller**
- **Buyer**
- **Circle Bridge**
- **Circle Onramp**
- **Sports result sources**

## Connections

- Seller → Drop launch: configures drop
- Drop launch → Agent planning: requests plan
- Drop launch → Post import: imports post
- Agent planning → Matches and odds: queries matches (evidence: `web/lib/sellerAgent.ts`)
- Matches and odds → Offer calculations: normalizes odds (evidence: `web/lib/matches.ts`)
- Drop launch → Seller account: opens account
- Drop launch → Promotion contracts: opens promotion
- Drop launch → Passkey wallets: signs launch (evidence: `web/components/manage/Launch.tsx`)
- Buyer → Checkout: places order
- Checkout → Passkey wallets: connects wallet (evidence: `web/components/Checkout.tsx`)
- Checkout → Promotion contracts: buys from drop
- Checkout → Shipping details: collects address (evidence: `web/components/Checkout.tsx`)
- Checkout → Digital delivery: reveals product (evidence: `web/components/Checkout.tsx`)
- Checkout → Booking slots: selects slot (evidence: `web/components/Checkout.tsx`)
- Checkout → Cross-chain top-up: offers bridge (evidence: `web/components/Checkout.tsx`)
- Checkout → Card top-up: offers card funding (evidence: `web/components/Checkout.tsx`)
- Checkout → Naira top-up: offers naira funding (evidence: `web/components/Checkout.tsx`)
- Cross-chain top-up → Circle Bridge: moves USDC (evidence: `web/components/BridgeTopUp.tsx`)
- Card top-up → Circle Onramp: funds wallet
- Naira top-up → Circle Onramp: funds wallet
- Agent cycle → Drop management: runs agent
- Drop management → Result settlement: settles outcomes
- Result settlement → Sports result sources: checks results
- Drop management → Promotion contracts: records decisions
- Drop management → Seller account: pays seller
- Drop management → Seller briefing: writes briefing
- Agent chat → Drop management: answers questions
- Seller dashboard → Contract book reader: loads books (evidence: `web/components/manage/Manager.tsx`)
- Contract book reader → Promotion contracts: reads drop data (evidence: `web/lib/manager.ts`)
- Contract book reader → Seller account: reads account (evidence: `web/lib/manager.ts`)
- Seller dashboard → Sales books: shows books (evidence: `web/components/manage/Manager.tsx`)
- Seller dashboard → Autopilot controls: shows controls (evidence: `web/components/manage/Manager.tsx`)
- Promotion contracts → Arc connectivity: reads contracts (evidence: `web/lib/promos.ts`)
- Seller account → Arc connectivity: reads account state (evidence: `web/lib/tifoAccount.ts`)
- Passkey wallets → Arc connectivity: submits transactions (evidence: `web/lib/circleWallet.ts`)
- Google wallets → Arc connectivity: signs transactions
- Seller → Agent decision log: reviews decisions
