Formular is a JSON message DSL for backend-owned dynamic menus and forms that can be rendered by GUI, TUI, CLI, MCP, web, or other frontends. It also supports backend-requested one-shot yes/no, selection, and captcha dialogs through asynchronous messages.
- Protocol and implementation notes: docs/protocol.md
- Browser frontend library: docs/frontend-js.md
- JSON Schemas: schemas/
- Go wire types: messages.go
Almagest is a real-world project that uses Formular.
The npm package entry point is a single dependency-free browser file:
import { FormularMenu } from "@asciimoth/formular-menu";
const menu = new FormularMenu("root", "settings", (message) => {
console.log("frontend message", message);
}, {
renderMultilineTextInput(textarea, { field }) {
if (field.subtype !== "json") return undefined;
const editor = document.createElement("span");
editor.className = "json-editor";
editor.append(textarea);
return editor;
}
});The optional renderMultilineTextInput hook can wrap multiline textareas for
syntax highlighting and other custom presentation. The native textarea stays
in control of values, validation, readonly state, and messages. See the
JavaScript frontend documentation
for the full contract.
Run the local WASM demo:
pnpm install
pnpm run demoThe demo renders two independent frontends and a Go WASM backend connected by one merged JSON message channel. Its JSON configuration field uses the custom multiline rendering hook for live syntax highlighting.
Files in this repository are distributed under the CC0 license.

To the extent possible under law,
ASCIIMoth
has waived all copyright and related or neighboring rights to
formular.