Dev Mode
morph dev starts a development environment with live hot reload. The native window stays open while you edit — changes appear instantly without restarting.
What Happens
File save → File watcher → Pipeline → IR dict → Unix socket → morph_devrt
│
JS logic → logic.<hash>.so → dlopen + rewire- File watcher detects a change in your
.mx,.css, or.tsfiles - Pipeline re-runs: parse, walk, build IR, layout, serialize
- JS logic is translated to C++, compiled to
logic.<hash>.so, and loaded viadlopen - IR dict is sent over a Unix socket to
morph_devrt - Window swaps the node tree and re-wires signals — no restart needed
Starting Dev Mode
morph devThis will:
- Build the dev runtime binary (
morph_devrt) via CMake if it doesn't exist - Start the Unix socket server
- Launch the native window
- Watch for file changes
Hot Reload
When you save a file:
- The IR is re-sent to the running window
- The node tree swaps instantly
- Your JS logic
.sois hot-reloaded — signals and effects are re-wired in place - DevTools state (open/closed, active tab) is preserved
The window never closes. Only the content inside it changes.
Dev Runtime Binary
morph_devrt is a pre-compiled C++ binary that:
- Opens a GLFW window
- Listens on a Unix socket (
/tmp/morph_dev.sock) - Receives IR JSON and builds a node tree
- Handles events, layout, and OpenGL rendering
- Supports DevTools (F12)
The binary is auto-built via CMake when first needed. It rebuilds automatically when shared runtime sources change (tracked via a source hash).
Source Hash Tracking
The dev binary monitors these directories for changes:
runtime/dev/runtime/core/runtime/render/runtime/ui/runtime/style/runtime/renderers/
If any file in these directories changes, morph_devrt is rebuilt before the next dev session.
DevTools
Press F12 to toggle the DevTools panel. It includes:
- Elements — inspect element tree, box model overlay, element info
- Rendering — frame stats, layout/paint diagnostics, live renderer switch
- Network —
fetch()request log - Logs — application log entries
See the Development Guide for details.
Tips
- Wayland issues — If the window doesn't open, try:
GDK_BACKEND=x11 morph dev - Slow reload — Check if your CSS files are large or if you have many Tailwind classes
- Socket errors — Delete
/tmp/morph_dev.sockand restart - Binary missing — Run
morph doctorto verify cmake, g++, and make are installed