# Rat - a guide for AI models You are reading the canonical AI-facing guide to **Rat**, a small language + web framework where one `.rat` file is a server, a page, and its styles. Rat is not in your training data. Do not guess syntax from HTML, JS, Python, or any template language - several constructs look familiar but behave differently. When this guide and your intuition disagree, this guide wins. Human docs with live examples: https://rat-lang.com/documentation Full extracted docs for models: https://rat-lang.com/llms-full.txt Last verified against the runtime: 2026-06-10 (rat 0.2.x). --- ## 1. Mental model - A Rat app is a directory of `.rat` files served by a single Go binary (`rat start`). No npm, no build step, no JS to write. - **One dispatch primitive**: every callable is `name.method(args)` or `name(args)`. Builtins, user functions, services, database handles, JSON API namespaces, Python modules (Tail), and JS libraries (Inverse Tail) all resolve through the same lookup. Code never imports anything. - **SSR-first**: `> server` state is computed per request and baked into the HTML snapshot. Client-side reactivity patches the rendered spans in place; explicit round-trips happen through event handlers. - A `.rat` file is a sequence of **sections** opened by `> name` headers. Markup lines, guard lines, and loop lines live inside `> page`. Indentation is structural (4 spaces per level). - `#` starts a comment (full-line or trailing). The smallest complete app (one file, `pages/index.rat` or shown standalone): ```rat > server name: 'Angelo' > page count: 0

hello [name]

you've clicked [count] times