# Mochi > Mochi is an SSR-first framework for Svelte 5 on Bun with islands-based selective hydration. ## Docs - [Welcome](https://mochi.fast/docs/intro/llms.txt): A lightweight, server-first Svelte 5 framework running on Bun that ships client-side JavaScript only for interactive islands. - [Your first Mochi app](https://mochi.fast/docs/your-first-mochi-app/llms.txt): Build your first page with serverProps, selective hydration, and server islands in four steps. - [Coming from SvelteKit](https://mochi.fast/docs/coming-from-sveltekit/llms.txt): Map each SvelteKit concept to its Mochi equivalent. - [Defining routes](https://mochi.fast/docs/defining-routes/llms.txt): Register pages, APIs, WebSockets, SSE endpoints, and file routes with the programmatic routes record. - [Selective hydration with mochi:hydrate](https://mochi.fast/docs/selective-hydration/llms.txt): Mark components with mochi:hydrate to ship client JavaScript only where you need interactivity. - [Client-only components with mochi:clientOnly](https://mochi.fast/docs/client-only/llms.txt): Skip SSR and mount a component in the browser with mochi:clientOnly. - [Lazy hydration with mochi:hydrate:visible](https://mochi.fast/docs/lazy-hydration/llms.txt): Defer island hydration until the component scrolls into view with mochi:hydrate:visible. - [Server islands with mochi:defer](https://mochi.fast/docs/server-islands/llms.txt): Render components after initial page load by fetching their HTML from the server with mochi:defer. - [Passing props to islands](https://mochi.fast/docs/island-props/llms.txt): How Mochi serializes props for hydratable islands, the supported types, and reserved names. - [Hydratable values](https://mochi.fast/docs/hydratable/llms.txt): Serialize computed server values into the page so the client reuses them instead of re-running the work. - [Server-only imports](https://mochi.fast/docs/server-only-imports/llms.txt): Keep server-only modules like bun:sqlite out of client bundles with the .server.ts convention. - [Progressively enhancing forms with enhance](https://mochi.fast/docs/progressively-enhancing-forms-with-enhance/llms.txt): Progressively enhance HTML forms to submit over fetch when JavaScript is available. - [Why Bun?](https://mochi.fast/docs/why-bun/llms.txt): Why Mochi chose Bun as its runtime and which Bun APIs the framework uses. - [HTTP streaming](https://mochi.fast/docs/http-streaming/llms.txt): Mochi renders each page as one complete document. Use SSE, WebSockets, and server islands for anything that arrives later. - [Environment constants](https://mochi.fast/docs/environment-constants/llms.txt): Build-time constants for branching on render target (isServer, isBrowser), dev mode (isDev), and the build itself (isBuilding). - [Request context](https://mochi.fast/docs/request-context/llms.txt): Access the current URL, route params, cookies, and locals from server-side code, plus the isomorphic url export. - [API routes](https://mochi.fast/docs/api-routes/llms.txt): Register JSON endpoints with Mochi.api() that receive a request event and return a Response. - [WebSocket routes](https://mochi.fast/docs/websocket-routes/llms.txt): Register WebSocket endpoints with Mochi.ws() and handle upgrade, open, message, close, and drain events. - [Server-Sent Events](https://mochi.fast/docs/server-sent-events/llms.txt): Push real-time updates to clients over a single HTTP connection with Mochi.sse(). - [Queues](https://mochi.fast/docs/queues/llms.txt): Run background jobs with Mochi.queue(), backed by bun-boss on memory, SQLite, Postgres, or embedded PGlite storage. - [Email](https://mochi.fast/docs/email/llms.txt): Send transactional email with Mochi.email() over SMTP, a custom send function, or Svelte templates rendered to inlined HTML. - [Persistence](https://mochi.fast/docs/persistence/llms.txt): Which storage backends each stateful Mochi feature supports — in-memory, file, SQLite, Postgres, or your own store. - [Middleware (hooks)](https://mochi.fast/docs/middleware/llms.txt): Intercept and transform requests and responses with SvelteKit-style handle functions. - [Trailing slash](https://mochi.fast/docs/trailing-slash/llms.txt): Enforce a consistent trailing-slash policy across all routes with automatic redirects. - [Rate limiting](https://mochi.fast/docs/rate-limiting/llms.txt): Per-route and global request rate limiting with memory, SQLite, and Postgres stores. - [Transforming HTML with transformPage](https://mochi.fast/docs/transform-page/llms.txt): Rewrite rendered HTML before it is sent to the client with the transformPage callback. - [Error handling](https://mochi.fast/docs/error-handling/llms.txt): Configure a custom error page and control how uncaught errors render to the client. - [Error boundaries](https://mochi.fast/docs/error-boundaries/llms.txt): Hydratable islands are auto-wrapped in svelte:boundary, so one island failure cannot crash the page. - [Utility helpers](https://mochi.fast/docs/utility-helpers/llms.txt): Helper functions for building JSON responses, error responses, and form-action results. - [Cache](https://mochi.fast/docs/cache/llms.txt): Cache server-side data with stale-while-revalidate semantics using MochiCache. - [Logging](https://mochi.fast/docs/logging/llms.txt): An isomorphic, level-gated logger that works in server, SSR, and client contexts. - [Request cache](https://mochi.fast/docs/request-cache/llms.txt): Memoize server-side work for the duration of a single request with requestCache and requestMemo. - [Events](https://mochi.fast/docs/events/llms.txt): Subscribe to framework lifecycle events like requests, WebSocket activity, and builds via a mitt emitter. - [Images](https://mochi.fast/docs/images/llms.txt): On-the-fly image transforms on Bun.Image via named sizes, with encrypted URLs and a stale-while-revalidate disk cache. - [View Transitions](https://mochi.fast/docs/view-transitions/llms.txt): Animate full-page navigations with the browser cross-document View Transitions API and zero JavaScript. - [RawScript](https://mochi.fast/docs/raw-script/llms.txt): Inline the raw contents of a file into the page at SSR time, addressed by a working-directory-relative path. - [Captcha](https://mochi.fast/docs/captcha/llms.txt): Slide-to-verify captcha with proof-of-work, replay protection, and no third-party service. - [Custom HTML shell](https://mochi.fast/docs/custom-html-shell/llms.txt): Replace the default HTML wrapper with a custom shell template containing Mochi placeholders. - [Speculation Rules](https://mochi.fast/docs/speculation-rules/llms.txt): Prefetch and prerender same-site URLs via a typed speculationRules option, injected as a