Search Docs
Loading...
Skip to content

Deno

This guide walks you through integrating the CreativeEditor SDK (CE.SDK) Engine with the native Node.js bindings in Deno, the secure and modern runtime for JavaScript and TypeScript. By the end of this guide, you’ll have a Deno script that loads a scene, modifies it, and exports it as an image—all without a UI.

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:

  • Want to programmatically edit and export scenes with native C++ performance using CE.SDK in Deno.
  • Prefer a secure and modern runtime with built-in TypeScript and native fetch support.
  • Need to integrate CE.SDK into server-side rendering or automation tools using Deno.

What You’ll Achieve#

  • Install and configure CE.SDK Engine using the native bindings in a Deno project.
  • Load and manipulate design scenes programmatically.
  • Export scenes to PNG images without any UI.

Prerequisites#

Before getting started, ensure you have:

  • Deno installed (Download Deno).
  • A valid CE.SDK license key (Get a free trial).
  • 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: Initialize Your Deno Project#

Create your project structure:

Terminal window
deno init my_project

Resulting in the following project structure:

my_project
├── deno.json
├── main_test.ts
└── main.ts

Step 2: Install CE.SDK Native for Deno#

Native addons cannot be loaded from Deno’s global npm cache, so the package must be installed into a local node_modules/ directory. Add the package and enable the local node_modules directory in your deno.json:

Terminal window
deno add npm:@cesdk/node-native@1.82.0
deno.json
{
"imports": {
"@cesdk/node-native": "npm:@cesdk/node-native@1.82.0"
},
"nodeModulesDir": "auto"
}

Then run deno install to materialize node_modules/.

In your main.ts, load and use the engine:

import CreativeEngine from '@cesdk/node-native';
import { writeFile } from 'node:fs/promises';
// CE.SDK configuration
const config = {
license: 'YOUR_CESDK_LICENSE_KEY', // Enter your CE.SDK license key
};
const engine = await CreativeEngine.init(config);
console.log('CE.SDK Engine initialized (Deno)');
try {
await engine.scene.load(
'https://cdn.img.ly/assets/demo/v3/ly.img.template/templates/cesdk_instagram_photo_1.scene',
);
const [page] = engine.block.findByType('page');
const blob = await engine.block.export(page, { mimeType: 'image/png' });
const arrayBuffer = await blob.arrayBuffer();
await writeFile('./example-output.png', new Uint8Array(arrayBuffer));
console.log('Export completed: example-output.png');
} finally {
engine.dispose();
}

Step 3: Run the Script#

Run the script with the permission flags the native addon needs:

Terminal window
deno run \
--allow-ffi \
--allow-read \
--allow-env \
--allow-net \
--allow-write \
main.ts

These flags are required to execute main.ts for the following reasons:

Flag Required Why
--allow-ffi Yes Allows Deno to load the native Node-API addon (cesdk_native.node).
--allow-read Yes Grants permission to read the bundled engine assets and any local scene or template files.
--allow-env Yes Lets the engine read environment variables during initialization.
--allow-net For remote assets Required to fetch remote assets and scenes (e.g., from cdn.img.ly) or to activate an API-key license.
--allow-write For file output Allows your script to write the exported image file (example-output.png) to disk.

As with any native addon, code inside the .node binary itself is not sandboxed by Deno’s permission system.

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

  • Make sure "nodeModulesDir": "auto" is set in your deno.json and run deno install — native addons cannot be loaded from Deno’s global npm cache.
  • 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: Requires ffi access

  • Add the --allow-ffi flag — it is required to load the native addon.

❌ Error: Invalid license key

  • Ensure your license key is correct and not expired.

Next Steps#

You’ve successfully integrated CE.SDK Engine with the native Node.js bindings in Deno. Now explore: