# Registry Configuration

## Example Configurations

### Basic Setup

examples/docs/general-registry-configuration/basic-setup.ts:

```ts
import { setup, actor } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });

const registry = setup({
  use: { myActor },
});
```

### Connecting to Rivet control plane

Environment-Variables:

```ts
import { setup, actor } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });

// Reads from RIVET_ENDPOINT, RIVET_TOKEN, and RIVET_NAMESPACE
const registry = setup({
  use: { myActor },
});
```

Config:

```ts
import { setup, actor } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });

const registry = setup({
  use: { myActor },
  endpoint: "https://api.rivet.dev",
  token: process.env.RIVET_TOKEN,
  namespace: "production",
});
```

## Starting Your App

After configuring your registry, start it:

registry.start():

```ts
import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

registry.start();
```

Serverless:

```ts
import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

export default registry.serve();
```

Serverless-with-Router:

```ts
import { Hono } from "hono";
import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

const app = new Hono();
app.all("/api/rivet/*", (c) => registry.handler(c.req.raw));

export default app;
```

Envoy:

```ts
import { actor, setup } from "rivetkit";

const myActor = actor({ state: {}, actions: {} });
const registry = setup({ use: { myActor } });

registry.startEnvoy();
```

See [Runtime Modes](/actors/docs/general/runtime-modes) for details on when to use each mode.

## Environment Variables

Many configuration options can be set via environment variables. See [Environment Variables](/actors/docs/general/environment-variables) for a complete reference.

## Configuration Reference

## Related

- [Actor Configuration](/actors/docs/general/actor-configuration): Configure individual actors
- [HTTP Server Setup](/actors/docs/general/http-server): Set up HTTP routing and middleware
