# cyrusemma/fast-datahub architecture

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

- Interactive diagram: https://gitdiagram.com/cyrusemma/fast-datahub
- Repository: https://github.com/cyrusemma/fast-datahub

## Overview

DataHUB is a Ghana-focused data-reseller platform for customers, resellers, agents and administrators. Users sign in, enter role-specific dashboards, and can buy data or airtime, manage wallets and review transactions; the README also documents top-ups, bills, referrals and bulk sales. Pricing is a distinct shared capability, with role-based configuration and margin forecasting. The graph focuses on evidenced routing, purchase, pricing and backend boundaries; unsampled role pages and payment integrations are represented at their supported directory or function paths.

Main entry points: [`src/pages`](https://github.com/cyrusemma/fast-datahub/tree/main/src/pages) (Role dashboards), [`src/pages/customer/CustomerBuyData.jsx`](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/customer/CustomerBuyData.jsx) (Customer data purchase), [`src/App.jsx`](https://github.com/cyrusemma/fast-datahub/blob/main/src/App.jsx) (Route and role access), [`src/api/bundles.api.js`](https://github.com/cyrusemma/fast-datahub/blob/main/src/api/bundles.api.js) (Bundle catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and access"]
  node_app["Route and role access<br/>[App.jsx]"]
  node_auth["Sign-in and registration"]
  node_authstate["Session state<br/>[authStore.js]"]
  node_portals["Role dashboards"]
end

subgraph group_commerce["Commerce and accounts"]
  node_customerbuy["Customer data purchase"]
  node_customerextras["Customer services"]
  node_agentcommerce["Agent bulk sales<br/>[AgentBuyBulk.jsx]"]
  node_resellercommerce["Reseller sales"]
  node_wallet["Wallet operations<br/>[wallet.api.js]"]
  node_walletstate["Wallet state<br/>[walletStore.js]"]
  node_transactions["Transaction records"]
  node_bundles["Bundle catalog<br/>[bundles.api.js]"]
end

subgraph group_pricing["Pricing operations"]
  node_pricingpages["Pricing consoles"]
  node_agentpricing["Agent pricing console"]
  node_resellerpricing["Reseller pricing console"]
  node_pricingengine["Pricing engine<br/>[pricingEngine.js]"]
  node_adminops["Administration"]
end

subgraph group_backend["Backend services"]
  node_supabase["Supabase client<br/>[supabase.js]"]
  node_buyfunction["Data purchase function<br/>[index.ts]"]
  node_topupfunction["Top-up verification<br/>[index.ts]"]
  node_fraudfunction["Fraud check<br/>[index.ts]"]
  node_invitefunction["Reseller invitations<br/>[index.ts]"]
  node_webhook["Payment webhook<br/>[index.ts]"]
end

node_user(("Platform user"))
node_paystack(("Paystack"))
node_db[("Supabase project")]

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_auth
node_auth -->|"updates session"| node_authstate
node_app -->|"initializes auth"| node_authstate
node_app -->|"routes by role"| node_portals
node_user -->|"buys data"| node_customerbuy
node_customerbuy -->|"loads bundles"| node_bundles
node_customerbuy -->|"uses wallet"| node_wallet
node_customerbuy -->|"uses transactions"| node_transactions
node_customerbuy -->|"uses wallet state"| node_walletstate
node_portals -->|"routes customer services"| node_customerextras
node_portals -->|"routes agent sales"| node_agentcommerce
node_portals -->|"routes reseller sales"| node_resellercommerce
node_portals -->|"routes administration"| node_adminops
node_pricingpages -->|"updates bundles"| node_bundles
node_pricingpages -->|"configures pricing"| node_pricingengine
node_agentpricing -->|"reads and saves prices"| node_pricingengine
node_resellerpricing -->|"reads and saves prices"| node_pricingengine
node_bundles -->|"uses pricing rules"| node_pricingengine
node_wallet -->|"uses client"| node_supabase
node_bundles -->|"uses client"| node_supabase
node_transactions -.->|"uses client"| node_supabase
node_supabase -->|"connects to"| node_db
node_wallet -.->|"may invoke"| node_buyfunction
node_paystack -.->|"sends events"| node_webhook
node_paystack -.->|"funds wallet"| node_topupfunction

click node_app "https://github.com/cyrusemma/fast-datahub/blob/main/src/App.jsx"
click node_auth "https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/auth"
click node_authstate "https://github.com/cyrusemma/fast-datahub/blob/main/src/store/authStore.js"
click node_portals "https://github.com/cyrusemma/fast-datahub/tree/main/src/pages"
click node_customerbuy "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/customer/CustomerBuyData.jsx"
click node_customerextras "https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/customer"
click node_agentcommerce "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/agent/AgentBuyBulk.jsx"
click node_resellercommerce "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/reseller/ResellerSellData.jsx"
click node_wallet "https://github.com/cyrusemma/fast-datahub/blob/main/src/api/wallet.api.js"
click node_walletstate "https://github.com/cyrusemma/fast-datahub/blob/main/src/store/walletStore.js"
click node_transactions "https://github.com/cyrusemma/fast-datahub/blob/main/src/api/transactions.api.js"
click node_bundles "https://github.com/cyrusemma/fast-datahub/blob/main/src/api/bundles.api.js"
click node_pricingpages "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/admin/AdminPricingEngine.jsx"
click node_agentpricing "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/agent/AgentPricingEngine.jsx"
click node_resellerpricing "https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/reseller/ResellerPricingEngine.jsx"
click node_pricingengine "https://github.com/cyrusemma/fast-datahub/blob/main/src/services/pricingEngine.js"
click node_adminops "https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/admin"
click node_supabase "https://github.com/cyrusemma/fast-datahub/blob/main/src/api/supabase.js"
click node_buyfunction "https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/buy-data/index.ts"
click node_topupfunction "https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/topup-verify/index.ts"
click node_fraudfunction "https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/fraud-check/index.ts"
click node_invitefunction "https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/invite-reseller/index.ts"
click node_webhook "https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/paystack-webhook/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_auth,node_authstate,node_portals,node_user toneBlue
class node_customerbuy,node_customerextras,node_agentcommerce,node_resellercommerce,node_wallet,node_walletstate,node_transactions,node_bundles,node_db toneAmber
class node_pricingpages,node_agentpricing,node_resellerpricing,node_pricingengine,node_adminops toneMint
class node_supabase,node_buyfunction,node_topupfunction,node_fraudfunction,node_invitefunction,node_webhook toneRose
class node_paystack toneIndigo
```

## Components

### App and access

- [Route and role access](https://github.com/cyrusemma/fast-datahub/blob/main/src/App.jsx): `src/App.jsx`
- [Sign-in and registration](https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/auth): `src/pages/auth`
- [Session state](https://github.com/cyrusemma/fast-datahub/blob/main/src/store/authStore.js): `src/store/authStore.js`
- [Role dashboards](https://github.com/cyrusemma/fast-datahub/tree/main/src/pages): `src/pages`

### Commerce and accounts

- [Customer data purchase](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/customer/CustomerBuyData.jsx): `src/pages/customer/CustomerBuyData.jsx`
- [Customer services](https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/customer): `src/pages/customer`
- [Agent bulk sales](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/agent/AgentBuyBulk.jsx): `src/pages/agent/AgentBuyBulk.jsx`
- [Reseller sales](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/reseller/ResellerSellData.jsx): `src/pages/reseller/ResellerSellData.jsx`
- [Wallet operations](https://github.com/cyrusemma/fast-datahub/blob/main/src/api/wallet.api.js): `src/api/wallet.api.js`
- [Wallet state](https://github.com/cyrusemma/fast-datahub/blob/main/src/store/walletStore.js): `src/store/walletStore.js`
- [Transaction records](https://github.com/cyrusemma/fast-datahub/blob/main/src/api/transactions.api.js): `src/api/transactions.api.js`
- [Bundle catalog](https://github.com/cyrusemma/fast-datahub/blob/main/src/api/bundles.api.js): `src/api/bundles.api.js`

### Pricing operations

- [Pricing consoles](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/admin/AdminPricingEngine.jsx): `src/pages/admin/AdminPricingEngine.jsx`
- [Agent pricing console](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/agent/AgentPricingEngine.jsx): `src/pages/agent/AgentPricingEngine.jsx`
- [Reseller pricing console](https://github.com/cyrusemma/fast-datahub/blob/main/src/pages/reseller/ResellerPricingEngine.jsx): `src/pages/reseller/ResellerPricingEngine.jsx`
- [Pricing engine](https://github.com/cyrusemma/fast-datahub/blob/main/src/services/pricingEngine.js): `src/services/pricingEngine.js`
- [Administration](https://github.com/cyrusemma/fast-datahub/tree/main/src/pages/admin): `src/pages/admin`

### Backend services

- [Supabase client](https://github.com/cyrusemma/fast-datahub/blob/main/src/api/supabase.js): `src/api/supabase.js`
- [Data purchase function](https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/buy-data/index.ts): `supabase/functions/buy-data/index.ts`
- [Top-up verification](https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/topup-verify/index.ts): `supabase/functions/topup-verify/index.ts`
- [Fraud check](https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/fraud-check/index.ts): `supabase/functions/fraud-check/index.ts`
- [Reseller invitations](https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/invite-reseller/index.ts): `supabase/functions/invite-reseller/index.ts`
- [Payment webhook](https://github.com/cyrusemma/fast-datahub/blob/main/supabase/functions/paystack-webhook/index.ts): `supabase/functions/paystack-webhook/index.ts`

### Other components

- **Platform user**
- **Paystack**
- **Supabase project**

## Connections

- Platform user → Route and role access: opens (evidence: `src/App.jsx`)
- Route and role access → Sign-in and registration: routes to (evidence: `src/App.jsx`)
- Sign-in and registration → Session state: updates session (evidence: `src/pages/auth/Register.jsx`)
- Route and role access → Session state: initializes auth (evidence: `src/App.jsx`)
- Route and role access → Role dashboards: routes by role (evidence: `src/App.jsx`)
- Platform user → Customer data purchase: buys data
- Customer data purchase → Bundle catalog: loads bundles (evidence: `src/pages/customer/CustomerBuyData.jsx`)
- Customer data purchase → Wallet operations: uses wallet (evidence: `src/pages/customer/CustomerBuyData.jsx`)
- Customer data purchase → Transaction records: uses transactions (evidence: `src/pages/customer/CustomerBuyData.jsx`)
- Customer data purchase → Wallet state: uses wallet state (evidence: `src/pages/customer/CustomerBuyData.jsx`)
- Role dashboards → Customer services: routes customer services (evidence: `src/App.jsx`)
- Role dashboards → Agent bulk sales: routes agent sales (evidence: `src/App.jsx`)
- Role dashboards → Reseller sales: routes reseller sales
- Role dashboards → Administration: routes administration (evidence: `src/App.jsx`)
- Pricing consoles → Bundle catalog: updates bundles (evidence: `src/pages/admin/AdminPricingEngine.jsx`)
- Pricing consoles → Pricing engine: configures pricing (evidence: `src/pages/admin/AdminPricingEngine.jsx`)
- Agent pricing console → Pricing engine: reads and saves prices (evidence: `src/pages/agent/AgentPricingEngine.jsx`)
- Reseller pricing console → Pricing engine: reads and saves prices (evidence: `src/pages/reseller/ResellerPricingEngine.jsx`)
- Bundle catalog → Pricing engine: uses pricing rules (evidence: `src/api/bundles.api.js`)
- Wallet operations → Supabase client: uses client (evidence: `src/api/wallet.api.js`)
- Bundle catalog → Supabase client: uses client (evidence: `src/api/bundles.api.js`)
- Transaction records → Supabase client: uses client
- Supabase client → Supabase project: connects to (evidence: `src/api/supabase.js`)
- Wallet operations → Data purchase function: may invoke
- Paystack → Payment webhook: sends events
- Paystack → Top-up verification: funds wallet
