Node.js SDK

Build video on FastPix from Node.js: a node.js video SDK

The official FastPix SDK for Node.js. Typed end-to-end, async-aware, retry-safe. Encodes a source URL into a playback ID in one call, provisions LL-HLS live streams, verifies webhooks with one helper, and ships with a migration path from the closest API peer (see comparison).

ES2020Min runtime
Typedend-to-end
Asyncthroughout

Trusted by product teams shipping video at scale

AAO NXTAadhanKnovorocketlaneDLICOMPractice by Numberssuperbit

Install

One install, one client, one call

Add the package, point the client at your API key, and you're talking to FastPix — strongly-typed, no scaffolding.

01

Install the package

bash · terminal

bash · terminal
npm install @fastpix/sdk

Runtime

Node 18+ / Bun 1.0+ / Deno via npm: specifier.

Type safety

Bundled .d.ts (no @types/* needed).

IDE support

VS Code, JetBrains WebStorm, full IntelliSense.

02

Initialize the client

TypeScript · index.ts

TypeScript · index.ts
import { FastPix } from "@fastpix/sdk";

const fp = new FastPix({
  apiKey: process.env.FASTPIX_API_KEY!,
  // optional: timeoutMs, maxRetries, baseUrl
});

Common operations

From upload to playback in 4 calls

Encode, wait, stream, upload. The four most common flows, typed end-to-end.

1. Encode a source URL into a playback ID

fp.assets.create
// Encode a source URL into a playback ID
const asset = await fp.assets.create({
  inputs: [{ url: "https://your-cdn.com/source.mp4" }],
  playbackPolicy: "public",
});

console.log(asset.playbackId);  // "abc123"

2. Wait until the asset is ready

fp.assets.waitUntilReady
// Poll until the asset is ready, or listen for the asset.ready webhook.
const ready = await fp.assets.waitUntilReady(asset.id, {
  pollIntervalMs: 2000,
  timeoutMs: 5 * 60 * 1000,
});

3. Provision a low-latency live stream

fp.live.create
// Provision a low-latency live stream
const stream = await fp.live.create({
  latencyMode: "low",          //  LL-HLS
  reconnectWindowSec: 60,
  playbackPolicy: "public",
});

// stream.streamKey -> push to rtmp://global-live.fastpix.com/live

4. Resumable chunked upload

@fastpix/upload
// Resumable, chunked upload from the browser or React Native
import { upload } from "@fastpix/upload";

await upload({
  endpoint: assetUploadUrl,    // returned by fp.assets.createUpload()
  file: pickedFile,
  chunkSizeMb: 8,
  onProgress: (pct) => setProgress(pct),
});

Security, compliance, and partnerships

PartnerNVIDIA Inception
PartnerGoogle Cloud Partner

Webhook signature verification

One helper, every event typed

Every webhook FastPix sends is signed. The SDK verifies the signature and returns a fully-typed event payload. Switch on event.type and reach the typed payload directly.

webhook.ts
import { verifyWebhook } from "@fastpix/sdk/webhooks";

app.post("/webhooks/fastpix", express.raw({ type: "application/json" }), (req, res) => {
  const event = verifyWebhook({
    payload: req.body,
    signature: req.header("FastPix-Signature")!,
    secret: process.env.FASTPIX_WEBHOOK_SECRET!,
  });

  if (event.type === "asset.ready") {
    // event.data is fully typed
  }
  res.sendStatus(200);
});

Concurrency model

Built for the Node.js runtime

All FastPix Node SDK methods return native Promises. Concurrency limits are handled by an internal connection pool (default 16). Override via the maxSockets constructor option. Long-running operations like waitUntilReady support AbortSignal.

Type safety + IDE support

Every API method is fully typed via bundled .d.ts files. Response shapes are union-typed by status, so a 404 narrows asset.id away at compile time. Use `import type { Asset, LiveStream } from "@fastpix/sdk";` to share request and response types with your application layer.

Migration

Swap the client, keep the shape

FastPix exposes primitives that mirror the closest API peer. The Node.js SDK keeps the call shapes recognizable so the migration is a one-file swap, not a rewrite. FastPix vs Mux side-by-side.

migrate.ts
// Before: import VideoClient from "@other-vendor/sdk";
// FastPix:
import { FastPix } from "@fastpix/sdk";

const fp = new FastPix({ apiKey: process.env.FASTPIX_API_KEY! });

// Before: const asset = await mux.video.assets.create({ input: url });
// FastPix:
const asset = await fp.assets.create({
  inputs: [{ url }],
  playbackPolicy: "public",
});

// Before: asset.playback_ids[0].id
// FastPix:
asset.playbackId;

Bulk migration tooling at /compare/mux and the docs migration guide handles asset re-ingest and playback-ID remap.

FAQ

Node.js SDK FAQ

  • What does the Node.js SDK ship with out of the box?

    All API surfaces (assets, live streams, playback policies, webhooks, simulcast, analytics query) plus the resumable chunked upload helper, webhook signature verification, automatic retries with exponential backoff, and configurable timeout / base URL / HTTP client. Type definitions are bundled.
  • Is the Node.js SDK production-ready?

    Yes. The client is used in production by FastPix customers shipping video on the Node.js runtime. The retry policy, connection pool defaults, and timeout shape are tuned against the same workload patterns that produce the numbers on the /performance page.
  • How do I authenticate against the FastPix API from Node.js?

    Set the FASTPIX_API_KEY environment variable and pass it to the client constructor. The SDK adds the Bearer header on every request. For server-side runtimes, fetching the API key from your secret store at startup and constructing the client once at module load is the recommended pattern.
  • Where do I get an API key?

    Sign up at the FastPix dashboard. The free trial provisions a key with no credit card; the trial plan covers 10 videos plus 100K streaming minutes plus AI samples. See /pricing for the full plan structure.

Read it, run it, ship it.

Every SDK, player, and integration lives on GitHub. Star the repos, file an issue, or open a PR — we build alongside the developers who use us.

Browse the repos