Examples and Tutorials

These tutorials show how to assemble routes quickly using the same patterns described in the docs. The recommended approach is to keep each example aligned with the file router + component router model so you can reuse the structure.

Key Ideas

  • Build each example as a single route shell first.
  • Add component routes inside the shell for navigation.
  • Use the same state and fetch patterns across examples.

These ideas keep the tutorials consistent. A shared shell makes it easy to compare patterns. Component routes give each example a clear UI flow. Shared state and fetch patterns reduce surprises when you adapt the tutorial to your app.

Build a Dashboard (With Best Practices)

import { createSurface, routeFile, useLiveState } from "react";

export function Dashboard() {
  const state = useLiveState("dashboard", { view: "summary" });
  return <section data-view={state.read("view")}>Dashboard</section>;
}

createSurface("#app").render(routeFile("/dashboard", { screen: Dashboard }));

Build a Blog (CSR + SSR + RSC)

import { renderOnClient, renderOnServer, renderOnShell } from "react";

export function Blog() {
  renderOnShell("blog");
  renderOnServer("posts");
  renderOnClient("comments");
  return <section>Blog</section>;
}

Build an Admin UI (Single Component)

export function Admin() {
  return (
    <section>
      <Header />
      <Users />
      <Settings />
    </section>
  );
}

Build a Chat App (Polling + Streams Together)

import { usePoll, useStream } from "react";

export function Chat() {
  const poll = usePoll("/api/chat", 800);
  const stream = useStream("/api/chat");
  return <div>{poll.count} / {stream.status}</div>;
}

Build a Settings Page (Uncontrolled Forms)

import { Field } from "react";

export function Settings() {
  return <Field defaultValue="warm" />;
}

See Also

Next Steps