Deno 2: The Node.js Alternative That Now Runs npm Packages

Deno 2 drops in npm and Node.js compatibility while keeping its permission model and built-in TypeScript - here is what changed, what still differs, and when to choose it.

Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

May 13, 2026
7 min read
Deno 2: The Node.js Alternative That Now Runs npm Packages

Deno 2: The Compatibility Release

One AI engineering post, weekly

LLM benchmarks, prompt techniques, and token-cost breakdowns — not another AI news roundup.

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:

typescript
// 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:

json
{
  "imports": {
    "express": "npm:express@4",
    "zod": "npm:zod@3"
  }
}
bash
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.

Team workspace

Ship faster with chat, meetings, and projects in one place — Zlyqor.

Start free

The Permission Model

Unlike Node.js, Deno requires explicit permission grants. No permission = no access:

bash
# 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:

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

bash
# 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

bash
# 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:

MetricDeno 2Node.js 22
HTTP req/s (no framework)98,00082,000
File read (1MB)1.2ms1.4ms
Startup time12ms45ms
TypeScript startup (no compile)15ms380ms (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:

bash
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

#deno-2#node.js-alternative#typescript#npm-compatibility#security

// discussion

Comments

0/4000
Mahmudul Haque Qudrati — CEO & ML Engineer at Pristren

Mahmudul Haque Qudrati

CEO & ML Engineer

Visionary technologist, software engineer, and machine learning specialist. Founder and CEO of Pristren, directing engineering teams that ship production-grade AI/ML pipelines, mission-critical full-stack applications, and developer tooling. Creator of Zlyqor, the unified team workspace platform. Author of 540+ technical guides and benchmark research reports on large language models, agentic workflows, Model Context Protocol (MCP), and modern web stacks.

PristrenZlyqor