# fetchlet > Run the server side of JavaScript web frameworks inside a Rust application, on QuickJS, Boa or V8. Index: https://fetchlet.roundtrip.dev/llms.txt # Getting started > Build a SvelteKit application into a fetchlet artifact and serve it from a Rust program with axum. Source: https://fetchlet.roundtrip.dev/docs · Markdown: https://fetchlet.roundtrip.dev/docs/index.md A fetchlet application has two parts: 1. **JavaScript build** — the `fetchlet` npm package bundles your web framework's server code and client assets into an artifact directory (`build/`). 2. **Rust host** — your Rust program loads that directory with `fetchlet` and `fetchlet-http` and serves it over HTTP (or embeds it into a single binary). This guide walks through SvelteKit and axum. For other frameworks, see [Frameworks](https://fetchlet.roundtrip.dev/docs/frameworks). To let a coding agent configure your project automatically, see [Coding agents](https://fetchlet.roundtrip.dev/docs/agents). ## Prerequisites - **Node.js** 20.19, 22.12, 24 or later (for building the JavaScript side) - **Rust** 1.100 or later A typical layout keeps the JavaScript app and Rust host side by side in the same project: ```text my-app/ ├── package.json ├── vite.config.ts ├── src/ # SvelteKit app ├── build/ # fetchlet artifact (generated) ├── Cargo.toml └── server/ └── main.rs # Rust host ``` ## 1. Build the artifact In your JavaScript project, install `fetchlet` as a development dependency: ```sh vp i -D fetchlet ``` Configure the SvelteKit adapter in `vite.config.ts`: ```ts // vite.config.ts import { sveltekit } from "@sveltejs/kit/vite"; import fetchletAdapter from "fetchlet/sveltekit"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [sveltekit({ adapter: fetchletAdapter({ out: "build" }) })], }); ``` Run your build command (for example, `vite build`). fetchlet writes `build/` containing: - `server.js` — the bundled server entry - `fetchlet.json` — manifest describing the handler, target engine, and requirements - `client/` — static client assets If you are not using Vite, use the [`fetchlet build` command](https://fetchlet.roundtrip.dev/docs/javascript/build#the-fetchlet-build-command) instead. ## 2. Serve it from Rust Add the required crates to your Rust project. `fetchlet` enables the QuickJS engine by default; add `--features boa` or `--features v8` to use another engine. ```sh cargo add fetchlet cargo add fetchlet-http --features axum cargo add tokio --features macros,rt-multi-thread,net cargo add anyhow ``` Start a server that reads the `build/` directory: ```rust // server/main.rs use fetchlet_http::Server; #[tokio::main] async fn main() -> anyhow::Result<()> { let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await?; println!("Listening on http://127.0.0.1:3000"); Server::new("build").serve(listener).await?; Ok(()) } ``` Run `cargo run` and open `http://127.0.0.1:3000`. `Server` serves client assets directly from Rust and forwards every other request to your framework. You can also add Rust API routes, pass environment values and host services to JavaScript, and set resource limits on `Server` ([Serving over HTTP](https://fetchlet.roundtrip.dev/docs/rust/fetchlet-http#serving-a-build-with-server)). ## 3. Develop with live reload During development, `fetchlet dev` watches your JavaScript sources, rebuilds the artifact on changes, and keeps the Rust server running with automatic browser reload. Add a `dev` feature in `Cargo.toml` that enables `fetchlet-http/dev-reload`, then run: ```sh vp exec fetchlet dev -- cargo run --features dev ``` Frameworks with Vite Environment API support can also run directly against `vite dev` without rebuilding ([Development server](https://fetchlet.roundtrip.dev/docs/javascript/dev)). ## 4. Ship as a single binary When you are ready to distribute your app, pack static assets into `assets.flpk` (`assets: true` in the adapter) and embed the build directory with `fetchlet_http::include_artifact!`. See [Embedding and distribution](https://fetchlet.roundtrip.dev/docs/shipping/embedding). ## Calling JavaScript without HTTP You do not need an HTTP server to use fetchlet. `fetchlet::App` lets Rust invoke a Fetch handler directly or call any exported JavaScript function with Serde values (`app.call("transform", &input)`). See [Running JavaScript](https://fetchlet.roundtrip.dev/docs/rust/fetchlet). ## Next steps - [Overview & choosing an engine](https://fetchlet.roundtrip.dev/docs/overview#choosing-an-engine): decide between QuickJS, Boa, and V8. - [Frameworks](https://fetchlet.roundtrip.dev/docs/frameworks): adapter setup and request context for each framework. - [Development server](https://fetchlet.roundtrip.dev/docs/javascript/dev): choose the best dev loop for your framework. - [Host services](https://fetchlet.roundtrip.dev/docs/rust/host-services): pass environment values, Rust functions, and outbound fetch to JavaScript. - [Examples](https://github.com/SegaraRai/fetchlet/tree/main/examples): runnable projects for every supported framework. # Overview > What fetchlet is for, how to choose an engine, and the design principles behind it. Source: https://fetchlet.roundtrip.dev/docs/overview · Markdown: https://fetchlet.roundtrip.dev/docs/overview/index.md fetchlet runs server-side JavaScript inside a Rust application. Rust passes a standard `Request` to a JavaScript Fetch handler and receives its `Response`, or calls exported synchronous and asynchronous functions directly through the same runtime. ## When to use fetchlet The primary use case is embedding the server side of a modern JavaScript web framework — SvelteKit, Astro, Nuxt, React Router, TanStack Start, HonoX, and others — inside a Rust program that ships as a single executable: | Use case | What JavaScript handles | | ------------------------ | ----------------------------------------------------------------------------- | | CLI with a web UI | Interactive pages and forms over the local project, results, or settings | | Local developer tools | Search, logs, diffs, reports, and dashboards over a local database or index | | Self-hosted applications | Framework SSR pages paired with Rust APIs, installed and run as one binary | | Desktop apps with Tauri | The same server-rendered pages as your web app, backed directly by Rust state | | Extensible rendering | Dynamic pages or HTML fragments with explicit permissions and resource limits | Static SPA or SSG builds can already be embedded in a Rust binary, but fetchlet brings the framework's server side — data loaders, form actions, streaming SSR, and server functions — so your web app, CLI UI, and desktop app can share the same codebase. When your Rust backend and JavaScript frontend need to deploy and scale independently, running separate Rust and Node.js services remains the better choice. ## Choosing an engine fetchlet supports three JavaScript engines behind one API. All three share the same [Web API profile](https://fetchlet.roundtrip.dev/docs/compatibility/web-api), so you can switch engines without rewriting application code. | Criterion | QuickJS (`quickjs`, default) | Boa (`boa`) | V8 (`v8`) | | --------------------- | -------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | Startup time | Fast (tens of ms) | Slower | Moderate | | Throughput under load | Moderate (interpreter) | Lower (interpreter) | Highest (JIT) | | Build toolchain | Requires a C compiler | Pure Rust (no C/C++) | Prebuilt V8 binary (MSVC static CRT on Windows) | | WebAssembly | Not available | Not available | Native | | Native `Intl` | Polyfilled via FormatJS | Polyfilled via FormatJS | Native ICU | | Heap limit | Enforced (`heap_bytes`) | Not supported in-process | Enforced (`heap_bytes`) | | Interrupting loops | Preemptive (`timeout`, `busy_timeout`) | At promise jobs / host calls, or via `process` isolation | Preemptive (`reliable_termination` for allocating loops) | **Rule of thumb:** - Start with **QuickJS** for CLIs, desktop apps, and general self-hosted tools where fast startup and small binaries matter. - Choose **V8** when you need high SSR throughput under concurrent load, native `Intl`, or libraries that require `WebAssembly` (such as `satori`, `resvg`, `shiki`, or `PGlite`). - Choose **Boa** when you want a pure-Rust build with no C/C++ toolchain. ## Core design - **Explicit permissions.** JavaScript has no access to the network, environment variables, or host resources unless Rust explicitly grants them through [`HostServices`](https://fetchlet.roundtrip.dev/docs/rust/host-services). - **Caller-owned resource limits.** Timeouts, heap limits, body sizes, and subrequest counts live in Rust configuration ([Resource limits](https://fetchlet.roundtrip.dev/docs/rust/resource-policy)). - **Independent axes.** Engine choice, instance lifetime (single instance vs. pooled), isolation mode (in-process vs. child process via the `process` feature), and permissions are configured independently. - **Minimal polyfills.** `fetchlet/build` bundles only the polyfills your target engine lacks and keeps native engine APIs when available. ## Isolation modes By default, fetchlet runs trusted application code in-process with explicit permission policies and resource limits. When you need stronger isolation — or hard memory and CPU termination on engines like Boa — enable the `process` feature to run each JavaScript instance in a dedicated child process while keeping host services and policies in the parent ([Process isolation](https://fetchlet.roundtrip.dev/docs/rust/fetchlet#process-isolation)). See [Security](https://fetchlet.roundtrip.dev/docs/shipping/security) for the exact boundaries of each mode. ## Where to go next - [Getting started](https://fetchlet.roundtrip.dev/docs): build and serve your first app. - [Frameworks](https://fetchlet.roundtrip.dev/docs/frameworks): pick your framework adapter. - [Serving over HTTP](https://fetchlet.roundtrip.dev/docs/rust/fetchlet-http): configure `Server`, routes, WebSockets, and Tauri webviews. - [Host services](https://fetchlet.roundtrip.dev/docs/rust/host-services): expose environment values, Rust functions, and outbound fetch. - [Embedding and distribution](https://fetchlet.roundtrip.dev/docs/shipping/embedding): bundle everything into one binary. # Coding agents > Let a coding agent set up fetchlet or work in a fetchlet project, using the documentation and skills in the fetchlet package. Source: https://fetchlet.roundtrip.dev/docs/agents · Markdown: https://fetchlet.roundtrip.dev/docs/agents/index.md The `fetchlet` npm package includes this documentation as Markdown files in `node_modules/fetchlet/docs/`. It also includes skills for coding agents. An agent that reads these files uses the documentation of the installed version. ## Start with a prompt Give this prompt to your agent in the JavaScript project of your application: ```text Set up fetchlet in this project. If the fetchlet package is not installed, install it as a development dependency with the project's package manager. Then read node_modules/fetchlet/docs/agents.md and follow its instructions for agents. ``` The agent finds the framework, configures its adapter and, when you agree, adds a Rust host that serves the build. ## What the package includes | Path | Content | | ------------------------ | --------------------------------------------------------- | | `docs/` | This documentation as Markdown | | `docs/llms.txt` | Index of every bundled Markdown page with relative paths | | `skills/setup-fetchlet/` | A skill that adds fetchlet and a Rust host to a project | | `skills/fetchlet/` | A skill for everyday work in a project that uses fetchlet | | `AGENTS_TEMPLATE.md` | A section for the instruction file of your project | The Rust crates do not include these files. A Rust project without a JavaScript application can use this website, as [Read the documentation online](#read-the-documentation-online) describes. ## Instructions for agents 1. Inspect the project. Find the package manager, the framework and its build tool, and any Rust host that already exists. In a monorepo, find the application that the user means. 2. Choose a skill and follow its `SKILL.md`. The skills are in `node_modules/fetchlet/skills/`: - Use `setup-fetchlet` when the project does not build a fetchlet artifact yet. - Use `fetchlet` when the project already uses fetchlet. 3. Tell the user which skill you chose and why, in one sentence. ## Install the skills Agents can read the skills from `node_modules/fetchlet/skills/` without installation. To let your agent load them automatically, link them into its skill directory, such as `.claude/skills/` for Claude Code or `.agents/skills/` for Codex: ```sh mkdir -p .claude/skills ln -s ../../node_modules/fetchlet/skills/fetchlet .claude/skills/fetchlet ``` A link keeps the skill in sync with the installed version. Copy the directory instead when your system does not support links. ## Add project instructions Add the contents of `node_modules/fetchlet/AGENTS_TEMPLATE.md` to the instruction file of your project, such as `AGENTS.md` or `CLAUDE.md`. The section tells agents in later sessions that the project uses fetchlet and where its documentation is. ## Read the documentation online Every page of this website has a **View as Markdown** link. Give your agent the [documentation index](https://fetchlet.roundtrip.dev/docs/llms.txt), or retrieve the [full documentation](https://fetchlet.roundtrip.dev/llms-full.txt) in one request. The Rust API reference is on [docs.rs](https://docs.rs/fetchlet). # Frameworks > Choose the adapter of your framework. Each one is a subpath of the fetchlet npm package. Source: https://fetchlet.roundtrip.dev/docs/frameworks · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/index.md Install `fetchlet` as a development dependency alongside your framework. Every framework adapter is a subpath of the `fetchlet` package, with framework packages listed as optional peer dependencies. ```sh vp i -D fetchlet ``` All adapters produce the same artifact layout (`server.js`, `client/`, and `fetchlet.json`) and work with QuickJS, Boa, and V8. | Framework | Adapter subpath | Dev server (`--vite`) | Example | | ------------------------------------------------- | ---------------------------------------------------------- | ------------------------- | --------------------------------------------------------------------------------------------------- | | [Astro](https://fetchlet.roundtrip.dev/docs/frameworks/astro) | `fetchlet/astro`, `fetchlet/astro/server` | Yes (`devServer: true`) | [astro-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/astro-axum) | | [Hono and HonoX](https://fetchlet.roundtrip.dev/docs/frameworks/hono) | `fetchlet/hono/vite`, `fetchlet/hono/conninfo` | Rebuild | [honox-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/honox-axum) | | [Nuxt and Nitro](https://fetchlet.roundtrip.dev/docs/frameworks/nitro) | `fetchlet/nitro`, `fetchlet/nitro/types` | Rebuild | [nuxt-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/nuxt-axum) | | [Qwik City](https://fetchlet.roundtrip.dev/docs/frameworks/qwik-city) | `fetchlet/qwik-city/vite`, `fetchlet/qwik-city/middleware` | Rebuild | [qwik-city-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/qwik-city-axum) | | [React Router](https://fetchlet.roundtrip.dev/docs/frameworks/react-router) | `fetchlet/react-router`, `fetchlet/react-router/context` | Yes (`fetchletDevServer`) | [react-router-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/react-router-axum) | | [Solid](https://fetchlet.roundtrip.dev/docs/frameworks/solid) | `fetchlet/solid`, `fetchlet/solid/context` | Yes | [solid-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/solid-axum) | | [SolidStart](https://fetchlet.roundtrip.dev/docs/frameworks/solid-start) | `fetchlet/solid-start`, `fetchlet/solid-start/context` | Yes | [solidstart-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/solidstart-axum) | | [SvelteKit](https://fetchlet.roundtrip.dev/docs/frameworks/sveltekit) | `fetchlet/sveltekit` | Rebuild | [sveltekit-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/sveltekit-axum) | | [TanStack Start](https://fetchlet.roundtrip.dev/docs/frameworks/tanstack-start) | `fetchlet/tanstack-start` | Yes | [tanstack-start-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/tanstack-start-axum) | | [vinext](https://fetchlet.roundtrip.dev/docs/frameworks/vinext) | `fetchlet/vinext`, `fetchlet/vinext/context` | Rebuild | [vinext-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/vinext-axum) | | [Waku](https://fetchlet.roundtrip.dev/docs/frameworks/waku) | `fetchlet/waku`, `fetchlet/waku/context` | Rebuild | [waku-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/waku-axum) | | [Vite](https://fetchlet.roundtrip.dev/docs/frameworks/vite) | `fetchlet/vite`, `fetchlet/vite/client-assets` | Yes | [vanilla-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/vanilla-axum) | ## Without a framework adapter - **Using Vite without a framework:** use [`fetchlet/vite`](https://fetchlet.roundtrip.dev/docs/frameworks/vite) for a standard `fetch(request, env, ctx)` server module plus browser entries. - **Without Vite:** use the [`fetchlet build` command](https://fetchlet.roundtrip.dev/docs/javascript/build#the-fetchlet-build-command) or call `buildArtifact` from [`fetchlet/build`](https://fetchlet.roundtrip.dev/docs/javascript/build). ## Unsupported frameworks Next.js (`next build` output — use [vinext](https://fetchlet.roundtrip.dev/docs/frameworks/vinext) instead), Qwik 2, and SolidStart builds targeting Nitro are not supported. ## Common notes across frameworks - **WebAssembly:** QuickJS and Boa do not provide `WebAssembly`. If your app or its dependencies require WebAssembly, build for and run on the `v8` backend ([Engine limits](https://fetchlet.roundtrip.dev/docs/javascript/build#engine-limits)). - **Static assets:** All adapters accept `assets: true` (or a custom configuration) to pack `client/` into a compressed `assets.flpk` archive for fast serving and single-binary embedding ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). # Astro > Build an Astro server into a fetchlet artifact with the fetchlet/astro adapter. Source: https://fetchlet.roundtrip.dev/docs/frameworks/astro · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/astro/index.md The `fetchlet/astro` adapter builds an Astro 7 server application into a fetchlet artifact. See [examples/astro-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/astro-axum) for a complete setup. ## Setup ```js // astro.config.mjs import { defineConfig } from "astro/config"; import fetchletAdapter from "fetchlet/astro"; export default defineConfig({ output: "server", adapter: fetchletAdapter({ backend: "quickjs", intl: { locales: ["en", "ja"], timeZoneData: "golden" }, }), }); ``` `backend`, `intl`, and `requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). The adapter automatically adds `Intl.DateTimeFormat` to `requirements` (bundled via FormatJS on QuickJS/Boa, native on V8). ## Request context and bindings | Value | Content | | ------------------------ | ------------------------------------------------------------------ | | `Astro.locals.env` | Rust's fixed bindings | | `Astro.locals.waitUntil` | Registers work after the response, within Rust's background budget | | `Astro.clientAddress` | Client IP from the Rust request context | | `getSecret(name)` | Reads a string env binding from Rust | ## Assets Pass `assets: true` to pack client assets into `assets.flpk`. Files under `build.assets` (`_astro/` by default) are cached for a year, and page paths follow your `trailingSlash` and `build.format` settings ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Development serving Set `devServer: true` to run `astro dev` behind your Rust host with `fetchlet-http`'s `vite-dev` feature and [`fetchlet dev --vite "astro dev"`](https://fetchlet.roundtrip.dev/docs/javascript/dev#serving-from-vite): ```js export default defineConfig({ output: "server", adapter: fetchletAdapter({ backend: "quickjs", devServer: true, }), }); ``` Your Rust host executes Astro's server code on your configured engine with full `Astro.locals` and `getSecret` support, while Vite serves browser modules, styles, and island HMR. When using a custom host (instead of `Server`), set `WorkerOptions::cancelled_calls` to `CancelledCalls::Finish` so cancelled client-router navigations do not reload the module graph. ## Notes Image transformation, server islands, sessions, and `output: "static"` are not currently supported by this adapter. # Hono and HonoX > Build Hono and HonoX applications into fetchlet artifacts. Source: https://fetchlet.roundtrip.dev/docs/frameworks/hono · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/hono/index.md The `fetchlet/hono/vite` plugin wraps `@hono/vite-build` 1 to bundle Hono and HonoX apps into a fetchlet artifact. See [examples/honox-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/honox-axum) and [examples/honox-tauri](https://github.com/SegaraRai/fetchlet/tree/main/examples/honox-tauri) for complete setups. ## Setup ```ts // vite.config.ts import fetchletBuild from "fetchlet/hono/vite"; import honox from "honox/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ honox(), fetchletBuild({ entry: "./app/server.ts", backend: "quickjs", }), ], }); ``` - `entry` points to a module with `export default app`. - `backend`, `intl`, and `requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). - `external` is forwarded to `@hono/vite-build`. - `functions` lists extra modules whose named exports become callable from Rust via `App::call` / `AppHandle::call` (`handle` is reserved) — useful for Tauri commands or CLI helpers. ## Request context and bindings | Value | Content | | -------------------------- | ---------------------------------------------------------------------- | | `c.env` | Rust's fixed bindings | | `c.executionCtx.waitUntil` | Registers work after the response, within Rust's background budget | | `getConnInfo(c)` | From `fetchlet/hono/conninfo`: client IP from the Rust request context | | `getRequestContext(c)` | From `fetchlet/hono/conninfo`: the full Rust request context | HonoX uses `AsyncLocalStorage` internally; the plugin enables `asyncContext: "serialized"` automatically. ## WebSockets Use `upgradeWebSocket` from `fetchlet/hono/websocket` to handle WebSocket routes. Configure `Instances::max_held_connections` on your Rust host ([WebSocket upgrades](https://fetchlet.roundtrip.dev/docs/rust/fetchlet-http#websocket-upgrades)): ```ts import { upgradeWebSocket } from "fetchlet/hono/websocket"; app.get( "/socket", upgradeWebSocket(() => ({ onMessage(event, ws) { ws.send(`echo: ${String(event.data)}`); }, })), ); ``` ## Output and assets The plugin writes `build/server.js`, `build/fetchlet.json`, and (with HonoX) `build/client/`. Pass `assets` to pack static files into `assets.flpk`. Because Hono public files are not necessarily content-hashed, configure caching explicitly via `assets: { cache: [...] }` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). # Nuxt and Nitro > Build Nuxt and Nitro 2 applications into a fetchlet artifact with the fetchlet/nitro preset. Source: https://fetchlet.roundtrip.dev/docs/frameworks/nitro · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/nitro/index.md The `fetchlet/nitro` preset bundles Nitro 2 (with h3 1) and Nuxt applications into a fetchlet artifact. See [examples/nuxt-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/nuxt-axum) for a complete setup. ## Setup ```ts // nuxt.config.ts /// export default defineNuxtConfig({ nitro: { preset: "fetchlet/nitro", fetchlet: { backend: "quickjs" }, }, }); ``` For standalone Nitro, put the same `preset` and `fetchlet` options in `nitro.config.ts`. `fetchlet.backend`, `fetchlet.intl`, and `fetchlet.requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). ## Output The preset writes `build/server.js`, `build/client/` (Nitro's public assets), and `build/fetchlet.json` (with `serveStatic` disabled because Rust serves static files). Node.js built-ins implemented by fetchlet (`node:crypto`, `node:async_hooks`, etc.) and `Buffer`/`process`/`setImmediate`/`clearImmediate` resolve to fetchlet's runtime ([Node.js compatibility](https://fetchlet.roundtrip.dev/docs/compatibility/node)); `unenv` handles the remaining modules. The preset enables `asyncContext: "serialized"`. Set `nitro.fetchlet.assets: true` to pack public assets into `assets.flpk`, preserving `maxAge` caching headers for entries such as `/_nuxt/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Requests and context - **Bindings:** read Rust bindings from `event.context.fetchlet.env` and declare their types on [`fetchlet/bindings`](https://fetchlet.roundtrip.dev/docs/javascript/runtime#binding-types): ```ts import type { ServiceBinding } from "fetchlet/bindings"; declare module "fetchlet/bindings" { interface FetchletBindings { NUXT_MESSAGE: string; RUST: ServiceBinding; } } ``` - **Runtime config:** Nitro reads runtime config overrides (keys starting with `NUXT_`) from `process.env`. Expose those keys explicitly in Rust with `HostServices::process_env("NUXT_...", value)` so they are available on both `event.context.fetchlet.env` and `process.env`. - **Client IP & `waitUntil`:** `getRequestIP(event)` reads `event.context.clientAddress`, and `event.waitUntil(promise)` registers background work with Rust. - **Streaming request bodies:** use `getRequestWebStream(event)` to stream uploads (`readBody` collects the body). - **Internal fetches:** `event.$fetch` and `event.fetch` with a relative path stay inside Nitro and keep `event.context.fetchlet`. Global `$fetch` with a path also stays inside Nitro without the request context. Absolute URLs go through Rust's `FetchPolicy` ([Framework fetches](https://fetchlet.roundtrip.dev/docs/rust/in-process-fetch#framework-fetches)). ## WebSockets Enable `nitro.experimental.websocket: true` to use `defineWebSocketHandler`. Configure `Instances::max_held_connections` on your Rust host ([WebSocket upgrades](https://fetchlet.roundtrip.dev/docs/rust/fetchlet-http#websocket-upgrades)). ## Notes - Vue rendering uses `renderToString`, so HTML responses are buffered. - Nitro 3 (h3 2), streaming SSR, and scheduled tasks are not yet supported. # Qwik City > Build a Qwik City server into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/qwik-city · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/qwik-city/index.md The `fetchlet/qwik-city/vite` plugin and `fetchlet/qwik-city/middleware` bundle a `@builder.io/qwik-city` 1 SSR app into a fetchlet artifact. See [examples/qwik-city-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/qwik-city-axum) for a complete setup. ## Setup Add the plugin to `vite.config.ts`: ```ts // vite.config.ts import { qwikCity } from "@builder.io/qwik-city/vite"; import { qwikVite } from "@builder.io/qwik/optimizer"; import { fetchletAdapter } from "fetchlet/qwik-city/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ qwikCity(), qwikVite({ client: { outDir: "build/client" }, ssr: { outDir: "node_modules/.cache/fetchlet-qwik-city" }, }), fetchletAdapter({ backend: "quickjs" }), ], }); ``` Create the fetchlet server entry: ```ts // src/entry.fetchlet.tsx import qwikCityPlan from "@qwik-city-plan"; import { manifest } from "@qwik-client-manifest"; import { createQwikCity } from "fetchlet/qwik-city/middleware"; import render from "./entry.ssr"; export default createQwikCity({ render, qwikCityPlan, manifest }); ``` Build both client and SSR bundles: ```sh vite build && vite build --ssr ``` The plugin accepts `entry` (default `src/entry.fetchlet.tsx`), `outDir`, `backend`, `intl`, `requirements`, and `assets` ([build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills)). ## Request event and bindings | Value | Content | | -------------------- | ------------------------------------------------------------------ | | `platform.env` | Rust's fixed bindings | | `platform.waitUntil` | Registers work after the response, within Rust's background budget | | `clientConn.ip` | Client IP from the Rust request context | | `env.get(name)` | Reads a string env binding from Rust | Note that Qwik City's built-in CSRF check requires an `Origin` header on `POST` and other mutating requests. ## Assets and WebSockets - Pass `assets: true` to pack `build/client/` into `assets.flpk` with 1-year immutable caching on `build/` and `assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). - To accept WebSockets in an endpoint, call `upgradeWebSocket(request)` from `fetchlet/runtime/handler` and pass the returned response to `send(response)`. ## Notes Qwik 2 (`@qwik.dev/router`) is not supported yet. # React Router > Build a React Router framework-mode server into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/react-router · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/react-router/index.md The `fetchlet/react-router` preset bundles a React Router 8 framework-mode server into a fetchlet artifact. See [examples/react-router-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/react-router-axum) for a complete setup. ## Setup ```ts // react-router.config.ts import type { Config } from "@react-router/dev/config"; import { fetchletPreset } from "fetchlet/react-router"; export default { presets: [fetchletPreset({ backend: "quickjs" })], } satisfies Config; ``` `backend`, `intl`, and `requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). The preset requires `ssr: true` and a single server bundle (`ssr: false` and `serverBundles` are not supported). Avoid defining your own `buildEnd` hook in `react-router.config.ts`, as it overrides the preset's artifact step. ## Output and assets `vite build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/`. Pass `assets: true` to pack `build/client/` into `assets.flpk` with 1-year immutable caching on `assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). Pages listed in `prerender` are served directly from the archive (with or without a trailing slash). ## Load context In loaders, actions, and middleware, read the fetchlet context with `getLoadContext(context)` (typed with your [`fetchlet/bindings`](https://fetchlet.roundtrip.dev/docs/javascript/runtime#binding-types) declaration): ```ts import { getLoadContext } from "fetchlet/react-router/context"; export async function loader({ context }: Route.LoaderArgs) { const { clientAddress, env, waitUntil } = getLoadContext(context); // ... } ``` | Value | Content | | --------------- | ------------------------------------------------------------------ | | `clientAddress` | Client IP from the Rust request context | | `env` | Rust's fixed bindings | | `waitUntil` | Registers work after the response, within Rust's background budget | ## Streaming and stack size Using `renderToReadableStream` from `react-dom/server.edge` in `entry.server` streams deferred data directly to the Rust HTTP response. React's streaming renderer needs more stack space than QuickJS's 1 MiB default in Rust debug builds. `fetchlet_http::Server` automatically sets a 4 MiB QuickJS stack limit and a 64 MiB native worker stack; if you build an `App` manually without `Server`, configure at least a 2–4 MiB QuickJS stack limit. ## Development serving Add `fetchletDevServer` to `vite.config.ts` to run React Router directly from `vite dev` behind your Rust host with React Fast Refresh ([`fetchlet dev --vite "vite dev"`](https://fetchlet.roundtrip.dev/docs/javascript/dev#serving-from-vite)): ```ts // vite.config.ts import { reactRouter } from "@react-router/dev/vite"; import { fetchletDevServer } from "fetchlet/react-router"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [reactRouter(), fetchletDevServer({ backend: "quickjs" })], }); ``` ## Notes Split `serverBundles` and RSC mode are not currently supported. # Solid > Build a Solid 2 full-stack application into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/solid · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/solid/index.md The `fetchlet/solid` Vite plugin bundles a Solid 2 full-stack application (`@solidjs/vite-plugin` with `start` and `ssr: true`) into a fetchlet artifact. For Solid 1 with SolidStart, use [fetchlet/solid-start](https://fetchlet.roundtrip.dev/docs/frameworks/solid-start). See [examples/solid-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/solid-axum) for a complete setup. ## Setup ```ts // vite.config.ts import solid from "@solidjs/vite-plugin"; import fetchletSolid from "fetchlet/solid"; import { fileRoutes } from "filesystem-routing/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ solid({ start: { middleware: "./src/middleware.ts", }, ssr: true, }), fileRoutes({ httpMethods: true, }), fetchletSolid({ backend: "quickjs", assets: true, }), ], }); ``` `outDir`, `backend`, `intl`, `requirements`, and `assets` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). Solid's `nodeServer` option is not needed. ## Output and assets `vite build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/`. Pass `assets: true` to pack client assets into `assets.flpk` with 1-year immutable caching on `assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Request context Read the Rust request context with `getRequestContext()` in middleware, API routes, and server functions (or `getRequestContext(event)` for an explicit event): ```ts import { getRequestContext } from "fetchlet/solid/context"; const { clientAddress, env, waitUntil } = getRequestContext(); ``` Type `env` by declaring your keys on [`fetchlet/bindings`](https://fetchlet.roundtrip.dev/docs/javascript/runtime#binding-types): ```ts declare module "fetchlet/bindings" { interface FetchletBindings { MESSAGE: string; } } ``` The plugin enables `asyncContext: "serialized"` for Solid's `AsyncLocalStorage` request event tracking. ## Development serving With `fetchletSolid()` configured, run [`fetchlet dev --vite "vite dev"`](https://fetchlet.roundtrip.dev/docs/javascript/dev#serving-from-vite) to run Solid's SSR handler on your Rust engine while Vite serves browser modules with Solid HMR (or use `--build-watch "vite build --watch"`). # SolidStart > Build a SolidStart 2 server into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/solid-start · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/solid-start/index.md The `fetchlet/solid-start` Vite plugin bundles a `@solidjs/start` 2 server (Solid 1) into a fetchlet artifact without Nitro. For Solid 2 applications, use [fetchlet/solid](https://fetchlet.roundtrip.dev/docs/frameworks/solid). See [examples/solidstart-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/solidstart-axum) for a complete setup. ## Setup ```ts // vite.config.ts import { solidStart } from "@solidjs/start/config"; import fetchletSolidStart from "fetchlet/solid-start"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ solidStart(), fetchletSolidStart({ backend: "quickjs", }), ], }); ``` `backend`, `intl`, `requirements`, `outDir`, and `assets` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). ## Output and assets `vite build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/`. Pass `assets: true` to pack client assets into `assets.flpk` with 1-year immutable caching on `_build/assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Request context `getRequestEvent().clientAddress`, h3's `getRequestIP(event)`, and `event.waitUntil` work as usual. Read Rust bindings with `getRequestContext()` (typed via [`fetchlet/bindings`](https://fetchlet.roundtrip.dev/docs/javascript/runtime#binding-types)): ```ts import { getRequestContext } from "fetchlet/solid-start/context"; // Use getRequestContext(event) inside API route handlers const { clientAddress, env, waitUntil } = getRequestContext(); ``` - The plugin enables `asyncContext: "serialized"` for `node:async_hooks`. - Because SolidStart compiles each HTTP method handler of an API route (`GET`, `POST`, etc.) as a separate module, place shared state in a separate module. - Use `fetchWithEvent(event.nativeEvent, "/api/...")` from `@solidjs/start/http` for in-framework requests that preserve request context; absolute URLs through global `fetch()` go through Rust's `FetchPolicy` ([Framework fetches](https://fetchlet.roundtrip.dev/docs/rust/in-process-fetch#framework-fetches)). ## Development serving With `fetchletSolidStart()` configured, run [`fetchlet dev --vite "vite dev"`](https://fetchlet.roundtrip.dev/docs/javascript/dev#serving-from-vite) to run SolidStart's server entry on your Rust engine while Vite serves browser modules with Solid HMR (or use `--build-watch "vite build --watch"`). # SvelteKit > Build a SvelteKit server into a fetchlet artifact with the fetchlet/sveltekit adapter. Source: https://fetchlet.roundtrip.dev/docs/frameworks/sveltekit · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/sveltekit/index.md The `fetchlet/sveltekit` adapter bundles a SvelteKit 3 server into a fetchlet artifact (`build/server.js`, `build/client/`, and `build/fetchlet.json`). See the [sveltekit-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/sveltekit-axum) and [sveltekit-axum-tauri](https://github.com/SegaraRai/fetchlet/tree/main/examples/sveltekit-axum-tauri) examples for complete setups. ## Setup ```ts // vite.config.ts import { sveltekit } from "@sveltejs/kit/vite"; import fetchletAdapter from "fetchlet/sveltekit"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ sveltekit({ compilerOptions: { experimental: { async: false, }, }, adapter: fetchletAdapter({ out: "build", backend: "quickjs", }), }), ], }); ``` `backend`, `intl`, and `requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). Build with `vite build` and develop with [`fetchlet dev`](https://fetchlet.roundtrip.dev/docs/javascript/dev) (full rebuild mode). ## Request context and bindings | From Rust | In SvelteKit | | ----------------------- | ----------------------------- | | Context `clientAddress` | `getClientAddress()` | | Host bindings | `platform.env` | | `waitUntil` | `platform.context.waitUntil` | | String env bindings | `env` passed to `server.init` | Type `platform.env` by declaring your keys on [`fetchlet/bindings`](https://fetchlet.roundtrip.dev/docs/javascript/runtime#binding-types). ## Assets Pass `assets: true` to pack `client/` into `build/assets.flpk`: - Files under `_app/immutable/` receive a 1-year `Cache-Control: immutable` header. - Prerendered pages are served without `.html` or a trailing slash, matching SvelteKit's default `trailingSlash: "never"`. - Customize rules with `assets: { include, routes, cache, respond, entries }` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Rendering profiles | `rendering` | Use | | ------------------------- | --------------------------------------------------------------------------------------------------------------------- | | `"synchronous"` (default) | Standard synchronous Svelte rendering (no `node:async_hooks` needed); promises returned from `load` still stream | | `"async"` | Svelte's async rendering (`compilerOptions.experimental.async`) and remote functions (`experimental.remoteFunctions`) | ```ts sveltekit({ compilerOptions: { experimental: { async: true } }, experimental: { remoteFunctions: true }, adapter: fetchletAdapter({ rendering: "async" }), }); ``` `"async"` enables `asyncContext: "serialized"` so `getRequestEvent()` works across `await` within a request. In a remote function, call `getRequestEvent()` before the first `await` if multiple remote functions run concurrently during one render. # TanStack Start > Build a TanStack Start server into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/tanstack-start · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/tanstack-start/index.md The `fetchlet/tanstack-start` Vite plugin bundles a `@tanstack/react-start` 1 server into a fetchlet artifact. See [examples/tanstack-start-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/tanstack-start-axum) for a complete setup. ## Setup ```ts // vite.config.ts import { tanstackStart } from "@tanstack/react-start/plugin/vite"; import react from "@vitejs/plugin-react"; import fetchletStart from "fetchlet/tanstack-start"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ tanstackStart(), react(), fetchletStart({ backend: "quickjs", }), ], }); ``` `backend`, `intl`, and `requirements` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). The plugin resolves `react-dom/server` to `react-dom/server.edge` and bundles dependencies with [fetchlet's export conditions](https://fetchlet.roundtrip.dev/docs/javascript/build#export-conditions). ## Output and assets `vite build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/`. Pass `assets: true` to pack `build/client/` into `assets.flpk` with 1-year immutable caching on `assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Request context Server functions, server routes, and middleware receive a `FetchletRequestContext`: | Value | Content | | --------------- | ------------------------------------------------------------------ | | `clientAddress` | Client IP from the Rust request context | | `env` | Rust's fixed bindings | | `waitUntil` | Registers work after the response, within Rust's background budget | Register the type once in your app: ```ts import type { FetchletRequestContext } from "fetchlet/tanstack-start"; declare module "@tanstack/react-start" { interface Register { server: { requestContext: FetchletRequestContext; }; } } ``` ## Development serving With `fetchletStart()` configured, run [`fetchlet dev --vite "vite dev"`](https://fetchlet.roundtrip.dev/docs/javascript/dev#serving-from-vite) to execute Start's server entry on your Rust engine while Vite serves browser modules with React Fast Refresh (or use `--build-watch "vite build --watch"`). The first dev request takes a few seconds while Vite pre-bundles server dependencies. ## Notes Prerendering, SPA mode, and TanStack Start for Solid are not currently verified. # vinext > Build a vinext (Next.js App Router on Vite) application into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/vinext · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/vinext/index.md The `fetchlet/vinext` Vite plugin bundles the App Router server of [vinext](https://github.com/cloudflare/vinext) 1 into a fetchlet artifact. See [examples/vinext-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/vinext-axum) for a complete setup. ## Setup ```ts // vite.config.ts import fetchletVinext from "fetchlet/vinext"; import vinext from "vinext"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ vinext(), fetchletVinext({ backend: "quickjs", }), ], }); ``` `backend`, `intl`, `requirements`, `outDir`, and `assets` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). ## Output and assets `vite build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/`. Pass `assets: true` to pack client assets into `assets.flpk` with 1-year immutable caching on `_next/static/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Request context Read the Rust request context in server components, route handlers, and server actions: ```ts import { getRequestContext } from "fetchlet/vinext/context"; const { clientAddress, env, waitUntil } = getRequestContext(); ``` `after()` from `next/server` is wired to `waitUntil` automatically. ## Node APIs Standard Node built-ins (`node:buffer`, `node:crypto`, etc.) come from [Node.js compatibility](https://fetchlet.roundtrip.dev/docs/compatibility/node). For vinext's additional expectations, the plugin provides: | Module or value | Behavior in fetchlet | | --------------- | ---------------------------------------------------------- | | `node:path` | `pathe` (POSIX and win32) | | `node:fs` | Empty virtual filesystem (vinext uses its in-memory cache) | | `node:module` | `createRequire` for React SSR entries | | `process.env` | Empty object; `process.platform` is `"linux"` | Next.js's fetch cache wraps `globalThis.fetch`; underlying requests still pass through Rust's `FetchPolicy`. ## Recommended Rust limits On the first request, vinext registers a `waitUntil` task per route module preload. If you set `Limits::background_tasks` on your Rust host, give it headroom (for example, `64`) so initial page renders do not hit the limit. ## Notes - Pages Router, filesystem ISR persistence, `next/image` optimization, and middleware are not currently verified. - Standard Next.js (`next build`) output is not supported. # Waku > Build a Waku RSC server into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/waku · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/waku/index.md The `fetchlet/waku` server entry adapter bundles a Waku 1 (1.0.0-rc.5+) RSC server into a fetchlet artifact. See [examples/waku-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/waku-axum) for a complete setup. ## Setup ```tsx // src/waku.server.tsx import adapter from "fetchlet/waku"; import { fsRouter } from "waku"; const modules = Object.fromEntries( Object.entries(import.meta.glob("/src/pages/**/*.{tsx,ts}")).map(([key, load]) => [ key.slice("/src/".length), load, ]), ); export default adapter(fsRouter(modules), { backend: "quickjs" }); ``` `backend`, `intl`, `requirements`, `outDir`, and `assets` follow the [build options](https://fetchlet.roundtrip.dev/docs/javascript/build#choosing-a-backend-and-polyfills). `middlewareFns` and `middlewareModules` work as in other Waku adapters. Build with `waku build`. ## Output and assets `waku build` writes `build/server.js`, `build/fetchlet.json`, and `build/client/` (including statically generated pages). Pass `assets: true` to pack client assets into `assets.flpk` with 1-year immutable caching on `assets/` ([Asset archive](https://fetchlet.roundtrip.dev/docs/reference/asset-archive)). ## Request context and bindings Read the Rust request context in server components, server functions, and API routes (call `getRequestContext()` with no arguments): ```ts import { getRequestContext } from "fetchlet/waku/context"; const { clientAddress, env, waitUntil } = getRequestContext(); ``` - In Hono middleware, bindings are available on `c.env` and `waitUntil` on `c.executionCtx.waitUntil`. - String bindings are also accessible via Waku's `getEnv(name)`. - The adapter enables `asyncContext: "serialized"` for `node:async_hooks`. - Request body limits are enforced by your Rust host's `Limits::request_body_bytes` (Hono's `bodyLimit` middleware is not used). # Vite > Build a framework-free Vite server entry and browser assets into a fetchlet artifact. Source: https://fetchlet.roundtrip.dev/docs/frameworks/vite · Markdown: https://fetchlet.roundtrip.dev/docs/frameworks/vite/index.md The `fetchlet/vite` plugin builds a standard Workers-style server module (`export default { fetch(request, env, ctx) }`) and optional browser entries into a fetchlet artifact — no framework required. See [examples/vanilla-axum](https://github.com/SegaraRai/fetchlet/tree/main/examples/vanilla-axum) (and [examples/vanilla-cli](https://github.com/SegaraRai/fetchlet/tree/main/examples/vanilla-cli) for a functions-only CLI) for complete setups. ## Setup ```ts // vite.config.ts import fetchlet from "fetchlet/vite"; import { defineConfig } from "vite"; export default defineConfig({ plugins: [ fetchlet({ server: "src/server.ts", client: "src/client.ts", backend: "quickjs", assets: true, }), ], }); ``` | Option | Default | Meaning | | -------------- | ----------------- | ------------------------------------------------------------------------------------ | | `server` | `"src/server.ts"` | Server module path | | `client` | none | Browser entry points (falls back to `index.html` if present) | | `outDir` | `"build"` | Output artifact directory | | `backend` | `"portable"` | Target engine (`quickjs`, `boa`, `v8`, or `portable`) | | `intl` | `{}` | `Intl` locales and time zone data ([build options](https://fetchlet.roundtrip.dev/docs/javascript/build)) | | `requirements` | `[]` | Extra APIs beyond the Web API profile ([build options](https://fetchlet.roundtrip.dev/docs/javascript/build)) | | `assets` | `false` | Pack `client/` into `assets.flpk` with 1-year immutable caching on `build.assetsDir` | ## Writing the server module Export a default `{ fetch(request, env, ctx) }` handler and any named functions you want Rust to call via `App::call` / `AppHandle::call_json` (`handle` is reserved). Modules without a default export build a functions-only artifact. ```ts import type { ExportedHandler } from "fetchlet/runtime"; declare module "fetchlet/bindings" { interface FetchletBindings { MESSAGE: string; } } export default { async fetch(request, env, ctx) { ctx.waitUntil(audit(request.url)); return new Response(`${env.MESSAGE} from ${ctx.clientAddress}`); }, } satisfies ExportedHandler; export function greet(name: string): string { return `Hello, ${name}`; } ``` `ctx` matches Cloudflare Workers' `ExecutionContext` plus `ctx.clientAddress` from Rust (`passThroughOnException()` is a no-op). `node:async_hooks` is not enabled by default; use [`fetchlet/build`](https://fetchlet.roundtrip.dev/docs/javascript/build) directly if you need `asyncContext`. ## Referencing browser entries Import `virtual:fetchlet/client-assets` in your server module to get the built `