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 engine, 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, contact our sales team or purchase a license.

Contact Sales

Purchase License

@cesdk/node-native Is Now Part of @cesdk/node#

@cesdk/node now runs the native engine. Where the native engine cannot run, it starts the WASM engine instead. @cesdk/node-native is deprecated. It stays available as an alias of @cesdk/node that starts the native engine by default, as before.

To migrate, install @cesdk/node and change the import:

import CreativeEngine from '@cesdk/node-native';
import CreativeEngine from '@cesdk/node';

To keep the earlier behavior, pass engine: 'native'. CreativeEngine.init then throws an error where the native engine cannot start, instead of starting the WASM engine:

const engine = await CreativeEngine.init({
license: 'YOUR_CESDK_LICENSE_KEY',
engine: 'native',
});

The platform packages are now @cesdk/node-darwin-arm64, @cesdk/node-darwin-x64, @cesdk/node-linux-x64 and @cesdk/node-win32-x64. If you list them in a bundler’s externals or in the dependenciesMeta of a Yarn Plug’n’Play project, use these names.

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 the native engine of CE.SDK’s 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 @cesdk/node and run CE.SDK Engine on the native engine.
  • 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. Contact sales 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 platform that the native engine supports: macOS (Apple Silicon or Intel), Linux (x64 or ARM64, glibc 2.39 or later) or Windows (x64, Windows 10 or Windows Server 2016). On other hosts, such as Alpine Linux (musl) or AWS Lambda, @cesdk/node starts the WASM engine.
  • On Windows, the native engine renders on the GPU through Direct3D 12. Video needs no install: the package ships its own GStreamer and codecs. Windows 10, 11 and Windows Server 2025 with Desktop Experience also use Media Foundation.
  • On Linux, install the system packages listed under Linux runtime dependencies in the package README. On Linux x64, the package ships its own GStreamer and codecs. On Linux ARM64, the native engine links the GStreamer of the system, so it needs these packages also for images.

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 for Node.js#

Run the following command to install the package:

Terminal window
npm install @cesdk/node@1.87.0-rc.3

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 not available for Linux ARM64, where video uses the open-source GStreamer codecs, which are meant for development. The pack is distributed separately from @cesdk/node and requires a CE.SDK license that includes licensed codecs. 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.

The pack is a codec module. CE.SDK runs the licensed codecs in a separate process, which it starts from the pack. Extract the archive into a folder of its own. Replace YYYY-MM-DD with the version in the downloaded filename:

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

The folder then holds the pack:

~/cesdk-codec-modules/
bin/
lib/
plugins/
presets/
misc/

Set CESDK_CODEC_MODULES to the codec module directory before CE.SDK loads. You can set it in the shell:

Terminal window
export CESDK_CODEC_MODULES="$HOME/cesdk-codec-modules"
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_CODEC_MODULES = `${process.env.HOME}/cesdk-codec-modules`;
const { default: CreativeEngine } = await import('@cesdk/node');

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

Without CESDK_CODEC_MODULES, CE.SDK uses no licensed codecs. On Linux x64 and Windows, the @cesdk/node platform package also contains open-source codec modules in a codec-modules folder next to the engine binary. CE.SDK starts them without any configuration. It reads the CESDK_CODEC_MODULES directory first, so a module there replaces a bundled module of the same name. Keep the licensed pack outside node_modules, because a reinstall replaces that folder.

CE.SDK reads the directories once for each process, so restart the Node.js process after you install a pack or change the path. Use the pack of your CE.SDK version: a pack of another version does not load, and CE.SDK prints the reason on stderr.

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';
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'

  • Verify the package is installed: npm ls @cesdk/node.

Error: Failed to load the native addon of @cesdk/node for ...

  • CreativeEngine.init throws this error with engine: 'native' when the native engine cannot start. With the default engine: 'auto', the WASM engine starts instead.
  • Ensure you’re on a platform that the native engine supports (macOS ARM/x64, Linux x64 or ARM64 with glibc 2.39 or later, or Windows x64).
  • npm can skip the optional platform package during install. Reinstall with npm install --include=optional @cesdk/node@1.87.0-rc.3.

Error: … is installed, but the system could not load it

  • The next line names the cause. On Linux it is usually a missing system library, such as libgstapp-1.0.so.0: cannot open shared object file. Install the packages listed under Linux runtime dependencies.

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 engine of @cesdk/node. Next, explore: