Prerequisite: complete Prerequisites & Installation (ztron doctor fully green).
Success is the native window showing "Hello Ztron". dev starts a Vite dev server,
launches the native window and boots the tjs backend; frontend edits hot-reload
instantly (HMR).
Open frontend/index.html, change <h1>Hello Ztron</h1> to
<h1>我的第一个 Ztron 应用</h1> ("My First Ztron App") and add a button:
Saving takes effect inside the window immediately (Vite HMR).
Commands are defined in the backend (create src/commands.ts next to
src/main.ts):
Register it in src/main.ts (the init template already ships a command
registration site inside .setup((app) => …) — add one line,
app.commandDef(greet), next to the template's own app.command("hello", …),
plus the import):
Generate the typed frontend bindings (the @zturnlibs/ztron-api package is
already listed in dependencies by init):
Call it from the frontend (frontend/src/main.ts):
Click the button → "你好, Ztron" appears. This chain (backend command → codegen → frontend invoke) is the entire skeleton of a Ztron app.
Produces a standalone .app (ad-hoc signed, .dmg included by default).
Before distributing, adjust identifier and the window declarations in
ztron.conf.json.
Next: Examples · Architecture · CLI Reference