# rehankwatla/tredye-noti architecture

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

- Interactive diagram: https://gitdiagram.com/rehankwatla/tredye-noti
- Repository: https://github.com/rehankwatla/tredye-noti

## Overview

Tredye Flow Alerts is a self-hosted NSE order-flow and order-block research terminal for manual review, not automated trading. A user opens the terminal; the service obtains Tredye flow data and optional Upstox quotes, depth, candles, and live ticks, then scores flow, detects/ranks blocks, and serves snapshots for the funnel and volume-profile tiles. Alerts, tracker outcomes, and settings are supported capabilities; settings also configure credentials and terminal rules. The graph follows documented features and indexed imports; unsampled modules are represented only where the README establishes their role.

Main entry points: [`src/service/flow-service.js`](https://github.com/rehankwatla/tredye-noti/blob/main/src/service/flow-service.js) (Flow service), [`src/components/OrderBlockTerminal.jsx`](https://github.com/rehankwatla/tredye-noti/blob/main/src/components/OrderBlockTerminal.jsx) (Order Block Terminal), [`src/server/server.js`](https://github.com/rehankwatla/tredye-noti/blob/main/src/server/server.js) (HTTP and SSE API), [`src/upstox/client.js`](https://github.com/rehankwatla/tredye-noti/blob/main/src/upstox/client.js) (Upstox client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Terminal experience"]
  node_terminal["Order Block Terminal"]
  node_funnel["Funnel and filters<br/>[04-stage-funnel.js]"]
  node_tiles["Profile tiles"]
  node_inspector["Hover inspector<br/>[06-fx-inspector.js]"]
  node_mobile["Mobile layout<br/>[07-mobile-stack.js]"]
  node_theme["Themes and canvas<br/>[01-theme-canvas.js]"]
  node_settingsui["Settings interface<br/>[SettingsView.jsx]"]
  node_settingsctl["Settings controller"]
end

subgraph group_service["Polling and analysis"]
  node_server["HTTP and SSE API<br/>[server.js]"]
  node_flowservice["Flow service<br/>[flow-service.js]"]
  node_hours["Market hours<br/>[hours.js]"]
  node_flow["Flow scoring<br/>[flow.js]"]
  node_aggressor["Aggressor metrics<br/>[aggressor.js]"]
  node_blocks["Order block detection<br/>[orderblocks.js]"]
  node_ranking["Candidate ranking"]
  node_signals["Alert signals<br/>[signals.js]"]
  node_outcomes["Alert outcomes<br/>[outcomes.js]"]
  node_edge["Edge report<br/>[flow-service.js]"]
end

subgraph group_market["Market data integrations"]
  node_tredye["Tredye client<br/>[client.js]"]
  node_upstox["Upstox client<br/>[client.js]"]
  node_fixture["Offline sample data<br/>[sample-fixture.js]"]
end

subgraph group_state["Persistence and outcomes"]
  node_store[("SQLite flow store<br/>[db.js]")]
end

node_reviewer(("Manual reviewer"))

node_reviewer -->|"reviews"| node_terminal
node_reviewer -->|"configures"| node_settingsui
node_terminal -->|"presents"| node_funnel
node_funnel -->|"requests snapshots"| node_server
node_terminal -->|"shows profiles"| node_tiles
node_terminal -->|"offers inspection"| node_inspector
node_terminal -->|"adapts layout"| node_mobile
node_terminal -->|"supports themes"| node_theme
node_settingsui -->|"loads controller"| node_settingsctl
node_settingsctl -->|"updates settings"| node_server
node_server -->|"routes requests"| node_flowservice
node_flowservice -->|"checks session"| node_hours
node_flowservice -->|"fetches flow"| node_tredye
node_flowservice -->|"fetches market data"| node_upstox
node_flowservice -->|"loads demo data"| node_fixture
node_flowservice -->|"scores confluence"| node_flow
node_flowservice -->|"detects blocks"| node_blocks
node_flowservice -->|"ranks candidates"| node_ranking
node_flowservice -->|"evaluates alerts"| node_signals
node_flowservice -->|"builds reports"| node_outcomes
node_flowservice -->|"persists state"| node_store
node_upstox -->|"computes trade metrics"| node_aggressor
node_flowservice -->|"serves dashboard state"| node_server
node_flowservice -->|"generates edge report"| node_edge
node_upstox -.->|"supplies candles and ticks"| node_tiles

click node_terminal "https://github.com/rehankwatla/tredye-noti/blob/main/src/components/OrderBlockTerminal.jsx"
click node_funnel "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/04-stage-funnel.js"
click node_tiles "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/05-tiles-tickets.js"
click node_inspector "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/06-fx-inspector.js"
click node_mobile "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/07-mobile-stack.js"
click node_theme "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/01-theme-canvas.js"
click node_settingsui "https://github.com/rehankwatla/tredye-noti/blob/main/src/components/SettingsView.jsx"
click node_settingsctl "https://github.com/rehankwatla/tredye-noti/blob/main/src/client/settings/settings-controller.js"
click node_server "https://github.com/rehankwatla/tredye-noti/blob/main/src/server/server.js"
click node_flowservice "https://github.com/rehankwatla/tredye-noti/blob/main/src/service/flow-service.js"
click node_hours "https://github.com/rehankwatla/tredye-noti/blob/main/src/market/hours.js"
click node_flow "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/flow.js"
click node_aggressor "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/aggressor.js"
click node_blocks "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/orderblocks.js"
click node_ranking "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/orderblock-ranking.js"
click node_signals "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/signals.js"
click node_outcomes "https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/outcomes.js"
click node_edge "https://github.com/rehankwatla/tredye-noti/blob/main/src/service/flow-service.js"
click node_tredye "https://github.com/rehankwatla/tredye-noti/blob/main/src/tredye/client.js"
click node_upstox "https://github.com/rehankwatla/tredye-noti/blob/main/src/upstox/client.js"
click node_fixture "https://github.com/rehankwatla/tredye-noti/blob/main/data/sample-fixture.js"
click node_store "https://github.com/rehankwatla/tredye-noti/blob/main/src/store/db.js"

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_terminal,node_funnel,node_tiles,node_inspector,node_mobile,node_theme,node_settingsui,node_settingsctl,node_reviewer toneBlue
class node_server,node_flowservice,node_hours,node_flow,node_aggressor,node_blocks,node_ranking,node_signals,node_outcomes,node_edge toneAmber
class node_tredye,node_upstox,node_fixture toneMint
class node_store toneRose
```

## Components

### Terminal experience

- [Order Block Terminal](https://github.com/rehankwatla/tredye-noti/blob/main/src/components/OrderBlockTerminal.jsx): `src/components/OrderBlockTerminal.jsx`
- [Funnel and filters](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/04-stage-funnel.js): `src/client/orderblock/js/04-stage-funnel.js`
- [Profile tiles](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/05-tiles-tickets.js): `src/client/orderblock/js/05-tiles-tickets.js`
- [Hover inspector](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/06-fx-inspector.js): `src/client/orderblock/js/06-fx-inspector.js`
- [Mobile layout](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/07-mobile-stack.js): `src/client/orderblock/js/07-mobile-stack.js`
- [Themes and canvas](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/orderblock/js/01-theme-canvas.js): `src/client/orderblock/js/01-theme-canvas.js`
- [Settings interface](https://github.com/rehankwatla/tredye-noti/blob/main/src/components/SettingsView.jsx): `src/components/SettingsView.jsx`
- [Settings controller](https://github.com/rehankwatla/tredye-noti/blob/main/src/client/settings/settings-controller.js): `src/client/settings/settings-controller.js`

### Polling and analysis

- [HTTP and SSE API](https://github.com/rehankwatla/tredye-noti/blob/main/src/server/server.js): `src/server/server.js`
- [Flow service](https://github.com/rehankwatla/tredye-noti/blob/main/src/service/flow-service.js): `src/service/flow-service.js`
- [Market hours](https://github.com/rehankwatla/tredye-noti/blob/main/src/market/hours.js): `src/market/hours.js`
- [Flow scoring](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/flow.js): `src/engine/flow.js`
- [Aggressor metrics](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/aggressor.js): `src/engine/aggressor.js`
- [Order block detection](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/orderblocks.js): `src/engine/orderblocks.js`
- [Candidate ranking](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/orderblock-ranking.js): `src/engine/orderblock-ranking.js`
- [Alert signals](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/signals.js): `src/engine/signals.js`
- [Alert outcomes](https://github.com/rehankwatla/tredye-noti/blob/main/src/engine/outcomes.js): `src/engine/outcomes.js`
- [Edge report](https://github.com/rehankwatla/tredye-noti/blob/main/src/service/flow-service.js): `src/service/flow-service.js`

### Market data integrations

- [Tredye client](https://github.com/rehankwatla/tredye-noti/blob/main/src/tredye/client.js): `src/tredye/client.js`
- [Upstox client](https://github.com/rehankwatla/tredye-noti/blob/main/src/upstox/client.js): `src/upstox/client.js`
- [Offline sample data](https://github.com/rehankwatla/tredye-noti/blob/main/data/sample-fixture.js): `data/sample-fixture.js`

### Persistence and outcomes

- [SQLite flow store](https://github.com/rehankwatla/tredye-noti/blob/main/src/store/db.js): `src/store/db.js`

### Other components

- **Manual reviewer**

## Connections

- Manual reviewer → Order Block Terminal: reviews
- Manual reviewer → Settings interface: configures
- Order Block Terminal → Funnel and filters: presents
- Funnel and filters → HTTP and SSE API: requests snapshots (evidence: `src/server/server.js`)
- Order Block Terminal → Profile tiles: shows profiles
- Order Block Terminal → Hover inspector: offers inspection
- Order Block Terminal → Mobile layout: adapts layout
- Order Block Terminal → Themes and canvas: supports themes
- Settings interface → Settings controller: loads controller (evidence: `src/components/SettingsView.jsx`)
- Settings controller → HTTP and SSE API: updates settings
- HTTP and SSE API → Flow service: routes requests (evidence: `src/server/server.js`)
- Flow service → Market hours: checks session (evidence: `src/service/flow-service.js`)
- Flow service → Tredye client: fetches flow (evidence: `src/service/flow-service.js`)
- Flow service → Upstox client: fetches market data (evidence: `src/service/flow-service.js`)
- Flow service → Offline sample data: loads demo data (evidence: `src/service/flow-service.js`)
- Flow service → Flow scoring: scores confluence (evidence: `src/service/flow-service.js`)
- Flow service → Order block detection: detects blocks (evidence: `src/service/flow-service.js`)
- Flow service → Candidate ranking: ranks candidates (evidence: `src/service/flow-service.js`)
- Flow service → Alert signals: evaluates alerts (evidence: `src/service/flow-service.js`)
- Flow service → Alert outcomes: builds reports (evidence: `src/service/flow-service.js`)
- Flow service → SQLite flow store: persists state (evidence: `src/service/flow-service.js`)
- Upstox client → Aggressor metrics: computes trade metrics (evidence: `src/upstox/client.js`)
- Flow service → HTTP and SSE API: serves dashboard state (evidence: `src/service/flow-service.js`)
- Flow service → Edge report: generates edge report (evidence: `src/service/flow-service.js`)
- Upstox client → Profile tiles: supplies candles and ticks
