SSR framework for Svelte 5 + Bun with islands-based selective hydration
On this page
Why Bun?
Mochi delegates subsystem complexity to the Bun runtime. Instead of maintaining a bundler, an HTML parser, a router, database drivers, compression, and hashing as separate packages, Mochi calls Bun’s standard library. Bun maintains those components. Mochi calls them.
Mochi ships about 10 runtime dependencies. It uses an external dependency when the dependency earns its place and improves the developer experience. The goal is an opinionated, batteries-included toolkit for building complex web apps.
What Mochi uses from Bun
Bun.build()— Mochi’s fast bundler, which builds sites with hundreds of routes in seconds.Bun.serve()— the HTTP and WebSocket server behindMochi.serve().bun:sqliteandbun:sql— zero-dependency SQLite and PostgreSQL for app data.- Native
.tsexecution and auto-loaded.env— TypeScript runs directly underbun run.
Batteries included
Building on Bun’s standard library lets Mochi ship this much out of the box. Here is how the surface compares to SvelteKit:
| Feature | Mochi | SvelteKit |
|---|---|---|
| Server islands & selective hydration | Yes - mochi:defer | No - full page hydration only |
| Built-in SQLite database | Yes - bun:sqlite | Partial - node:sqlite via adapter-node on Node or Deno |
| Built-in Postgres & MySQL support | Yes - Bun.sql() | No - bring your own cloud database |
| Background job queues | Yes - Mochi.queue() | No |
| Minimal client-side JavaScript | Yes - zero JS unless hydrated; tuned for first load | Partial - tuned for repeat navigations; no zero-JS pages (CSR opt-out breaks interactivity) |
| Deployment targets | No - Bun only | Yes - Node, Vercel, Bun and other cloud providers |
| Prerendering / SSG | Partial - route warmup supported | Yes |
| Build as static HTML | No - SSR only | Yes - adapter-static |
| Form actions + progressively enhanced forms | Yes | Yes |
| Form captcha | Yes - MochiCaptcha | No - third-party service |
| Rate limiting | Yes | No - third-party package only |
| Middleware | Yes | Yes |
| Hooks & extension filters | Yes - eventHooks & filters | No |
| Top-level await | Yes | Partial - experimental |
| Real-time WebSockets | Yes - Mochi.ws() | No - custom server with external package |
| Server-Sent Events | Yes - Mochi.sse() | No - manual setup, limited provider support |
| Built-in caching library | Yes - MochiCache | No |
| Cookie helpers | Yes | Yes |
| AI development support | Yes - Skill, MCP & llms.txt | Yes - Skill, MCP & llms.txt |
| Client-side router | No | Yes |
| Type-safe routes & params | Planned | Yes - generated ./$types & $app/types |
| Remote functions (type-safe RPC) | No | Yes - experimental |
| View Transitions | Yes - built-in component | Partial - manual wiring |
| Highly interactive apps | Yes - WS, SSE & View Transitions | Yes - SPA mode & remote functions |
| Tailwind | Yes - Tailwind v4 | Yes |
| Built-in Markdown (mdsvex) | Yes - mdsvex built-in | Yes - via integration (sv add mdsvex) |
| Centralized logging system | Yes - mochiEvents | No - experimental OpenTelemetry only |
| Image resizing | Yes - named sizes, runtime transforms | Partial - build-time only; runtime at extra cost |
| Link preloading | Planned | Yes |
| Service worker integration | Planned | Yes |
| Snapshots | Partial - browser-native restoration | Yes - manual setup |
On the horizon
As Bun adds features, Mochi gains new abilities. For example, Bun.Image() powers on-the-fly image resizing.