Files
btcprice/CLAUDE.md
T
magnusandClaude Opus 4.6 13a53a26d0 Switch to HTMX WebSocket, use LAN IP for btcdata URL
- Replace vanilla JS WebSocket with HTMX ws extension (hx-ext="ws")
- Add HTMX + ws extension CDN scripts to page head
- Zero client-side JavaScript — HTMX handles connection, reconnect, and
  DOM swap of HTML fragments from btcdata
- Hidden div safelists Tailwind classes used in btcdata HTML fragments
- Update BTCDATA_URL to LAN IP (192.168.50.42) for cross-machine access
- Update CLAUDE.md and README.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 22:28:29 +01:00

2.0 KiB

btcprice

Bitcoin price tracker UI — Clojure Kit web application. Serves the HTML/Tailwind UI. Connects to btcdata for live price data via WebSocket.

Build & Development Commands

  • make run — Start dev server on port 4000
  • make repl — Start nREPL
  • 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

(dev-prep!)   ;; Prepare dev system
(go)          ;; Start system
(reset)       ;; Reload code & restart
(halt)        ;; Stop system

Architecture

  • Framework: Kit (Integrant-based)
  • Server: Undertow
  • Routing: Reitit
  • Templates: Hiccup + HTMX (WebSocket extension)
  • Styling: Tailwind CSS v4
  • Data backend: btcdata (separate service at BTCDATA_URL, default http://192.168.50.42:4100)
  • No database — all data comes from btcdata

Source Layout

src/clj/pmagnus/btcprice/
├── core.clj              # App entry point
├── config.clj            # System config loader
└── web/
    ├── handler.clj       # Ring handler + routes
    ├── htmx.clj          # page/fragment macros
    ├── controllers/
    │   └── health.clj    # Health check
    ├── middleware/
    │   ├── core.clj      # Base middleware
    │   ├── exception.clj # Exception handling
    │   └── formats.clj   # Content negotiation
    └── routes/
        ├── api.clj       # /api routes (JSON)
        ├── ui.clj        # UI routes (HTML + HTMX WebSocket)
        └── utils.clj     # Route utilities