# khoi1709/commitpot architecture

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

- Interactive diagram: https://gitdiagram.com/khoi1709/commitpot
- Repository: https://github.com/khoi1709/commitpot

## Overview

CommitPot is a bilingual web app and Solidity attendance-commitment fund. Participants create pots with fixed deposits and deadlines, join by depositing test tokens, and receive a personal QR; a trusted verifier confirms attendance, after which the pot is finalized and eligible participants claim payouts. The app supports mock demonstrations and configured local/Fuji chain access. The excerpts show the UI, runtime selection, browser adapter, repository, and domain rules; contract internals are represented from the README and tree, not inspected source.

Main entry points: [`apps/web/src/presentation/CommitPotApp.tsx`](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/presentation/CommitPotApp.tsx) (Pot interface), [`apps/web/src/infrastructure/avalanche/repository.ts`](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/repository.ts) (Chain repository), [`packages/contracts/src/CommitPot.sol`](https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/CommitPot.sol) (CommitPot core), [`apps/web/src/infrastructure/avalanche/browser.ts`](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/browser.ts) (Browser chain setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_web["Pot interface<br/>[CommitPotApp.tsx]"]
  node_messages["EN/VI messages<br/>[messages.ts]"]
  node_qr["Participant QR<br/>[index.ts]"]
  node_activity["Activity history<br/>[activity.ts]"]
  node_pending["Pending operations<br/>[pending.ts]"]
end

subgraph group_application["Application and domain"]
  node_runtime["Runtime selection<br/>[runtime.ts]"]
  node_rules["Pot rules and payouts<br/>[rules.ts]"]
  node_amounts["Amounts and identifiers<br/>[amounts.ts]"]
  node_domainports["Domain interfaces<br/>[ports.ts]"]
end

subgraph group_adapters["Runtime adapters"]
  node_mock["Mock environment<br/>[index.ts]"]
  node_browser["Browser chain setup<br/>[browser.ts]"]
  node_repository["Chain repository<br/>[repository.ts]"]
end

subgraph group_contracts["On-chain system"]
  node_core["CommitPot core<br/>[CommitPot.sol]"]
  node_verifiercontract["EIP-712 verifier"]
  node_strategy["Equal split strategy"]
end

node_participant(("Participant"))
node_verifier(("Attendance verifier"))
node_wallet["Injected wallet"]
node_rpc["Configured RPC"]
node_token["Supported test token<br/>[LocalTestUSDC.sol]"]

node_participant -->|"uses"| node_web
node_verifier -->|"records attendance"| node_web
node_web -->|"selects runtime"| node_runtime
node_web -->|"renders copy"| node_messages
node_web -->|"encodes and reads"| node_qr
node_web -->|"parses pending state"| node_pending
node_web -->|"loads activity"| node_activity
node_web -->|"validates pot inputs"| node_rules
node_web -->|"reads pot status"| node_repository
node_runtime -->|"creates demo runtime"| node_mock
node_browser -->|"creates repository"| node_repository
node_browser -->|"uses provider"| node_wallet
node_repository -->|"reads chain"| node_rpc
node_repository -->|"requests signatures"| node_wallet
node_repository -->|"reads and submits"| node_core
node_repository -->|"checks and approves"| node_token
node_core -.->|"verifies attendance"| node_verifiercontract
node_core -.->|"applies payout rules"| node_strategy

click node_web "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/presentation/CommitPotApp.tsx"
click node_messages "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/i18n/messages.ts"
click node_qr "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/qr/index.ts"
click node_activity "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/activity.ts"
click node_pending "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/pending.ts"
click node_runtime "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/runtime.ts"
click node_rules "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/rules.ts"
click node_amounts "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/amounts.ts"
click node_domainports "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/ports.ts"
click node_mock "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/mock/index.ts"
click node_browser "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/browser.ts"
click node_repository "https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/repository.ts"
click node_token "https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/LocalTestUSDC.sol"
click node_core "https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/CommitPot.sol"
click node_verifiercontract "https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/EIP712AttendanceVerifier.sol"
click node_strategy "https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/EqualSplitStrategy.sol"

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_web,node_messages,node_qr,node_activity,node_pending toneBlue
class node_runtime,node_rules,node_amounts,node_domainports toneAmber
class node_mock,node_browser,node_repository toneMint
class node_core,node_verifiercontract,node_strategy toneRose
class node_participant,node_verifier,node_wallet,node_rpc toneIndigo
class node_token toneTeal
```

## Components

### Web experience

- [Pot interface](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/presentation/CommitPotApp.tsx): `apps/web/src/presentation/CommitPotApp.tsx`
- [EN/VI messages](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/i18n/messages.ts): `apps/web/src/i18n/messages.ts`
- [Participant QR](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/qr/index.ts): `apps/web/src/infrastructure/qr/index.ts`
- [Activity history](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/activity.ts): `apps/web/src/application/activity.ts`
- [Pending operations](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/pending.ts): `apps/web/src/application/pending.ts`

### Application and domain

- [Runtime selection](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/application/runtime.ts): `apps/web/src/application/runtime.ts`
- [Pot rules and payouts](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/rules.ts): `apps/web/src/domain/rules.ts`
- [Amounts and identifiers](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/amounts.ts): `apps/web/src/domain/amounts.ts`
- [Domain interfaces](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/domain/ports.ts): `apps/web/src/domain/ports.ts`

### Runtime adapters

- [Mock environment](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/mock/index.ts): `apps/web/src/infrastructure/mock/index.ts`
- [Browser chain setup](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/browser.ts): `apps/web/src/infrastructure/avalanche/browser.ts`
- [Chain repository](https://github.com/khoi1709/commitpot/blob/main/apps/web/src/infrastructure/avalanche/repository.ts): `apps/web/src/infrastructure/avalanche/repository.ts`

### On-chain system

- [CommitPot core](https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/CommitPot.sol): `packages/contracts/src/CommitPot.sol`
- [EIP-712 verifier](https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/EIP712AttendanceVerifier.sol): `packages/contracts/src/EIP712AttendanceVerifier.sol`
- [Equal split strategy](https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/EqualSplitStrategy.sol): `packages/contracts/src/EqualSplitStrategy.sol`

### Other components

- **Participant**
- **Attendance verifier**
- **Injected wallet**
- **Configured RPC**
- [Supported test token](https://github.com/khoi1709/commitpot/blob/main/packages/contracts/src/LocalTestUSDC.sol): `packages/contracts/src/LocalTestUSDC.sol`

## Connections

- Participant → Pot interface: uses (evidence: `README.md`)
- Attendance verifier → Pot interface: records attendance (evidence: `README.md`)
- Pot interface → Runtime selection: selects runtime (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → EN/VI messages: renders copy (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → Participant QR: encodes and reads (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → Pending operations: parses pending state (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → Activity history: loads activity (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → Pot rules and payouts: validates pot inputs (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Pot interface → Chain repository: reads pot status (evidence: `apps/web/src/presentation/CommitPotApp.tsx`)
- Runtime selection → Mock environment: creates demo runtime (evidence: `apps/web/src/application/runtime.ts`)
- Browser chain setup → Chain repository: creates repository (evidence: `apps/web/src/infrastructure/avalanche/browser.ts`)
- Browser chain setup → Injected wallet: uses provider (evidence: `apps/web/src/infrastructure/avalanche/browser.ts`)
- Chain repository → Configured RPC: reads chain (evidence: `apps/web/src/infrastructure/avalanche/repository.ts`)
- Chain repository → Injected wallet: requests signatures (evidence: `apps/web/src/infrastructure/avalanche/repository.ts`)
- Chain repository → CommitPot core: reads and submits (evidence: `apps/web/src/infrastructure/avalanche/repository.ts`)
- Chain repository → Supported test token: checks and approves (evidence: `apps/web/src/infrastructure/avalanche/repository.ts`)
- CommitPot core → EIP-712 verifier: verifies attendance
- CommitPot core → Equal split strategy: applies payout rules
