Skip to content

Getting Started

Snakeway is a programmable traffic control engine that sits in front of your services and executes a configurable pipeline of logic on every request and response.

At its core, Snakeway answers a simple question:

“What should happen to this request before, during, and after it reaches an upstream service?”

Snakeway lets you answer that question with devices - small, composable units of logic that can observe, mutate, short-circuit, or enrich traffic as it flows through the system.

Snakeway is a modern, high-performance edge proxy built on Rust and Pingora. Getting it running on your local machine is straightforward, whether you’re building from source or using a pre-compiled binary.

To build Snakeway from source, you will need the Rust toolchain installed. If you don’t have it yet, you can install it via rustup.

Once Rust is ready, clone the Snakeway repository and build the project using Cargo:

Terminal window
git clone https://github.com/snakewayhq/snakeway.git
cd snakeway
cargo build --release -p snakeway

After the build completes, you’ll find the snakeway binary in the target/release directory.

The best way to understand Snakeway is to see it in action. In this guide, we’ll walk through setting up a minimal proxy that forwards traffic to a public API.

The snakeway binary is a self-contained executable. However, it expects a configuration directory to be present to define its behavior. By default, it looks for a directory named config in the current working directory.

Generate a Snakeway configuration directory called “my-first-proxy” using the httpbin template:

Terminal window
snakeway config init ./my-first-proxy --template=httpbin

You should now see a directory structure that looks like this:

Terminal window
my-first-proxy
├── device.d
└── identity.hcl
├── ingress.d
└── httpbin.hcl
└── snakeway.hcl

Run Snakeway, pointing it to your new configuration directory:

Terminal window
snakeway run --config ./my-first-proxy

Finally, open a new terminal and send a request to your local proxy:

Terminal window
curl -i http://localhost:8080/get

You should see a successful response from httpbin.org, served through your local Snakeway instance!

HTTP/1.1 200 OK
Content-Type: application/json
...
{
"args": {},
"headers": {
"Host": "httpbin.org",
...
},
"url": "https://httpbin.org/get"
}

Congratulations! You’ve just configured and launched your first Snakeway proxy. From here, you can begin exploring more advanced features like Devices, Devices, and Static File Serving.