Express

Set up debugger in an Express.js project.

Last updated March 19, 2026

Express

This guide covers adding debugger to an Express project. The setup takes one line.

Express official docs

Feature Support
Server console Yes
Server errors Yes
HTTP requests Yes
Browser script injection Manual

Install

npm install -D @ephem-sh/debugger

Set up

Import and call instrumentExpress with your Express app:

import express from 'express'
import { instrumentExpress } from '@ephem-sh/debugger/express'

const app = express()
instrumentExpress(app)

This sets up the log store, IPC bridge, console patching, and HTTP middleware for the ingest endpoint and browser client script. It no-ops when NODE_ENV is production.

Browser support

The middleware automatically serves /_/d.js and handles POST /_/d for browser log ingestion. Add script tags before </body> in your HTML templates:

<script>window.__DEBUGGER_INGEST_URL__="/_/d";</script>
<script src="/_/d.js" defer></script>

Verify

node index.ts
npx dbg status
pnpm dlx dbg status
bun x dbg status
yarn dlx dbg status
npx dbg browser console
pnpm dlx dbg browser console
bun x dbg browser console
yarn dlx dbg browser console
npx dbg server console
pnpm dlx dbg server console
bun x dbg server console
yarn dlx dbg server console

Full example

See the complete working example at examples/node/expressjs.

Search Documentation

Search for pages and content