Streaming API
Terra Pulse
Watch wearable readings reach the browser the moment they are recorded. Clone it to see how to connect, stay connected and render a live stream with nothing but a WebSocket.
npx @tryterra/cli examples clone streaming-consumer-web-app
Overview
Pulse is the consumer half of a Streaming API integration. It opens a WebSocket to Terra's broker, authenticates as a consumer, and renders every reading the moment it arrives, with no SDK in between. A small Express server stands in for your backend, so your API key never reaches the browser. For the producer half, see Terra Grip.
What's inside
- Consumer connection: a WebSocket to Terra's broker that receives live readings for every user you stream.
- Server-side tokens: a single-use developer token minted by your backend, so the API key stays off the client.
- Connection lifecycle: HELLO, IDENTIFY, READY and DISPATCH, with jittered heartbeats and a clear close-code policy.
- Resilient reconnects: a fresh token and exponential backoff on every retry, with dropped connections kept apart from protocol errors.
- Live dashboard: per-user, per-type rolling buffers feeding a scrolling chart and sparkline cards.
Run it locally
You need the Terra CLI, Node.js 18 or later, and a dev ID and API key from the Terra dashboard. No hardware required.
1. Clone and configure
terra examples clone streaming-consumer-web-app my-appcd my-appnpm installcp .env.example .envAdd your dev ID and API key to .env. Only the token server reads them.
2. Start the app
npm run devThis starts the token server on port 4000 and the app on 5173. Open localhost:5173 and the status pill turns from Connecting to Live once Terra sends READY.
3. Generate some data
Pulse only receives. On the streaming page of the dashboard, add a test user and choose Generate test data. Their section appears as soon as readings flow.
Next steps
The whole integration lives in src/lib/consumer.ts, so start there. Tokens come from a single mintToken function in src/lib/stream.ts: point it at your own endpoint and the consumer drops straight into your product. Pair it with Terra Grip to watch a real wearable stream end to end.
More examples

Vantage API
Terra Dispatch
A diagnostics storefront and ops console on the Vantage API: order blood and DNA test kits, track fulfilment, and deliver FHIR results.

Lab Reports API
Terra Panel
A clinician dashboard on the Lab Reports API: upload a lab report PDF, get standardized biomarkers, and read them against the patient's wearable history.

Streaming API
Terra Grip
A React Native reference app for the Streaming API: pair a wearable, stream live biometrics to Terra, and render them on screen. No backend, no keys on the device.




