application structure

How This Clojure Application Actually Works

The app is intentionally small enough to retrace end to end. It is one `HttpServer`, one handler, one route table, and a handful of route-local renderers. That simplicity is carrying the project right now; it is also where the next brittleness lives.

This page exists so the architecture can be inspected from inside the running app, not inferred from a file or a conversation.

load-bearing expressions
Request Path

One small `HttpServer` binds on localhost, hands every request to one handler, and routes by literal path.

• `handler` parses the URI and query string.

• `route` dispatches to HTML or JSON responses.

• `send!` writes the response and handles HEAD correctly.

State And Filesystem

The app is intentionally thin. Its only durable local state today is the repo-growth snapshot file under `.cache/repo-growth.edn`.

• `repo-growth-summary` walks the parent repo and annotates recency.

• `capture-repo-snapshot!` keeps the last 24 structure snapshots.

• `git-status-map` shells out once and decorates paths with drift.

Presentation Layer

All public surfaces are server-rendered strings with shared CSS plus route-specific style blocks.

• `html-page` provides the shared shell.

• `agency-page`, `architectural-atlas-page`, and `repo-growth-page` are route-local compositions.

• `hydra-page` is the one route with heavy client-side behavior.

Current Brittle Bits

The app is coherent enough to serve, but several seams are still narrow and hand-built.

• One namespace still owns data, routing, CSS, and HTTP.

• HTML is concatenated strings instead of templated views.

• Validation is external and shallow; there are no Clojure tests yet.

request lifecycle
(HttpServer/create ...)
  -> handler
  -> query parsing
  -> route
  -> html-response | json-response
  -> send!

The whole app currently depends on direct path dispatch. That makes it easy to reason about and cheap to change, but it will want a more explicit route data model once the route family grows again.

next hardening moves

Split transport, route data, and HTML composition into separate namespaces before the file grows much further.

Add Clojure tests for `route`, repo snapshot history, and query parsing instead of relying only on external validation.

Replace string concatenation for larger pages with Hiccup or a minimal HTML DSL once the current editorial surfaces settle.