Search Docs
Loading...
Skip to content

Node.js (Native) - New Project

This guide walks you through integrating the CreativeEditor SDK (CE.SDK) Engine in a Node.js environment using the native bindings, enabling you to process images, designs, and videos programmatically with native C++ performance. By the end of this guide, you’ll have a working Node.js script that loads a scene, modifies it, and exports it as an image.

What’s CreativeEditor SDK?#

CreativeEditor SDK (CE.SDK) lets you integrate a customizable image and video editor into your web app. It includes filters, text overlays, and other media editing tools, and adapts easily to your use case.

CreativeEditor SDK is a commercial product. To use it, you need a valid license key. If you don’t have one yet, you can get a free trial or purchase a license.

Free Trial

Purchase License

Who Is This Guide For?#

This guide is for developers who:

  • Need native C++ performance for image and video processing in a Node.js environment.
  • Want to use CE.SDK’s native Node.js package for automation or backend processing with GPU-accelerated video export.
  • Prefer a script-based approach for design generation, image exports, and video rendering.

What You’ll Achieve#

  • Install and configure CE.SDK Engine using the native Node.js bindings.
  • Load and manipulate design scenes programmatically.
  • Export designs as PNG images without requiring a UI.

Prerequisites#

Before getting started, ensure you have:

  • Node.js v22 or later installed. (Download Node.js). The Bun and Deno runtimes are supported as well.
  • A valid CE.SDK license key - Required for engine initialization. Start a free trial to get your license key. To try the package first, give an empty string (license: ''). The engine starts in evaluation mode and puts a watermark on the output.
  • A supported platform: macOS (Apple Silicon or Intel), Linux (x64, glibc 2.39 or later) or Windows (x64, Windows 10 or Windows Server 2016).
  • On Windows, install the GStreamer MSVC x86_64 runtime (1.24 or later) before you start. The package loads it at start, so it is necessary also for images. Windows renders on the CPU: device: 'gpu' gives an error and 'auto' uses the CPU.

Step 1: Set Up Your Project#

Create a new project folder and navigate into it:

Terminal window
mkdir my-cesdk-native-project
cd my-cesdk-native-project

Next, create a new index.mjs file manually or by running:

Terminal window
touch index.mjs

Step 2: Install CE.SDK Native for Node.js#

Run the following command to install the native package:

Terminal window
npm install @cesdk/node-native@1.83.0

Your project structure should now look like this:

/my-cesdk-native-project
├── node_modules
├── index.mjs
└── package.json

Install Licensed Codecs on Linux#

For licensed video and audio codecs on Linux x86_64, download the codec pack from your licensing dashboard. The pack is distributed separately from @cesdk/node-native and requires a CE.SDK license that includes licensed codecs. Keep GStreamer installed on the server, and install Python 3 at /usr/bin/python3 for codec license cleanup.

Pass your dashboard API key as the license option when calling CreativeEngine.init() to reserve a codec license when processing video or audio.

Extract the downloaded archive to the default directory for the user that runs your Node.js process. Replace YYYY-MM-DD with the version in the downloaded filename:

Terminal window
mkdir -p "$HOME/.local/share/cesdk-codecs"
tar -xzf "$HOME/Downloads/licensed-codec-pack-YYYY-MM-DD.tar.gz" \
-C "$HOME/.local/share/cesdk-codecs"

The extracted directory should contain these folders directly:

~/.local/share/cesdk-codecs/
plugins/
presets/
misc/

CE.SDK automatically detects this installation, selects the licensed codecs, and loads plugins from its plugins/ folder.

For a custom installation, extract the archive to another directory and set CESDK_LICENSED_CODEC_PACK before loading CE.SDK. You can set it in the shell:

Terminal window
mkdir -p "$HOME/my-cesdk-codecs"
tar -xzf "$HOME/Downloads/licensed-codec-pack-YYYY-MM-DD.tar.gz" \
-C "$HOME/my-cesdk-codecs"
export CESDK_LICENSED_CODEC_PACK="$HOME/my-cesdk-codecs"
node index.mjs

You can also set it directly in Node.js using process.env. Replace the static CE.SDK import in your script with a dynamic import so the assignment runs before CE.SDK loads:

process.env.CESDK_LICENSED_CODEC_PACK = `${process.env.HOME}/my-cesdk-codecs`;
const { default: CreativeEngine } = await import('@cesdk/node-native');

For CommonJS, set process.env.CESDK_LICENSED_CODEC_PACK before calling require('@cesdk/node-native').

Set the override to the pack root, which contains plugins/, presets/, and misc/. A non-empty override replaces the default path. An unset or empty override uses $HOME/.local/share/cesdk-codecs. Restart the Node.js process after installing a pack or changing the path; discovery is cached for the process lifetime.

Step 3: Write Your Script#

Modify index.mjs to initialize CE.SDK Engine and process a scene:

import fs from 'fs/promises';
import CreativeEngine from '@cesdk/node-native';
async function main() {
// Configuration for the engine
const config = {
// Use '' to try the engine in evaluation mode (the output has a watermark).
license: 'YOUR_CESDK_LICENSE_KEY',
};
// Initialize CE.SDK Engine
const engine = await CreativeEngine.init(config);
console.log('CE.SDK Engine initialized');
try {
// Load a scene from a URL
await engine.scene.loadFromURL(
'https://cdn.img.ly/assets/demo/v3/ly.img.template/templates/cesdk_instagram_photo_1.scene',
);
// Find the first page in the scene
const [page] = engine.block.findByType('page');
// Export the scene as a PNG image
const blob = await engine.block.export(page, { mimeType: 'image/png' });
// Save the exported image to the file system
await fs.writeFile(
'./example-output.png',
Buffer.from(await blob.arrayBuffer()),
);
console.log('Export completed: example-output.png');
} catch (error) {
console.error('Error processing scene:', error);
} finally {
// Dispose of the engine to free resources
engine.dispose();
}
}
main().catch(console.error);

Step 4: Run the Script#

Once everything is set up, run your script using:

Terminal window
node index.mjs

This code processes the scene and generates an image file named example-output.png in your project directory.

Troubleshooting & Common Errors#

Error: Cannot find module '@cesdk/node-native'

  • Verify the package is installed: npm ls @cesdk/node-native.
  • Ensure you’re on a supported platform (macOS ARM/x64, Linux x64 with glibc 2.39 or later, or Windows x64). Windows ARM64, Alpine Linux (musl) and Linux ARM64 are not supported — use the WASM-based @cesdk/node package there.

Error: Invalid license key

  • Verify that your license key is correct and not expired.

Development Best Practices#

  • Dispose resources - Always call engine.dispose() in a finally block to free memory.
  • Use async/await - Engine operations including initialization, loading scenes, and exporting are asynchronous.

Next Steps#

Congratulations! You’ve successfully integrated CE.SDK Engine using the native Node.js bindings. Next, explore: