Hello world
The smallest meaningful Rat file. Two sections — > server declares state available at render time, > page declares the markup. [name] reads the server var inline.
The minimal page
pages/home/page.rat
pages/home/page.rat becomes the route /home. The > server block holds values resolved server-side before the page renders; > page is the markup tree. [name] is bracket interpolation — anywhere a value goes, [expr] reads it.
> server
name: 'world'
> page
<h1> Hello, [name]
<p> Welcome to your first Rat page. Hello, world
Welcome to your first Rat page.
Multiple server vars
Mix them into prose
Every name declared in > server is in scope for the rest of the file. Use them in headings, attrs, calculations inside [...] — the same brackets handle them all.
> server
user: 'Ada'
age: 36
> page
<h1> Hi [user]
<p> You are [age] years old, born around [2026 - age]. Hi Ada
You are 36 years old, born around 1990.
The route map
Rat infers routes from the filesystem. There's no router config — every page is wherever its file lives.
Filesystem → routes
What auto-discovery gives you
pages/about/page.rat is /about. A folder name in square brackets becomes a dynamic segment exposed as args.slug.
pages/
home/page.rat # /home
about/page.rat # /about
blog/[slug].rat # /blog/<anything>
documentation/page.rat # /documentation Next up: Interpolation — what you can write inside [...], attr interpolation, and the expression grammar.