# Overview

> What Relay and Switchboard are, and how a publisher, a viewer and your backend fit together.

URL: https://www.caprid.com/docs/getting-started/

Caprid is two services and the SDKs that talk to them.

- **Relay** is Mux's Media over QUIC (MoQ) relay network. Clients connect to a relay to publish tracks
  and to subscribe to them. A track is a sequence of objects, and the relays carry them from a
  publisher to every subscriber, across regions. The payloads are bytes the relay doesn't interpret,
  so a track can carry video, audio, captions, chat, or game state.
- **Switchboard** is the control plane. It owns your Organization and its Namespaces, issues the
  keys your backend signs Client tokens with, and decides, for every session on every relay,
  whether it may start and what it may do.
- **The Relay SDKs** connect your code to a relay: [`@caprid/relay`](https://www.caprid.com/docs/sdks/typescript/) for browsers
  and Node, and [`caprid-relay`](https://www.caprid.com/docs/sdks/python/) for Python asyncio. They share one
  [specification](https://www.caprid.com/docs/spec/), so both behave the same way.

## How the pieces fit

```
                 ┌──────────────── Switchboard ────────────────┐
  your backend ──┤ API key: manage Namespaces, Signing keys    │
                 │ Admission: may this session start?          │
                 └──────────────────────▲──────────────────────┘
                                        │
  publisher ──── Client token ──────► relay ◄────── Client token ──── viewer
  (SDK)                              (Relay)                          (SDK)
```

1. Your **backend** holds an [API key](https://www.caprid.com/docs/guides/credentials/#api-keys) and a
   [Signing key](https://www.caprid.com/docs/guides/credentials/#signing-keys). It never ships either to a browser or app.
2. For each publisher or viewer, your backend mints a short-lived
   [Client token](https://www.caprid.com/docs/guides/credentials/#client-tokens): a JWT saying which paths under your
   Namespace it may publish to (`put`) and subscribe to (`get`).
3. The **Client** (your web page, app, or service, using an SDK) connects to a relay with that token.
   The relay asks Switchboard to admit the session, then enforces the token's grant on every request.
4. Publishers announce a namespace and write objects to tracks; subscribers subscribe to tracks and
   receive the objects.

The SDK guides call the token a "Relay JWT". It's the same Client token: the SDKs consume it, and
Switchboard (or your own backend, with a Signing key) issues it.

## Pick a path

- **Try it end to end.** The [Quickstart](https://www.caprid.com/docs/getting-started/quickstart/) goes from an API key to an
  object published and received.
- **Wire up your backend.** [Credentials](https://www.caprid.com/docs/guides/credentials/) covers every key and token, and
  [Prod and staging](https://www.caprid.com/docs/guides/prod-and-staging/) how to keep them apart. The
  [Account API reference](https://www.caprid.com/docs/reference/http/account/) has every route.
- **Build a client.** Start with the [TypeScript guide](https://www.caprid.com/docs/sdks/typescript/guide/) or the
  [Python guide](https://www.caprid.com/docs/sdks/python/guide/).
- **Run your own relays.** [Running a Self-hosted relay](https://www.caprid.com/docs/guides/self-hosted-relays/) enrolls
  `moq-relay` on your infrastructure.
- **Working with an AI agent?** [Build with AI agents](https://www.caprid.com/docs/agents/) lists the Markdown, `llms.txt`
  and OpenAPI entry points, and the rules an agent should follow.

## Status

The SDKs are before 1.0. Install them from npm (`@caprid/relay`) and PyPI (`caprid-relay`). Each
SDK's packages release together at one version, so install matching versions. Before 1.0, a minor
version can break the API. The [TypeScript](https://www.caprid.com/docs/sdks/typescript/changelog/) and
[Python](https://www.caprid.com/docs/sdks/python/changelog/) changelogs say what changed.
