From ce343dfcf6782c46afc6366f148c46aa7d3514ab Mon Sep 17 00:00:00 2001 From: Per Magnus Petersen Date: Mon, 23 Feb 2026 20:48:56 +0100 Subject: [PATCH] Add README, update docker-compose and CLAUDE.md Docker runs on port 4041 alongside local dev on 4000. Include btcdata docker-compose for unified startup. Co-Authored-By: Claude Opus 4.6 --- CLAUDE.md | 14 +++++++++++++- README.md | 32 ++++++++++++++++++++++++++++++++ docker-compose.yml | 23 ++++++----------------- 3 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 README.md diff --git a/CLAUDE.md b/CLAUDE.md index 950bc2e..7d088f2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,6 +1,6 @@ # btcprice -Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/HTMX/Tailwind UI. Connects to btcdata for live price data via SSE. +Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/Tailwind UI. Connects to btcdata for live price data via SSE. ## Build & Development Commands @@ -9,6 +9,18 @@ Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/HTMX/T - `make test` — Run tests - `make tailwind` — Watch Tailwind CSS for changes - `make uberjar` — Build production JAR +- `docker compose up -d` — Start btcprice + btcdata containers + +## Docker + +Docker runs alongside local dev on different ports: + +| Service | Local dev | Docker | +|----------|----------------|----------------| +| btcprice | localhost:4000 | localhost:4041 | +| btcdata | localhost:4100 | localhost:4101 | + +btcprice's docker-compose includes btcdata via `include: ../btcdata/docker-compose.yml`. ## REPL Commands diff --git a/README.md b/README.md new file mode 100644 index 0000000..75014e3 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# btcprice + +Bitcoin price tracker UI. Serves an HTML page with live price updates streamed from [btcdata](../btcdata) via Server-Sent Events. + +## Quick Start + +```bash +# 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://localhost:4100` | btcdata service URL (injected into browser JS) | + +## How It Works + +The server renders an HTML page that includes a vanilla JavaScript `EventSource` connecting directly to btcdata's SSE endpoint (`BTCDATA_URL/api/price/stream`). Price updates are rendered client-side with color-coded changes (green up, red down). + +## Tech Stack + +Clojure · Kit · Undertow · Reitit · Hiccup · Tailwind CSS v4 diff --git a/docker-compose.yml b/docker-compose.yml index 4622ccb..f94f6d9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,11 @@ -services: - btcdata: - build: ../btcdata - restart: unless-stopped - ports: - - "4100:4100" - environment: - BTCDATA_PORT: "4100" - JDBC_URL: "jdbc:postgresql://postgres:5432/btcprod?user=postgres&password=ratata,123" - CORS_ORIGIN: "http://localhost:4040" - extra_hosts: - - "postgres:host-gateway" +include: + - path: ../btcdata/docker-compose.yml - app: +services: + btcprice: build: . restart: unless-stopped ports: - - "4040:4040" + - "4041:4040" environment: - BTCDATA_URL: "http://btcdata:4100" - depends_on: - - btcdata + BTCDATA_URL: "http://localhost:4101"