DEV Community

Alex Spinov
Alex Spinov

Posted on

Deno 2 Has a Free Runtime — Node.js Compatibility Without node_modules

Deno 2 Finally Fixed the Compatibility Problem

Deno 1 was brilliant but impractical. You could not use npm packages. The ecosystem was tiny. Nobody shipped production apps on it.

Deno 2 changed everything. Full npm compatibility. node_modules support. Drop-in Node.js replacement.

What Deno 2 Gives You

Native TypeScript

# No tsconfig. No ts-node. No build step.
deno run app.ts
Enter fullscreen mode Exit fullscreen mode

TypeScript just works. Always has in Deno.

npm Packages Work

import express from 'npm:express'

const app = express()
app.get('/', (req, res) => res.send('Hello from Deno!'))
app.listen(3000)
Enter fullscreen mode Exit fullscreen mode

Prefix with npm: and it works. No npm install. No node_modules folder (unless you want one).

Built-in Tools

deno fmt          # Format (like Prettier)
deno lint         # Lint (like ESLint)  
deno test         # Test runner (like Jest)
deno bench        # Benchmarks
deno compile      # Compile to single binary
deno jupyter      # Jupyter notebook kernel
deno doc          # Generate docs
Enter fullscreen mode Exit fullscreen mode

No dev dependencies. No config files. It is all built in.

Security by Default

# This FAILS — no network access by default
deno run app.ts
# Error: Requires net access to "0.0.0.0:3000"

# Explicitly grant permissions
deno run --allow-net --allow-read app.ts
Enter fullscreen mode Exit fullscreen mode

No random npm package can steal your SSH keys or exfiltrate env variables. You must explicitly allow file, network, and environment access.

Deno Deploy (Edge Hosting)

deno deploy --project=my-app main.ts
Enter fullscreen mode Exit fullscreen mode

Deploy to 35+ edge locations worldwide. Free tier includes:

  • 1M requests/month
  • 100GB bandwidth
  • KV storage included
  • Cron jobs included

Compile to Single Binary

deno compile --allow-net --allow-read server.ts
# Creates: ./server (single executable)
Enter fullscreen mode Exit fullscreen mode

Distribute your app as one file. No runtime needed. Runs on macOS, Linux, Windows.

Deno vs Node.js vs Bun in 2026

Feature Deno 2 Node.js 22 Bun
TypeScript Native Via ts-node Native
Security Permissions None None
Package manager Built-in npm/pnpm/yarn bun
Test runner Built-in --test flag Built-in
Formatter Built-in Prettier No
Linter Built-in ESLint No
npm compat Full Native Full
Compile to binary Yes Yes (SEA) Yes
Deploy platform Deno Deploy Many No

When to Use Deno 2

  • New projects where you want everything built-in
  • Security-sensitive code (permissions model)
  • Edge deployment (Deno Deploy is excellent)
  • Scripts and tools (compile to single binary)

When to Stay on Node.js

  • Existing large codebase (migration cost)
  • Specific Node.js native addons (C++ modules)
  • Team familiarity trumps technical advantages

Install

curl -fsSL https://deno.land/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

Building scripts that need web data? 88+ scrapers on Apify. Custom solutions: spinov001@gmail.com

Top comments (0)