debug

A tiny, zero-config JavaScript debugging utility with namespaced, color-coded output for Node.js and the browser.

Library
npm
v4.4.3
11,454 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
51 /100 Fair
Development Activity 8
Maintenance 20
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
86 /100 Excellent
Architecture 86
Code Quality 82
Innovation 92
Learning Curve 90

debug is a minimalist JavaScript debugging utility modelled after Node.js core’s own internal debugging technique. It lets you wrap conditional log output in named debug instances that stay completely silent in production unless explicitly enabled, so you can sprinkle diagnostic statements throughout a codebase without paying a runtime cost or cluttering normal output.

Output is toggled entirely through the DEBUG environment variable (or localStorage.debug in the browser), with wildcard and exclusion patterns for selecting exactly which namespaces to surface. Each namespace gets an automatic color, printf-style formatters, and millisecond timing diffs between calls, making it one of the most widely depended-on packages in the npm ecosystem.

What You Get

  • A tiny factory API: require('debug')('namespace') returns a ready-to-use logging function
  • Runtime enable/disable controlled by the DEBUG env var (or localStorage.debug in browsers) with wildcard and exclusion patterns
  • Automatic per-namespace colors and millisecond timing diffs between successive calls
  • printf-style formatters (%o, %O, %s, %d, %j) plus support for registering custom formatters
  • Isomorphic builds for both Node.js and the browser from a single package

Common Use Cases

  • Instrumenting a library so downstream consumers can toggle its internal logging without code changes
  • Adding low-overhead, namespaced diagnostics to an application that stay quiet in production
  • Selectively enabling logs from specific subsystems (e.g. DEBUG=app:db,app:http) while excluding noisy ones

Under The Hood

Architecture — The package is deliberately small and factored around a shared core: src/index.js sniffs the runtime (checking process.type, process.browser, and process.__nwjs) and delegates to either src/node.js or src/browser.js, each of which supplies environment-specific concerns (color detection, output stream, env parsing) into the common setup(env) factory in src/common.js. That factory builds the createDebug function, whose per-namespace debug closure tracks previous timestamps, computes millisecond diffs, applies formatters, and short-circuits immediately when disabled.

Tech Stack — Pure JavaScript targeting node >=6, with a single runtime dependency (ms for humanizing time diffs) and an optional supports-color peer dependency for richer Node color output. Browser bundles are produced with browserify; tests run on mocha with sinon, and karma drives the browser test suite. Linting is handled by xo.

Code Quality — The codebase is compact and well-commented, with a clear separation between shared logic and platform adapters. Tests exist (test.js plus test.node.js) covering enable/disable semantics, formatting, and namespace matching, run through mocha and karma. The narrow API surface and long production history across hundreds of millions of weekly downloads make it battle-tested.

API Design — The public API is exceptionally ergonomic: require('debug')('namespace') returns a callable logger, and everything else (wildcards, exclusions, .extend(), .enable()/.disable(), custom formatters, per-instance log overrides) layers on without ceremony. Zero configuration is required to get started, and runtime control via the DEBUG env var means instrumentation needs no code changes to toggle.

Used by 32 apps in this directory

TypeScript
94%
MIT

Actual

Invoicing Finance

28,786

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
73
Dependency
Built with
TypeScript 94%
Updated 1 weeks ago
TypeScript
83%
Other

AFFiNE

Collaboration · Note Taking · Productivity

72,584

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
90
Repo Health
87
Technical
67
Dependency
Built with
TypeScript 83%
Rust 10%
Updated 1 weeks ago
TypeScript
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,597

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
72
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 2 weeks ago
TypeScript
49%
MPL 2.0

Artillery

Developer Tools · Devops

9,076

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
87
Repo Health
73
Technical
68
Dependency
Built with
TypeScript 49%
JavaScript 48%
Updated 3 weeks ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,969

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
63
Dependency
Built with
JavaScript 100%
Updated 7 months ago
TypeScript
91%
Other

browserless

Automation · Developer Tools

13,696

Run headless Chrome, Firefox, and WebKit as a managed Docker service — drop-in Puppeteer and Playwright support with no infrastructure overhead.

View details
85
Repo Health
82
Technical
73
Dependency
Built with
TypeScript 91%
Updated 1 weeks ago
TypeScript
96%
Other

CapRover

Developer Tools · Devops · Hosting Control Panel

15,161

Deploy any app, database, or website to your own server in minutes—no Docker or Linux expertise required.

View details
88
Repo Health
82
Technical
68
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
JavaScript
90%
Other

CodeSandbox

Code Editors · Developer Tools

13,641

Instantly ready browser-based IDE that runs full npm dependency resolution and transpilation entirely client-side, with no server needed.

View details
70
Repo Health
76
Technical
62
Dependency
Built with
JavaScript 90%
Updated 2 weeks ago
TypeScript
99%
Apache 2.0

Colanode

Collaboration · Knowledge Management · Team Chat

5,134

Local-first, self-hosted workspace that combines real-time chat, Notion-style pages, and structured databases — all synced via CRDTs so you work offline without losing a keystroke.

View details
47
Repo Health
73
Technical
70
Dependency
Built with
TypeScript 99%
Updated 5 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers