How akenshaw/flowsurface-web works
Main Components
• Data Source & Connectivity:
• wsBinance.js – This file is responsible for setting up a websocket connection to Binance. It streams live data (orderbook and kline information) and also incorporates trades (managed by the buffer).
• connectorUtils.js – Likely a helper module that encapsulates details of connecting, parsing, or handling websocket data.
• Data Aggregation & Processing:
• canvasAggr.js – Acts as the core aggregator that takes data from the websocket streams (orderbook, kline, and trades buffer) and processes it. The README explains that the data streams (including grouped exchange data) are processed here for rendering.
• Main processing flow – The README describes how the controller receives three streams (orderbook, latest kline, trades buffer) and passes them to the canvas instance. This includes grouping (footprint instance, volume, CVD, and OI components) based on specific tick size multipliers.
• Presentation & Rendering:
• index.html (and the version in dist/index.html) – The HTML structure contains the canvas element where the 2D rendering takes place.
• style.css and asset files (e.g., index-paYHrqP6.css) – Responsible for styling the UI.
• main.js – Likely the entry point that initializes the data connection, binds the aggregation process, and triggers the rendering.
• Build & Configuration:
• vite.config.js, package.json, package-lock.json – These indicate the build system (Vite) that is used to bundle and serve the application assets.
Relationships and Interactions
• The Aggregation/Controller logic collects three distinct streams: orderbook updates, 1-minute klines, and a trades buffer (populated by incoming websocket data).
Architectural Patterns and Technologies
• The pattern is essentially a reactive, client-side data processing pipeline where data flows from WebSocket streams → Aggregation & Business Logic (processing, grouping data) → Rendering on a canvas UI.
• Technologies involved include JavaScript (ES modules), a bundler/development server (Vite), and standard HTML/CSS for the UI layer.
• Although not explicitly separated into frontend and backend, the nature of the project (working entirely in the browser) means that all layers are integrated into a single-page application.