---
title: How to run the Unleash Proxy
---

The [Unleash Proxy](../sdks/unleash-proxy.md) provides a way for you to consume feature toggles in [front-end clients](../sdks/index.md#front-end-sdks), such as the [JavaScript Proxy client](../sdks/proxy-javascript.md) and [React Proxy client](../sdks/proxy-react.md).

Depending on your setup, the Proxy is most easily run in one of two ways, depending on your situation:
- Run the proxy via Docker
- Run the proxy as a Node.js app

If you're using a hosted version of Unleash, we can also run the proxy for you if you'd rather not run it yourself.

## Prerequisites

This is what you need to do before you can run the proxy

- A running Unleash server to connect to
- A client API token for the proxy to use.
- if you're running the Proxy via Docker: [the `docker` command line tool](https://www.docker.com/)
- If you're running the Proxy as a Node.js app: [Node.js and its command line tools](https://nodejs.org/).

## How to run the Proxy via Docker

The easiest way to run Unleash is via Docker. We have published a [docker image on docker hub](https://hub.docker.com/r/unleashorg/unleash-proxy).

### 1. Pull the Proxy image

   ```bash
   docker pull unleashorg/unleash-proxy
   ```

### 2. Start the proxy

   ```bash
   docker run \
      -e UNLEASH_PROXY_CLIENT_KEYS=some-secret \
      -e UNLEASH_URL='https://app.unleash-hosted.com/demo/api/' \
      -e UNLEASH_API_TOKEN=56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d \
      -p 3000:3000 \
      unleashorg/unleash-proxy
   ```

You should see the following output:

   ```bash
   Unleash-proxy is listening on port 3000!
   ```

## How to run the Proxy as a Node.js app

To run the Proxy via Node.js, you'll have to create your own Node.js project and use the Unleash Proxy as a dependency. Assuming you've already set up your project, here's the steps to take to start the proxy as part of your app:

### 1. Install the Unleash Proxy package

   ``` shell npm2yarn
   npm install @unleash/proxy
   ```

### 2. Initialize and start the proxy in your code.

A fully working sample app that uses the proxy:

   ``` js
   const port = 3000;

   const { createApp } = require('@unleash/proxy');

   const app = createApp({
       unleashUrl: 'https://app.unleash-hosted.com/demo/api/',
       unleashApiToken: '56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d',
       clientKeys: ['some-secret', 'another-proxy-secret', 's1'],
       refreshInterval: 1000,
   });

   app.listen(port, () =>
       console.log(`Unleash Proxy listening on http://localhost:${port}/proxy`),
   );
   ```

## Verify that the proxy is working

In order to verify the proxy you can use curl and see that you get a few evaluated feature toggles back. Assuming that the proxy is running on port 3000 and that your proxy client key is `some-secret`, you could run this command :

```bash
curl http://localhost:3000/proxy -H "Authorization: some-secret"
```

Check the reference docs for API return values
