Skip to main content

Concepts & Vocabulary

structpages has its own canonical terms for its recurring patterns. Where a React / Next.js / React Router concept maps cleanly, it's noted as a cross-reference for knowledge transfer — but the structpages term is primary. Two guardrails: Go wins where Go owns the concept (ServeHTTP is a handler method, not a "server action"), and pure composition isn't named (a layout is just a component that takes children — there's no "layout route").

Core nouns

TermWhat it isCross-ref
pagea route-tagged struct — a node in the route treeNext/RR route/page
page groupa page with no render of its own (no Page or ServeHTTP), only child pages; served through its /{$} page— (not a "layout route")
componenta standalone templ Foo() block — reusable, mount-independent, package-prefixed idReact component
page componenta templ (p Page) Foo() method — mount-aware, receiver in scope (incl. Page, Content). Used two ways: composition (called inside another page component) and re-rendering (returned alone as a partial)React component (bound)
childrentempl { children... } compositionReact children
partiala page component returned on its own as an HTMX response to re-render just that region — a role a page component plays, not a distinct kindHTMX

The props cluster

TermWhat it isCross-ref
Props methodthe Props(...) method that loads data via DIlike RR loader / Next getServerSideProps
props structthe named struct type the Props method returns and page components acceptlike a React props type
propsa value of the props struct, in flight into a page componentReact props (the value)

The chain reads: the Props method returns a props struct; that props value is handed to a page component.

Methods on a page

TermMethodJob
Page methodPage(props)the main render entry — a page component that composes the full page (layout + content)
Props methodProps(...)loads data via DI → returns the props struct
handler methodServeHTTP(...)imperative entry: mutate / redirect / serve JSON, or render a partial via RenderComponent — the Go http.Handler shape
Middlewares methodMiddlewares()declares middleware for the page + descendants

(Content is not a framework concept — just a conventional page component name for a layout's main region; the matcher treats it like any other page component.)

The two render entries differ in flavor: the Page method renders declaratively (compose page components); the handler method renders imperatively (write the response, or hand a page component to RenderComponent). Both ultimately render through page components.

Request lifecycle

For a rendering page: route match → Props method (with RenderTarget injected to pick the region) → page component renderPage for full loads, a partial for HTMX requests targeting that region's id. A handler method (ServeHTTP) bypasses this pipeline: it responds imperatively, optionally handing a page component to RenderComponent.

API helpers (literal — these are the public API)

RenderComponent, RenderTarget, URLFor, ID / IDTarget, Ref, WithArgs (dependency injection / args).

Loose comparisons (analogies, not structpages terms)

For readers arriving from React/Next — transfer aids, not structpages vocabulary.

structpagesReact/Next analogynote
/{$} route of a page groupRR index routenothing special — just the group's own page
Page method vs handler methoddeclarative page vs imperative Route Handler / API routetwo ways to respond within one router — not "Page Router vs App Router"
component compositionServer Component compositionboth render on the server