Embed your web framework in Rust.
fetchlet runs the server side of SvelteKit, Astro, TanStack Start, React Router, Nuxt, and more inside a Rust process—on QuickJS, Boa, or V8. Ship a rich web UI in a single binary, with no Node.js runtime or reverse proxy.
Bundle your framework with a fetchlet adapter, then serve client assets, Rust routes, and SSR pages from one axum server.
import { sveltekit } from "@sveltejs/kit/vite";
import fetchletAdapter from "fetchlet/sveltekit";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
sveltekit({
adapter: fetchletAdapter({ out: "build" }),
}),
],
});use axum::{Router, routing::get};
use fetchlet_http::Server;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await?;
Server::new("build")
.routes(|_| Router::new().route("/api/health", get(|| async { "ok" })))
.serve(listener)
.await?;
Ok(())
}Expose Rust functions directly on env so server-side JS calls your database, file index, or native crates without HTTP serialization.
export async function load({ platform }) {
const users = await platform.env.DB.query(
"SELECT id, name FROM users LIMIT 20",
[],
);
return { users };
}use fetchlet::{FunctionRequest, Functions, HostServices};
use fetchlet_http::Server;
use serde_json::{Value, json};
let db = Functions::new().method("query", |req: FunctionRequest| async move {
let (sql, params): (String, Vec<Value>) = req.args()?;
let rows = run_query(&sql, ¶ms).await?;
Ok(json!(rows))
});
Server::new("build")
.host_services(move || HostServices::new().functions("DB", db.clone()))
.serve(listener)
.await?;Pack static files into a Brotli archive (assets.flpk) and embed the entire artifact into your Rust executable at compile time.
import fetchletStart from "fetchlet/tanstack-start";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [
tanstackStart(),
react(),
fetchletStart({ backend: "quickjs", assets: true }),
],
});use fetchlet_http::{Artifact, Server};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let artifact: Artifact = fetchlet_http::include_artifact!("../build");
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await?;
Server::from_artifact(artifact).serve(listener).await?;
Ok(())
}Serve SSR pages inside a Tauri webview over a custom URI scheme—no local TCP port, and Tauri commands can call JS exports directly.
export async function load({ platform }) {
// Runs in-process inside the Tauri binary
const workspace = await platform.env.WORKSPACE.summary();
return { workspace };
}use fetchlet_http::{Server, WebviewScheme};
const SCHEME: WebviewScheme = WebviewScheme::new("app");
let webview = Server::new("build")
.host_services(build_host_services)
.webview(SCHEME, 16 * 1024 * 1024)
.await?;
let protocol = webview.clone();
tauri::Builder::default()
.register_asynchronous_uri_scheme_protocol(SCHEME.name(), move |_, req, res| {
let protocol = protocol.clone();
tauri::async_runtime::spawn(async move {
res.respond(protocol.respond(req).await);
});
});Keep the framework you already know.
All framework guidesJavaScript renders.
Rust owns the rest.
Route internal origins straight to your axum router with zero TCP overhead, inject upstream API tokens after authorization so JavaScript never sees them, and cap memory and execution time per request—all from one Rust configuration.
let router = OriginRouter::new()
.internal("https://fetchlet.internal", router_transport(api))?
.external("https://api.example.com", HttpClient::new())?
.into_service()
.credentials(|url, headers| {
if url.host_str() == Some("api.example.com") {
headers.insert("authorization", token.parse()?);
}
Ok(())
});
Server::new("build")
.host_services(move || HostServices::new().outbound(router.clone()))
.limits(Limits {
timeout: Some(Duration::from_secs(5)),
heap_bytes: Some(64 * 1024 * 1024),
..Default::default()
})Three engines, one profile
Run the same WinterTC Web APIs and Node.js subset on QuickJS (fast startup), Boa (pure Rust), or V8 (JIT, native Intl, WebAssembly). Switch engines with one Cargo feature.
Deny-by-default permissions
JavaScript cannot touch the network, filesystem, or host env unless Rust grants it. Outbound HTTP, TCP, and WebSockets enforce exact allowlists and block private IPs to prevent SSRF.
Limits & process isolation
Bound timeouts, CPU busy time, engine heaps, body sizes, and subrequests in Rust. Enable the process feature to isolate each instance in a child process with OS memory limits.
From local HMR to a single binary.
- 01
Develop with live reload
Keep your Rust host running while Vite serves browser HMR and your Rust engine evaluates updated server modules on the fly.
Development serverfetchlet dev --vite "vite dev" -- cargo run --features vite-dev - 02
Build a portable artifact
Bundles your server entry with only the polyfills your target engine lacks, plus Brotli-compressed static assets in assets.flpk.
Building artifactsvite build - 03
Ship one executable
Embed the server bundle and asset archive into your Rust binary—ready for CLIs, Tauri desktop apps, or self-hosted deployments.
Embedding & distributionlet artifact = fetchlet_http::include_artifact!("../build");
Start building with fetchlet.
Add an adapter to your web app, serve it from Rust, and ship one binary.