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.
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:
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.
Practical deep-dives on LLMs, developer tools, and AI engineering. No filler. Unsubscribe any time.
// written byFIG. AUTH-01
530
Mahmudul Haque Qudrati
CEO & ML Engineer
CEO and ML Engineer at Pristren. Builds AI-powered software for teams and writes about machine learning, LLMs, developer tools, and practical AI applications.
Open Code Review – An AI-powered code review CLI tool: A Practical Overview
Open Code Review is an open-source CLI tool from Alibaba that uses AI to review code changes. It runs locally, supports multiple LLMs, and costs about $0.01 per review. Here's a practical breakdown.