Skip to content

How to understand a Deno codebase

Deno runs TypeScript directly, imports modules by URL or by `jsr:` and `npm:` specifiers, and requires explicit permissions for network, file and environment access. Configuration and dependency aliases live in `deno.json`, which plays the role of `package.json` and `tsconfig.json` together.

How to tell it's Deno

  • deno.json or deno.jsonc, often with a deno.lock
  • Imports like jsr:@std/http or npm:express, or aliases from an import map
  • Deno.serve, Deno.env.get and Deno.readTextFile calls

Where things usually live

deno.json
Tasks (scripts), import map, compiler options, lint and format settings.
main.ts
Common entry point; check tasks for the real one.
routes/ and islands/
In Fresh apps: file-based routes and interactive components.
*_test.ts
Tests run with deno test.

Conventions, not rules. Real projects rename and move things, so confirm against the repository.

Where to start reading

  1. deno.json tasks, to find the start command and its permission flags
  2. The import map, to see what bare names point to
  3. The file passed to deno run

How a request moves through the code

  1. 1A task runs deno run with permission flags such as --allow-net.
  2. 2Deno resolves imports through the import map and caches remote modules.
  3. 3The entry calls Deno.serve(handler), or a framework does.
  4. 4The handler receives a web-standard Request and returns a Response.

Questions to ask about the repository

  • Which permissions does this app need, and why?
  • What does each alias in the import map resolve to?
  • Is this a Fresh app, a plain Deno.serve server or a CLI?

What trips people up

  • Missing permission flags cause runtime errors that look like bugs in the code.
  • Node-style process.env and require may not work; look for Deno.env or Node compatibility imports.