Embed the server side of JavaScript web frameworks inside a Rust binary.
Website · Getting started · Frameworks · Coding agents · Examples
fetchlet runs the server side of SvelteKit, Astro, TanStack Start, React Router, Nuxt, Solid, HonoX, and more inside a Rust process — on QuickJS, Boa, or V8. Ship a CLI, local tool, self-hosted service, or Tauri desktop app as a single binary with a rich web UI, without bundling Node.js or running a reverse proxy.
Rust passes a standard Request and receives a Response, and can also call
exported JavaScript functions directly through the same runtime.
A fetchlet application has two halves: the fetchlet npm package bundles your
framework into a portable artifact directory (build/), and a Rust host serves
it with fetchlet and fetchlet-http.
Prerequisites: Node.js 20.19, 22.12, 24+ (build time) and Rust 1.100+.
npm install --save-dev fetchletConfigure your framework adapter (for example, SvelteKit):
// 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",
assets: true,
}),
}),
],
});Running vite build writes build/ with server.js, fetchlet.json, and
client assets (packed into assets.flpk when assets: true). See
Frameworks for all 12
adapters, or use fetchlet build without Vite.
cargo add fetchlet
cargo add fetchlet-http --features axum
cargo add tokio --features macros,rt-multi-thread,net
cargo add anyhow// server/main.rs
use fetchlet::HostServices;
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")
.host_services(|| HostServices::new().env("APP_NAME", "fetchlet"))
.serve(listener)
.await?;
Ok(())
}To embed the build directory into a single executable at compile time, use
fetchlet_http::include_artifact!("../build")
(Embedding and distribution).
Use fetchlet::App / AppHandle directly to invoke a Fetch handler or call
named JavaScript exports with Serde values (app.call("transform", &input) or
app.call_json("add", &[...])). See
Running JavaScript.
- Three engines, one Web API profile. Choose
quickjs(default, fast startup),boa(pure Rust), orv8(JIT, native Intl & WebAssembly) via Cargo features — all running the same WinterTC Web API layer and Node.js compatibility subset. - In-process Rust integration. Expose Rust functions directly on
env(Functions), or route internal origins (https://fetchlet.internal) to your axum router with zero TCP overhead and a trustedContextJavaScript cannot read or forge. - Deny-by-default permissions. JavaScript has no network, filesystem, or
host env access unless granted through
HostServices. Outbound HTTP, TCP, and WebSocket clients enforce exact allowlists and block private IPs by default. - Resource limits & process isolation. Configure timeouts, CPU busy limits,
heap caps, body sizes, and subrequest budgets in Rust. Enable the
processfeature to isolate each engine instance in a child process. - Single-binary & Tauri ready. Pack static assets into a Brotli
assets.flpkarchive, embed everything withinclude_artifact!, or serve over a Tauri custom URI scheme withServer::webview. - Coding agent friendly. Installing the
fetchletnpm package bundles version-matched Markdown docs and agent skills innode_modules/fetchlet/(Coding agents).
Run any example from this repository:
vp install --frozen-lockfile
vp run @fetchlet-internal/example-sveltekit-axum#serve| Example | Host | Port |
|---|---|---|
| TanStack Start + axum | axum | 3500 |
| React Router + axum | axum | 3300 |
| vinext + axum | axum | 3900 |
| Astro + axum | axum | 3100 |
| SvelteKit + axum | axum | 3000 |
| Nuxt + axum | axum | 3200 |
| SolidStart + axum | axum | 3600 |
| Solid 2 + axum | axum | — |
| Waku + axum | axum | 3800 |
| Qwik City + axum | axum | 3700 |
| HonoX + axum | axum | 3400 |
| Vanilla Vite + axum | axum | — |
| Vanilla CLI | CLI | — |
| HonoX + Tauri | Tauri | — |
| Markdown Workspace | CLI / Tauri | — |
See examples/README.md for dev loops (dev, dev:vite)
and switching engines.
- User docs: https://fetchlet.roundtrip.dev/docs
- Rust API reference: docs.rs/fetchlet · fetchlet-http · fetchlet-net
- Maintainer docs: docs
crates/fetchlet/ Core runtime: engines, AppHandle pools, HostServices, process isolation
crates/fetchlet-http/ HTTP integrations (Tower, hyper, axum, actix), Server, artifacts, webviews
crates/fetchlet-net/ Outbound HTTP, TCP/TLS, and WebSocket transports
crates/fetchlet-web/ Engine-independent Rust implementations of Web APIs
packages/fetchlet/ User-facing npm package: framework adapters, CLI, runtime
packages/node/ @fetchlet/node: guest Node.js built-in modules
packages/web/ @fetchlet/web: guest Web API implementations
examples/ Runnable applications per framework and Rust host
apps/website/ Documentation website (fetchlet.roundtrip.dev)
docs/ Maintainer documentation, research, and TODOs
vp install --frozen-lockfile
vp run check
vp run test:rust
vp run test:matrix
vp run test:hostvp run verify runs the full regular test suite. See
docs/verification.md and
docs/security-testing.md for details.
Dual-licensed under MIT or Apache-2.0.