Deno Commands

deno commands cheatsheet.

Run, permission, test and compile — the Deno commands you use every day. Tap to copy.

Run
deno run <file>.tsRun a TypeScript or JavaScript file
deno run --allow-net <file>Run with network access allowed
deno run -A <file>Run with all permissions granted
deno run --watch <file>Re-run automatically on file changes
deno serve <file>Serve an HTTP handler exported by the file
Permissions
deno run --allow-read <file>Allow filesystem read access
deno run --allow-write <file>Allow filesystem write access
deno run --allow-env <file>Allow reading environment variables
deno run --allow-run <file>Allow running subprocesses
deno run --deny-net <file>Deny network access explicitly
Tasks & deps
deno task <name>Run a task defined in deno.json
deno add <pkg>Add a dependency to deno.json
deno installInstall dependencies from deno.json
deno cache <file>Download and cache a module's dependencies
Test & bench
deno testRun tests in the project
deno test --allow-allRun tests with all permissions
deno benchRun benchmarks
deno coverageReport test coverage
Quality
deno fmtFormat your code
deno lintLint your code for problems
deno check <file>Type-check without running
deno doc <file>Show a module's documentation
Tools & info
deno compile <file>Build a standalone executable
deno upgradeUpdate Deno to the latest version
deno --versionShow the installed Deno version
deno infoShow cache and dependency info

What Deno actually does

Deno is a modern runtime for JavaScript and TypeScript, built as an alternative to Node.js by the same original author. Its headline trick is that it runs TypeScript directly — no separate compile step, no tsconfig wrangling — so deno run app.ts just works. It also ships a whole toolchain in one binary: a test runner, formatter, linter and bundler are all built in, which means far fewer dev dependencies cluttering your project.

Secure by default

The distinctive thing about running code with Deno is that a program can't touch anything sensitive unless you say so. By default a script has no access to the network, filesystem or environment variables. You opt in with permission flags: --allow-net for network, --allow-read and --allow-write for files, --allow-env for environment. When you just want to get moving, -A grants everything, and matching --deny-* flags let you carve out exceptions.

Tasks and dependencies

Configuration lives in deno.json, which holds an import map and a tasks section you run with deno task <name> — the rough equivalent of package scripts. Deno 2 added familiar package management: deno add records a dependency (from JSR or npm), deno install pulls everything the project needs, and deno cache downloads a module graph ahead of time so later runs are offline-fast.

The built-in toolchain

Because so much comes bundled, day-to-day upkeep is a handful of subcommands: deno fmt formats, deno lint catches problems, deno check type-checks without running, and deno test runs your suite. When you're ready to ship, deno compile turns a script into a single standalone executable. These pair naturally with the Git commands for version control and the Docker commands when you containerise your app.

FAQ

Why does Deno need permission flags?
Deno is secure by default, so a script can't touch the network, filesystem or environment unless you allow it. Flags like --allow-net or --allow-read grant exactly the access a program needs, and -A allows everything.
How do I run a TypeScript file in Deno?
Just point deno run at the file: deno run app.ts. Deno runs TypeScript directly with no separate build or tsconfig step, adding permission flags only where the script needs them.

More cheatsheets