Deno 2.0 Overview
Deno 2.0 is a groundbreaking release that significantly improves compatibility with Node.js. You can use existing npm packages almost as-is, making migration from Node.js much easier.
Full Node.js/npm Compatibility
Direct Use of npm Packages
// Use npm packages with npm: prefix
import express from "npm:express@4";
const app = express();
app.get("/", (req, res) => {
res.send("Hello from Deno!");
});
app.listen(3000);
package.json Support
{
"dependencies": {
"express": "^4.18.0",
"prisma": "^5.0.0"
}
}
The traditional npm/yarn workflow can now be used as-is.
Evolution of deno.json
{
"tasks": {
"dev": "deno run --watch main.ts",
"build": "deno compile main.ts",
"test": "deno test"
},
"imports": {
"@std/": "jsr:@std/"
}
}
New Permission Model
More granular permission control is now possible.
# Restrict reading to specific directory
deno run --allow-read=./data main.ts
# Restrict network to specific domain
deno run --allow-net=api.example.com main.ts
# Temporary permission prompt
deno run --prompt main.ts
JSR (JavaScript Registry)
Deno’s new package registry is now officially operational.
// Import from JSR
import { serve } from "jsr:@std/http";
import { assertEquals } from "jsr:@std/assert";
JSR Features
| Item | Description |
|---|---|
| TypeScript Native | Type definitions included by default |
| Source Code Publishing | Publish pre-transpiled code |
| Security | Signed packages |
Performance Improvements
- Reduced startup time
- Reduced memory usage
- Latest V8 engine adoption
Deno Use Cases
✓ Script execution
✓ Web server development
✓ CLI tool creation
✓ Serverless functions
✓ Edge execution with Deno Deploy
Summary
Deno 2.0 maintains Deno’s strengths of security and developer experience while ensuring compatibility with the Node.js ecosystem. Gradual migration from existing Node.js projects has become a realistic option.
← Back to list