@sksat/uneri
v0.2.0
Published
DuckDB-wasm + uPlot real-time time-series charting for streaming simulation data.
Downloads
285
Maintainers
Readme
uneri
DuckDB-wasm + uPlot time-series charting library for real-time streaming data.
Generic schema-driven design: define columns and derived SQL expressions, and uneri handles DuckDB ingestion, query-time downsampling, and chart rendering.
Build
pnpm install
pnpm buildTest
pnpm test # vitest unit tests (59 tests)
pnpm test:e2e # Playwright E2E tests (5 tests)Examples
sine-wave
Basic real-time sine/cosine visualization.
pnpm example:sine-waveOpen http://localhost:5174
mixed-density
Mixed-density data test: sparse overview (100 points over 5000s) + dense streaming (100 msg/sec). Used for E2E testing of the time-bucket downsampling algorithm.
pnpm example:mixed-densityOpen http://localhost:5175
Architecture
IngestBuffer<T>— staging buffer with drain pattern (decouples WebSocket arrival from DuckDB insertion)useDuckDB(schema)— initializes DuckDB-wasm, creates tableuseTimeSeriesStore(options)— tick loop: drain buffer → INSERT → periodic query with downsamplingTimeSeriesChart— uPlot wrapper with programmatic update guardbuildDerivedQuery(schema, tMin, maxPoints)— time-bucket downsampling SQLsliceArrays/lowerBound/upperBound— binary search viewport clipping
