Runtimes in Dwizi: Deno vs Node.js
Dwizi executes tools inside secure, isolated JavaScript runtimes. Choosing the right runtime affects how you write code, import libraries, and move fast.
For most users, Deno is the recommended runtime.
Enterprise Note: Enterprise instances can implement their own custom runtime environments beyond Deno and Node.js.
TL;DR
- Use Deno if you want:
- Native TypeScript
- Zero build steps
- Easy third-party imports via URLs
- Use Node.js only if you need:
- Legacy Node APIs
- Existing Node-only code
Deno (Recommended)
Deno is a modern JavaScript runtime designed for secure, fast execution. It aligns naturally with Dwizi's model: ephemeral runtimes, explicit inputs, and no dependency installation.
Why Deno Works Best on Dwizi
-
Native TypeScript No transpilation, no build step, no configuration.
-
URL-based imports Import libraries directly from CDNs like
esm.shordeno.land. Nopackage.json, nonode_modules, no installs. -
Security-first Permissions are explicit by default, reducing accidental access.
Version
- Deno 2.x
Example: Using a Third-Party Library
import _ from "https://esm.sh/lodash@4.17.21";
export default async function ({ items }) {
return { shuffled: _.shuffle(items) };
}
This pattern is ideal for:
- AI tools
- MCP tools
- Stateless transformations
- API adapters
Node.js
Node.js is the industry-standard JavaScript runtime. Dwizi supports it for compatibility with existing Node-based scripts.
When to Use Node.js
- You already have a Node.js script
- You rely on Node-specific APIs
- Migrating to Deno is not practical
Version
- Node.js 24+
Dependency Model (Important)
Dwizi does not run npm install at execution time.
This means:
- External NPM packages must be:
- Bundled ahead of time, or
- Polyfilled manually
- No dynamic dependency installation at runtime
If you need easy third-party libraries, Deno is strongly recommended instead.
Example: Using Built-in Node APIs
import fs from "node:fs";
export default async function () {
return { files: fs.readdirSync("/") };
}
Runtime Comparison
| Feature | Deno | Node.js |
|---|---|---|
| Recommended by Dwizi | ✅ Yes | ⚠️ Only if needed |
| TypeScript | Native | Requires tooling |
| Dependency Setup | URL imports | Must bundle |
| Build Step | None | Usually required |
| Security Model | Explicit permissions | Implicit |
| Top-level await | Yes | Yes |
Choosing a Runtime
Choose Deno if you are:
- Creating a new tool
- Using TypeScript
- Importing third-party libraries
- Building MCP-compatible tools
Choose Node.js only if:
- You already have Node-only code
- You depend on Node-specific behavior