Node.js lets any package access your file system, network, and environment variables. Deno asks permission first.
What is Deno?
Deno is a secure JavaScript/TypeScript runtime created by Ryan Dahl — the same person who created Node.js. It fixes the design mistakes Ryan regrets about Node while keeping full npm compatibility.
Why Deno Is Worth Your Attention
1. Secure by Default
# This FAILS — no permission granted
deno run server.ts
# Error: Requires net access to "0.0.0.0:3000"
# Explicitly grant permissions
deno run --allow-net --allow-read server.ts
# Or allow specific hosts only
deno run --allow-net=api.example.com server.ts
No package can silently exfiltrate data. You control what your code can access.
2. Native TypeScript
// server.ts — runs directly, no tsconfig needed
const handler = (req: Request): Response => {
const url = new URL(req.url);
if (url.pathname === '/api/time') {
return Response.json({ time: new Date().toISOString() });
}
return new Response('Not found', { status: 404 });
};
Deno.serve({ port: 8000 }, handler);
deno run --allow-net server.ts
3. Full npm Compatibility
// Use any npm package with npm: specifier
import express from 'npm:express@4';
import { PrismaClient } from 'npm:@prisma/client';
import chalk from 'npm:chalk@5';
const app = express();
app.get('/', (req, res) => {
res.json({ message: chalk.green('Hello from Deno + Express!') });
});
app.listen(3000);
4. Built-in Tooling
# Formatter (like Prettier)
deno fmt
# Linter (like ESLint)
deno lint
# Test runner (like Jest)
deno test
# Type checker
deno check server.ts
# Bundler
deno compile server.ts # Creates a standalone executable!
# Documentation generator
deno doc server.ts
# Benchmarking
deno bench bench.ts
All built in. Zero configuration. Zero npm packages to install.
5. Compile to Standalone Executables
# Compile to a single binary
deno compile --allow-net --allow-read server.ts
# Output: server (or server.exe on Windows)
# No Deno/Node installation needed to run it
./server
Distribute your app as a single file. No runtime required.
6. Deno KV — Built-in Database
const kv = await Deno.openKv();
// Store data
await kv.set(["users", "alice"], { name: "Alice", role: "admin" });
// Retrieve
const result = await kv.get(["users", "alice"]);
console.log(result.value); // { name: "Alice", role: "admin" }
// List by prefix
const users = kv.list({ prefix: ["users"] });
for await (const entry of users) {
console.log(entry.key, entry.value);
}
SQLite locally, globally replicated on Deno Deploy. No database setup needed.
7. Standard Library (Audited by Deno Team)
import { parse } from 'jsr:@std/csv';
import { format } from 'jsr:@std/datetime';
import { serve } from 'jsr:@std/http';
import { join } from 'jsr:@std/path';
import { crypto } from 'jsr:@std/crypto';
No more choosing between 5 CSV parsers. One standard, audited library.
Deno vs Node.js vs Bun
| Deno | Node.js | Bun | |
|---|---|---|---|
| Security | Permissions model | None | None |
| TypeScript | Native | Via tsc/tsx | Native |
| npm compat | Full (npm:) | Native | Full |
| Formatter | Built-in | Via Prettier | No |
| Linter | Built-in | Via ESLint | No |
| Test runner | Built-in | Via Jest/Vitest | Built-in |
| Compile to binary | Yes | Via pkg/nexe | No |
| Built-in DB | Deno KV | No | SQLite |
Getting Started
# Install
curl -fsSL https://deno.land/install.sh | sh
# Init project
deno init my-project
# Run
deno run --allow-net server.ts
# Or use tasks (like npm scripts)
deno task dev
The Bottom Line
Deno is what Node.js would look like if designed today. Security-first, batteries-included, and fully npm-compatible. If you care about supply chain security, Deno's permission model alone is worth the switch.
Building data tools? I create custom web scraping solutions. Check my Apify actors or email spinov001@gmail.com.
Top comments (0)