Documentation
Docs
Introduction
Getting Started
Tutorial: build an app
Core Concepts
Routing
Server-Side Rendering
Mimir, state management
Pages & Layouts
API Routes
Styling & Theming
Building & Deploying
API Reference
Guides
Recipes
FAQ (use cases)
Reference , ekko:ssr and ekko:ssr/css
The low-level server-rendering primitives rune is built on. You mostly use these indirectly (via
createApp), but they are available directly.
ekko:ssr/css
compileSass(scss: string) → string
Compiles SCSS source to CSS. Used at server start to build the inlined stylesheet:
Compiled once at startup, restart the server to pick up SCSS changes. See SCSS.
ekko:ssr (rendering primitives)
These power the pipeline; createApp calls them for you.
renderToString(element) → string
Renders a React element tree to an HTML string. When @ekko/react-dom/server is imported, this is React's
real renderToString (hooks, context). Without it, a built-in pure renderer is used (legacy/no-React apps).
htmlShell(opts) → string
Assembles a complete HTML document.
| Option | Type | Purpose |
|---|---|---|
title | string | <title> (default "EkkoJS App"). |
head | string | Extra <head> HTML (styles, SEO). |
body | string | Inner HTML for <div id="__ekko">. |
styles | string[] | <link rel="stylesheet"> hrefs. |
scripts | string[] | <script src> srcs. |
modules | string[] | <script type="module" src> srcs. |
modulepreload | string[] | <link rel="modulepreload"> hrefs. |
data | any | Embedded as <script id="__EKKO_DATA__" type="application/json">. |
inlineStyles | string | A <style> block in <head>. |
lang | string | <html lang> (default "en"). |
escapeHtml(s) → string
Escapes &, <, >, ", ' for safe HTML embedding.
serializeProps(value) → JSON-safe value
Recursively prepares a value for embedding in hydration data. Throws on non-serializable inputs (functions, symbols, BigInt, NaN/Infinity, RegExp, Map/Set, circular refs), keep atom values and props JSON-shaped.
jsonForScript(v) → string
JSON-encodes a value with <, >, & escaped so it is safe inside a <script> (prevents </script>
breakout).
getRenderer() → renderer | null
Returns the registered external renderer (React's, after import "@ekko/react-dom/server"), or null.
registerRenderer(r)
Registers an external renderer as the active one. @ekko/react-dom/server calls this on import, which is why
that single import switches the whole SSR pipeline to React's renderer.
How they compose (for reference)
ssr() → seed Mimir → renderToString(layout(page)) → resolve assets (manifest)
→ htmlShell({ body, head, styles, modules, modulepreload, data }) → cache → respondYou rarely call these directly; createApp orchestrates them. They are documented so the pipeline is fully
inspectable.
Next: ekko.json schema.