# jospay/ccnph-duplicate architecture

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

- Interactive diagram: https://gitdiagram.com/jospay/ccnph-duplicate
- Repository: https://github.com/jospay/ccnph-duplicate

## Overview

This is an Expo/React Native cooperative-finance app with file-based screens for accounts, wallet transfers and loans, cooperative services, training, news, commerce, and chat. The main evidenced workflow is opening the dashboard, which loads wallet information and ads through service modules; authenticated API requests use the shared API client and token store. Other screen families are represented from the route tree, but their internal flows are not inferred where source was not sampled.

Main entry points: [`src/services/api.ts`](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/api.ts) (HTTP API client), [`src/store/useAuthStore.ts`](https://github.com/jospay/ccnph-duplicate/blob/main/src/store/useAuthStore.ts) (Auth state), [`app/(main)/index.tsx`](https://github.com/jospay/ccnph-duplicate/blob/main/app/(main)/index.tsx) (Home dashboard), [`src/services/walletService.ts`](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/walletService.ts) (Wallet service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_account["Account and profile"]
  node_auth["Authentication screens"]
  node_profilescreens["Profile screens"]
  node_profileapi["Profile service<br/>[profileService.ts]"]
end

subgraph group_wallet["Wallet and lending"]
  node_walletscreens["Wallet and transfers"]
  node_transferscreen["Transfer workflow<br/>[index.tsx]"]
  node_walletservice["Wallet service<br/>[walletService.ts]"]
  node_loanscreens["Loan workflow"]
  node_loanservice["Loan service<br/>[loanService.ts]"]
  node_loantypes["Loan data types<br/>[loan.types.ts]"]
  node_transferverify["Transfer verification"]
end

subgraph group_community["Cooperative and content"]
  node_coop["Cooperative services<br/>[index.tsx]"]
  node_training["Training screens"]
  node_news["News screens<br/>[index.tsx]"]
  node_newsservice["News service<br/>[newsService.ts]"]
end

subgraph group_commerce["Store and messaging"]
  node_store["Store screens"]
  node_productservice["Product service<br/>[productService.ts]"]
  node_supportchat["Support chat<br/>[index.tsx]"]
  node_chatservice["Chat service<br/>[chatService.ts]"]
  node_intellectualchat["Intellectual chat<br/>[index.tsx]"]
  node_shopchat["Seller chat<br/>[index.tsx]"]
  node_shopchatservice["Shop chat service<br/>[chatShopService.ts]"]
  node_chatdesign["Chat presentation<br/>[chat-design.tsx]"]
end

subgraph group_platform["Shared app layer"]
  node_entry["Route entry<br/>[index.tsx]"]
  node_authstate["Auth state<br/>[useAuthStore.ts]"]
  node_dashboard["Home dashboard<br/>[index.tsx]"]
  node_api["HTTP API client<br/>[api.ts]"]
  node_banners["Banner slider<br/>[BannerSlider.tsx]"]
  node_ads["Ad service<br/>[adService.ts]"]
  node_theme["Cooperative theme<br/>[useCoopTheme.ts]"]
  node_alert["Alert component<br/>[CustomAlert.tsx]"]
  node_skeleton["Loading skeleton<br/>[skeleton.tsx]"]
  node_uistate["UI state<br/>[useUIStore.ts]"]
end

node_user(("App user"))
node_backend["Application backend"]

node_user -->|"opens app"| node_entry
node_entry -->|"checks session"| node_authstate
node_authstate -->|"refreshes profile"| node_api
node_authstate -->|"fetches profile"| node_backend
node_dashboard -->|"loads balance"| node_walletservice
node_dashboard -->|"loads ads"| node_ads
node_banners -->|"loads ads"| node_ads
node_transferscreen -->|"gets config"| node_walletservice
node_transferscreen -->|"calculates fee"| node_walletservice
node_supportchat -->|"loads and sends"| node_chatservice
node_intellectualchat -->|"loads and sends"| node_chatservice
node_shopchat -->|"loads and sends"| node_shopchatservice
node_authstate -->|"sets auth token"| node_api
node_api -->|"sends requests"| node_backend
node_news -->|"loads news"| node_newsservice
node_news -->|"searches news"| node_newsservice
node_store -->|"searches products"| node_productservice
node_loanservice -->|"requests loan data"| node_api
node_newsservice -->|"requests news"| node_api
node_walletservice -->|"requests wallet data"| node_api
node_chatservice -->|"requests chat data"| node_api
node_productservice -->|"requests product data"| node_api
node_auth -.->|"updates session"| node_authstate
node_profilescreens -.->|"manages profile"| node_profileapi
node_coop -.->|"loads cooperative data"| node_api
node_training -.->|"loads training data"| node_api
node_loanscreens -.->|"requests loan data"| node_loanservice
node_supportchat -.->|"renders chat UI"| node_chatdesign
node_intellectualchat -.->|"renders chat UI"| node_chatdesign
node_shopchat -.->|"renders chat UI"| node_chatdesign
node_dashboard -.->|"uses branding"| node_theme
node_dashboard -.->|"reads UI state"| node_uistate
node_loanscreens -.->|"uses loan types"| node_loantypes
node_transferscreen -.->|"verifies transfer"| node_transferverify
node_alert -->|"uses brand color"| node_theme
node_skeleton -.->|"none"| node_backend

click node_entry "https://github.com/jospay/ccnph-duplicate/blob/main/app/index.tsx"
click node_auth "https://github.com/jospay/ccnph-duplicate/tree/main/app/(auth)"
click node_authstate "https://github.com/jospay/ccnph-duplicate/blob/main/src/store/useAuthStore.ts"
click node_profilescreens "https://github.com/jospay/ccnph-duplicate/tree/main/app/(main-profile)"
click node_profileapi "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/profileService.ts"
click node_dashboard "https://github.com/jospay/ccnph-duplicate/blob/main/app/(main)/index.tsx"
click node_walletscreens "https://github.com/jospay/ccnph-duplicate/tree/main/app/(load)"
click node_transferscreen "https://github.com/jospay/ccnph-duplicate/blob/main/app/(transper)/index.tsx"
click node_walletservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/walletService.ts"
click node_loanscreens "https://github.com/jospay/ccnph-duplicate/tree/main/app/(loan)"
click node_loanservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/loanService.ts"
click node_coop "https://github.com/jospay/ccnph-duplicate/blob/main/app/(coop)/index.tsx"
click node_training "https://github.com/jospay/ccnph-duplicate/tree/main/app/(business)"
click node_news "https://github.com/jospay/ccnph-duplicate/blob/main/app/(news)/index.tsx"
click node_newsservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/newsService.ts"
click node_store "https://github.com/jospay/ccnph-duplicate/tree/main/app/(store)"
click node_productservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/productService.ts"
click node_supportchat "https://github.com/jospay/ccnph-duplicate/blob/main/app/(chat-support)/index.tsx"
click node_chatservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/chatService.ts"
click node_intellectualchat "https://github.com/jospay/ccnph-duplicate/blob/main/app/(intellectual-chat)/index.tsx"
click node_shopchat "https://github.com/jospay/ccnph-duplicate/blob/main/app/(store-chat)/index.tsx"
click node_shopchatservice "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/chatShopService.ts"
click node_api "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/api.ts"
click node_banners "https://github.com/jospay/ccnph-duplicate/blob/main/src/components/BannerSlider.tsx"
click node_ads "https://github.com/jospay/ccnph-duplicate/blob/main/src/services/adService.ts"
click node_theme "https://github.com/jospay/ccnph-duplicate/blob/main/src/hooks/useCoopTheme.ts"
click node_loantypes "https://github.com/jospay/ccnph-duplicate/blob/main/src/types/loan.types.ts"
click node_chatdesign "https://github.com/jospay/ccnph-duplicate/blob/main/src/components/chat-design.tsx"
click node_alert "https://github.com/jospay/ccnph-duplicate/blob/main/src/components/CustomAlert.tsx"
click node_transferverify "https://github.com/jospay/ccnph-duplicate/blob/main/src/components/TransferVerifyModal.tsx"
click node_skeleton "https://github.com/jospay/ccnph-duplicate/blob/main/src/components/ui/skeleton.tsx"
click node_uistate "https://github.com/jospay/ccnph-duplicate/blob/main/src/store/useUIStore.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_auth,node_profilescreens,node_profileapi,node_user toneBlue
class node_walletscreens,node_transferscreen,node_walletservice,node_loanscreens,node_loanservice,node_loantypes,node_transferverify toneAmber
class node_coop,node_training,node_news,node_newsservice toneMint
class node_store,node_productservice,node_supportchat,node_chatservice,node_intellectualchat,node_shopchat,node_shopchatservice,node_chatdesign toneRose
class node_entry,node_authstate,node_dashboard,node_api,node_banners,node_ads,node_theme,node_alert,node_skeleton,node_uistate,node_backend toneIndigo
```

## Components

### Account and profile

- [Authentication screens](https://github.com/jospay/ccnph-duplicate/tree/main/app/(auth)): `app/(auth)`
- [Profile screens](https://github.com/jospay/ccnph-duplicate/tree/main/app/(main-profile)): `app/(main-profile)`
- [Profile service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/profileService.ts): `src/services/profileService.ts`

### Wallet and lending

- [Wallet and transfers](https://github.com/jospay/ccnph-duplicate/tree/main/app/(load)): `app/(load)`
- [Transfer workflow](https://github.com/jospay/ccnph-duplicate/blob/main/app/(transper)/index.tsx): `app/(transper)/index.tsx`
- [Wallet service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/walletService.ts): `src/services/walletService.ts`
- [Loan workflow](https://github.com/jospay/ccnph-duplicate/tree/main/app/(loan)): `app/(loan)`
- [Loan service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/loanService.ts): `src/services/loanService.ts`
- [Loan data types](https://github.com/jospay/ccnph-duplicate/blob/main/src/types/loan.types.ts): `src/types/loan.types.ts`
- [Transfer verification](https://github.com/jospay/ccnph-duplicate/blob/main/src/components/TransferVerifyModal.tsx): `src/components/TransferVerifyModal.tsx`

### Cooperative and content

- [Cooperative services](https://github.com/jospay/ccnph-duplicate/blob/main/app/(coop)/index.tsx): `app/(coop)/index.tsx`
- [Training screens](https://github.com/jospay/ccnph-duplicate/tree/main/app/(business)): `app/(business)`
- [News screens](https://github.com/jospay/ccnph-duplicate/blob/main/app/(news)/index.tsx): `app/(news)/index.tsx`
- [News service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/newsService.ts): `src/services/newsService.ts`

### Store and messaging

- [Store screens](https://github.com/jospay/ccnph-duplicate/tree/main/app/(store)): `app/(store)`
- [Product service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/productService.ts): `src/services/productService.ts`
- [Support chat](https://github.com/jospay/ccnph-duplicate/blob/main/app/(chat-support)/index.tsx): `app/(chat-support)/index.tsx`
- [Chat service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/chatService.ts): `src/services/chatService.ts`
- [Intellectual chat](https://github.com/jospay/ccnph-duplicate/blob/main/app/(intellectual-chat)/index.tsx): `app/(intellectual-chat)/index.tsx`
- [Seller chat](https://github.com/jospay/ccnph-duplicate/blob/main/app/(store-chat)/index.tsx): `app/(store-chat)/index.tsx`
- [Shop chat service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/chatShopService.ts): `src/services/chatShopService.ts`
- [Chat presentation](https://github.com/jospay/ccnph-duplicate/blob/main/src/components/chat-design.tsx): `src/components/chat-design.tsx`

### Shared app layer

- [Route entry](https://github.com/jospay/ccnph-duplicate/blob/main/app/index.tsx): `app/index.tsx`
- [Auth state](https://github.com/jospay/ccnph-duplicate/blob/main/src/store/useAuthStore.ts): `src/store/useAuthStore.ts`
- [Home dashboard](https://github.com/jospay/ccnph-duplicate/blob/main/app/(main)/index.tsx): `app/(main)/index.tsx`
- [HTTP API client](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/api.ts): `src/services/api.ts`
- [Banner slider](https://github.com/jospay/ccnph-duplicate/blob/main/src/components/BannerSlider.tsx): `src/components/BannerSlider.tsx`
- [Ad service](https://github.com/jospay/ccnph-duplicate/blob/main/src/services/adService.ts): `src/services/adService.ts`
- [Cooperative theme](https://github.com/jospay/ccnph-duplicate/blob/main/src/hooks/useCoopTheme.ts): `src/hooks/useCoopTheme.ts`
- [Alert component](https://github.com/jospay/ccnph-duplicate/blob/main/src/components/CustomAlert.tsx): `src/components/CustomAlert.tsx`
- [Loading skeleton](https://github.com/jospay/ccnph-duplicate/blob/main/src/components/ui/skeleton.tsx): `src/components/ui/skeleton.tsx`
- [UI state](https://github.com/jospay/ccnph-duplicate/blob/main/src/store/useUIStore.ts): `src/store/useUIStore.ts`

### Other components

- **App user**
- **Application backend**

## Connections

- App user → Route entry: opens app (evidence: `app/index.tsx`)
- Route entry → Auth state: checks session (evidence: `app/index.tsx`)
- Auth state → HTTP API client: refreshes profile (evidence: `src/store/useAuthStore.ts`)
- Auth state → Application backend: fetches profile (evidence: `src/store/useAuthStore.ts`)
- Home dashboard → Wallet service: loads balance (evidence: `app/(main)/index.tsx`)
- Home dashboard → Ad service: loads ads (evidence: `app/(main)/index.tsx`)
- Banner slider → Ad service: loads ads (evidence: `src/components/BannerSlider.tsx`)
- Transfer workflow → Wallet service: gets config (evidence: `app/(transper)/index.tsx`)
- Transfer workflow → Wallet service: calculates fee (evidence: `app/(transper)/index.tsx`)
- Support chat → Chat service: loads and sends (evidence: `app/(chat-support)/index.tsx`)
- Intellectual chat → Chat service: loads and sends (evidence: `app/(intellectual-chat)/index.tsx`)
- Seller chat → Shop chat service: loads and sends (evidence: `app/(store-chat)/index.tsx`)
- Auth state → HTTP API client: sets auth token (evidence: `src/services/api.ts`)
- HTTP API client → Application backend: sends requests (evidence: `src/services/api.ts`)
- News screens → News service: loads news (evidence: `app/(news)/index.tsx`)
- News screens → News service: searches news (evidence: `app/(news)/index.tsx`)
- Store screens → Product service: searches products (evidence: `app/(store)/search.tsx`)
- Loan service → HTTP API client: requests loan data (evidence: `src/services/loanService.ts`)
- News service → HTTP API client: requests news (evidence: `src/services/newsService.ts`)
- Wallet service → HTTP API client: requests wallet data (evidence: `src/services/walletService.ts`)
- Chat service → HTTP API client: requests chat data (evidence: `src/services/chatService.ts`)
- Product service → HTTP API client: requests product data (evidence: `src/services/productService.ts`)
- Authentication screens → Auth state: updates session
- Profile screens → Profile service: manages profile
- Cooperative services → HTTP API client: loads cooperative data
- Training screens → HTTP API client: loads training data
- Loan workflow → Loan service: requests loan data (evidence: `app/(loan)/index.tsx`)
- Support chat → Chat presentation: renders chat UI (evidence: `app/(chat-support)/index.tsx`)
- Intellectual chat → Chat presentation: renders chat UI (evidence: `app/(intellectual-chat)/index.tsx`)
- Seller chat → Chat presentation: renders chat UI (evidence: `app/(store-chat)/index.tsx`)
- Home dashboard → Cooperative theme: uses branding (evidence: `app/(main)/index.tsx`)
- Home dashboard → UI state: reads UI state (evidence: `app/(main)/index.tsx`)
- Loan workflow → Loan data types: uses loan types (evidence: `app/(loan)/index.tsx`)
- Transfer workflow → Transfer verification: verifies transfer
- Alert component → Cooperative theme: uses brand color (evidence: `src/components/CustomAlert.tsx`)
- Loading skeleton → Application backend: none
