BlendDuck helps users create high-quality videos by easily combining text, images, video clips, Lottie animations, and custom widgets.

Projects in BlendDuck are made up of multiple clips, and each clip can include different elements and animations. You can also set a global theme to keep your project’s style consistent.

This guide will help you get started with BlendDuck quickly. We’ll cover how to install the SDK, authenticate, and create your first video project.

Step 1: Install the SDK

First, install the BlendDuck Node.js SDK using npm:

npm install @blendduck/node-sdk

Step 2: Set Up Authentication

To use the BlendDuck SDK, you’ll need an API key. If you haven’t already, sign up for a BlendDuck account and generate an API key in your account settings.

Once you have your API key, you can set it up in your project:

import BlendDuck from "@blendduck/node-sdk";

const client = new BlendDuck({
  apiKey: process.env.BLENDDUCK_API_KEY
});

SDK Keys are secrets. Do not expose them.

Step 3: Create Your First Project

Now, let’s create a simple video project with a single clip and a text element:

import BlendDuck, {
  Project,
  Clip,
  Text,
  Animation,
  AnimationType,
  AnimationEasing
} from "@blendduck/node-sdk";

async function createFirstProject() {
  const client = new BlendDuck({
    apiKey: process.env.BLENDDUCK_API_KEY
  });

  // Create a new project
  const project = new Project();
  project.title = "My First BlendDuck Project";

  // Add a clip to the project
  const clip = new Clip(5); // 5 second duration
  project.addClip(clip);

  // Add a text element to the clip
  const textElement = new Text();
  textElement.text = "Hello, BlendDuck!";
  textElement.x = 400; // Center horizontally (assuming 1920x1080 resolution)
  textElement.y = 540; // Center vertically
  textElement.fontSize = 60;
  clip.addElement(textElement);

  // Add a fade-in animation to the text
  const fadeIn = new Animation(AnimationType.FadeIn);
  fadeIn.startTime = 0;
  fadeIn.endTime = 1;
  fadeIn.easing = AnimationEasing.Smooth;
  textElement.addAnimation(fadeIn);

  // Create the project on BlendDuck
  const projectId = await client.projects.create(project);

  console.log(`Project created successfully! ID: ${projectId}`);
  console.log(`Edit your project at: https://blendduck.com/editor/${projectId}`);
}

createFirstProject();

This script creates a new project with a single 5-second clip containing animated text.

Next Steps

Congratulations! You’ve created your first BlendDuck project. From here, you can dive into the project schema or create more complicated videos. Happy video creating!