Skip to content

Commit 5c202b8

Browse files
committed
chore: update readme
1 parent 57923cb commit 5c202b8

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ yarn add replane-sdk
2828

2929
## Quick start
3030

31+
> **Important:** Each API key is tied to a specific project. The client can only access configs from the project that the API key belongs to. If you need to access configs from multiple projects, create separate API keys and initialize separate clients for each project.
32+
3133
```ts
3234
import { createReplaneClient } from "replane-sdk";
3335

3436
const client = createReplaneClient({
35-
apiKey: process.env.REPLANE_API_KEY!,
37+
apiKey: process.env.REPLANE_API_KEY!, // API key for a specific project
3638
baseUrl: "https://api.my-replane-host.com",
3739
});
3840

@@ -81,7 +83,7 @@ Returns an object: `{ getConfigValue, watchConfigValue, close }`.
8183
#### Options
8284

8385
- `baseUrl` (string) – API origin (no trailing slash needed).
84-
- `apiKey` (string) – API key for authorization. Required.
86+
- `apiKey` (string) – API key for authorization. Required. **Note:** Each API key is tied to a specific project and can only access configs from that project.
8587
- `fetchFn` (function) – custom fetch (e.g. `undici.fetch` or mocked fetch in tests).
8688
- `timeoutMs` (number) – abort the request after N ms. Default: 2000.
8789
- `retries` (number) – number of retry attempts on failures (5xx or network errors). Default: 2.
@@ -212,6 +214,25 @@ const client = createReplaneClient({
212214
});
213215
```
214216

217+
Multiple projects:
218+
219+
```ts
220+
// Each project needs its own API key and client instance
221+
const projectAClient = createReplaneClient({
222+
apiKey: process.env.PROJECT_A_API_KEY!,
223+
baseUrl: "https://api.my-replane-host.com",
224+
});
225+
226+
const projectBClient = createReplaneClient({
227+
apiKey: process.env.PROJECT_B_API_KEY!,
228+
baseUrl: "https://api.my-replane-host.com",
229+
});
230+
231+
// Each client only accesses configs from its respective project
232+
const featureA = await projectAClient.getConfigValue("feature-flag");
233+
const featureB = await projectBClient.getConfigValue("feature-flag");
234+
```
235+
215236
## Roadmap
216237

217238
- Config caching

0 commit comments

Comments
 (0)