# Run an index

> Run your own index of the Tangled network.

The index is `bobbin`, the service behind the [Tangled API](/docs/api/bobbin/). It keeps everything in memory and rebuilds it from a [hydrant](https://tangled.org/ptr.pet/hydrant) stream on every start, so it needs no database. It also needs a slingshot for records and identities.

Build it:

```sh
nix build .#bobbin
```

Configure it with environment variables:

| Variable                 | Value                                                                                   |
| ------------------------ | --------------------------------------------------------------------------------------- |
| `BOBBIN_SERVICE_DID`     | Required. The index’s own DID, for example `did:web:index.example.com`.                 |
| `BOBBIN_HYDRANT_URL`     | Your hydrant, for example `wss://hydrant.example.com`.                                  |
| `BOBBIN_SLINGSHOT_URL`   | Your slingshot. Hydrant serves this too, so it is often the same host.                  |
| `BOBBIN_MIRROR_URL`      | Your knotmirror. Without it, repository pages have no code.                             |
| `BOBBIN_BIND`            | Address to listen on. Defaults to `127.0.0.1:8090`.                                     |
| `BOBBIN_CORS_ORIGINS`    | Origins of the web apps that call the index, for example `https://tangled.example.com`. |
| `BOBBIN_TRUSTED_PROXIES` | IPs or CIDRs of your reverse proxy, so knots rate-limit per visitor.                    |

Every other setting is optional. `bobbin config-template` prints all of them with their defaults, and you can put them in a TOML file passed with `--config` instead. Check the configuration, then start it:

```sh
./result/bin/bobbin validate
./result/bin/bobbin
```

Put a reverse proxy in front of it for TLS.