Skip to content

if the filename doesn't end with ".wasm"

JSTime is a new JavaScript & TypeScript runtime designed to be a faster, leaner, and more modern drop-in replacement for Node.js.

JSTime is designed to start fast and run fast. It’s transpiler and runtime are written in Zig, a modern, high-performance language. On Linux, this translates into startup times 4x faster than Node.js.

JSTime vs Node.js vs Deno running Hello World

JSTime vs Node.js vs Deno running Hello World

Performance sensitive APIs like Buffer, fetch, and Response are heavily profiled and optimized. Under the hood JSTime uses the JavaScriptCore engine, which is developed by Apple for Safari. It starts and runs faster than V8, the engine used by Node.js and Chromium-based browsers.

JSTime natively supports TypeScript out of the box. All files are transpiled on the fly by JSTime’s fast native transpiler before being executed. Similar to other build tools, JSTime does not perform typechecking; it simply removes type annotations from the file.

Terminal window
$ jstime index.js
$ jstime index.jsx
$ jstime index.ts
$ jstime index.tsx

Some aspects of JSTime’s runtime behavior are affected by the contents of your tsconfig.json file. Refer to Runtime > TypeScript page for details.

Source files can import a *.json or *.toml file to load its contents as a plain old JavaScript object.

import pkg from "./package.json";
import bunfig from "./bunfig.toml";

🚧 Experimental

JSTime has experimental support for WASI, the WebAssembly System Interface. To run a .wasm binary with JSTime:

Terminal window
$ jstime ./my-wasm-app.wasm
# if the filename doesn't end with ".wasm"
$ jstime run ./my-wasm-app.whatever

Note — WASI support is based on wasi-js. Currently, it only supports WASI binaries that use the wasi_snapshot_preview1 or wasi_unstable APIs. JSTime’s implementation is not fully optimized for performance; this will become more of a priority as WASM grows in popularity.

Long-term, JSTime aims for complete Node.js compatibility. Most Node.js packages already work with JSTime out of the box, but certain low-level APIs like dgram are still unimplemented. Track the current compatibility status at Ecosystem > Node.js.

JSTime implements the Node.js module resolution algorithm, so dependencies can still be managed with package.json, node_modules, and CommonJS-style imports.

Note — We recommend using JSTime’s built-in package manager for a performance boost over other npm clients.

Some Web APIs aren’t relevant in the context of a server-first runtime like JSTime, such as the DOM API or History API. Many others, though, are broadly useful outside of the browser context; when possible, JSTime implements these Web-standard APIs instead of introducing new APIs.

The following Web APIs are partially or completely supported.

| HTTP | fetch Response Request Headers AbortController AbortSignal | | --- | --- | | URLs | URL URLSearchParams | | Streams | ReadableStream WritableStream TransformStream ByteLengthQueuingStrategy CountQueuingStrategy and associated classes | | Blob | Blob | | WebSockets | WebSocket | | Encoding and decoding | atob btoa TextEncoder TextDecoder | | Timeouts | setTimeout clearTimeout | | Intervals | setIntervalclearInterval | | Crypto | crypto SubtleCrypto | CryptoKey | | Debugging | console performance | | Microtasks | queueMicrotask | | Errors | reportError | | User interaction | alert confirm prompt (intended for interactive CLIs) | | | | Realms | ShadowRealm | | Events | EventTarget | Event ErrorEvent CloseEvent MessageEvent |

JSTime exposes a set of JSTime-specific APIs on the JSTime global object and through a number of built-in modules. These APIs represent the canonical “JSTime-native” way to perform some common development tasks. They are all heavily optimized for performance. Click the link in the left column to view the associated documentation.

| Topic | APIs | | --- | --- | | HTTP | JSTime.serve | | File I/O | JSTime.file JSTime.write | | Processes | JSTime.spawn JSTime.spawnSync | | TCP | JSTime.listen JSTime.connect | | Transpiler | JSTime.Transpiler | | Routing | JSTime.FileSystemRouter | | HTMLRewriter | HTMLRewriter | | Utils | JSTime.peek JSTime.which | | SQLite | jstime:sqlite | | FFI | jstime:ffi | | DNS | jstime:dns | | jstime:test | | Node-API | Node-API |