Skip to content

Commit bcdd45d

Browse files
Magmusacyczerwiukk
andauthored
Change all occurrences of previous sandbox/prod distinction to reflect our new model (#251)
## Description Documentation should now be up to date with our new changes made to room manager as well as web-client-sdk --------- Co-authored-by: adrian <33912477+czerwiukk@users.noreply.github.com>
1 parent ab560c4 commit bcdd45d

14 files changed

Lines changed: 171 additions & 107 deletions

docs/examples/react-native.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 0
88
_Runnable reference apps demonstrating common Fishjam use cases in React Native_
99

1010
Each example is a standalone Expo application you can run locally and use as a starting point for your own project.
11-
All examples use `@fishjam-cloud/react-native-client` and require a Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app).
11+
All examples use `@fishjam-cloud/react-native-client`. You need a Fishjam ID to connect to the media server, and a Sandbox API URL to create rooms and get peer tokens. Get your Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app), and your Sandbox API URL from the [Sandbox tab](https://fishjam.io/app/sandbox). See [What is the Sandbox API?](../explanation/sandbox-api-concept) for an in-depth explanation.
1212

1313
| Example | What it demonstrates |
1414
| ----------------------------------------- | --------------------------------------------------------------------- |

docs/examples/react.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar_position: 1
88
_Runnable reference apps demonstrating common Fishjam use cases in React_
99

1010
Each example is a standalone React application you can run locally and use as a starting point for your own project.
11-
All examples use `@fishjam-cloud/react-client` and require a Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app).
11+
All examples use `@fishjam-cloud/react-client`. You need a Fishjam ID to connect to the media server, and a Sandbox API URL to create rooms and get peer tokens. Get your Fishjam ID from the [Fishjam Dashboard](https://fishjam.io/app), and your Sandbox API URL from the [Sandbox tab](https://fishjam.io/app/sandbox). See [What is the Sandbox API?](../explanation/sandbox-api-concept) for an in-depth explanation.
1212

1313
| Example | What it demonstrates |
1414
| ----------------------------------- | ----------------------------------------------------------------------- |

docs/explanation/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ The ID of your Fishjam instance. It is used by your backend server to add peers
3636

3737
### Sandbox API
3838

39-
A simple testing API allowing you to test Fishjam features without requiring you to add any functionalities to your backend. As the name suggests, it's available **only** in the Sandbox environment. You can find more details [here](/how-to/backend/sandbox-api-testing).
39+
A simple testing API allowing you to test Fishjam features without requiring you to add any functionalities to your backend. It is intended for development and testing only, not for production use. You can find more details [here](/how-to/backend/sandbox-api-testing).

docs/explanation/sandbox-api-concept.mdx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ The Sandbox API is a development tool that simplifies getting started with Fishj
1010

1111
## What can the Sandbox API do?
1212

13-
The Sandbox API is an HTTP server that comes with Fishjam's Sandbox environment.
13+
The Sandbox API is an HTTP server provided by us for development and testing.
1414
It provides basic room creation and peer management functionality without requiring you to set up your own backend infrastructure.
1515

1616
### Key Characteristics
1717

1818
- **Development-purposed**: Designed for initial development and testing
1919
- **No authentication**: Simplified access for quick prototyping
20-
- **Sandbox-only**: Only available in the Sandbox environment
20+
- **Testing-only**: Not intended for production use; use your own authenticated backend for production
21+
22+
## Sandbox API URL and Fishjam ID
23+
24+
You can find your sandbox credentials in the [Sandbox tab](https://fishjam.io/app/sandbox) of the Fishjam Dashboard.
25+
26+
The **Sandbox API** is a hosted HTTP backend you can use to test Fishjam without writing your own server. It creates [**rooms**](../explanation/rooms) and **peers** for conferencing, and supports [**livestreaming**](../explanation/livestreams) by issuing the streamer and viewer credentials. It's an example implementation of what you need to build using our [**JavaScript server SDK**](../api/server) to go to production.
27+
28+
You can use your sandbox credentials by passing them to the `useSandbox` hook in the client SDK, which will create rooms and peer tokens for you, or by calling the Sandbox API URL directly from your client and using the returned `peerToken` to connect to Fishjam.
29+
30+
The **Fishjam ID** from the [Dashboard tab](https://fishjam.io/app) is passed to `FishjamProvider` so the client can connect to the Fishjam media server after it gets a peer token.
31+
32+
If your Sandbox API URL is exposed or your credentials are compromised, generate a new URL from the Sandbox tab to invalidate the old one. You can also disable the Sandbox API and enable it again when you want to resume sandbox testing.
33+
If you expose your Sandbox API URL in a public deployment, it can leak (for example through client code or network requests). Anyone who obtains that URL can create rooms and peers on your behalf.
2134

2235
## The Problem Sandbox API Solves
2336

docs/explanation/security-tokens.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Management tokens provide your backend server with administrative access to Fish
2929
- **Long-lived**: Management tokens remain valid until manually regenerated
3030
- **High privilege**: Management tokens allow performing administrative operations and should only be used in backend applications.
3131
- **Backend-only**: Management tokens should never be sent to client applications.
32-
- **Environment-specific**: There are different tokens for sandbox and production.
3332

3433
### What Management Tokens Can Do
3534

docs/how-to/backend/production-deployment.mdx

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ type: how-to
33
description: Deploy your Fishjam backend safely to production, moving from sandbox to a production-ready setup.
44
---
55

6-
import Tabs from "@theme/Tabs";
76
import TabItem from "@theme/TabItem";
7+
import Tabs from "@theme/Tabs";
88

99
# How to Deploy Fishjam to Production
1010

@@ -15,27 +15,29 @@ This guide covers the essential steps to move from development (using the Sandbo
1515
## Prerequisites
1616

1717
- Working Fishjam backend (see [Backend Quick Start](../../tutorials/backend-quick-start))
18-
- Production Fishjam environment (not Sandbox)
18+
- A Fishjam account on the **Standard Jar** plan (recommended for production deployments)
1919
- Domain and SSL certificates for your backend
2020
- Production database and infrastructure
2121

22-
## Step 1: Set up production Fishjam environment
22+
## Step 1: Get your Fishjam credentials
2323

24-
### Get production credentials
24+
### Get credentials from the dashboard
2525

2626
1. Log in to [Fishjam Dashboard](https://fishjam.io/app)
27-
2. Create or select your **Production** environment (not Sandbox)
28-
3. Copy your production **Fishjam ID** and **Management Token**
29-
4. Note: These are different from your sandbox credentials
27+
2. Copy your **Fishjam ID** and **Management Token** from the dashboard
28+
29+
:::tip
30+
The **Standard Jar** plan is recommended for production deployments. With the **Mini Jar** plan, you can still develop and test using the Sandbox API, but production deployments should use the Standard Jar plan to get full access and reliability guarantees.
31+
:::
3032

3133
### Environment variables setup
3234

33-
Create production environment variables:
35+
Create your environment variables:
3436

3537
```bash
36-
# Production Fishjam credentials
37-
FISHJAM_ID="your-production-fishjam-id"
38-
FISHJAM_MANAGEMENT_TOKEN="your-production-management-token"
38+
# Fishjam credentials
39+
FISHJAM_ID="your-fishjam-id"
40+
FISHJAM_MANAGEMENT_TOKEN="your-management-token"
3941

4042
# Your application settings
4143
NODE_ENV="production"
@@ -47,7 +49,7 @@ JWT_SECRET="your-secure-jwt-secret"
4749
CORS_ORIGIN="https://yourdomain.com"
4850
```
4951

50-
## Step 2: Implement proper authentication
52+
## Step 2: Replace Sandbox API with proper authentication
5153

5254
### Replace Sandbox API calls
5355

@@ -61,7 +63,8 @@ import express from "express";
6163
const authenticateUser = {} as any;
6264
const app = express();
6365

64-
const { getSandboxPeerToken } = useSandbox();
66+
const sandboxApiUrl = "your-sandbox-api-url-here";
67+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl });
6568

6669
const userToken = "";
6770
const roomName = "";

docs/how-to/backend/sandbox-api-testing.mdx

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ sidebar_position: 5
33
description: Use the Sandbox API to create rooms and peers for testing without setting up your own backend server.
44
---
55

6-
import Tabs from "@theme/Tabs";
76
import TabItem from "@theme/TabItem";
7+
import Tabs from "@theme/Tabs";
88

99
# Testing with the Sandbox API
1010

@@ -13,16 +13,20 @@ The Sandbox API is a development tool that lets you create rooms and peers for t
1313
## Prerequisites
1414

1515
- Access to [Fishjam Dashboard](https://fishjam.io/app)
16-
- A Sandbox environment set up
1716

18-
## Step 1: Get your Fishjam ID
17+
## Step 1: Get your Fishjam ID and Sandbox API URL
1918

2019
1. Log in to [Fishjam Dashboard](https://fishjam.io/app)
21-
2. Navigate to your [Sandbox Environment](https://fishjam.io/app/sandbox)
20+
2. Navigate to the [Sandbox tab](https://fishjam.io/app/sandbox)
2221
3. Copy your **Fishjam ID**
22+
4. In the **Sandbox API** section, copy your **Sandbox API URL**
2323

2424
:::note
25-
`FISHJAM_ID` is your unique sandbox identifier. Anyone who knows this ID can join your rooms, so keep it secure during development.
25+
You need both values for React/React Native apps:
26+
27+
- `Sandbox API url` is used to call the Sandbox API to create test rooms and return peer tokens.
28+
- `Fishjam ID` is passed to `FishjamProvider` so the client can connect to the Fishjam media server after it gets a peer token.
29+
2630
:::
2731

2832
## Step 2: Create a room and get peer tokens
@@ -41,8 +45,8 @@ The Sandbox API is a development tool that lets you create rooms and peers for t
4145

4246
// ...
4347

44-
// fishjamId is provided through FishjamProvider
45-
const { getSandboxPeerToken } = useSandbox();
48+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
49+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
4650
const peerToken = await getSandboxPeerToken(roomName, peerName);
4751
```
4852

@@ -51,15 +55,15 @@ The Sandbox API is a development tool that lets you create rooms and peers for t
5155
<TabItem value="react" label="React">
5256

5357
```ts
54-
const FISHJAM_ID = "...";
5558
const roomName = "testRoom";
5659
const peerName = "testUser";
5760
// ---cut---
5861
import { useSandbox } from '@fishjam-cloud/react-client';
5962

6063
// ...
6164

62-
const { getSandboxPeerToken } = useSandbox();
65+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
66+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
6367
const peerToken = await getSandboxPeerToken(roomName, peerName);
6468
```
6569

@@ -78,7 +82,7 @@ The Sandbox API is a development tool that lets you create rooms and peers for t
7882
### Room types available
7983

8084
- `conference` - For video/audio conferencing (default)
81-
- `audio-only` - For audio-only conferencing
85+
- `audio_only` - For audio-only conferencing
8286
- `livestream` - For one-to-many video/audio streaming
8387

8488
## Step 3: Handle the response
@@ -88,7 +92,6 @@ The Sandbox API returns a JSON response with connection details:
8892
```json
8993
{
9094
"peerToken": "<PEER_TOKEN>",
91-
"url": "wss://fishjam.io/api/v1/connect/${YOUR_APP_UUID}",
9295
"room": {
9396
"id": "<ROOM_ID>",
9497
"name": "foo"
@@ -114,6 +117,7 @@ Below are examples on how to use tokens from the Sandbox API in your frontend ap
114117
const roomName = "testRoom";
115118
const peerName = `user_${Date.now()}`;
116119
const FISHJAM_ID = "...";
120+
const SANDBOX_API_URL = "...";
117121

118122
const RoomView = (props: {peerToken: string}) => null;
119123
// ---cut---
@@ -122,7 +126,7 @@ Below are examples on how to use tokens from the Sandbox API in your frontend ap
122126
export default function TestScreen() {
123127
const [peerToken, setPeerToken] = useState<string | null>(null);
124128
// fishjamId is provided through FishjamProvider
125-
const { getSandboxPeerToken } = useSandbox();
129+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
126130

127131
useEffect(() => {
128132
const fetchPeerToken = async () => {
@@ -154,13 +158,14 @@ Below are examples on how to use tokens from the Sandbox API in your frontend ap
154158
```tsx
155159
import React, { useState, useEffect } from "react";
156160

157-
const FISHJAM_ID = "your-app-uuid-here";
161+
const FISHJAM_ID = "your-fishjam-id-here";
162+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
158163
// ---cut---
159164
import { FishjamProvider, useConnection, useSandbox } from "@fishjam-cloud/react-client";
160165

161166
function VideoCallComponent() {
162167
const { joinRoom, peerStatus } = useConnection();
163-
const { getSandboxPeerToken } = useSandbox();
168+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
164169

165170
const handleJoinRoom = async () => {
166171
const roomName = "testRoom";
@@ -201,9 +206,10 @@ Below are examples on how to use tokens from the Sandbox API in your frontend ap
201206

202207
```ts
203208
import { useSandbox } from "@fishjam-cloud/react-client";
204-
const { getSandboxPeerToken } = useSandbox();
209+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
210+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
205211
// ---cut---
206-
const audioOnlyUrl = await getSandboxPeerToken(
212+
const audioOnlyPeerToken = await getSandboxPeerToken(
207213
"audioTest",
208214
"user1",
209215
"audio_only",
@@ -214,15 +220,18 @@ const audioOnlyUrl = await getSandboxPeerToken(
214220

215221
```ts
216222
import { useSandbox } from "@fishjam-cloud/react-client";
217-
const { getSandboxLivestream, getSandboxViewerToken } = useSandbox();
223+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
224+
const { getSandboxLivestream, getSandboxViewerToken } = useSandbox({
225+
sandboxApiUrl: SANDBOX_API_URL,
226+
});
218227
// ---cut---
219228

220229
const livestreamName = "livestream1";
221230
// For the streamer
222-
const streamerUrl = await getSandboxLivestream(livestreamName);
231+
const streamerData = await getSandboxLivestream(livestreamName);
223232

224233
// For viewers, you need a viewer token (different endpoint)
225-
const viewerTokenUrl = await getSandboxViewerToken(livestreamName);
234+
const viewerToken = await getSandboxViewerToken(livestreamName);
226235
```
227236

228237
## Step 6: Handle multiple peers
@@ -231,7 +240,8 @@ To test with multiple participants, create multiple peer tokens with different p
231240

232241
```ts
233242
import { useSandbox } from "@fishjam-cloud/react-client";
234-
const { getSandboxPeerToken } = useSandbox();
243+
const SANDBOX_API_URL = "your-sandbox-api-url-here";
244+
const { getSandboxPeerToken } = useSandbox({ sandboxApiUrl: SANDBOX_API_URL });
235245
// ---cut---
236246
// First peer
237247
const peer1Response = await getSandboxPeerToken("multiTest", "alice");
@@ -278,37 +288,36 @@ const roomName = `livestream-demo`;
278288

279289
### Issue: Connection failures
280290

281-
**Problem**: Invalid Fishjam ID or network issues.
291+
**Problem**: Invalid Fishjam ID, invalid Sandbox API URL, disabled Sandbox API, or network issues.
282292

283293
**Solution**:
284294

285-
1. Verify your Fishjam ID in the Fishjam Dashboard
286-
2. Check network connectivity
287-
3. Ensure you're using the sandbox environment
295+
1. Verify your Fishjam ID in the Fishjam Dashboard.
296+
2. Verify your Sandbox API URL in the [Sandbox tab](https://fishjam.io/app/sandbox).
297+
3. Make sure the Sandbox API is enabled.
298+
4. Check network connectivity.
288299

289300
## Security reminder
290301

291302
:::danger
292303
**The Sandbox API is not safe for production!**
293304

294305
- No authentication required
295-
- Anyone with your Fishjam ID can join rooms
306+
- Anyone with your Sandbox API URL can create rooms and peer tokens
296307
- Identical room/peer names get the same tokens
297308
- No rate limiting or abuse protection
298309

299310
Only use the Sandbox API for development and testing.
300311
:::
301312

302-
## Resetting your app
303-
304-
If you need to reset your Sandbox API:
313+
## Managing your Sandbox API
305314

306-
1. Go to [Fishjam Dashboard](https://fishjam.io/app/sandbox)
307-
2. Click **Settings**
308-
3. Click **Reset App**
309-
4. Get your new Fishjam ID
315+
Manage the Sandbox API from the [Sandbox tab](https://fishjam.io/app/sandbox):
310316

311-
This will invalidate all existing tokens (including the management token!) and give you a fresh sandbox environment.
317+
- If your Sandbox API URL is exposed or credentials are compromised, click **Generate new URL**. This invalidates the old URL.
318+
- If you want to stop using it, click **Disable Sandbox API**.
319+
- When you want to use it again, click **Enable Sandbox API**.
320+
Your `FISHJAM_ID` is still required by `FishjamProvider` to connect to the Fishjam media server. The Sandbox API URL is only used to request test room and peer tokens.
312321

313322
## Next steps
314323

0 commit comments

Comments
 (0)