Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Cloudflare platform skill covering Workers, D1, R2, KV, AI, Durable Objects, and security.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/realtimekit/configuration.md
1# RealtimeKit Configuration23Configuration guide for RealtimeKit setup, client SDKs, and wrangler integration.45## Installation67### React8```bash9npm install @cloudflare/realtimekit @cloudflare/realtimekit-react-ui10```1112### Angular13```bash14npm install @cloudflare/realtimekit @cloudflare/realtimekit-angular-ui15```1617### Web Components/HTML18```bash19npm install @cloudflare/realtimekit @cloudflare/realtimekit-ui20```2122## Client SDK Configuration2324### React UI Kit25```tsx26import { RtkMeeting } from '@cloudflare/realtimekit-react-ui';27<RtkMeeting authToken="<token>" onLeave={() => {}} />28```2930### Angular UI Kit31```typescript32@Component({ template: `<rtk-meeting [authToken]="authToken" (rtkLeave)="onLeave($event)"></rtk-meeting>` })33export class AppComponent { authToken = '<token>'; onLeave() {} }34```3536### Web Components37```html38<script type="module" src="https://cdn.jsdelivr.net/npm/@cloudflare/realtimekit-ui/dist/realtimekit-ui/realtimekit-ui.esm.js"></script>39<rtk-meeting id="meeting"></rtk-meeting>40<script>41document.getElementById('meeting').authToken = '<token>';42</script>43```4445### Core SDK Configuration46```typescript47import RealtimeKitClient from '@cloudflare/realtimekit';4849const meeting = new RealtimeKitClient({50authToken: '<token>',51video: true, audio: true, autoSwitchAudioDevice: true,52mediaConfiguration: {53video: { width: { ideal: 1280 }, height: { ideal: 720 }, frameRate: { ideal: 30 } },54audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true },55screenshare: { width: { max: 1920 }, height: { max: 1080 }, frameRate: { ideal: 15 } }56}57});58await meeting.join();59```6061## Backend Setup6263### Create App & Credentials6465**Dashboard**: https://dash.cloudflare.com/?to=/:account/realtime/kit6667**API**:68```bash69curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<account_id>/realtime/kit/apps' \70-H 'Content-Type: application/json' \71-H 'Authorization: Bearer <api_token>' \72-d '{"name": "My RealtimeKit App"}'73```7475**Required Permissions**: API token with **Realtime / Realtime Admin** permissions7677### Create Presets7879```bash80curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<account_id>/realtime/kit/<app_id>/presets' \81-H 'Authorization: Bearer <api_token>' \82-d '{83"name": "host",84"permissions": {85"canShareAudio": true,86"canShareVideo": true,87"canRecord": true,88"canLivestream": true,89"canStartStopRecording": true90}91}'92```9394## Wrangler Configuration9596### Basic Configuration97```jsonc98// wrangler.jsonc99{100"name": "realtimekit-app",101"main": "src/index.ts",102"compatibility_date": "2025-01-01", // Use current date103"vars": {104"CLOUDFLARE_ACCOUNT_ID": "abc123",105"REALTIMEKIT_APP_ID": "xyz789"106}107// Secrets: wrangler secret put CLOUDFLARE_API_TOKEN108}109```110111### With Database & Storage112```jsonc113{114"d1_databases": [{ "binding": "DB", "database_name": "meetings", "database_id": "d1-id" }],115"r2_buckets": [{ "binding": "RECORDINGS", "bucket_name": "recordings" }],116"kv_namespaces": [{ "binding": "SESSIONS", "id": "kv-id" }]117}118```119120### Multi-Environment121```bash122# Deploy to environments123wrangler deploy --env staging124wrangler deploy --env production125```126127## TURN Service Configuration128129RealtimeKit can use Cloudflare's TURN service for connectivity through restrictive networks:130131```jsonc132// wrangler.jsonc133{134"vars": {135"TURN_SERVICE_ID": "your_turn_service_id"136}137// Set secret: wrangler secret put TURN_SERVICE_TOKEN138}139```140141TURN automatically configured when enabled in account - no client-side changes needed.142143## Theming & Design Tokens144145```typescript146import type { UIConfig } from '@cloudflare/realtimekit';147148const uiConfig: UIConfig = {149designTokens: {150colors: {151brand: { 500: '#0066ff', 600: '#0052cc' },152background: { 1000: '#1A1A1A', 900: '#2D2D2D' },153text: { 1000: '#FFFFFF', 900: '#E0E0E0' }154},155borderRadius: 'extra-rounded', // 'rounded' | 'extra-rounded' | 'sharp'156theme: 'dark' // 'light' | 'dark'157},158logo: { url: 'https://example.com/logo.png', altText: 'Company' }159};160161// Apply to React162<RtkMeeting authToken={token} config={uiConfig} onLeave={() => {}} />163164// Or use CSS variables165// :root { --rtk-color-brand-500: #0066ff; --rtk-border-radius: 12px; }166```167168## Internationalization (i18n)169170### Custom Language Strings171```typescript172import { useLanguage } from '@cloudflare/realtimekit-ui';173174const customLanguage = {175'join': 'Entrar',176'leave': 'Salir',177'mute': 'Silenciar',178'unmute': 'Activar audio',179'turn_on_camera': 'Encender cámara',180'turn_off_camera': 'Apagar cámara',181'share_screen': 'Compartir pantalla',182'stop_sharing': 'Dejar de compartir'183};184185const t = useLanguage(customLanguage);186187// React usage188<RtkMeeting authToken={token} t={t} onLeave={() => {}} />189```190191### Supported Locales192Default locales available: `en`, `es`, `fr`, `de`, `pt`, `ja`, `zh`193194```typescript195import { setLocale } from '@cloudflare/realtimekit-ui';196setLocale('es'); // Switch to Spanish197```198199## See Also200201- [API](./api.md) - Meeting APIs, REST endpoints202- [Patterns](./patterns.md) - Backend integration examples203- [README](./README.md) - Overview and quick start204