• Unified API
  • Mobile SDK
  • Connection Widget
  • Streaming
  • Lab Reports API
  • Graph API
  • Health Scores
  • Health Rewards
  • Planned Workouts
  • Lab Testing
  • AI Interface
  • Enterprise
  • Insurance
  • Integrations
  • Research
  • Podcast
  • Blog
  • Reports
  • Events
  • Documentation
  • Community
  • Example apps
  • Wearable Data
  • About
  • Customers
  • Partners
  • Careers
  • Support
  • Pricing
Terra
Pricing
Become an integrationGet started
All examples
Product
Streaming API
Platform
Web app
Repository
tryterra/terra-examples

In this example:

  • 01Overview
  • 02What's inside
  • 03Run it locally
  • 04Next steps
  • 05More examples
All examples

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.

Terminal
npx @tryterra/cli examples clone streaming-consumer-web-app
View on GitHubDocumentation
Terra Pulse streaming dashboard with a live heart-rate chart over the last 60 seconds and sparkline cards for acceleration, distance, floors, gyroscope, speed and steps, on a blue background

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

  1. Consumer connection: a WebSocket to Terra's broker that receives live readings for every user you stream.
  2. Server-side tokens: a single-use developer token minted by your backend, so the API key stays off the client.
  3. Connection lifecycle: HELLO, IDENTIFY, READY and DISPATCH, with jittered heartbeats and a clear close-code policy.
  4. Resilient reconnects: a fresh token and exponential backoff on every retry, with dropped connections kept apart from protocol errors.
  5. 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

Terminal
terra examples clone streaming-consumer-web-app my-appcd my-appnpm installcp .env.example .env

Add your dev ID and API key to .env. Only the token server reads them.

2. Start the app

Terminal
npm run dev

This 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.

PreviousTerra BasecampNextTerra Dispatch

More examples

  • Terra Dispatch storefront listing standard and comprehensive blood test kits with prices and order buttons, under a demo-data banner, on a yellow background

    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.

  • Terra Panel patient view for Marcus Reid with an AI intelligence brief and flagged lab values for cholesterol, glucose and vitamin D, on a lavender background

    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.

  • Terra Grip phone screen streaming a live heart rate of 70 bpm and an R-R interval of 624 ms, each with a trend line, on a dark background

    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.

next ventures
pioneer fund
samsung next
y combinator
general catalyst

The world's best health apps run on Terra data

Get started
ProductsIntegrationsAI InterfaceAuthenticationMobile DevelopmentDocumentationGraphAPI
DocumentationAPISDKQuickstartExample Apps
CommunityBlogResearchCommunityPodcastAuthorsGithub
CompanyAboutCareersCustomersBecome an IntegrationCookies PolicyGDPRPrivacy PolicyTerms of Purchase
© Terra API. 2026 — All rights reserved.

Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.

Cookies Policy