Concepts
Routes are explicit objects.
A route has a path, optional metadata, and a render function. Keeping routes as plain objects makes them easy for humans and agents to inspect.
Route shape
import { html, route } from "@nativefragments/core/server";
export const homeRoute = route("/", {
meta: () => ({
title: "Home",
description: "Home page",
canonical: "https://example.com/"
}),
render: () => html`<h1>Home</h1>`
});
Manifest
Apps export an array of routes. The Cloudflare adapter normalizes paths, matches requests, and renders the matched route.
Nested route regions
A route can define named fragments for sub-regions. The full route still renders a complete page, while fragment links can request only the named region.
import { fragment, html, route } from "@nativefragments/core/server";
const profile = fragment("settings-panel", profilePanel);
route("/settings/profile", {
render: settingsPage,
fragments: [profile]
});