SDKs and packages

Use the official TypeScript SDK, Effect v4 SDK, 2D replay embed controller, webhook verifier, and self-hosted overlay SDK.

Strave publishes focused packages for TypeScript and Effect v4 applications. They handle OIDC Trusted Workload token exchange, Idempotency-Key headers, strong If-Match revision tags, cursor pagination, live SSE streams, webhook verification, and hosted 2D replay embeds.

Install @strave/sdk

bun add @strave/sdk

For Effect v4 projects, also install effect v4:

bun add @strave/sdk effect

Plain TypeScript client

The root entry point (@strave/sdk) has zero runtime dependencies and runs in Node.js, Bun, Cloudflare Workers, and browsers. Use oidcWorkload in production so your servers authenticate with short-lived OIDC tokens instead of static secrets, or start with sandbox: true at zero cost:

import { createStraveClient, paginate } from "@strave/sdk";
import { getVercelOidcToken } from "@vercel/oidc";

const strave = createStraveClient({
	oidcWorkload: {
		clientId: process.env.STRAVE_CLIENT_ID!,
		getAssertion: () =>
			getVercelOidcToken({ audience: "https://strave.gg/api/auth" }),
		scopes: ["event:read"],
	},
});

const { data: event, etag } = await strave.events.get("event_01K4ZK");

for await (const match of paginate((cursor) =>
	strave.events.listMatches(event.id, { cursor }),
)) {
	console.log(match.id, match.status, etag);
}

Effect v4 client

@strave/sdk/effect provides a Context.Service tag (StraveClient), StraveClient.layer, StraveClient.sandboxLayer, StraveClient.layerFromEnv, typed Schema.TaggedError failures, and Effect Stream consumers:

import { StraveClient } from "@strave/sdk/effect";
import { Effect, Stream } from "effect";

const program = Effect.gen(function* () {
	const strave = yield* StraveClient;
	const { data: event } = yield* strave.events.get("event_sbx_eml_s7");

	yield* strave
		.streamEvent(event.id)
		.pipe(Stream.runForEach((frame) => Effect.logInfo(frame.type)));
}).pipe(Effect.provide(StraveClient.sandboxLayer()));

Verify webhooks

@strave/sdk/webhooks verifies strave-webhook-signature headers with Web Crypto HMAC SHA-256 and constant-time comparison:

import { createWebhookHandler } from "@strave/sdk/webhooks";

export const POST = createWebhookHandler({
	secret: process.env.STRAVE_WEBHOOK_SECRET!,
	onEvent: async ({ deliveryId, event }) => {
		console.log(deliveryId, event.type, event.data.resourceId);
	},
});

Control 2D replay embeds with @strave/replay-embed

@strave/replay-embed mounts Strave's hosted /embed/replay viewer and exposes a typed postMessage controller with zero replay parser code or map assets. See the 2D replay viewer guide.

bun add @strave/replay-embed

Self-hosted OBS overlays with @strave/overlay-sdk

Strave's managed third-party overlay hosting is not online yet. Use createLiveOverlaySource in @strave/overlay-sdk to drive self-hosted OBS browser sources from a backend SSE proxy today. See the Self-hosted OBS overlays guide.

bun add @strave/overlay-sdk

Next steps