NestJS Official, built by Rendobar

Process video in a NestJS app

Use @rendobar/nestjs to inject Rendobar's client into your services and run any job, from FFmpeg commands to captions and AI images. It verifies webhook signatures before your handler runs and keeps Rendobar's refusals out of your responses.

View on npm Read the docs
videos.service.ts
import { Injectable } from "@nestjs/common";
import { RendobarClient } from "@rendobar/nestjs";
import { outputUrl } from "@rendobar/sdk";
@Injectable()
export class VideosService {
// Injected by type. RendobarModule provides the client.
constructor(private readonly rb: RendobarClient) {}
// Waits for the job. Throws JobFailedError if it fails.
async scale(url: string): Promise<string | undefined> {
const job = await this.rb.jobs.run({
type: "ffmpeg",
inputs: { "source.mp4": url },
params: { command: "ffmpeg -i source.mp4 -vf scale=1280:-2 -c:v libx264 -crf 23 out.mp4" },
});
return outputUrl(job); // signed URL of out.mp4
}
}

Overview

Import RendobarModule once and inject RendobarClient wherever you need it. It is the TypeScript SDK client, so every job type is a typed call: FFmpeg commands, timeline videos, captions and AI images. A missing API key stops the app at startup instead of failing on the first request. @RendobarWebhook() verifies a delivery's signature against the raw body and passes your handler the typed event. A filter answers any Rendobar ApiError with a 502 and logs its request id, so a revoked key never reaches your users as your own 401.

Set up

  1. Install

    Add the module and the SDK, and put a new API key in RENDOBAR_API_KEY.

    npm install @rendobar/nestjs @rendobar/sdk
  2. Register the module

    Import RendobarModule in your root module. Use forRootAsync to read the key and secret from ConfigService.

    const secret = process.env.RENDOBAR_WEBHOOK_SECRET;
    if (!secret) throw new Error("Set RENDOBAR_WEBHOOK_SECRET");
    @Module({ imports: [RendobarModule.forRoot({ webhooks: { secret } })] })
    export class AppModule {}
  3. Inject the client

    Ask for RendobarClient in any constructor and call jobs.run, which waits for the job and throws if it fails.

    constructor(private readonly rb: RendobarClient) {}
  4. Verify webhooks

    Create the app with rawBody: true, then put @RendobarWebhook() on the handler. A bad or stale signature gets a 401 before your code runs.

    @Post("rendobar")
    @HttpCode(204)
    @RendobarWebhook()
    handle(event: RendobarWebhookEvent) {
    if (isKnownWebhookEvent(event) && event.event === "job.completed") console.log(event.data.jobId);
    }

Questions

Which NestJS versions does @rendobar/nestjs support?

NestJS 10 and 11 on Node 22 or later, with @rendobar/sdk 5.18 or later as a peer dependency. Webhook verification needs the Express adapter, Nest's default.

Why does Rendobar webhook verification need rawBody in NestJS?

The signature covers the exact bytes Rendobar sent. Parsed and re-serialised JSON has different bytes, so @RendobarWebhook() reads the raw body and answers 500 naming the fix when rawBody: true is missing.

Can a NestJS app receive Rendobar webhooks without an API key?

Yes. Pass webhooks and no client to RendobarModule.forRoot, and the app starts without a key. A call to the client is then refused with MISSING_API_KEY before any request.

What do my users see when a Rendobar call fails?

The module's filter answers a Rendobar ApiError with a 502 and a generic body, and logs the error code and request id. Pass apiErrorFilter: false to handle those errors yourself.

All integrations