Skip to main content
On this page

Get started with Deno

Deno (/ˈdiːnoʊ/, pronounced dee-no) is an open source JavaScript, TypeScript, and WebAssembly runtime with secure defaults and a great developer experience. This page takes you from nothing to a running, tested project in a few minutes.

Why Deno? Jump to heading

  • Works with your existing Node.js projects. Drop Deno into a repo with package.json and node_modules and it just runs; mix npm: imports with native ES modules as you migrate.
  • Modern module system. ES modules with URL imports, JSR for typed packages, and workspaces.
  • TypeScript-first. Run .ts files directly. No tsc, no build step, no config.
  • Secure by default. Code runs in a sandbox with no file, network, or environment access until you grant it.
  • A full toolchain, no plumbing. Built-in formatter, linter, test runner, benchmarking, and a lot more. No devDependencies to wire up.

Install Deno Jump to heading

Install the runtime with one command:

>_
curl -fsSL https://deno.land/install.sh | sh
pwsh
irm https://deno.land/install.ps1 | iex

Verify the install:

>_
deno --version

See Installation for package managers, Docker, and other options.

Create a project Jump to heading

Scaffold a new project with deno init:

>_
deno init my_project

That creates a small, ready-to-run project:

my_project
├── deno.json      # project configuration: tasks, imports, lint/fmt settings
├── main.ts        # a tiny HTTP server built on Deno.serve
└── main_test.ts   # its tests

deno.json is where your tasks, dependencies, and tooling config live. Think package.json plus your tool configs, in one file.

Run it Jump to heading

>_
$ cd my_project
$ deno -N main.ts
Listening on http://localhost:8000/

Notice the -N (short for --allow-net). Deno is secure by default: code can't touch the network, filesystem, or environment until you grant it. Open the URL to see the response.

main.ts is TypeScript and it ran directly: no tsc, no build step. It's also built on the web-standard Deno.serve with Request/Response, so what you learn here is the platform, not a framework.

Test it Jump to heading

The project ships with tests. Run them with deno test. The test runner is built in, so there's nothing to install:

>_
$ deno test
running 2 tests from ./main_test.ts
returns html on / ... ok (12ms)
returns json on /api ... ok (0ms)

ok | 2 passed | 0 failed (15ms)

Add a dependency Jump to heading

Pull in packages from npm or JSR with deno install:

>_
deno install express            # any npm package, like npm install
deno install jsr:@std/assert    # the Deno standard library, on JSR

Then import and use them:

import { assertEquals } from "@std/assert";

assertEquals(1 + 1, 2);

Use the built-in toolchain Jump to heading

Formatting, linting, and more come with the runtime, no setup needed:

>_
deno fmt     # format your code
deno lint    # catch problems
deno task    # run scripts defined in deno.json

Next steps Jump to heading

Last updated on

Did you find what you needed?

Edit this page
Privacy policy