# pranavv-12/cardsense architecture

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

- Interactive diagram: https://gitdiagram.com/pranavv-12/cardsense
- Repository: https://github.com/pranavv-12/cardsense

## Overview

CardSense is a credit-card recommendation and wallet-optimization product. Users explore the card catalog or enter spending and income in the browser to see single-card recommendations, wallet combinations, and reward analysis; a Python pipeline also produces segmentation, recommendation, and evaluation outputs used by the dashboard. The README documents real, linked, and synthetic data modes and cohort reporting. Some backend phases and report wiring are documented rather than shown in excerpts, so those relationships cite the README.

Main entry points: [`frontend/src/App.jsx`](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/App.jsx) (Dashboard shell), [`backend/pipeline.py`](https://github.com/pranavv-12/cardsense/blob/main/backend/pipeline.py) (Analytics orchestration), [`frontend/src/data.js`](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/data.js) (Dashboard data access), [`frontend/src/components/Advisor.jsx`](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Advisor.jsx) (Wallet advisor UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Dashboard"]
  node_app["Dashboard shell<br/>[App.jsx]"]
  node_recommender["Single-card recommender<br/>[Recommender.jsx]"]
  node_optimizer["Existing-card optimizer<br/>[Optimizer.jsx]"]
  node_marketplace["Card catalog"]
  node_clusters["Cluster explorer<br/>[Clusters.jsx]"]
  node_methodology["Data methodology<br/>[Methodology.jsx]"]
end

subgraph group_wallet["Reward Analysis"]
  node_advisor_ui["Wallet advisor UI<br/>[Advisor.jsx]"]
  node_wallet_engine["Wallet optimizer<br/>[advisor.js]"]
  node_report_view["Advisor report view<br/>[report.js]"]
end

subgraph group_batch["Analytics Pipeline"]
  node_pipeline["Analytics orchestration<br/>[pipeline.py]"]
  node_source_loader["Real and linked loaders<br/>[real_data.py]"]
  node_synthetic_data["Synthetic generator<br/>[generate_data.py]"]
  node_linked_prep["Linked data preparation"]
  node_wallet_batch["Batch wallet optimizer<br/>[advisor.py]"]
  node_cohort_reports["Cohort reports<br/>[report.py]"]
end

subgraph group_data["Data Sources"]
  node_shared_data["Dashboard data access<br/>[data.js]"]
  node_catalog_data["Card catalog data<br/>[cards.json]"]
  node_pipeline_outputs["Pipeline results"]
  node_linked_outputs["Linked-source results"]
end

node_user(("Card seeker"))

node_user -->|"enters spending"| node_recommender
node_user -->|"enters profile"| node_advisor_ui
node_app -->|"renders"| node_recommender
node_app -->|"renders"| node_optimizer
node_app -->|"renders"| node_advisor_ui
node_app -->|"renders"| node_marketplace
node_app -->|"renders"| node_clusters
node_app -->|"renders"| node_methodology
node_recommender -->|"scores cards"| node_shared_data
node_optimizer -->|"reads card data"| node_shared_data
node_marketplace -->|"reads catalog"| node_shared_data
node_advisor_ui -->|"calculates wallet"| node_wallet_engine
node_advisor_ui -->|"builds report"| node_report_view
node_shared_data -->|"loads"| node_catalog_data
node_shared_data -->|"loads"| node_pipeline_outputs
node_shared_data -->|"loads"| node_linked_outputs
node_pipeline -->|"loads real sources"| node_source_loader
node_pipeline -.->|"uses fallback"| node_synthetic_data
node_linked_prep -.->|"prepares linked input"| node_source_loader
node_pipeline -->|"produces real results"| node_pipeline_outputs
node_pipeline -->|"produces linked results"| node_linked_outputs
node_pipeline -.->|"supports wallet analysis"| node_wallet_batch
node_cohort_reports -->|"uses optimizer"| node_wallet_batch
node_cohort_reports -->|"uses pipeline results"| node_pipeline

click node_app "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/App.jsx"
click node_recommender "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Recommender.jsx"
click node_optimizer "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Optimizer.jsx"
click node_marketplace "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/CardMarketplace.jsx"
click node_clusters "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Clusters.jsx"
click node_methodology "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Methodology.jsx"
click node_advisor_ui "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Advisor.jsx"
click node_wallet_engine "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/advisor.js"
click node_report_view "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/report.js"
click node_shared_data "https://github.com/pranavv-12/cardsense/blob/main/frontend/src/data.js"
click node_catalog_data "https://github.com/pranavv-12/cardsense/blob/main/data/cards.json"
click node_pipeline_outputs "https://github.com/pranavv-12/cardsense/blob/main/data/pipeline_output.json"
click node_linked_outputs "https://github.com/pranavv-12/cardsense/blob/main/data/pipeline_output_linked.json"
click node_pipeline "https://github.com/pranavv-12/cardsense/blob/main/backend/pipeline.py"
click node_source_loader "https://github.com/pranavv-12/cardsense/blob/main/backend/real_data.py"
click node_synthetic_data "https://github.com/pranavv-12/cardsense/blob/main/backend/generate_data.py"
click node_linked_prep "https://github.com/pranavv-12/cardsense/blob/main/backend/build_fraud_users.py"
click node_wallet_batch "https://github.com/pranavv-12/cardsense/blob/main/backend/advisor.py"
click node_cohort_reports "https://github.com/pranavv-12/cardsense/blob/main/backend/report.py"

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_recommender,node_optimizer,node_marketplace,node_clusters,node_methodology toneBlue
class node_advisor_ui,node_wallet_engine,node_report_view toneAmber
class node_pipeline,node_source_loader,node_synthetic_data,node_linked_prep,node_wallet_batch,node_cohort_reports toneMint
class node_shared_data,node_catalog_data,node_pipeline_outputs,node_linked_outputs toneRose
class node_user toneIndigo
```

## Components

### Dashboard

- [Dashboard shell](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Single-card recommender](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Recommender.jsx): `frontend/src/components/Recommender.jsx`
- [Existing-card optimizer](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Optimizer.jsx): `frontend/src/components/Optimizer.jsx`
- [Card catalog](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/CardMarketplace.jsx): `frontend/src/components/CardMarketplace.jsx`
- [Cluster explorer](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Clusters.jsx): `frontend/src/components/Clusters.jsx`
- [Data methodology](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Methodology.jsx): `frontend/src/components/Methodology.jsx`

### Reward Analysis

- [Wallet advisor UI](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/components/Advisor.jsx): `frontend/src/components/Advisor.jsx`
- [Wallet optimizer](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/advisor.js): `frontend/src/advisor.js`
- [Advisor report view](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/report.js): `frontend/src/report.js`

### Analytics Pipeline

- [Analytics orchestration](https://github.com/pranavv-12/cardsense/blob/main/backend/pipeline.py): `backend/pipeline.py`
- [Real and linked loaders](https://github.com/pranavv-12/cardsense/blob/main/backend/real_data.py): `backend/real_data.py`
- [Synthetic generator](https://github.com/pranavv-12/cardsense/blob/main/backend/generate_data.py): `backend/generate_data.py`
- [Linked data preparation](https://github.com/pranavv-12/cardsense/blob/main/backend/build_fraud_users.py): `backend/build_fraud_users.py`
- [Batch wallet optimizer](https://github.com/pranavv-12/cardsense/blob/main/backend/advisor.py): `backend/advisor.py`
- [Cohort reports](https://github.com/pranavv-12/cardsense/blob/main/backend/report.py): `backend/report.py`

### Data Sources

- [Dashboard data access](https://github.com/pranavv-12/cardsense/blob/main/frontend/src/data.js): `frontend/src/data.js`
- [Card catalog data](https://github.com/pranavv-12/cardsense/blob/main/data/cards.json): `data/cards.json`
- [Pipeline results](https://github.com/pranavv-12/cardsense/blob/main/data/pipeline_output.json): `data/pipeline_output.json`
- [Linked-source results](https://github.com/pranavv-12/cardsense/blob/main/data/pipeline_output_linked.json): `data/pipeline_output_linked.json`

### Other components

- **Card seeker**

## Connections

- Card seeker → Single-card recommender: enters spending (evidence: `frontend/src/components/Recommender.jsx`)
- Card seeker → Wallet advisor UI: enters profile (evidence: `frontend/src/components/Advisor.jsx`)
- Dashboard shell → Single-card recommender: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Existing-card optimizer: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Wallet advisor UI: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Card catalog: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Cluster explorer: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Data methodology: renders (evidence: `frontend/src/App.jsx`)
- Single-card recommender → Dashboard data access: scores cards (evidence: `frontend/src/components/Recommender.jsx`)
- Existing-card optimizer → Dashboard data access: reads card data (evidence: `frontend/src/components/Optimizer.jsx`)
- Card catalog → Dashboard data access: reads catalog (evidence: `frontend/src/components/CardMarketplace.jsx`)
- Wallet advisor UI → Wallet optimizer: calculates wallet (evidence: `frontend/src/components/Advisor.jsx`)
- Wallet advisor UI → Advisor report view: builds report (evidence: `frontend/src/components/Advisor.jsx`)
- Dashboard data access → Card catalog data: loads (evidence: `frontend/src/data.js`)
- Dashboard data access → Pipeline results: loads (evidence: `frontend/src/data.js`)
- Dashboard data access → Linked-source results: loads (evidence: `frontend/src/data.js`)
- Analytics orchestration → Real and linked loaders: loads real sources (evidence: `backend/pipeline.py`)
- Analytics orchestration → Synthetic generator: uses fallback (evidence: `README.md`)
- Linked data preparation → Real and linked loaders: prepares linked input (evidence: `README.md`)
- Analytics orchestration → Pipeline results: produces real results (evidence: `README.md`)
- Analytics orchestration → Linked-source results: produces linked results (evidence: `README.md`)
- Analytics orchestration → Batch wallet optimizer: supports wallet analysis (evidence: `README.md`)
- Cohort reports → Batch wallet optimizer: uses optimizer (evidence: `README.md`)
- Cohort reports → Analytics orchestration: uses pipeline results (evidence: `README.md`)
