How nubank/morse works
Project Type and Purpose
• Morse is an interactive data‐browsing tool for Clojure programs.
• It ships as both a Clojure CLI tool/library and a standalone JavaFX‐based UI.
• It can run in two modes:
– Remote mode (connects over the network to a running JVM via an external “Replicant Server”)
– In-process mode (embedded within the target application JVM)
File Structure
Top-level directories and files:
• src/dev/nu/morse.clj + src/dev/nu/morse/*.clj – core Clojure entry points (“backend”)
• src/dev/nu/morse/impl/*.clj – implementation modules (JS interop, file I/O, YAML, data beans, Monaco editor plumbing)
• resources/dev/nu/morse/*.fxml, .css, .html, .js – JavaFX UI view files & static assets (Monaco editor, Raphael charts, CSS)
• project.clj & deps.edn – build / dependency configuration, CLI‐tool registration
• zip-static/ – example data shipped for offline mode or tests
• docs/ – design/usage documentation
README for Additional Insights
• Technologies in play: Clojure 1.10+, Java 11+, JavaFX, Replicant Server (external), CLJ CLI tool
• Two operational modes (remote & in-process)
• UI uses JavaFX with embedded Monaco code editor & charts
Main Components & Interactions
Break the system into these primary components:
A. CLI / Library Loader
• Defined by deps.edn & project.clj
• Launches the Morse REPL or JavaFX UI
B. Core Backend (Clojure Modules)
• morse.clj, fx.clj, ui.clj: orchestration & UI‐startup logic
• impl/* modules: connect to Replicant Server or embed in‐process hook
C. Remote Connector
• Uses data.alpha.replicant-server over TCP/WebSocket
• Translates live JVM data into EDN/JSON messages
D. JavaFX Front‐end
• FXML + CSS + JavaFX controllers (via cljfx)
• Embeds Monaco editor for code‐views, Raphael for charts
• Static assets in resources/dev/nu/morse/libs/monaco & codeview.html/.css
E. External Dependencies
• Replicant Server (external JVM process)
• Target Clojure application (the “live program”)
Interactions:
1. User invokes clj -m nu.morse (in‐process) or clj -X:remote / uses Tool install (remote).
2. Morse backend initializes – either attaches to local JVM via in‐process hook or opens a TCP/WebSocket to Replicant Server.
3. Replicant Server streams the live program’s data snapshots.
4. Backend modules marshal the data into UI model objects.
5. JavaFX UI renders interactive data navigator, charts, code views.
6. User navigates, backend may request further data (drill-downs).
Architectural Patterns & Principles
• Modular layering: CLI/Launcher → Backend (Clojure) → Connector → UI
• Pluggable connector abstraction (remote vs in-process)
• UI is declarative (cljfx) + resource‐driven (FXML, Monaco)
• Clear separation of concerns: data fetching, data modelling, view rendering