RatMinimal web framework

Routing

Routes come from the filesystem. Put a .rat file under pages/ and its path becomes the URL. No router config, no middleware list, no manifest. The mapping is direct: a folder name is a path segment, and page.rat or index.rat is the folder's own URL.

Path map

Each file maps to a 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, and its > page block describes the markup. main.rat wraps every page with the shell. See Main shell for details.

# 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 visit to / with no pages/page.rat returns a 404. Set defaultRoute in settings.rat to redirect the root to a real landing page. The redirect fires only for GET /, so same-path navigations still work.

See also Dynamic routes · Main shell · Settings

<__raw_slot id2 lang>