Skip to main content

View table of contents

Using JSR with Deno

Deno is a secure runtime for JavaScript and TypeScript. It has native support for JSR imports using either an import map or jsr: specifiers.

Using import maps

Deno supports web standard import maps, the deno.json configuration file can act as an import map with the "imports" field. You can add JSR imports manually to deno.json, or you can add them using the deno add command.

In this example, we add the most recent version of @luca/flag to your project.

deno add @luca/flag

After executing this command, you will have an import map entry in deno.json that looks something like this:

  "imports": {
    "@luca/flag": "jsr:@luca/flag@^1.0.1"

You can then use the module from code like this:

import { printProgress } from "@luca/flag";

Using JSR specifiers

In Deno, you can use packages without an install step by using jsr: specifiers directly within your source files. In this example, we import the @luca/flag module directly in our code, without needing an import map entry.

import { printProgress } from "jsr:@luca/flag@^1.0.1";


Learn more about using packages.

Additional tooling

Deno provides a variety of additional tools to help manage JSR packages.


The deno publish command can be used to publish JSR packages. Packages can be published from a local machine, or from CI.

Learn more about publishing packages.

Documentation linting and preview

Deno provides a built-in lint rule to ensure that all exported functions and variables in a JSR package have JSDoc comments.

The documentation linter can be run using the deno doc --lint command.

deno doc --lint

Deno can also generate an HTML version of the documentation for your package. This is a good way to preview how a package’s documentation will look on once it’s published.

deno doc --html

Dependency analysis

The deno info command can be used to analyze the dependencies of a JSR package. This command will display a list of all dependencies, including their version constraints.

$ deno info jsr:@std/fs

Edit this page on GitHub