Skip to content
Official Scramjet Logo

Scramjet is an interception-based web proxy designed to evade internet censorship, bypass arbitrary web browser restrictions and innovate web proxy technologies. It strives to maintain security, developer friendliness and performance unlike many other web proxies regardless of its open source nature.

Scramjet is currently the flagship web proxy made by Mercury Workshop and it is highly recommended that you switch to it. Don’t worry, it is stable enough for most use cases to go into production!

  1. Install the package: pnpm install https://github.com/MercuryWorkshop/scramjet/releases/download/latest/mercuryworkshop-scramjet-1.0.2-dev.tgz (PNPM is recommended unless you use an alternative runtime like Bun)

  2. Setup a transport on your site

  3. Serve the Scramjet build under your specified route using the path import { scramjetPath } from "@mercuryworkshop/scramjet/path". We will use /scram/ as a route for these examples.

  4. Write a SW

sw.js:

importScripts("/scram/scramjet.all.js");

const { ScramjetServiceWorker } = $scramjetLoadWorker();
const scramjet = new ScramjetServiceWorker();

self.addEventListener("fetch", (event) => {
	event.respondWith(async () => {
    await scramjet.loadConfig();
    if (scramjet.route(event)) {
      return scramjet.fetch(event);
    }

    return fetch(event.request);
  });
});
  1. Initialize BareMux and ScramjetController, and register your SW.

Import the scripts in this order:

  1. BareMux
  2. BareMux Transport of your chioce
  3. Scramjet all bundle

In your JS Script:

const { ScramjetController } = $scramjetLoadController();

const scramjet = new ScramjetController({
  files: {
	  wasm: "/scram/scramjet.wasm.wasm",
	  all: "/scram/scramjet.all.js",
	  sync: "/scram/scramjet.sync.js",
  }
});

scramjet.init();

navigator.serviceWorker.register("sw.js");

// Init BareMux
const connection = new BareMux.BareMuxConnection("/baremux/worker.js");
// Set the transport yourself
connection.setTransport(...);

Until Scramjet has an NPM package, you have to use the CI builds, which run every time a commit is pushed to main. If you want to upgrade to a new CI build and you use PNPM, you must type pnpm cache delete @mercuryworkshop/scramjet and then install it again.

Now, Scramjet uses a new main bundle scramjet.all.js, which combines the former scripts. Replaces these bundles:

<link rel="prefetch" href="/scram/scramjet.worker.js" />
<link rel="prefetch" href="/scram/scramjet.shared.js" />
...
<script src="/scram/scramjet.controller.js"></script>

Scramjet is easier to setup than UV. You may still use UV alongside Scramjet if you really find it necessary, however UV is unmaintained software and has far less site support than Scramjet.

With:

<script src="/scram/scramjet.all.js"></script>

Here is an example setup of Scramjet as a proxy site. If you get lost and need a reference along the way, you can fork it or take inspiration from it. It’s essentially Ultraviolet-App, but with Scramjet as the SW proxy instead.

You can read the full Scramjet Typedocs for better API documentation.