Rat docs

Setup

Rat ships as a single Go binary. Build it once and use the same rat executable to scaffold projects, run the dev server, and produce static HTML output.

1. Build the binary

One-time, from the rat-go directory

Clone the repo and compile the CLI. On Windows the output is rat.exe; on macOS / Linux it's plain rat.

cd rat-go
go build -o rat.exe ./cmd/rat

2. Scaffold a project

rat new mysite

rat new writes a directory with the canonical project shape: pages/ for routed pages, pups/ for components, styles/, api/, public/, plus a main.rat layout and a settings.rat.

.\rat.exe new mysite
cd mysite

3. Start the dev server

Hot reload on every save

rat start reads settings.rat for port + host, watches every .rat file under the project, and pushes an SSE event whenever something changes — the page refreshes without a full reload.

..\rat.exe start

4. Project layout

What rat new gives you

The shape Rat expects. Every directory is auto-discovered; there's no central manifest. pages/foo/page.rat becomes the route /foo, pups/greeting.rat becomes the greeting tag, and so on.

mysite/
  pages/         # routed pages
  pups/          # reusable components
  styles/        # global CSS (.styles.rat)
  api/           # JSON endpoints
  public/        # static assets
  main.rat       # root layout
  settings.rat   # port, host, db, build modes

Once the server is up, the next page — Hello world — walks through the smallest possible .rat page and what each line does.