Rat docs

CLI

The rat binary is the whole tool surface: scaffold a project, run the dev server, produce static HTML, install dependencies, run database tooling. There's no package script layer to maintain — the commands target the project in the current directory.

rat new

Scaffold a project

Writes a minimal project layout to the given directory — main.rat, a pages/index.rat, a styles file, a settings.json, an empty rat.json. Existing files are preserved; only missing pieces are written.

rat new mysite
cd mysite

rat start

Dev server with hot reload

Reads settings.rat (or settings.json) for host/port, watches the project, and serves over HTTP. Hot reload is on by default — every .rat / .css / .js / .py save pushes a SSE event and the browser refreshes.

rat start            # uses settings host/port
rat start 8080       # override the port

rat build

Static HTML output

Walks every routable page, renders against the loaded site, and writes <out>/<route>/index.html for each. Useful for previewing the rendered shell or for static deploys when the project has no live database / handler needs.

rat build            # defaults to ./out
rat build dist       # custom directory

rat run

Run a .rat file as a script

Executes a single .rat file whose top level declares > main[args]. Positional CLI arguments are bound as a Rat string array; << returns the exit code. No HTTP, no page render — same engine, just a different entry point. See the script-mode page for the full surface.

rat run hello.rat
rat run seed_users.rat alice bob carol

rat install / rat i

Dependencies — npm + Python

rat install restores every dep recorded for the project: npm packages from rat.json into public/vendor/<name>/, then Python deps from lang/python/requirements.txt into a per-project venv. rat i <pkg> adds an npm package and records it.

rat install                # restore everything
rat i react                # add latest react
rat i react@18.2.0         # pin a version
rat i react preact uuid    # add several

rat db

Database tooling

Subcommands cover the migration lifecycle. status lists discovered models; migrate <name> writes a new migration from the current schema; push applies pending migrations; rollback <name> reverts one.

rat db status
rat db migrate add_users
rat db push
rat db rollback add_users

Next: Settings — what settings.rat controls and how build modes work.