JavaScript Runtime & Web APIs
Every JavaScript app runs inside its own dedicated microVM with a modern JS runtime, Web standard APIs, and core Node.js modules—built once, snapshotted, and restored on demand.
Handler formats
Both concise serve() and standard Workers-style module exports work identically:
js
// Style 1: serve()
serve(async (req) => {
const body = await req.json();
return Response.json({ ok: true, got: body });
});
// Style 2: ES module default export
export default {
async fetch(request, env, ctx) {
return new Response("ok");
}
};Supported Web & Node APIs
- Web Standards:
Request,Response,Headers,URL,URLSearchParams,fetch(),crypto.subtle,crypto.getRandomValues,TextEncoder/TextDecoder,ReadableStream,WritableStream,TransformStream,AbortController,FormData,Blob,File,Caches(up to 8 MiB / 128 responses / 32 cache names),AsyncLocalStorage. - Node Built-ins:
node:crypto,node:buffer,node:stream,node:url,node:path,node:events,node:util,node:querystring,node:string_decoder. - Static assets beside code: Place static assets in a
public/directory inside a folder deploy to serve them directly from the edge without waking the VM.
Outbound fetch()
Call any public https:// API (Stripe, Resend, OpenAI, Slack/Discord webhooks, GitHub, Telegram):
- Public HTTPS only: Private/loopback IPs and non-HTTPS URLs are blocked at the egress gateway.
- Per-request bounds: 1.5 s per-fetch deadline (within the 2 s total handler CPU budget), 48 KiB max request body, 256 KiB max response body, up to 5 redirects.
- Rate limits: 10 requests/s (burst 20), 4 in-flight per app, 8 in-flight per account.
Not a fit for nma.sh
- Apps requiring raw TCP sockets (
net,tls), local filesystem persistence (fs), child processes (child_process), or native C++ addons. - Long-running background workers, WebSocket servers, or heavy server-side CPU workloads (>2 s CPU per request).