🍡 mochi

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 command
bunx 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"
  }
}
OptionDefaultDescription
--entry <path>./src/index.tsRuntime entry whose Mochi.serve() call supplies routes, markdown, and optimize.
--out-dir <path>./.mochiBuild output directory.
--public-dir <path>./publicStatic assets directory.
--asset-prefix <path>/_mochiURL prefix for framework client assets.
--devoffBuild 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-key

It creates .env if missing, appends MOCHI_KEY if absent, and prompts before overwriting an existing key.

OptionDescription
-f, --forceOverwrite 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.