Deno 2.0 Finally Released
In October 2024, Deno 2.0 was officially released. With significantly enhanced Node.js compatibility, practicality has dramatically improved. Deno, which Ryan Dahl said he “built to learn from Node.js’s shortcomings,” has finally become a viable option.
What is Deno: A JavaScript/TypeScript runtime developed by Ryan Dahl, the creator of Node.js. Features include security, native TypeScript support, and modern web standard APIs.
Major New Features
1. Full npm Compatibility
You can now use npm packages as-is. You can import directly using the npm: schema.
// Import npm packages directly
import express from "npm:express@4";
import { z } from "npm:zod";
const app = express();
app.get("/", (req, res) => {
res.json({ message: "Hello from Deno!" });
});
app.listen(3000);
Most npm packages work, making migration from Node.js easy.
2. package.json Support
With package.json, you can use traditional npm install and node_modules.
# Run existing Node.js project with Deno
deno run --allow-net --allow-read app.js
# package.json scripts can also be run
deno task start
3. LTS (Long Term Support) Introduction
With enterprise adoption in mind, LTS versions have been introduced. With long-term support for stable versions, production use has become realistic.
4. Workspaces and Multiple Project Management
Supports monorepo configurations. You can define workspaces in deno.json.
// deno.json
{
"workspace": ["./packages/api", "./packages/web", "./packages/shared"]
}
5. Package Publishing via JSR
JSR (JavaScript Registry) has arrived. You can publish TypeScript as-is and distribute packages usable by both npm and Deno.
// Import from JSR
import { assertEquals } from "jsr:@std/assert";
// Publishing is easy
// deno publish
Security Model
Deno’s signature security model has also evolved.
# Explicitly allow only necessary permissions
deno run --allow-net=api.example.com --allow-read=./data app.ts
# Allow all permissions (recommended only during development)
deno run -A app.ts
| Permission Flag | Description |
|---|---|
--allow-net | Network access |
--allow-read | File reading |
--allow-write | File writing |
--allow-env | Environment variable access |
--allow-run | Subprocess execution |
Development Tool Enhancement
Deno 2.0 also significantly improves the development experience.
Built-in Tools
# Formatter
deno fmt
# Linter
deno lint
# Test runner
deno test
# Benchmark
deno bench
# Documentation generation
deno doc
# Bundler
deno compile # Generate single executable
TypeScript Native
TypeScript works out of the box without configuration. No need to struggle with tsconfig.json settings.
// app.ts - Can be executed as-is
interface User {
id: number;
name: string;
}
const user: User = { id: 1, name: "Tanaka" };
console.log(user);
Comparison with Node.js
| Feature | Deno 2.0 | Node.js |
|---|---|---|
| TypeScript | Native support | Requires transpiler |
| Security | Explicit permission control | All permissions by default |
| Package management | URL/npm/jsr | npm |
| Config files | Minimal | Many required |
| Web standard APIs | Fetch etc. standard support | Added from v18 |
| Ecosystem | Rapidly growing | Huge & mature |
Framework Support Status
Here’s the Deno support status for major frameworks.
- Fresh: Deno’s official full-stack framework (Islands Architecture)
- Hono: High-speed web framework (full Deno support)
- Oak: Express-like middleware framework
- Express: Works via npm compatibility
- Next.js: Partial support
// Hono example
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/", (c) => c.json({ message: "Hello Hono!" }));
Deno.serve(app.fetch);
Summary
Deno 2.0 has become a practical option with significantly enhanced Node.js compatibility. It has many advantages including security, native TypeScript, and modern APIs. For new projects or security-focused projects, it’s worth actively considering.
← Back to list