Skip to main content

Installation

Scramjet is available as an npm package and can be installed using your preferred package manager.

Requirements

Before installing Scramjet, make sure you have:
  • Node.js (recent version recommended)
  • A package manager: npm, yarn, or pnpm

Install the package

npm install @mercuryworkshop/scramjet

Package exports

Scramjet provides multiple export options depending on your use case:

Default export

import scramjet from "@mercuryworkshop/scramjet";
This is a no-op export that won’t bundle Scramjet into your application.

Bundled export

import "@mercuryworkshop/scramjet/bundled";
Use this to include the full Scramjet bundle with all dependencies.

Path utilities

import { path } from "@mercuryworkshop/scramjet/path";
Provides utility functions for working with Scramjet paths and URLs.
For most use cases, you’ll want to load Scramjet via a script tag rather than bundling it directly. See the quickstart guide for the recommended setup.

Static files

After installation, you need to serve the Scramjet static files from your web server. These files are located in the dist directory of the package:
  • scramjet.bundle.js - Main Scramjet bundle
  • scramjet.all.js - All-in-one bundle for service workers
  • scramjet.sync.js - Synchronous XHR support
  • scramjet.wasm.wasm - WebAssembly rewriter module
Make sure these files are accessible from your web server at the paths you configure in your Scramjet initialization.

For development

If you want to build Scramjet from source for development purposes:
1

Clone the repository

git clone --recursive https://github.com/MercuryWorkshop/scramjet
cd scramjet
2

Install dependencies

pnpm install
Scramjet development requires pnpm. The package includes a preinstall hook to enforce this.
3

Build the rewriter

pnpm rewriter:build
This requires:
  • rustup
  • wasm-bindgen
  • Binaryen’s wasm-opt
  • The wasm-snip fork from r58Playz
4

Build Scramjet

pnpm build
5

Run the dev server

pnpm dev
Scramjet will be running at http://localhost:1337 and will rebuild when files change.

Next steps

Now that you have Scramjet installed, follow the quickstart guide to set up your first proxy.

Build docs developers (and LLMs) love