BT

Getting Started

Add real-time body tracking, activity detection, and session analytics to your app in a few minutes.

Overview

@bodytracker/sdk is a framework-agnostic JavaScript SDK for real-time body tracking in the browser. It turns a device camera feed into structured activity data — standing, walking, running, sitting — along with movement quality signals and session analytics, so you can build fitness, physical-therapy, or motion-aware products without training or hosting your own computer-vision models.

The core package has no UI and no framework dependencies. If you're building with React, pair it with @bodytracker/react for hooks and components that wrap the same tracker instance.

Requirements

  • Node.js 18 or later for your build tooling.
  • A browser with camera access — the SDK requests permission via getUserMedia.
  • A modern browser: the latest two versions of Chrome, Edge, Safari, or Firefox. Older browsers may lack the WebGL and WebAssembly features tracking relies on.
  • A BodyTracker API key — grab one from the dashboard after signing up.

Quick Start

Install the package, then initialize a tracker, start a session, and listen for movement updates:

tracker.tsTypeScript
import { BodyTracker } from "@bodytracker/sdk"; const tracker = new BodyTracker({ apiKey: "bt_live_51H8x...redacted" }); await tracker.init(); const session = await tracker.startSession({ activity: "walking" }); tracker.on("movementChanged", (event) => {  console.log("Movement changed:", event);}); await tracker.stopSession();tracker.destroy();

Your First Session

A session represents one continuous tracking window. Listen for sessionStarted and sessionEnded to react to lifecycle changes, and call getActivity() at any point to read the current activity and tracking quality:

first-session.tsTypeScript
import { BodyTracker } from "@bodytracker/sdk"; const tracker = new BodyTracker({ apiKey: "bt_live_9F2ke...redacted" }); await tracker.init(); tracker.on("sessionStarted", (session) => {  console.log("Session started:", session);}); tracker.on("sessionEnded", (summary) => {  console.log("Session ended:", summary);}); const session = await tracker.startSession({  activity: "running",  label: "Morning run",}); // Poll the current activity snapshot at any point during tracking.const snapshot = tracker.getActivity();console.log(`Currently ${snapshot.activity}, quality: ${snapshot.quality}`); const summary = await tracker.stopSession();console.log(`Recorded ${summary.durationSeconds}s of ${summary.activity}`);

Next Steps