Source-derived

This map describes checked-in architecture, not runtime telemetry.

Rendering decision

SSR and CSR are modes, not rival products.

Choose where the first useful UI is rendered, then decide whether browser WASM should resume it. This template ships the balanced default: SSR + hydration.

ModeFirst documentAfter loadChoose it whenTemplate status
SSR + hydrationThe Worker streams useful route HTML.Browser WASM hydrates that DOM. Router navigation avoids a new document request; route data may still call server functions.You need fast first paint, indexable content, and app-like interaction.Current template
SSR onlyThe Worker returns useful HTML for every page request.Links and forms rely on document requests unless small client enhancements are added.The product is content-led and does not need a persistent reactive client.Supported direction; not a packaged lane
Pure CSRThe platform serves an HTML shell; browser WASM creates the useful UI.The browser owns rendering and calls APIs for server data.A named, isolated surface values static hosting or offline behavior more than first-response HTML.Deferred until a consumer needs it

What this means now:keep SSR + hydration as the core. If pure CSR earns a real use case, add it as an isolated Workers Static Assets pattern with its own entrypoint and proof—do not turn the whole template into an SPA.

Platform decision

Choose the full-stack deployment target.

Workers and Pages can both reach the Workers runtime, but they create different project, routing, deployment, and proof boundaries.

QuestionWorkers Static AssetsCloudflare PagesDecision
What deploys?The Worker and `target/site` assets deploy as one unit.The Pages package targets the same handler and assets in advanced mode.Choose one
Who owns routing?The platform asset router serves exact files; non-assets reach the generated Worker entrypoint.The advanced-mode handler receives every request and forwards assets.Separate routing contracts
When is it justified?The current SSR, server-function, D1, Assets, and realtime boundaries need one runtime.Choose Pages for a Pages project and its deployment workflow.Pages source-qualified

Checked in now:The Pages runtime and production preparation path are locally qualified; live deployment is a separate proof stage. Workers remains the default. An authorized deployment must earn provider readback and live evidence.

Platform asset router

The first branch happens before Worker code.

The `[assets]` binding gives Cloudflare the static directory and keeps non-asset requests on the SSR path.

  1. 01
    Browser request

    A document, identity file, hashed `/pkg/` artifact, API call, or realtime upgrade reaches Cloudflare.

  2. 02
    Exact asset match?

    Yes: Workers Static Assets responds without invoking user Worker code. No: the request continues to the Worker entrypoint.

  3. 03
    Worker entrypoint

    The Rust entry owns `/realtime/socket`; its explicit asset delegation is a safe fallback if it receives an asset path.

  4. 04
    Leptos SSR

    Every remaining route reaches Axum + Leptos for pages, typed server functions, status handling, and security headers.

  5. 05
    Hydration

    The returned HTML loads hashed client assets, then browser WASM resumes the server-rendered DOM.

01 · Browser

Initiates

Navigates, submits intent, receives HTML, then runs the hydration bundle.

Owner: user agent
02 · Asset router

Branches

Serves exact static matches before user code and sends non-assets to the Worker.

Owner: Workers Static Assets
03 · Worker entry

Dispatches

Handles the WebSocket lane, preserves explicit asset delegation, then falls through to SSR.

Owner: workers-rs fetch handler
04 · Axum + Leptos

Renders

Matches routes, supplies app context, runs server functions, and streams useful HTML.

Owner: Rust SSR bundle
05 · D1

Persists

D1 owns session-scoped records and is available only through the Worker binding.

Owner: Cloudflare binding
06 · Hydration

Resumes

The client WASM binds events to server-rendered markup without replacing the application model.

Owner: browser bundle
07 · Realtime lane

Upgrades

Only `/realtime/socket` upgrades in the template. Shared rooms and presence require Durable Objects.

Owner: Worker, then adopted pattern

Delivery contract

Declaration is not delivery proof.

A route closes only when source, server mount, navigation, host fallback, assets, hydration, and rendered behavior agree.

Route tree

`AppLayout` stays inside `Router`; the wildcard remains last.

Static assets

Workers Assets serves named identity files and immutable `/pkg/` artifacts.

Dynamic work

Non-asset requests fall through to Leptos SSR and typed server functions.

Next plate

Choose a pattern only after its owner is clear.