Deno - Modern JavaScript/TypeScript Runtime
Install and use Deno, the secure next-generation JavaScript/TypeScript runtime with built-in TypeScript support, zero-config tooling, web-standard APIs, and enterprise-grade security — covering installation, configuration, CLI tools, and common use cases.
- Step 1
Overview
Deno is a modern, secure runtime for JavaScript and TypeScript built on web standards. Created by Ryan Dahl (the original creator of Node.js), Deno addresses many of Node.js's architectural challenges while adding powerful new features.
Key Features:
- Secure by Default: No file system, network, or environment access unless explicitly granted
- TypeScript First: Native TypeScript support with zero configuration
- Web Standards: Built on web APIs that work the same in browser and server
- Complete Tooling: Built-in test runner, formatter, linter, and documentation generator
- Single Binary: No external dependencies, downloads in seconds
- Node Compatibility: Seamless npm package and Node.js built-in module support
- Modern Architecture: Based on V8, libuv, and Rust with async/await
- Enterprise Ready: Production deployments at Netflix, GitHub, Supabase, Stripe, Slack, and 400k+ users
Why Deno:
- Security: Sandboxed by default, explicit permissions
- Developer Experience: Zero-config TypeScript, built-in tools
- Web Standards: Future-proof APIs that match the browser
- Performance: Fast startup, efficient execution
- Simplicity: One binary, no complex dependency management
Official site: https://deno.com GitHub: https://github.com/denoland/deno (100K+ stars) Documentation: https://docs.deno.com JSR Package Registry: https://jsr.io Deno Deploy (Edge Platform): https://deno.com/deploy - Step 2
Quick Installation
Deno runs on macOS, Linux, and Windows. It's a single binary with no external dependencies.
Supported platforms:
- macOS: Intel (x64) and Apple Silicon (arm64)
- Windows: x64 and ARM64
- Linux: x64
Installation methods:
- Shell script (recommended) - fastest, best performance
- npm - convenient but slower startup
- Homebrew (macOS) - macOS package management
- Other package managers - Nix, asdf, vfox
# Option 1: Shell Script (Recommended) # Fastest startup, best performance curl -fsSL https://deno.land/install.sh | sh # Option 2: npm (Convenient but slower startup) npm install -g deno # Option 3: Homebrew (macOS only) brew install deno # Option 4: asdf Version Manager asdf plugin add deno https://github.com/asdf-community/asdf-deno.git asdf install deno latest asdf set -u deno latest # Option 5: vfox Version Manager vfox add deno vfox install deno@latest vfox use --global deno # Option 6: Nix nix-shell -p deno # Option 7: Cargo (from source) cargo install deno --locked # Option 8: Winget (Windows) winget install DenoLand.Deno # Verify installation deno --version # Should print something like: deno 2.0.x # View the help documentation deno help - Step 3
Running Code & the Permissions Model
Deno runs
.jsand.tsfiles directly — no build or transpile step. Its defining trait is that scripts are sandboxed: they cannot touch the filesystem, network, or environment unless you grant access with explicit flags. This is the opposite of Node.js, where any script has full access by default.Grant only what a script needs (least privilege), or use
-Ato allow everything during development.# Run a local file deno run main.ts # Run straight from a URL deno run https://docs.deno.com/examples/hello-world.ts # Granular permissions deno run --allow-net main.ts # network only deno run --allow-read=./data main.ts # read a specific dir deno run --allow-env --allow-net api.ts # env vars + network # Allow everything (dev convenience) deno run -A main.ts # REPL and one-off evaluation deno repl deno eval "console.log(1 + 2)"⚠ Heads up: Prefer scoped permissions (e.g. `--allow-read=./data`) over blanket `-A` in anything that runs untrusted code or ships to production. - Step 4
Project Configuration (deno.json)
A
deno.json(ordeno.jsonc) at the project root configures the runtime, tasks, dependencies, and tool settings. Deno auto-discovers it — no flag needed. It replaces much of whatpackage.json,tsconfig.json, and a bundler config do in a Node project.Use
tasksfor script shortcuts (deno task dev),importsfor bare-specifier import maps, andcompilerOptionsto tune TypeScript.{ "tasks": { "dev": "deno run --watch --allow-net main.ts", "start": "deno run --allow-net main.ts", "test": "deno test --allow-read" }, "imports": { "@std/assert": "jsr:@std/assert@^1.0.0", "oak": "jsr:@oak/oak@^17" }, "compilerOptions": { "strict": true, "lib": ["deno.window"] }, "fmt": { "lineWidth": 100, "singleQuote": false }, "lint": { "rules": { "tags": ["recommended"] } } } - Step 5
Built-in Toolchain
Deno ships a full toolchain in the single binary — no installing ESLint, Prettier, Jest, ts-node, or a bundler. Every command works zero-config but respects
deno.jsonwhen present.These cover formatting, linting, testing, type-checking, documentation, and producing standalone executables.
deno fmt # format code (Prettier-style) deno lint # lint with recommended rules deno test # run *_test.ts / *.test.ts files deno test --coverage # collect coverage deno check main.ts # type-check without running deno doc main.ts # generate docs from JSDoc deno bench # run benchmarks # Compile to a self-contained executable deno compile --allow-net -o server main.ts # Keep deps and the toolchain current deno upgrade - Step 6
Managing Dependencies (npm, JSR, import maps)
Deno has no
node_modulesinstall step by default — it caches remote modules on first use. You can import from three main sources:- JSR (
jsr:) — the modern JavaScript registry, Deno's preferred source - npm (
npm:) — the entire npm ecosystem works via thenpm:specifier - HTTPS URLs — import directly from any URL
Map long specifiers to short names in the
importsblock ofdeno.jsonso application code stays clean.// Direct specifiers import { serve } from "jsr:@std/http"; import express from "npm:express@4"; import { z } from "npm:zod"; // With an import map in deno.json: // "imports": { "@std/assert": "jsr:@std/assert@^1.0.0" } import { assertEquals } from "@std/assert"; assertEquals(1 + 1, 2); // Add dependencies from the CLI (writes to deno.json) // $ deno add jsr:@oak/oak // $ deno add npm:chalk // // Pre-cache all deps (e.g. in CI / Docker build): // $ deno install - JSR (
- Step 7
Common Use Cases
Because Deno implements web-standard APIs (
fetch,Request,Response,URL, Web Streams), the same code often runs in the browser, on the server, and at the edge. Typical uses:- HTTP servers & APIs via the built-in
Deno.serve - Scripting & automation — single-file tools with scoped permissions, runnable straight from a URL
- Edge functions deployed to Deno Deploy, Supabase Edge Functions, or Cloudflare
- Jupyter notebooks via the built-in kernel (
deno jupyter --install)
The example below is a complete, dependency-free HTTP server.
// server.ts — run with: deno run --allow-net server.ts Deno.serve({ port: 8000 }, (req: Request) => { const url = new URL(req.url); if (url.pathname === "/") { return new Response("Hello from Deno!"); } if (url.pathname === "/api/time") { return Response.json({ now: new Date().toISOString() }); } return new Response("Not Found", { status: 404 }); }); // Deploy globally: // deno deploy (https://deno.com/deploy) - HTTP servers & APIs via the built-in
Feature requests
Sign in to suggest features or vote on existing ones.
No feature requests yet.
Discussion
Sign in to join the discussion.
No comments yet.