# orhant/trading-view-api-examples-server-node-express architecture

> Architecture diagram of the GitHub repository orhant/trading-view-api-examples-server-node-express, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/orhant/trading-view-api-examples-server-node-express
- Repository: https://github.com/orhant/trading-view-api-examples-server-node-express

## Overview

This small example accepts a WebSocket client, opens a TradingView connection for it, and forwards market status and price updates back to the client. The README documents the connect, forward, and disconnect workflow; the source shows server setup and callback handling. TradingView is an external dependency. The implementation is a single bridge module, so chart selection and lifecycle handling are kept together rather than split into speculative subsystems.

Main entry points: [`src/websocket.js`](https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/src/websocket.js) (WebSocket bridge), [`index.js`](https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/index.js) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Server"]
  node_http["HTTP server<br/>[index.js]"]
  node_bridge["WebSocket bridge<br/>[websocket.js]"]
end

subgraph group_market["Market data"]
  node_tradingview["TradingView API"]
end

node_client(("WebSocket client"))

node_http -->|"creates"| node_bridge
node_client -->|"connects"| node_bridge
node_bridge -->|"opens chart"| node_tradingview
node_tradingview -->|"emits updates"| node_bridge
node_bridge -->|"forwards data"| node_client
node_client -->|"closes connection"| node_bridge
node_bridge -->|"disconnects"| node_tradingview

click node_http "https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/index.js"
click node_bridge "https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/src/websocket.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_http,node_bridge,node_client toneBlue
class node_tradingview toneAmber
```

## Components

### Server

- [HTTP server](https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/index.js): `index.js`
- [WebSocket bridge](https://github.com/orhant/trading-view-api-examples-server-node-express/blob/main/src/websocket.js): `src/websocket.js`

### Market data

- **TradingView API**

### Other components

- **WebSocket client**

## Connections

- HTTP server → WebSocket bridge: creates (evidence: `index.js`)
- WebSocket client → WebSocket bridge: connects (evidence: `README.md`)
- WebSocket bridge → TradingView API: opens chart (evidence: `src/websocket.js`)
- TradingView API → WebSocket bridge: emits updates (evidence: `src/websocket.js`)
- WebSocket bridge → WebSocket client: forwards data (evidence: `src/websocket.js`)
- WebSocket client → WebSocket bridge: closes connection (evidence: `src/websocket.js`)
- WebSocket bridge → TradingView API: disconnects (evidence: `src/websocket.js`)
