# denomwoyo/lindaflow_v2 architecture

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

- Interactive diagram: https://gitdiagram.com/denomwoyo/lindaflow_v2
- Repository: https://github.com/denomwoyo/lindaflow_v2

## Overview

LindaFlow is a local-first M-Pesa transaction and risk-assessment service with a browser dashboard. Users assess and record transactions, review risk decisions, and initiate STK Push payments; offline submissions queue in the browser and sync when connectivity returns. The backend also exposes Daraja C2B registration and callbacks. Sampled Go code confirms routing, risk scoring, JSONL persistence, and provider calls; unsampled handler details and README capability descriptions were unavailable, so those relationships are not expanded.

Main entry points: [`LindaFlow/cmd/lindaflow/main.go`](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go) (HTTP API server), [`LindaFlow/web/app.js`](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/app.js) (Browser workflow), [`LindaFlow/web/index.html`](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/index.html) (Dashboard UI), [`LindaFlow/web/sw.js`](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/sw.js) (Offline app shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser experience"]
  node_dashboard["Dashboard UI<br/>[index.html]"]
  node_client["Browser workflow<br/>[app.js]"]
  node_offline_queue[("Offline queue<br/>[app.js]")]
  node_app_shell["Offline app shell<br/>[sw.js]"]
end

subgraph group_service["Transaction service"]
  node_http_server["HTTP API server<br/>[main.go]"]
  node_risk["Risk assessment<br/>[main.go]"]
  node_transactions["Transaction handling<br/>[main.go]"]
  node_store[("JSONL transaction store<br/>[main.go]")]
end

subgraph group_payments["M-Pesa integration"]
  node_daraja_client["Daraja API client<br/>[main.go]"]
end

node_user(("Merchant user"))
node_daraja["Safaricom Daraja"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"submits forms"| node_client
node_client -->|"requests API"| node_http_server
node_client -->|"queues offline"| node_offline_queue
node_offline_queue -->|"syncs transactions"| node_http_server
node_client -->|"registers worker"| node_app_shell
node_app_shell -->|"caches assets"| node_dashboard
node_http_server -->|"routes assessment"| node_risk
node_http_server -->|"routes transactions"| node_transactions
node_transactions -->|"scores event"| node_risk
node_transactions -->|"persists records"| node_store
node_http_server -->|"routes payment requests"| node_daraja_client
node_daraja_client -->|"requests OAuth and payments"| node_daraja
node_daraja -.->|"sends callbacks"| node_http_server

click node_dashboard "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/index.html"
click node_client "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/app.js"
click node_offline_queue "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/app.js"
click node_app_shell "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/sw.js"
click node_http_server "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go"
click node_risk "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go"
click node_transactions "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go"
click node_store "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go"
click node_daraja_client "https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go"

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_dashboard,node_client,node_offline_queue,node_app_shell,node_user toneBlue
class node_http_server,node_risk,node_transactions,node_store toneAmber
class node_daraja_client toneMint
class node_daraja toneIndigo
```

## Components

### Browser experience

- [Dashboard UI](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/index.html): `LindaFlow/web/index.html`
- [Browser workflow](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/app.js): `LindaFlow/web/app.js`
- [Offline queue](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/app.js): `LindaFlow/web/app.js`
- [Offline app shell](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/web/sw.js): `LindaFlow/web/sw.js`

### Transaction service

- [HTTP API server](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go): `LindaFlow/cmd/lindaflow/main.go`
- [Risk assessment](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go): `LindaFlow/cmd/lindaflow/main.go`
- [Transaction handling](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go): `LindaFlow/cmd/lindaflow/main.go`
- [JSONL transaction store](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go): `LindaFlow/cmd/lindaflow/main.go`

### M-Pesa integration

- [Daraja API client](https://github.com/denomwoyo/lindaflow_v2/blob/main/LindaFlow/cmd/lindaflow/main.go): `LindaFlow/cmd/lindaflow/main.go`

### Other components

- **Merchant user**
- **Safaricom Daraja**

## Connections

- Merchant user → Dashboard UI: uses
- Dashboard UI → Browser workflow: submits forms (evidence: `LindaFlow/web/app.js`)
- Browser workflow → HTTP API server: requests API (evidence: `LindaFlow/web/app.js`)
- Browser workflow → Offline queue: queues offline (evidence: `LindaFlow/web/app.js`)
- Offline queue → HTTP API server: syncs transactions (evidence: `LindaFlow/web/app.js`)
- Browser workflow → Offline app shell: registers worker (evidence: `LindaFlow/web/app.js`)
- Offline app shell → Dashboard UI: caches assets (evidence: `LindaFlow/web/sw.js`)
- HTTP API server → Risk assessment: routes assessment (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- HTTP API server → Transaction handling: routes transactions (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- Transaction handling → Risk assessment: scores event (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- Transaction handling → JSONL transaction store: persists records (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- HTTP API server → Daraja API client: routes payment requests (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- Daraja API client → Safaricom Daraja: requests OAuth and payments (evidence: `LindaFlow/cmd/lindaflow/main.go`)
- Safaricom Daraja → HTTP API server: sends callbacks
