1. Install Node.js
Install Node.js 22 or 24 and npm on Windows or macOS, then open a terminal. The same commands work in PowerShell.
node --version
npm --versionOfficial Node.js downloadDOCUMENTATION
Test the structures you read about in the technical book on your own machine. Create a page with the CLI, then explore examples using Core, site-generation, and HTML alongside grammar and evaluation contracts.
Supported setup: Node.js 22/24. The literate API is experimental and Node.js-only.
An experimental release for Windows and macOS using Node.js 22/24 and npm.
Install Node.js 22 or 24 and npm on Windows or macOS, then open a terminal. The same commands work in PowerShell.
node --version
npm --versionOfficial Node.js downloadInstall the experimental version with this pinned command. If PowerShell blocks scripts, use npm.cmd and matra.cmd instead. If the global command is not found, check npm's prefix and PATH.
npm install --global @matra/[email protected]
matra --versionAbout npm prefixChoose a directory that does not exist for hello. Open dist/index.html or preview the displayed localhost URL. Refresh the browser manually after changes and stop with Ctrl+C.
matra init hello
cd hello
matra build
matra devPublished npm packageThis is experimental. Builds execute document JavaScript, so use trusted documents only. No OS sandbox or execution timeout is guaranteed. Campaign information and support dates will be announced separately.
First step
Install exact versions and refer to the README and public API contract.
The left panel shows the complete Markdown source. matra.entry selects main.matra, and matra.values exposes the JavaScript expression as content. @matra/core evaluates the document, while @matra/site-generation builds a site from pages, shared layouts, and data. The CLI creates and builds starter projects. The code below shows each package in use.
---
matra:
entry: main.matra
values:
- content.js.part
---
# Compose a page with Matra packages
```main.matra
html(lang="en") {
head {
title { content.pageTitle(content.title) }
}
body {
header {
p { "MATRA / PACKAGE EXAMPLES" }
h1 { content.title }
p { content.description }
}
main {
...for (item in content.packages) {
section(id=item.id) {
h2 { item.name }
p { item.description }
pre { code { item.example } }
}
}
}
footer {
p { "These package workflows are experimental; check each package's release notes." }
}
}
}
```
```content.js.part
({
title: "Compose a page with Matra packages",
description: "Use the CLI to start a project, Core to evaluate Matra documents, and site-generation to build a site.",
pageTitle: title => `${title} | Matra`,
packages: [
{
id: "cli",
name: "@matra/cli",
description: "Create and preview a starter project with the experimental CLI.",
example: "npm install --global @matra/[email protected]\nmatra init hello\ncd hello && matra dev"
},
{
id: "core",
name: "@matra/core",
description: "Build and run a literate Matra document in Node.js.",
example: 'const value = await runLiterate(await buildLiterate(source))'
},
{
id: "site-generation",
name: "@matra/site-generation",
description: "Generate pages from Matra templates, page data, and a shared layout.",
example: 'await generateSite({ root, output: "dist", pages })'
}
]
})
```<html lang="en">
<head>
<title>Compose a page with Matra packages | Matra</title>
</head>
<body>
<header>
<p>MATRA / PACKAGE EXAMPLES</p>
<h1>Compose a page with Matra packages</h1>
<p>Use the CLI to start a project, Core to evaluate Matra documents, and site-generation to build a site.</p>
</header>
<main>
<section id="cli">
<h2>@matra/cli</h2>
<p>Create and preview a starter project with the experimental CLI.</p>
<pre><code>npm install --global @matra/[email protected]
matra init hello
cd hello && matra dev</code></pre>
</section>
<section id="core">
<h2>@matra/core</h2>
<p>Build and run a literate Matra document in Node.js.</p>
<pre><code>const value = await runLiterate(await buildLiterate(source))</code></pre>
</section>
<section id="site-generation">
<h2>@matra/site-generation</h2>
<p>Generate pages from Matra templates, page data, and a shared layout.</p>
<pre><code>await generateSite({ root, output: "dist", pages })</code></pre>
</section>
</main>
<footer>
<p>These package workflows are experimental; check each package's release notes.</p>
</footer>
</body>
</html>Read and try
01
A minimal runnable path connecting Matra, JavaScript, and the HTML renderer.
View examples →02
Primary sources for the document data model, grammar, and public literate API.
Browse specifications →03
Roles and provisional usage examples for Core, CLI, HTML, and site-generation.
View packages →Important
The literate API does not provide compatibility guarantees, an OS sandbox, or a timeout guarantee. Review the public API contract first.