IDebug is experimental. Prefer enabling only in development.
Core concepts

Core concepts

Sessions

A session groups events for one HTTP request (or a short-lived orphan batch for background work).

FieldMeaning
idUnique session id
kindrequest or orphan
method / urlFrom the first req event
statusCode / durationMsFrom res
activeStill open until response finishes

Concurrent requests get different session ids via AsyncLocalStorage. There is no process-global “current session” static.

Events (TraceEvent)

Every stored server event has:

{
  id, type, sessionId, timestamp, sequence, appName, environment, payload;
}

sequence is monotonic per process and powers polling (sinceSequence) and SSE.

Event types

TypeRole
reqIncoming request snapshot
resResponse status, headers, elapsed time
functionCallWrapped function I/O — with phase: 'enter' | 'exit'
middlewareCallMiddleware name
reqModified / resModifiedField mutations (source: 'app' | 'framework')
errorRequest-scoped errors
dbQueryORM/driver query nested under the issuing function

Double-point paths

Wrappers emit enter when a function is called and exit when it returns. The UI path graph therefore reads:

request → controller↓ → service↓ → db query → service↑ → controller↑ → response

instead of only deepest-first exit events. Database calls are dbQuery events with the same parentName / executionOrder as functions, so the UI call tree shows controller → service → query.

Redaction

Before store.record, payloads are walked and sensitive keys replaced with ***:

authorization, cookie, password, token, api_key, …

Add more via redactKeys in config.

Store

In-memory ring buffer:

  • maxSessions (default 200)
  • maxEventsPerSession (default 500)
  • maxTotalEvents (default 10_000)

Subscribers power the SSE stream at {basePath}/api/stream.

UI base path

Default /__idebug. Hosts:

  • Static SPA (@idebug/ui dist)
  • REST + SSE under /api/*

See HTTP API.

Database queries

@idebug/db emits dbQuery events on the same session. Wrap ORM clients (instrumentDrizzle, instrumentPrisma, …) and wrap the functions that call them — queries become leaves of that call tree. Live demo: sample-db-api on port 3003. Guide: Database queries.