> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/mercuryworkshop/scramjet/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install Scramjet in your project using npm, yarn, or pnpm

# 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

<CodeGroup>
  ```bash npm theme={null}
  npm install @mercuryworkshop/scramjet
  ```

  ```bash yarn theme={null}
  yarn add @mercuryworkshop/scramjet
  ```

  ```bash pnpm theme={null}
  pnpm add @mercuryworkshop/scramjet
  ```
</CodeGroup>

## Package exports

Scramjet provides multiple export options depending on your use case:

### Default export

```javascript theme={null}
import scramjet from "@mercuryworkshop/scramjet";
```

This is a no-op export that won't bundle Scramjet into your application.

### Bundled export

```javascript theme={null}
import "@mercuryworkshop/scramjet/bundled";
```

Use this to include the full Scramjet bundle with all dependencies.

### Path utilities

```javascript theme={null}
import { path } from "@mercuryworkshop/scramjet/path";
```

Provides utility functions for working with Scramjet paths and URLs.

<Tip>
  For most use cases, you'll want to load Scramjet via a script tag rather than bundling it directly. See the [quickstart guide](/quickstart) for the recommended setup.
</Tip>

## 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

<Note>
  Make sure these files are accessible from your web server at the paths you configure in your Scramjet initialization.
</Note>

## For development

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

<Steps>
  <Step title="Clone the repository">
    ```bash theme={null}
    git clone --recursive https://github.com/MercuryWorkshop/scramjet
    cd scramjet
    ```
  </Step>

  <Step title="Install dependencies">
    ```bash theme={null}
    pnpm install
    ```

    <Note>
      Scramjet development requires pnpm. The package includes a preinstall hook to enforce this.
    </Note>
  </Step>

  <Step title="Build the rewriter">
    ```bash theme={null}
    pnpm rewriter:build
    ```

    This requires:

    * `rustup`
    * `wasm-bindgen`
    * Binaryen's `wasm-opt`
    * The `wasm-snip` fork from r58Playz
  </Step>

  <Step title="Build Scramjet">
    ```bash theme={null}
    pnpm build
    ```
  </Step>

  <Step title="Run the dev server">
    ```bash theme={null}
    pnpm dev
    ```

    Scramjet will be running at [http://localhost:1337](http://localhost:1337) and will rebuild when files change.
  </Step>
</Steps>

## Next steps

Now that you have Scramjet installed, follow the [quickstart guide](/quickstart) to set up your first proxy.
