Skip to main content

CLI Reference

The newter-compiler command-line tool provides five commands for working with Newt files.

Commands

Run (default)

newter-compiler [file]

Opens a native wgpu window and renders the UI. If no file is specified, a built-in demo is shown.

ArgumentDescription
[file]Path to a .newt file (optional)
--screenName of the screen to render

Example:

newter-compiler dashboard.newt
newter-compiler dashboard.newt --screen Settings

Serve

newter-compiler serve <file> [--port PORT] [--host HOST] [--screen NAME]

Starts the Canvas IDE -- an Axum-based web server that renders your UI in the browser with live-reload.

FlagDefaultDescription
<file>requiredPath to a .newt file
--port3333Port to listen on
--host0.0.0.0Host address to bind to
--screenfirst screenName of the screen to render

Example:

newter-compiler serve app.newt
newter-compiler serve app.newt --port 8080
newter-compiler serve app.newt --screen Dashboard

The server watches the file for changes and pushes updates to the browser via WebSocket. Every time you save, the UI refreshes automatically.

Build

newter-compiler build <file> --html [-o OUTPUT] [--screen NAME]

Compiles a .newt file and exports it as a self-contained HTML file.

FlagDefaultDescription
<file>requiredPath to a .newt file
--htmlrequiredOutput format (currently only HTML)
-oout.htmlOutput file path
--screenfirst screenName of the screen to render

Example:

newter-compiler build dashboard.newt --html
newter-compiler build dashboard.newt --html -o dashboard.html
newter-compiler build dashboard.newt --html --screen Overview -o overview.html

Check

newter-compiler check <file>

Parses and validates a .newt file without rendering. Exits with code 0 if the file is valid, or prints errors and exits with a non-zero code.

ArgumentDescription
<file>Path to a .newt file

Example:

newter-compiler check app.newt

This is useful in CI pipelines or pre-commit hooks to catch syntax errors early.

Watch

newter-compiler watch <file> --html [-o OUTPUT] [--screen NAME]

Watches a .newt file for changes and rebuilds the HTML output on every save. Equivalent to running build automatically whenever the file is modified.

FlagDefaultDescription
<file>requiredPath to a .newt file
--htmlrequiredOutput format
-oout.htmlOutput file path
--screenfirst screenName of the screen to render

Example:

newter-compiler watch dashboard.newt --html -o dashboard.html

Global flag

--screen NAME

All commands that render output accept --screen to select which screen to display. If omitted, the first screen defined in the file is used.

newter-compiler serve app.newt --screen Settings
newter-compiler build app.newt --html --screen Settings -o settings.html

Exit codes

CodeMeaning
0Success
1Compilation error
2File not found
3Invalid arguments

Next steps