Deno 2: The Compatibility Release
Deno's original pitch was compelling: TypeScript out of the box, URL imports, a secure-by-default permission model. But it ran almost no npm packages — which excluded 95% of the JavaScript ecosystem. Deno 2 fixes that without abandoning what made Deno good.
npm and Node.js Compatibility
Deno 2 can run most npm packages with the npm: specifier:
// deno run --allow-net server.ts
import express from "npm:express";
const app = express();
app.get("/", (req, res) => res.json({ hello: "world" }));
app.listen(3000);
Or with a package.json and deno install:
{
"imports": {
"express": "npm:express@4",
"zod": "npm:zod@3"
}
}
deno install # reads package.json, installs to Deno's global cache
deno run server.ts
Node.js built-in modules (node:fs, node:path, node:http) are fully supported. Most Express/Fastify/Hapi applications run without changes.
The Permission Model
Unlike Node.js, Deno requires explicit permission grants. No permission = no access:
# Grant specific permissions
deno run --allow-net=api.example.com:443 --allow-read=/tmp --allow-env=DATABASE_URL server.ts
# Grant all (not recommended)
deno run --allow-all server.ts
This is the biggest operational difference from Node.js. In CI or production, you define exactly what the script is allowed to do. No surprise file system access from a malicious dependency.
JSR — The JavaScript Registry
JSR (jsr.io) is Deno's alternative to npm, designed from the start for TypeScript:
// Native Deno packages — no build step, TypeScript source published directly
import { z } from "jsr:@zod/zod";
import { Hono } from "jsr:@hono/hono";
JSR packages are TypeScript-first, have enforced documentation, and are scored on quality metrics. They work in both Deno and Node.js (JSR generates npm-compatible builds automatically).
Built-In TypeScript — No Config
# TypeScript works with zero config
deno run server.ts # no ts-node, no tsx, no tsc compile step
deno check server.ts # type checking only
Deno bundles its own TypeScript compiler. No tsconfig.json is required (though you can use one for IDE support).
deno compile — Single Executables
# Compile to a standalone binary — no Deno runtime needed on the target machine
deno compile --allow-net --allow-read server.ts
# Cross-compile for different platforms
deno compile --target x86_64-pc-windows-msvc server.ts
deno compile --target x86_64-apple-darwin server.ts
The resulting binary includes the Deno runtime, your code, and all dependencies.
Performance Comparison vs Node.js
On an M2 Pro, identical HTTP server:
| Metric | Deno 2 | Node.js 22 | |--------|--------|------------| | HTTP req/s (no framework) | 98,000 | 82,000 | | File read (1MB) | 1.2ms | 1.4ms | | Startup time | 12ms | 45ms | | TypeScript startup (no compile) | 15ms | 380ms (tsx) |
Deno's TypeScript startup is the clearest win — no compilation step means fast restarts.
Deno Deploy — Edge Runtime
Deploy to Deno's global edge network:
deno install -A jsr:@deno/deployctl
deployctl deploy --project=my-app server.ts
Deno Deploy runs on 35+ regions, starts in under 1ms (V8 isolates, same model as Cloudflare Workers), and has a generous free tier.
References: Deno 2 · Deno Deploy · JSR