Skip to content

Setup Environment

Prerequisites

  • Basic knowledge of Rust programming language and Cargo.
  • Basic knowledge of Makefile.
  • Basic knowledge of Docker.
  • Basic knowledge of TypeScript and Node.js.

Node.js Setup

Install Node.js and npm

To install Node.js and npm, follow these steps:

  1. Visit the Node.js download page and download the LTS version for your operating system.
  2. Run the installer and follow the setup instructions.
  3. Ensure that you check the option to install npm along with Node.js.

Verify Installation

After installation, verify Node.js, npm, and npx are properly installed:

node --version
npm --version
npx --version    # npx comes with npm 5.2.0+

About npx

  • npx comes bundled with npm version 5.2.0 and higher
  • If npx command is not found, update npm:
    npm install -g npm@latest
    
  • Or install npx explicitly:
    npm install -g npx
    

Note for Windows Users

If you encounter issues with permissions or paths, consider using nvm-windows to manage Node.js versions.

Using nvm for Node.js

If you prefer using a version manager, you can use nvm (Node Version Manager):

  • For macOS/Linux:

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    source ~/.bashrc
    nvm install --lts
    

  • For Windows, use nvm-windows and follow the installation instructions on the GitHub page.

Package Manager Installation

If you need to install package managers first:

Rust Setup

Install Rust

If you haven't installed Rust, you can install it using rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Verify Installation

After installation, verify Rust and Cargo are properly installed:

rustc --version
cargo --version

Note for Windows Users

If you're using Windows, we recommend:

  1. Using Windows Subsystem for Linux (WSL)
  2. Or installing Rust through the official installer from rustup.rs

Optional: IDE Setup

We recommend using VS Code with the following extensions:

  • rust-analyzer
  • Even Better TOML
  • CodeLLDB

WebAssembly Tools Setup

Install wasm-pack

Install wasm-pack

wasm-pack is a tool for building Rust-generated WebAssembly packages.

# Install wasm-pack using Cargo
cargo install wasm-pack

Verify Installation

After installation, verify wasm-pack is properly installed:

wasm-pack --version

Install wasm-opt

Install wasm-opt

You can install wasm-opt using Cargo:

cargo install wasm-opt

Alternatively, you can install it as part of the Binaryen toolkit:

  1. Download from GitHub
  2. Extract and add to PATH:
wget https://github.com/WebAssembly/binaryen/releases/download/version_109/binaryen-version_109-x86_64-linux.tar.gz
tar -xzf binaryen-version_109-x86_64-linux.tar.gz
export PATH=$PATH:$(pwd)/binaryen-version_109/bin

Verify Installation

After installation, verify wasm-opt is properly installed:

wasm-opt --version

Install Make

Linux/macOS Users

For Unix-based systems, Make is usually pre-installed. If not:

Ubuntu/Debian:

sudo apt update
sudo apt install build-essential

macOS:

xcode-select --install

Windows Setup for Make

Windows users have several options:

  1. Using Chocolatey (Recommended):

    choco install make
    

  2. Using MSYS2:

    # First install MSYS2 from https://www.msys2.org/
    # Then open MSYS2 terminal and run:
    pacman -S make
    

  3. Using WSL (Best Option):

    # Install WSL first
    wsl --install
    
    # After WSL is installed, open Ubuntu terminal and run:
    sudo apt update
    sudo apt install build-essential
    

Verify Installation

After installation, verify Make is properly installed:

make --version

Package Manager Installation

If you need to install package managers first:

After installing the package manager, make sure you correctly setup the environment variables for the package manager.

Docker Setup

Install Docker

Choose your operating system and follow the installation steps:

  1. For Ubuntu/Debian:

    # Remove old versions
    sudo apt-get remove docker docker-engine docker.io containerd runc
    
    # Install dependencies
    sudo apt-get update
    sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
    
    # Add Docker's official GPG key
    sudo mkdir -m 0755 -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    
    # Set up the repository
    echo \
        "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
        $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
    # Install Docker Engine
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    

  2. For macOS:

    • Download Docker Desktop for Mac
    • Double-click the downloaded .dmg file and drag Docker to Applications
    • Start Docker from Applications
  3. For Windows:

Verify Installation

After installation, verify Docker is properly installed:

docker --version
docker compose version

Post-installation Steps

To use Docker without sudo (Linux):

# Create docker group
sudo groupadd docker

# Add your user to docker group
sudo usermod -aG docker $USER

# Apply new group membership (or log out and back in)
newgrp docker

Test Docker Installation

Run a test container:

docker run hello-world