Skip to content

Client SDK Demo

Doug Fennell edited this page Sep 26, 2025 · 1 revision

Client SDK Demo

This page shows how to run the demo app and exercise it using the @rdcp.dev/client SDK.

Prerequisites

  • Node 18+
  • Demo app running locally
npm run dev --prefix packages/rdcp-demo-app

Environment

The scripts read these env vars when present:

  • RDCP_BASE_URL (default: http://localhost:3000)
  • RDCP_AUTH_METHOD = api-key | bearer
  • RDCP_CLIENT_ID (default: demo-client)
  • RDCP_API_KEY (when api-key)
  • RDCP_BEARER_TOKEN (when bearer)

Scripts

  • Client demo flows
npm run demo:client
  • Auth examples (Basic and Bearer)
npm run demo:client:auth
  • Benchmark: client vs direct fetch
npm run demo:benchmark

Node example

import { createRDCPClient } from '@rdcp.dev/client'
import { RDCP_HEADERS } from '@rdcp.dev/core'

const rdcp = createRDCPClient({
  baseUrl: 'http://localhost:3000',
  headers: {
    [RDCP_HEADERS.AUTH_METHOD]: 'api-key',
    [RDCP_HEADERS.CLIENT_ID]: 'demo-client',
    'x-api-key': process.env.RDCP_API_KEY!,
  },
})

await rdcp.getDiscovery()
await rdcp.getStatus()
await rdcp.postControl({ action: 'enable', categories: ['API_ROUTES'] })
await rdcp.getHealth()
Clone this wiki locally