# 2274802010922/pipicachu architecture

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

- Interactive diagram: https://gitdiagram.com/2274802010922/pipicachu
- Repository: https://github.com/2274802010922/pipicachu

## Overview

pipicachu is a Solana USDC escrow product for community digital-goods deals. Sellers create a shareable deal; buyers review terms and fees, fund it, and the seller records delivery. The buyer confirms or disputes, and an arbitrator resolves disputes; the on-chain program controls escrow, deadlines, bonds, and payout or refund. The web UI also supports arbitrator and organization management, fee transparency, and finalized-receipt verification. Arrows use README statements or shown imports/calls; several frontend and program internals are represented at their exact source paths because their implementations were not sampled.

Main entry points: [`src/frontend/features/deal.tsx`](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/deal.tsx) (Deal workflow UI), [`programs/pipicachu-escrow/src/lib.rs`](https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/lib.rs) (Escrow program), [`src/frontend/components/payment-breakdown.tsx`](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/payment-breakdown.tsx) (Fees and trust view), [`src/app/api/rpc/route.ts`](https://github.com/2274802010922/pipicachu/blob/main/src/app/api/rpc/route.ts) (RPC proxy route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Deal experience"]
  node_deal_ui["Deal workflow UI<br/>[deal.tsx]"]
  node_deal_controller["Deal controller"]
  node_deal_components["Deal details and progress<br/>[deal-details.tsx]"]
  node_payment_view["Fees and trust view"]
  node_receipt_view["Payment receipt"]
  node_create_ui["Deal creation<br/>[create.tsx]"]
  node_arbitrator_ui["Arbitrator workspace<br/>[arbitrator.tsx]"]
  node_manage_ui["Organization management<br/>[manage.tsx]"]
  node_wallet["Wallet connection<br/>[wallet.tsx]"]
  node_language["Language provider<br/>[provider.tsx]"]
end

subgraph group_escrow_client["Escrow client"]
  node_escrow_client["Escrow instructions and queries<br/>[instructions.ts]"]
  node_fee_rules["Fee calculation<br/>[fees.ts]"]
  node_governance["Arbitrator governance<br/>[governance.ts]"]
  node_keeper["Keeper settlement<br/>[keeper.ts]"]
end

subgraph group_chain["On-chain escrow"]
  node_program["Escrow program<br/>[lib.rs]"]
  node_account_contexts["Account constraints<br/>[contexts.rs]"]
  node_settlement["Settlement transfers<br/>[settlement.rs]"]
end

subgraph group_operations["Service operations"]
  node_rpc_route["RPC proxy route<br/>[route.ts]"]
  node_rpc_service["RPC validation and upstream<br/>[rpc.ts]"]
  node_rate_limit["Request rate limit<br/>[rate-limit.ts]"]
  node_authority_route["Program status route<br/>[route.ts]"]
  node_authority_service["Authority verification"]
  node_redis[("Redis quota and reports<br/>[redis.ts]")]
end

node_buyer_seller(("Buyer and seller"))
node_arbitrator(("Community arbitrator"))
node_solana{{"Solana network"}}

node_buyer_seller -->|"use deal link"| node_deal_ui
node_arbitrator -.->|"manage standing"| node_arbitrator_ui
node_buyer_seller -.->|"create deal"| node_create_ui
node_deal_ui -->|"delegates actions"| node_deal_controller
node_deal_ui -->|"renders details"| node_deal_components
node_deal_ui -->|"renders fees"| node_payment_view
node_deal_ui -->|"renders receipt"| node_receipt_view
node_deal_ui -->|"calculates fees"| node_fee_rules
node_payment_view -->|"calculates breakdown"| node_fee_rules
node_payment_view -->|"fetches status"| node_authority_route
node_authority_route -->|"reads authority"| node_authority_service
node_deal_ui -->|"uses translations"| node_language
node_deal_ui -.->|"uses connected wallet"| node_wallet
node_create_ui -.->|"builds deal transaction"| node_escrow_client
node_arbitrator_ui -.->|"uses governance actions"| node_governance
node_manage_ui -.->|"uses organization actions"| node_governance
node_deal_controller -.->|"loads and submits"| node_escrow_client
node_escrow_client -.->|"sends RPC requests"| node_rpc_route
node_wallet -->|"signs transactions"| node_solana
node_rpc_route -->|"limits requests"| node_rate_limit
node_rpc_route -->|"validates and forwards"| node_rpc_service
node_rpc_service -->|"calls upstream RPC"| node_solana
node_authority_service -->|"reads program accounts"| node_rpc_service
node_keeper -->|"submits finalize"| node_program
node_solana -->|"dispatches instructions"| node_program
node_program -->|"validates accounts"| node_account_contexts
node_program -.->|"executes settlement"| node_settlement
node_program -->|"moves escrow funds"| node_solana
node_rate_limit -.->|"uses shared quota"| node_redis

click node_deal_ui "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/deal.tsx"
click node_deal_controller "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/hooks/use-deal-controller.tsx"
click node_deal_components "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/deal-details.tsx"
click node_payment_view "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/payment-breakdown.tsx"
click node_receipt_view "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/payment-receipt.tsx"
click node_create_ui "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/create.tsx"
click node_arbitrator_ui "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/arbitrator.tsx"
click node_manage_ui "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/manage.tsx"
click node_wallet "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/wallet.tsx"
click node_language "https://github.com/2274802010922/pipicachu/blob/main/src/frontend/i18n/provider.tsx"
click node_escrow_client "https://github.com/2274802010922/pipicachu/blob/main/src/escrow/instructions.ts"
click node_fee_rules "https://github.com/2274802010922/pipicachu/blob/main/src/escrow/fees.ts"
click node_governance "https://github.com/2274802010922/pipicachu/blob/main/src/escrow/governance.ts"
click node_keeper "https://github.com/2274802010922/pipicachu/blob/main/src/escrow/keeper.ts"
click node_program "https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/lib.rs"
click node_account_contexts "https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/contexts.rs"
click node_settlement "https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/settlement.rs"
click node_rpc_route "https://github.com/2274802010922/pipicachu/blob/main/src/app/api/rpc/route.ts"
click node_rpc_service "https://github.com/2274802010922/pipicachu/blob/main/src/backend/rpc.ts"
click node_rate_limit "https://github.com/2274802010922/pipicachu/blob/main/src/backend/rate-limit.ts"
click node_authority_route "https://github.com/2274802010922/pipicachu/blob/main/src/app/api/program-status/route.ts"
click node_authority_service "https://github.com/2274802010922/pipicachu/blob/main/src/backend/program-authority.ts"
click node_redis "https://github.com/2274802010922/pipicachu/blob/main/src/backend/redis.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_deal_ui,node_deal_controller,node_deal_components,node_payment_view,node_receipt_view,node_create_ui,node_arbitrator_ui,node_manage_ui,node_wallet,node_language toneBlue
class node_escrow_client,node_fee_rules,node_governance,node_keeper toneAmber
class node_program,node_account_contexts,node_settlement toneMint
class node_rpc_route,node_rpc_service,node_rate_limit,node_authority_route,node_authority_service,node_redis toneRose
class node_buyer_seller,node_arbitrator,node_solana toneIndigo
```

## Components

### Deal experience

- [Deal workflow UI](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/deal.tsx): `src/frontend/features/deal.tsx`
- [Deal controller](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/hooks/use-deal-controller.tsx): `src/frontend/hooks/use-deal-controller.tsx`
- [Deal details and progress](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/deal-details.tsx): `src/frontend/components/deal-details.tsx`
- [Fees and trust view](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/payment-breakdown.tsx): `src/frontend/components/payment-breakdown.tsx`
- [Payment receipt](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/components/payment-receipt.tsx): `src/frontend/components/payment-receipt.tsx`
- [Deal creation](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/create.tsx): `src/frontend/features/create.tsx`
- [Arbitrator workspace](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/arbitrator.tsx): `src/frontend/features/arbitrator.tsx`
- [Organization management](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/features/manage.tsx): `src/frontend/features/manage.tsx`
- [Wallet connection](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/wallet.tsx): `src/frontend/wallet.tsx`
- [Language provider](https://github.com/2274802010922/pipicachu/blob/main/src/frontend/i18n/provider.tsx): `src/frontend/i18n/provider.tsx`

### Escrow client

- [Escrow instructions and queries](https://github.com/2274802010922/pipicachu/blob/main/src/escrow/instructions.ts): `src/escrow/instructions.ts`
- [Fee calculation](https://github.com/2274802010922/pipicachu/blob/main/src/escrow/fees.ts): `src/escrow/fees.ts`
- [Arbitrator governance](https://github.com/2274802010922/pipicachu/blob/main/src/escrow/governance.ts): `src/escrow/governance.ts`
- [Keeper settlement](https://github.com/2274802010922/pipicachu/blob/main/src/escrow/keeper.ts): `src/escrow/keeper.ts`

### On-chain escrow

- [Escrow program](https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/lib.rs): `programs/pipicachu-escrow/src/lib.rs`
- [Account constraints](https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/contexts.rs): `programs/pipicachu-escrow/src/contexts.rs`
- [Settlement transfers](https://github.com/2274802010922/pipicachu/blob/main/programs/pipicachu-escrow/src/settlement.rs): `programs/pipicachu-escrow/src/settlement.rs`

### Service operations

- [RPC proxy route](https://github.com/2274802010922/pipicachu/blob/main/src/app/api/rpc/route.ts): `src/app/api/rpc/route.ts`
- [RPC validation and upstream](https://github.com/2274802010922/pipicachu/blob/main/src/backend/rpc.ts): `src/backend/rpc.ts`
- [Request rate limit](https://github.com/2274802010922/pipicachu/blob/main/src/backend/rate-limit.ts): `src/backend/rate-limit.ts`
- [Program status route](https://github.com/2274802010922/pipicachu/blob/main/src/app/api/program-status/route.ts): `src/app/api/program-status/route.ts`
- [Authority verification](https://github.com/2274802010922/pipicachu/blob/main/src/backend/program-authority.ts): `src/backend/program-authority.ts`
- [Redis quota and reports](https://github.com/2274802010922/pipicachu/blob/main/src/backend/redis.ts): `src/backend/redis.ts`

### Other components

- **Buyer and seller**
- **Community arbitrator**
- **Solana network**

## Connections

- Buyer and seller → Deal workflow UI: use deal link (evidence: `README.md`)
- Community arbitrator → Arbitrator workspace: manage standing
- Buyer and seller → Deal creation: create deal
- Deal workflow UI → Deal controller: delegates actions (evidence: `src/frontend/features/deal.tsx`)
- Deal workflow UI → Deal details and progress: renders details (evidence: `src/frontend/features/deal.tsx`)
- Deal workflow UI → Fees and trust view: renders fees (evidence: `src/frontend/features/deal.tsx`)
- Deal workflow UI → Payment receipt: renders receipt (evidence: `src/frontend/features/deal.tsx`)
- Deal workflow UI → Fee calculation: calculates fees (evidence: `src/frontend/features/deal.tsx`)
- Fees and trust view → Fee calculation: calculates breakdown (evidence: `src/frontend/components/payment-breakdown.tsx`)
- Fees and trust view → Program status route: fetches status (evidence: `src/frontend/components/payment-breakdown.tsx`)
- Program status route → Authority verification: reads authority (evidence: `src/app/api/program-status/route.ts`)
- Deal workflow UI → Language provider: uses translations (evidence: `src/frontend/features/deal.tsx`)
- Deal workflow UI → Wallet connection: uses connected wallet
- Deal creation → Escrow instructions and queries: builds deal transaction
- Arbitrator workspace → Arbitrator governance: uses governance actions
- Organization management → Arbitrator governance: uses organization actions
- Deal controller → Escrow instructions and queries: loads and submits
- Escrow instructions and queries → RPC proxy route: sends RPC requests
- Wallet connection → Solana network: signs transactions (evidence: `README.md`)
- RPC proxy route → Request rate limit: limits requests (evidence: `src/app/api/rpc/route.ts`)
- RPC proxy route → RPC validation and upstream: validates and forwards (evidence: `src/app/api/rpc/route.ts`)
- RPC validation and upstream → Solana network: calls upstream RPC (evidence: `src/backend/rpc.ts`)
- Authority verification → RPC validation and upstream: reads program accounts (evidence: `src/backend/program-authority.ts`)
- Keeper settlement → Escrow program: submits finalize (evidence: `README.md`)
- Solana network → Escrow program: dispatches instructions (evidence: `README.md`)
- Escrow program → Account constraints: validates accounts (evidence: `programs/pipicachu-escrow/src/lib.rs`)
- Escrow program → Settlement transfers: executes settlement (evidence: `programs/pipicachu-escrow/src/lib.rs`)
- Escrow program → Solana network: moves escrow funds (evidence: `README.md`)
- Request rate limit → Redis quota and reports: uses shared quota
