Everyframe · TypeScript SDK reference

Getting started

Install the SDK, learn the four core concepts, and run your first pipeline.

@jtdigital/renderbox-sdk on npm →

Install

One package on npm: @jtdigital/renderbox-sdk builds typed pipeline graphs and the job messages you submit to the Everyframe platform. ESM, Node 18+, TypeScript 5.

terminal

npm install @jtdigital/renderbox-sdk

Build a graph

A pipeline is a dataflow graph. Inputs produce typed streams, ops transform them, sinks terminate the graph. Nothing executes locally: the SDK emits a JSON graph the engine validates and runs.

redact.ts

import { graph } from '@jtdigital/renderbox-sdk';

const g = graph();
const [video, audio] = g.open('uploads/crowd.mp4');

const faces    = video.detect({ model: 'retinaface_mv2', threshold: 0.5 });
const redacted = video.redact(faces, { mode: 'blur', radius: 25 });

g.write('renders/redacted.mp4', redacted, audio);

Four concepts

Everything in the SDK is one of: a graph() you build on, sort-typed streams (VideoStream, AudioStream, DetectionStream, and friends), ops as methods on those streams, and the terminals g.json() (graph_ir) and g.io() (S3 bindings).

concepts.ts

// 1. Streams are sort-typed: 13 sorts, checked by tsc
const g = graph();
const [v, a] = g.open('uploads/input.mp4');   // [VideoStream, AudioStream]

// 2. Ops are methods on the stream; each returns the next stream
const scaled = v.scale({ w: 1920, h: 1080 });

// 3. Chain same-sort ops fluently
const graded = scaled
  .curves({ preset: 'vintage' })
  .gblur({ sigma: 2 });

// 4. Outputs live on the graph
g.write('renders/out.mp4', graded, a);

Run it

The SDK builds the pipeline; it doesn't run it. g.json() is the graph_ir and g.io() gives you the S3 input/output bindings; you add identity (job id, tenant) from your own app and publish the JobMessage over an AMQP connection to the Everyframe platform, provisioned per tenant with usage metered on our side. In a scaffolded project the renderbox module ships the transport (S3 upload, submit, consume); a plain Node project pairs the SDK with amqplib and an S3 client. See Running jobs for the full contract.

submit.ts

import { graph } from '@jtdigital/renderbox-sdk';

// 1. upload the source to your bucket; you choose the S3 key
const key = 'uploads/' + jobId + '.mp4';
await storage.put(key, bytes, 'video/mp4');

// 2. build the pipeline, referencing inputs/outputs by S3 key
const g = graph();
const [v, a] = g.open(key);
g.write('renders/' + jobId + '.mp4', v.scale({ w: 1920, h: 1080 }), a);

// 3. graph_ir + derived I/O bindings; identity is YOUR app's, not the SDK's
const job = {
  job_id: jobId,
  tenant_id: process.env.RENDERBOX_TENANT_ID,
  graph_ir: g.json(),
  input_files: g.io().inputs,
};

// 4. publish to the renderbox exchange over your tenant AMQP connection
await renderbox.submit(job);

// 5. completion arrives on results.<tenant>.completed
renderbox.onCompleted((msg) => {
  if (msg.status === 'success') serve(msg.outputs[0].s3_key);
});