No description
  • JavaScript 56%
  • TypeScript 36.6%
  • Vue 6%
  • CSS 0.8%
  • Shell 0.3%
  • Other 0.2%
Find a file
Djuri Baars ed46958e0f
Some checks failed
CI / build-and-test (push) Failing after 34s
Merge origin/main: resolve by keeping ours
Discard incoming branch's changes — superseded by current main.
2026-05-03 20:21:22 +02:00
.github Bump pnpm/action-setup in the actions group across 1 directory 2026-04-17 21:44:37 +00:00
config chore: add ESLint + Prettier and run them in CI 2026-04-17 23:27:42 +02:00
docker chore: migrate from yarn 1 to pnpm 10 2026-04-17 23:39:34 +02:00
docs chore: clean up benchmarking docs 2026-05-03 19:55:47 +02:00
public build: refresh public/index.html bundle hash after dep bump 2026-05-03 20:12:02 +02:00
scripts style: apply prettier to new docs and type-declaration files 2026-04-20 20:34:00 +02:00
server chore: clean up benchmarking docs 2026-05-03 19:55:47 +02:00
src style: prettier-format App.vue and panel_texts.ts 2026-05-03 20:14:35 +02:00
tests feat(frontend): replace WASM BTClock with pure-TS BTClockV4 2026-05-03 20:09:34 +02:00
.env.sample feat(wasm): type-safe BTClockModule + env-based emscripten build 2026-04-20 20:28:41 +02:00
.gitignore chore: ignore beads/dolt artifacts 2026-05-03 20:09:26 +02:00
.prettierignore chore: migrate from yarn 1 to pnpm 10 2026-04-17 23:39:34 +02:00
.prettierrc chore: add ESLint + Prettier and run them in CI 2026-04-17 23:27:42 +02:00
docker-compose.yaml chore: migrate from yarn 1 to pnpm 10 2026-04-17 23:39:34 +02:00
emscripten.sh feat(wasm): type-safe BTClockModule + env-based emscripten build 2026-04-20 20:28:41 +02:00
eslint.config.js chore: add ESLint + Prettier and run them in CI 2026-04-17 23:27:42 +02:00
index.ts bench: synthetic /api/_inject endpoint 2026-04-22 22:11:04 +02:00
package.json chore(deps): bump in-range dependencies 2026-05-03 20:11:56 +02:00
pnpm-lock.yaml chore(deps): bump in-range dependencies 2026-05-03 20:11:56 +02:00
README.md feat(dev): mount Vite as middleware for Vue HMR 2026-04-20 20:47:32 +02:00
tsconfig.json chore: add ESLint + Prettier and run them in CI 2026-04-17 23:27:42 +02:00
vite.config.ts feat(nostr): configurable relay list, default to relay.primal.net 2026-04-22 17:46:13 +02:00
vitest.config.ts test: add characterisation tests for ws1/ws2 protocols and HTTP routes 2026-04-17 22:39:05 +02:00

BTClock WS data source

CI License: MIT Node.js pnpm

A lightweight server that aggregates Bitcoin price, block height, and mempool fee data from a handful of public sources and republishes it to BTClock displays (and any other client) over WebSockets and REST.

Features

  • Aggregated BTC price from Kraken, Bitfinex, Coinbase, Binance, Gemini, Bitflyer, and CoinCap with outlier filtering and median consensus
  • Block height + median mempool fee via a mempool.space WebSocket
  • Two WebSocket protocols:
    • /api/v1/ws — legacy JSON broadcast (every client receives every update)
    • /api/v2/ws — MessagePack with per-event-type subscriptions
  • REST endpoints under /api/* for simple polling
  • Dev-only Scalar playground at /docs and OpenAPI 3.1 spec at /openapi.json

Quick start

pnpm install            # install dependencies
cp .env.sample .env     # then fill in the values you need
pnpm build              # compile the frontend
pnpm start              # run the webserver (defaults to http://localhost:8080)

For development, pnpm dev starts the Fastify server with tsx watch (auto-reloads on server changes) and mounts Vite as middleware so Vue edits get hot module replacement without a rebuild.

Configuration

All runtime configuration is read from .env — see .env.sample for the full list. Highlights:

Variable Purpose
MEMPOOL_INSTANCE Hostname of the upstream mempool.space WebSocket
OWN_PRICE_DATA Aggregate prices from the built-in exchange feeds
LOGLEVEL pino log level
NOSTR_PUB / NOSTR_PRIV Keys used by the optional Nostr publisher
PUBLISH_TO_NOSTR Toggle for the Nostr publisher
BTCLOCK_FIRMWARE_SRC Path to a local btclock firmware checkout — only needed to rebuild the WASM data handler via ./emscripten.sh

API documentation

/docs and /openapi.json are mounted only when NODE_ENV !== 'production'. In production both routes return 404; the REST and WebSocket endpoints themselves are unaffected.

Development

pnpm lint           # eslint
pnpm format:check   # prettier
pnpm test           # vitest
pnpm build          # production bundle

CI runs all four on every push and pull request.

License

MIT