5c1a080831c2cd910e8e5fd4183b754ab368cb98
Safelist Tailwind classes for currency rate HTML fragments from btcdata WebSocket. Add make run-docker target that connects to Docker btcdata on port 4101. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
btcprice
Bitcoin price tracker UI. Serves an HTML page with live price updates streamed from btcdata via WebSocket using HTMX.
Quick Start
# Start btcdata first (provides price data)
cd ../btcdata && make run
# Local dev
make run # starts on port 4000
make tailwind # watch Tailwind CSS (separate terminal)
# Docker (starts both btcprice + btcdata)
docker compose up -d # btcprice on 4041, btcdata on 4101
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
4000 |
HTTP server port |
BTCDATA_URL |
http://192.168.50.42:4100 |
btcdata service URL (browser connects via WebSocket) |
How It Works
The server renders an HTML page with HTMX and the WebSocket extension (hx-ext="ws"). HTMX connects directly to btcdata's WebSocket endpoint (BTCDATA_URL/api/price/ws), which sends HTML fragments. HTMX swaps the received <div id="price-display"> into the DOM automatically. Price changes are color-coded (green up, red down). Reconnection is handled by HTMX with exponential backoff.
Tech Stack
Clojure · Kit · Undertow · Reitit · Hiccup · HTMX · Tailwind CSS v4
Languages
Python
87.1%
Dockerfile
6.7%
Makefile
4.3%
JavaScript
1.3%
CSS
0.6%