SSR framework for Svelte 5 + Bun with islands-based selective hydration
On this page
Installing mochi-framework puts a mochi-framework binary on your PATH. Inside a project it’s available to package.json scripts directly; anywhere else, run it with bunx:
bunx mochi-framework <command> [options]bunx mochi-framework --help # list every commandbunx mochi-framework --version # print the installed version-h/--help and -v/--version work as shorthands.
build
Produces a production bundle by reading config straight from your entry’s Mochi.serve() call, so the prebuilt manifest stays single-sourced with the runtime. This is the command behind your build script:
{
"scripts": {
"build": "mochi-framework build"
}
}| Option | Default | Description |
|---|---|---|
--entry <path> | ./src/index.ts | Runtime entry whose Mochi.serve() call supplies routes, markdown, and optimize. |
--out-dir <path> | ./.mochi | Build output directory. |
--public-dir <path> | ./public | Static assets directory. |
--asset-prefix <path> | /_mochi | URL prefix for framework client assets. |
--dev | off | Build with development: true. |
See Deployment for how the output is served.
generate-key
Generates a MOCHI_KEY (a base64url-encoded 32-byte secret — the format server-island prop signing expects) and writes it to .env in the current directory:
bunx mochi-framework generate-keyIt creates .env if missing, appends MOCHI_KEY if absent, and prompts before overwriting an existing key.
| Option | Description |
|---|---|
-f, --force | Overwrite an existing MOCHI_KEY without prompting. |
update-skill
Fetches the latest SKILL.md — agent guidance for coding assistants — and writes it into your project for the given agent (default: claude-code):
bunx mochi-framework update-skill [agent]Run it again whenever you upgrade the framework to keep the guidance in sync. The optional agent argument controls the destination; see Docs for LLMs for the full list of supported agents.