Core Concepts - Krate Docs
You're viewing an older version ().
Krate Docs

How Krate builds sites: signals, static-first rendering, and a single Go compiler.

#Core Concepts

Three ideas shape everything else in Krate:

  1. Signals, not hooks. State is a getter/setter pair; effects subscribe to the exact signals they read. There is no virtual DOM diffing on the client.
  2. Static-first. Every page is evaluated at build time to static HTML. The runtime hydration bundle only binds the dynamic parts.
  3. One Go binary. The lexer, parser, bundler, renderer, CSS pipeline, and Tailwind are all built into the compiler.
Tip

Coming from React? Krate transpiles React hooks and JSX automatically and auto-calls bare reads like {count}. See React Compatibility.

#Reactivity model

Signals are the unit of state. createSignal returns a [getter, setter] pair:

const [count, setCount] = createSignal(0);
count();             // read
setCount(1);         // write
setCount(c => c + 1) // functional update

Effects re-run when the signals they read change. Memos cache derived values. Context provides dependency injection. Resources handle async data. See Reactivity for the full API.

#Rendering modes

Every page is pre-rendered at build time into a static shell. Depending on the page's exports and config, the final HTML can be:

  • SSG (default) — fully static HTML, no runtime data.
  • ISR — static shell; the page body is cached per URL variant and revalidated in the background.
  • SSR — static shell; the page body is rendered fresh per request.
  • Streaming — static shell with dynamic regions (runtime components / Suspense) that the sidecar renders and splices in, streaming as they resolve.

All four modes are static-first: only the page's dynamic regions (or its whole body, for ISR/SSR) are rendered at request time. See Rendering for details.

#Component tiers

Components are classified into four tiers — static, client, server, and runtime — that determine how and where they render. See Component Tiers.

#Guides

GuideWhat it covers
ReactivitySignals, effects, memos, context, resources
Routing & LayoutsFile-based routing, dynamic routes, layouts
Component TiersStatic / client / server / runtime
RenderingSSG, ISR, SSR & streaming
StylingCSS Modules, Tailwind, the CSS pipeline

Want the internals (lexer → parser → bundler → renderer)? See Contributing → Architecture.

Last updated: 2026-10-16

Contributors: Noinkin