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 v20 or later installed. (Download Node.js).
  • A valid CE.SDK license key - Required for engine initialization. Start a free trial to get your license key.
  • A supported platform: macOS (ARM or x64) or Linux (x64).

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

Your project structure should now look like this:

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

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 = {
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 pngBuffer = await engine.block.export(page, 'image/png');
// Save the exported image to the file system
await fs.writeFile('./example-output.png', Buffer.from(pngBuffer));
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 or Linux x64).

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: