⚖

Gold Knight Tech

JavaScript runtime · Powered by Rust

OakJS

Write logic in JavaScript. Build the runtime in Rust. OakJS runs JavaScript programs the way Node.js does - the same modules, the same event loop, the same built-in modules and the same output - in one small program that starts in a few milliseconds. And a Rust application can embed it to run JavaScript plugins.

Linux · macOS · WindowsRaspberry Pi too
One file, ~6 MBNothing else to install
~15 ms, 6 MBStartup and memory

1What it does

2Install - choose one of two ways

Both ways end the same: the oakjs command, ready in any new terminal. Use one of them, not both. To update later, do the same again.

Way 1 · One command in a terminal

The command downloads the program for your system, checks it and puts it on your PATH - just for you, no administrator needed.

Linux and macOS (Terminal):

curl -fsSL https://goldknighttech.ca/downloads/oakjs/install.sh | sh

Windows (PowerShell):

irm https://goldknighttech.ca/downloads/oakjs/install.ps1 | iex

Way 2 · Download the installer and double-click it

Instead of Way 1 - no terminal needed to install: click your system below, open the downloaded file, follow the steps. It installs OakJS for everyone on the computer.

🪟 Windows

Windows 10/11, x64. Windows may say "Windows protected your PC": click More info → Run anyway (the installer isn't signed yet). ⬇ OakJS-Setup.exe

 macOS

macOS 11+, Apple silicon and Intel. If macOS won't open it: System Settings → Privacy & Security → Open Anyway (not signed yet). ⬇ OakJS.pkg

🐧 Linux

Ubuntu 20.04+, Debian 10+, Raspberry Pi OS (64-bit). Open it with Software Install, or sudo apt install ./oakjs_amd64.deb. ⬇ oakjs_amd64.deb (PC) ⬇ oakjs_arm64.deb (Raspberry Pi)

Which one?

Way 1: terminal commandWay 2: installer
HowPaste one line, press EnterDownload, double-click, Next → Finish
ForYou alone - no administrator passwordEveryone on the computer
WhereLinux, macOS: ~/.oakjs/bin · Windows: %LOCALAPPDATA%\Programs\OakJSLinux: /usr/bin · macOS: /usr/local/bin · Windows: C:\Program Files\OakJS
RemoveDelete that folder (section 4)Like any program (Settings → Apps; sudo apt remove oakjs)
ResultThe same oakjs command, on your PATH

Just the program, to put where you like: Linux x86-64 · Linux arm64 · macOS · Windows · SHA256SUMS · version ….

3Use it

oakjs app.js arg1 arg2        # run a program (CommonJS or ES module)
oakjs                         # the prompt - type .exit to leave
oakjs -e 'console.log(require("os").platform())'
oakjs -p '[1, 2, 3].map(x => x * 2)'
oakjs --help

A web server in four lines - save it as server.js, run oakjs server.js, open http://localhost:3000:

const http = require("http");
http.createServer((req, res) => {
  res.end(`Hello from OakJS - you asked for ${req.url}\n`);
}).listen(3000, () => console.log("http://localhost:3000"));
🚧

Not there yet: streams (fs.createReadStream, child_process.spawn, streaming HTTP bodies), net/tls/dgram, zlib and worker threads. A program that needs them says so with an error.

4Update and remove

Update: the same way you installed - run the command again, or download and open the new installer.

Remove - installed with Way 2: like any other program (Windows: Settings → Apps → OakJS; Linux: sudo apt remove oakjs; macOS: sudo rm /usr/local/bin/oakjs). Installed with Way 1:

# Linux and macOS (and remove the "# OakJS" lines from ~/.zshrc, ~/.bashrc, ~/.profile)
rm -rf ~/.oakjs
# Windows (PowerShell)
Remove-Item -Recurse "$env:LOCALAPPDATA\Programs\OakJS"