Search Docs
Loading...
Skip to content

Deno

This guide walks you through integrating the CreativeEditor SDK (CE.SDK) Engine with the native engine of @cesdk/node 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, contact our sales team or purchase a license.

Contact Sales

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 @cesdk/node in a Deno project and run CE.SDK Engine on the native engine.
  • 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 (Request a license).
  • 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, @cesdk/node starts the WASM engine.
  • On Windows, the native engine renders on the GPU through Direct3D 12. Windows 10, 11 and Windows Server 2025 with Desktop Experience use Media Foundation for video and need no install; Windows N editions need the Media Feature Pack. On Server Core, in a Server Core or Nano Server container, or on a Windows Server older than 2025, install the GStreamer MSVC x86_64 runtime (1.24 or later) for video.
  • On Linux, install the system packages listed under Linux runtime dependencies in the package README. The native engine links GStreamer, so it needs them also for images.

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 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@1.87.0-rc.3
deno.json
{
"imports": {
"@cesdk/node": "npm:@cesdk/node@1.87.0-rc.3"
},
"nodeModulesDir": "auto"
}

Then run deno install to materialize node_modules/.

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

import CreativeEngine from '@cesdk/node';
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'

  • 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.

❌ 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).

❌ 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: 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 engine of @cesdk/node in Deno. Now explore: