Rat docs

Routing

Routes are inferred from the filesystem. Drop a .rat file under pages/ and its path becomes the URL — no router config, no middleware list, no manifest to keep in sync. The mapping is mechanical: folder name = path segment, page.rat or index.rat = the folder's own URL.

Path map

Every file becomes its own route

Each row shows the source file on the left and the URL it serves on the right. page.rat and index.rat are interchangeable — both collapse to their parent folder so pages/about/page.rat serves /about.

pages/home/page.rat            # /home
pages/about/page.rat           # /about
pages/about/team/page.rat      # /about/team
pages/posts/index.rat          # /posts
pages/docs/quick-start.rat     # /docs/quick-start

One file per route

No shared boilerplate

A page file is self-contained: its > server block resolves before render, its > page block describes the markup. main.rat wraps every page with the shell — see Main shell for that story.

# pages/about/page.rat
> server
title: 'About us'

> page
<h1> [title]
<p> A handful of people, one binary, one bet.

Default landing route

settings.rat → defaultRoute

A bare visit to / with no pages/page.rat would 404. Set defaultRoute in settings.rat to redirect the root to a real landing page. The redirect only fires for GET / — same-path navigations still work.

# settings.rat
default_route: '/home'

Next: Dynamic routes — capturing slugs with [name].rat filenames.