Skip to content

Commit da6d6e6

Browse files
Copilotjog1t
andcommitted
docs: document unified endpoint format in connect-backend guide
Co-authored-by: jog1t <39823706+jog1t@users.noreply.github.com>
1 parent 30b277d commit da6d6e6

1 file changed

Lines changed: 79 additions & 14 deletions

File tree

website/src/content/docs/self-hosting/connect-backend.mdx

Lines changed: 79 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,65 @@ Once connected:
2323

2424
## Environment Variables
2525

26-
### `RIVET_ENGINE`
27-
The endpoint of your Rivet Engine instance.
26+
RivetKit supports two formats for configuration:
27+
28+
1. **Unified Endpoint Format** (Recommended): Embed namespace and token in the endpoint URL
29+
2. **Separate Variables**: Use individual environment variables for each config
30+
31+
### Unified Endpoint Format (Recommended)
32+
33+
The unified format allows you to specify the endpoint, namespace, and token in a single URL using HTTP Basic Auth syntax:
34+
35+
```bash
36+
# Format: https://namespace:token@endpoint
37+
RIVET_ENDPOINT=https://my-namespace:pub_abc123@api.rivet.dev
38+
```
39+
40+
This format is more concise and reduces configuration complexity. The namespace and token are automatically extracted from the URL.
41+
42+
### Separate Variables
43+
44+
You can also use separate environment variables:
45+
46+
```bash
47+
RIVET_ENDPOINT=https://api.rivet.dev
48+
RIVET_NAMESPACE=my-namespace
49+
RIVET_TOKEN=pub_abc123
50+
```
51+
52+
<Note>
53+
Both formats are supported. Choose the one that works best for your deployment workflow.
54+
</Note>
55+
56+
### Configuration Details
57+
58+
### `RIVET_ENDPOINT` or `RIVET_ENGINE`
59+
The endpoint of your Rivet Engine instance. Can include namespace and token in unified format.
2860

2961
```bash
30-
# Local development
62+
# Unified format (recommended)
63+
RIVET_ENDPOINT=https://my-namespace:pub_abc123@api.rivet.dev
64+
65+
# Or separate endpoint only
66+
RIVET_ENDPOINT=https://api.rivet.dev
67+
68+
# Legacy alias (still supported)
3169
RIVET_ENGINE=http://localhost:6420
70+
```
71+
72+
### `RIVET_TOKEN`
73+
Authentication token for accessing the Rivet Engine (when not using unified endpoint format).
3274

33-
# Production
34-
RIVET_ENGINE=https://engine.your-domain.com
75+
```bash
76+
# Client/publishable token (safe for frontend)
77+
RIVET_TOKEN=pub_abc123
78+
79+
# Runner/secret token (backend only)
80+
RIVET_TOKEN=sec_xyz789
3581
```
3682

3783
### `RIVET_NAMESPACE`
38-
The namespace to run actors in. Useful for multi-tenant deployments.
84+
The namespace to run actors in (when not using unified endpoint format). Useful for multi-tenant deployments.
3985

4086
```bash
4187
RIVET_NAMESPACE=production
@@ -61,26 +107,45 @@ RIVET_RUNNER_KEY=unique-runner-key-123
61107

62108
## Connection Examples
63109

64-
### Testing Setup
110+
### Local Development (No Engine)
65111

66-
You do not need the engine for local development, but it can be helpful for testing your production-readiness:
112+
You do not need the engine for local development:
113+
114+
```bash
115+
npm run dev
116+
```
117+
118+
### Local Development (With Engine)
119+
120+
For testing production-readiness:
67121

68122
```bash
69123
# Start the engine
70124
docker run -p 6420:6420 rivetkit/engine
71125

72-
# In another terminal, start your runner
73-
RIVET_ENGINE=http://localhost:6420 npm run dev
126+
# In another terminal, start your runner with unified endpoint
127+
RIVET_ENDPOINT=http://default:your-token@localhost:6420 npm run dev
128+
129+
# Or with separate variables
130+
RIVET_ENDPOINT=http://localhost:6420 \
131+
RIVET_NAMESPACE=default \
132+
RIVET_TOKEN=your-token \
133+
npm run dev
74134
```
75135

76136
### Production Setup
77137

78138
```bash
79-
# Assume the engine is running at 1.2.3.4
139+
# With unified endpoint (recommended)
140+
RIVET_ENDPOINT=https://my-namespace:pub_abc123@api.rivet.dev \
141+
RIVET_RUNNER=worker-$(hostname) \
142+
RIVET_RUNNER_KEY=$(cat /etc/machine-id) \
143+
npm run start
80144

81-
# On runner nodes
82-
RIVET_ENGINE=http://1.2.3.4 \
83-
RIVET_NAMESPACE=production \
145+
# Or with separate variables
146+
RIVET_ENDPOINT=https://api.rivet.dev \
147+
RIVET_NAMESPACE=my-namespace \
148+
RIVET_TOKEN=pub_abc123 \
84149
RIVET_RUNNER=worker-$(hostname) \
85150
RIVET_RUNNER_KEY=$(cat /etc/machine-id) \
86151
npm run start

0 commit comments

Comments
 (0)