# pixelpilot5/cardsplit architecture

> Architecture diagram of the GitHub repository pixelpilot5/cardsplit, 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/pixelpilot5/cardsplit
- Repository: https://github.com/pixelpilot5/cardsplit

## Overview

CardSplit is a marketplace for shoppers to find bank-card discounts through cardholders, register cards, and coordinate a deal with escrow-style progress and messaging. The main flow starts in the React app: product input is analyzed by the server, offers and matching cardholders are presented, and a selected deal is managed through the deal room. Server state appears in-memory in the sampled routes; no persistent database or payment-provider integration is evidenced. README content was empty, so capability coverage follows the supplied source index and excerpts.

Main entry points: [`src/App.tsx`](https://github.com/pixelpilot5/cardsplit/blob/main/src/App.tsx) (App orchestrator), [`server.ts`](https://github.com/pixelpilot5/cardsplit/blob/main/server.ts) (HTTP API), [`src/utils/offerCalculator.ts`](https://github.com/pixelpilot5/cardsplit/blob/main/src/utils/offerCalculator.ts) (Offer calculator), [`src/components/CardholderMarketplace.tsx`](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/CardholderMarketplace.tsx) (Cardholder marketplace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shopper experience"]
  node_app["App orchestrator<br/>[App.tsx]"]
  node_product_input["Product input"]
  node_product_analysis["Product analysis"]
  node_header["Header<br/>[Header.tsx]"]
end

subgraph group_market["Offers and marketplace"]
  node_offer_matrix["Offer matrix"]
  node_offer_calculator["Offer calculator<br/>[offerCalculator.ts]"]
  node_marketplace["Cardholder marketplace"]
  node_register_card["Card registration"]
  node_sample_data["Sample profiles<br/>[mockData.ts]"]
end

subgraph group_deals["Deal coordination"]
  node_deal_modal["Deal room"]
  node_safety_guide["Safety guide"]
end

subgraph group_backend["Application services"]
  node_api_server["HTTP API<br/>[server.ts]"]
  node_domain_types["Domain models<br/>[index.ts]"]
end

node_shopper(("Shopper"))
node_genai{{"Google GenAI"}}
node_buyer_platform{{"Shopping platform"}}

node_shopper -->|"uses"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_product_input
node_app -->|"renders"| node_product_analysis
node_app -->|"renders"| node_offer_matrix
node_app -->|"renders"| node_marketplace
node_app -->|"renders"| node_deal_modal
node_app -->|"renders"| node_register_card
node_app -->|"renders"| node_safety_guide
node_product_input -->|"submits query"| node_app
node_app -->|"requests analysis"| node_api_server
node_api_server -->|"calculates offers"| node_offer_calculator
node_app -->|"initializes offers"| node_offer_calculator
node_app -->|"loads samples"| node_sample_data
node_app -->|"passes product"| node_product_analysis
node_app -->|"passes offers"| node_offer_matrix
node_app -->|"passes profiles"| node_marketplace
node_offer_matrix -->|"formats amounts"| node_offer_calculator
node_marketplace -->|"formats amounts"| node_offer_calculator
node_product_analysis -->|"formats amounts"| node_offer_calculator
node_register_card -->|"registers holder"| node_api_server
node_marketplace -->|"selects holder"| node_app
node_deal_modal -->|"submits deal actions"| node_app
node_app -->|"creates deal"| node_api_server
node_api_server -->|"calculates offers"| node_offer_calculator
node_api_server -->|"uses domain models"| node_domain_types
node_app -->|"uses domain models"| node_domain_types
node_api_server -.->|"analyzes product"| node_genai
node_api_server -.->|"supports listings"| node_buyer_platform

click node_app "https://github.com/pixelpilot5/cardsplit/blob/main/src/App.tsx"
click node_product_input "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/ProductInputHero.tsx"
click node_product_analysis "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/ProductAnalysisCard.tsx"
click node_offer_matrix "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/CardOffersMatrix.tsx"
click node_offer_calculator "https://github.com/pixelpilot5/cardsplit/blob/main/src/utils/offerCalculator.ts"
click node_marketplace "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/CardholderMarketplace.tsx"
click node_register_card "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/RegisterCardModal.tsx"
click node_sample_data "https://github.com/pixelpilot5/cardsplit/blob/main/src/data/mockData.ts"
click node_deal_modal "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/DealEscrowModal.tsx"
click node_safety_guide "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/SafetyGuideSection.tsx"
click node_header "https://github.com/pixelpilot5/cardsplit/blob/main/src/components/Header.tsx"
click node_api_server "https://github.com/pixelpilot5/cardsplit/blob/main/server.ts"
click node_domain_types "https://github.com/pixelpilot5/cardsplit/blob/main/src/types/index.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_app,node_product_input,node_product_analysis,node_header toneBlue
class node_offer_matrix,node_offer_calculator,node_marketplace,node_register_card,node_sample_data toneAmber
class node_deal_modal,node_safety_guide toneMint
class node_api_server,node_domain_types toneRose
class node_shopper,node_genai,node_buyer_platform toneIndigo
```

## Components

### Shopper experience

- [App orchestrator](https://github.com/pixelpilot5/cardsplit/blob/main/src/App.tsx): `src/App.tsx`
- [Product input](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/ProductInputHero.tsx): `src/components/ProductInputHero.tsx`
- [Product analysis](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/ProductAnalysisCard.tsx): `src/components/ProductAnalysisCard.tsx`
- [Header](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/Header.tsx): `src/components/Header.tsx`

### Offers and marketplace

- [Offer matrix](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/CardOffersMatrix.tsx): `src/components/CardOffersMatrix.tsx`
- [Offer calculator](https://github.com/pixelpilot5/cardsplit/blob/main/src/utils/offerCalculator.ts): `src/utils/offerCalculator.ts`
- [Cardholder marketplace](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/CardholderMarketplace.tsx): `src/components/CardholderMarketplace.tsx`
- [Card registration](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/RegisterCardModal.tsx): `src/components/RegisterCardModal.tsx`
- [Sample profiles](https://github.com/pixelpilot5/cardsplit/blob/main/src/data/mockData.ts): `src/data/mockData.ts`

### Deal coordination

- [Deal room](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/DealEscrowModal.tsx): `src/components/DealEscrowModal.tsx`
- [Safety guide](https://github.com/pixelpilot5/cardsplit/blob/main/src/components/SafetyGuideSection.tsx): `src/components/SafetyGuideSection.tsx`

### Application services

- [HTTP API](https://github.com/pixelpilot5/cardsplit/blob/main/server.ts): `server.ts`
- [Domain models](https://github.com/pixelpilot5/cardsplit/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **Shopper**
- **Google GenAI**
- **Shopping platform**

## Connections

- Shopper → App orchestrator: uses
- App orchestrator → Header: renders (evidence: `src/App.tsx`)
- App orchestrator → Product input: renders (evidence: `src/App.tsx`)
- App orchestrator → Product analysis: renders (evidence: `src/App.tsx`)
- App orchestrator → Offer matrix: renders (evidence: `src/App.tsx`)
- App orchestrator → Cardholder marketplace: renders (evidence: `src/App.tsx`)
- App orchestrator → Deal room: renders (evidence: `src/App.tsx`)
- App orchestrator → Card registration: renders (evidence: `src/App.tsx`)
- App orchestrator → Safety guide: renders (evidence: `src/App.tsx`)
- Product input → App orchestrator: submits query (evidence: `src/components/ProductInputHero.tsx`)
- App orchestrator → HTTP API: requests analysis (evidence: `server.ts`)
- HTTP API → Offer calculator: calculates offers (evidence: `server.ts`)
- App orchestrator → Offer calculator: initializes offers (evidence: `src/App.tsx`)
- App orchestrator → Sample profiles: loads samples (evidence: `src/App.tsx`)
- App orchestrator → Product analysis: passes product (evidence: `src/App.tsx`)
- App orchestrator → Offer matrix: passes offers (evidence: `src/App.tsx`)
- App orchestrator → Cardholder marketplace: passes profiles (evidence: `src/App.tsx`)
- Offer matrix → Offer calculator: formats amounts (evidence: `src/components/CardOffersMatrix.tsx`)
- Cardholder marketplace → Offer calculator: formats amounts (evidence: `src/components/CardholderMarketplace.tsx`)
- Product analysis → Offer calculator: formats amounts (evidence: `src/components/ProductAnalysisCard.tsx`)
- Card registration → HTTP API: registers holder (evidence: `src/components/RegisterCardModal.tsx`)
- Cardholder marketplace → App orchestrator: selects holder (evidence: `src/App.tsx`)
- Deal room → App orchestrator: submits deal actions (evidence: `src/components/DealEscrowModal.tsx`)
- App orchestrator → HTTP API: creates deal (evidence: `src/App.tsx`)
- HTTP API → Offer calculator: calculates offers (evidence: `server.ts`)
- HTTP API → Domain models: uses domain models (evidence: `server.ts`)
- App orchestrator → Domain models: uses domain models (evidence: `src/App.tsx`)
- HTTP API → Google GenAI: analyzes product
- HTTP API → Shopping platform: supports listings
