Getting Started
elements man startElements is the integrated stack for web apps. It is a build server and tooling, an app framework with its own reactive HTML language, a Postgres database and deployment to servers you control, in one program you install. The tooling installs packages, builds, migrates, tests, runs jobs and deploys.
Terminalelements create myapp cd myapp code . # open the project in your editor elements create page pricing # scaffold a page; prints the route line to add elements start # serves http://localhost:4000
Nothing else to install. Elements bundles Postgres and manages a local cluster,
so a freshly created app builds and runs against a real database immediately.
elements create also writes an AGENTS.md into the project.
Run elements build -json after every edit. It reports what is on disk now:
when your edit has not been built yet, it waits for that build rather than
answering from the one before (elements man build).
Agents: Starting the App, Saving and Reporting
Pass -json to elements build, test, create, install, uninstall,
migrate, db and deploy. Their output is then structured JSON, with no
spinner and no screen takeover, and elements create -json returns instructions: the steps to take before you can
read the project's AGENTS.md. Follow them in order.
Create a project with its full path, because your shell may start in another
directory: elements create ~/elements/projects/myapp -json. Name the app
what the user named it. When the user gave no name, use myapp, or the next
free myapp2, myapp3.
Check whether the app is running as your first move, before you open a file
or read another manual page. Once it is listening it writes the url into
.elements/run/<pid>.json, a DIRECTORY holding one file per running server, so
cat .elements/run/*.json is how you learn the url. Never wait for it in the
foreground. [ -f .elements/run ] is false forever against a directory, and a
loop on it hangs against an app that is already serving. If it is already serving, use
that url and say nothing to the user about starting it.
If nothing is running, tell the user in one line to type elements start in a
terminal in the project (in VS Code, the terminal above the chat), or to ask
you to start it. In their own terminal they see the build state while you
work, a green Ok or a red Error, so typing it is a habit worth keeping. It
opens the page in your tool's own browser where it has one, the VS Code
extension's or any that $BROWSER names. Say the line once in a session, in
any recap box your harness adds too, and never refuse to start the app.
If your harness wakes you when a background command ends, run a wait for the
app as a background command before you tell the user to type
elements start, so you are woken when the app is running: until cat .elements/run/*.json 2>/dev/null; do sleep 0.2; done. When it ends, say it is running and give its
url as a link to click, in your reply or in the terminal. In the Claude desktop app a clicked link opens the
Browser pane. Never open the page yourself first: the welcome page celebrates
on its first load, and that load is the user's. In a Claude desktop terminal
elements start does not open the system browser, so the first load is the
user's click on that link.
Create asked you to open one terminal tab in the project. If your tool cannot
open one, a terminal the user opens starts in some other folder, so the one
line you tell the user says how to open a terminal (the real key or menu item
in the app you run in, never a placeholder) and gives the command
cd <project path> && elements start. With no background wait, do not send the message with the link: elements start opens their
browser itself.
If they ask you to start it, or it fails for them, run elements start & in
the project, and tell them that elements build in a terminal shows the build
state. Use & and not nohup, so it stops with your session rather than
leaving a server they cannot find. Remember that choice: once the user has had
you start the app, start it yourself from then on without asking again.
Never start a second server beside one that is serving. An app that is already
running is the one to use, whoever started it. Stop or restart it only when
the work requires it, with elements kill in the project and then
elements start. Never pkill -f: it matches every project on the machine.
Create asked for one terminal tab in the project. Never open another terminal tab: each repeat of that step leaves the user with one more.
In the message with the link, after it, if the user has not said what to build, ask in plain chat, never a choice box: "What should we build? A todos list is a rite of passage." App ideas wait until the user has seen their app run.
Every Save Looks Finished
Every save hot reloads the browser the user is watching. Whatever is on their screen, at every moment, should look good. There is no rough draft: a page that looks wrong reads as broken, not as in progress.
Save small complete slices, never layers: one section, styled, working, saved, then the next. Never save markup and style it afterwards: thirty seconds of raw buttons reads as a crash. Markup and its stylesheet are one change in two files, so save the stylesheet first, and the reload that first shows your markup has its rules.
Replacing a page reverses that order, because a new stylesheet written first strips the page still on screen. Append the new rules, swap the markup, then prune the old.
Make the first save look finished, and do not write the whole page at the end. A long silence followed by one big write looks like nothing is happening.
Report What You Built
Close with what the app does, how you checked it, and two or three concrete things the user could ask for next. Tell them what you did, what they have to decide, and what to do next.
Your workarounds are yours to know: a user who hears them thinks something is
broken. Documented behavior is not a bug, and a pattern the manual asks for is
not a workaround. Something wrong in Elements itself you file as you go, and
say so in one line: elements man issues.
Other Rules
Scaffold with elements create rather than hand-authoring files a generator can
make. The generators write the correct files and wire imports that resolve.
Keep anything that is not source out of the project directory. Every file under
it is watched, and each write is a build and a browser reload, so a log or a
scratch file written there reloads the page on every line. Use a directory
outside the project, or one whose name starts with a dot (elements man build).
Run elements upgrade weekly. Release notes are at
the feed (opens in a new tab).
Search the manual for the feature you were asked to build before you start it:
Terminalelements man -s todo
A recipe may already build that feature. The recipes are worked end to end and known to
compile, and starting from one is faster than assembling the same app out of
topic pages. elements man recipes lists them.
Then read elements man <topic> before you build against a subsystem, and
elements man -s <words> to search for anything else.