Universal SDK Interface
The complete interface contract shared by every DebugBundle SDK — methods, config fields, behavior guarantees, and volume controls.
Every DebugBundle SDK implements this universal interface contract. Language-specific naming conventions differ (camelCase for JavaScript/PHP/Java/Kotlin/Swift, PascalCase methods for Go, snake_case for Python/Ruby), but the semantics, behavior guarantees, and volume control rules are identical.
Core Methods
Every SDK exposes these methods:
| Method | Purpose | Returns |
|---|---|---|
init(config) | Initialize the SDK with configuration. Must be called once before any capture. | void |
captureException(error, context?) | Capture an error/exception with optional context. | void |
captureLog(message, level, context?) | Capture a structured log event. | void |
captureRequest(request, response, context?) | Capture an HTTP request/response pair. | void |
captureMessage(message, level?, context?) | Capture a diagnostic message. | void |
setContext(key, value) | Attach persistent context to all future events. | void |
probe(label, data, opts?) | Buffer diagnostic data in a ring buffer. | void |
flush() | Force-send all buffered events. | Promise<void> |
Language Naming Conventions
| Language | Style | Example |
|---|---|---|
| Node.js | camelCase | debugbundle.captureException(err) |
| Browser | camelCase | debugbundle.captureException(err) |
| Python | snake_case | debugbundle.capture_exception(err) |
| PHP | camelCase (PSR) | DebugBundle::captureException($e) |
| Java | camelCase | client.captureException(error) |
| Go | PascalCase methods | client.CaptureException(ctx, err) |
| C# / .NET | PascalCase methods | DebugBundle.CaptureException(error) |
| Ruby | snake_case | DebugBundle.capture_exception(error) |
| Android | Kotlin camelCase | DebugBundle.captureException(error) |
| Swift | Swift camelCase | DebugBundle.captureException(error) |
| React Native | camelCase | DebugBundle.captureException(error) |
Configuration Fields
All SDKs accept these common configuration fields:
| Field | Type | Default | Description |
|---|---|---|---|
projectToken | string | — | Required. Project token for ingestion auth (dbundle_proj_...). |
environment | string | auto-detect | Deployment environment: production, staging, development, etc. |
service | string | auto-detect | Service name for multi-service projects. |
enabled | boolean | true | Kill switch — set to false to disable all capture. |
redactFields | string[] | Default set | Additional field names to redact before transmission. |
sampleRate | number | 1.0 | Event sampling rate (0.0–1.0). Applied per-event. |
batchSize | number | SDK-specific | Max events per batch (Node: 50, Browser: 25). |
flushInterval | number (ms) | SDK-specific | Max time before batch send (Node: 2000, Browser: 3000). |
endpoint | string | https://api.debugbundle.com/v1/events | Ingestion endpoint URL. |
transport | string | auto-detect | http, file, or relay (browser only). |
localEventsDir | string | .debugbundle/local/events | Directory for file transport output. |
Browser-Specific Fields
| Field | Type | Default | Description |
|---|---|---|---|
maxBreadcrumbs | number | 10 | Ring buffer size for breadcrumbs. |
breadcrumbsOnErrorOnly | boolean | true | Only ship breadcrumbs alongside exceptions. |
captureNetwork | boolean | true | Capture network request breadcrumbs. |
captureClicks | boolean | true | Capture click event breadcrumbs. |
captureRouteChanges | boolean | true | Capture navigation breadcrumbs. |
captureConsole | boolean | false | Capture console.error/console.warn breadcrumbs. |
networkFilter | object | — | Filter network breadcrumbs by URL, status code, response time. |
sessionSampleRate | number | 1.0 | Session-level sampling (all-or-nothing per session). |
maxEventsPerSession | number | 100 | Hard cap per session; only exceptions permitted after cap. |
Transport Modes
| Mode | SDK | Description |
|---|---|---|
http | Server and mobile SDKs | Direct HTTPS to ingestion API. Default for connected projects. |
file | Node, Python, PHP, Java, .NET, Go, Ruby | Write events to local filesystem for CLI processing. Default for local-only server projects. |
offline queue | Android, iOS, React Native | Bounded app-private queue with platform-aware deferred flushing. Used for offline, background, and local/development paths. |
relay | Browser | Send events through your backend relay endpoint instead of directly to DebugBundle. |
Transport is automatically selected based on your .debugbundle/local/connection.json mode:
- Local-only →
filetransport (server SDKs), app-private offline queue (mobile SDKs),relayorhttp(browser) - Connected →
httptransport with SDK-specific buffering or offline retry
Event Envelope
Every captured event is wrapped in a standard envelope:
{
"event_id": "evt_01HXYZ...",
"event_type": "backend_exception",
"timestamp": "2026-03-24T10:30:00.000Z",
"service": { "name": "api-server", "environment": "production" },
"sdk": { "name": "@debugbundle/sdk-node", "version": "1.0.0" },
"context": { "user_id": "usr_123" },
"payload": { /* event-type-specific data */ }
}Backend Runtime Facts
Backend exception events include a payload.runtime object. Every backend SDK reports the runtime version; SDKs should also include safe process facts when the language exposes them without reading environment variables or secrets.
| Field | Meaning |
|---|---|
platform, arch | Operating system and CPU architecture. |
pid, cwd, uptime_sec, hostname | Process identity and lifetime context. |
memory | Best-effort runtime memory stats when available. |
framework_version, framework_extras | Best-effort framework-specific context. |
Current shipped scope: the Node.js SDK captures the full safe process-fact set. Python and PHP emit runtime version today and can receive the same fuller enrichment in their SDK-specific releases.
Event Types
| Type | Source | Description |
|---|---|---|
backend_exception | Server SDKs | Unhandled or manually captured exceptions. |
frontend_exception | Browser and mobile client SDKs | JavaScript, React Native, Android, or iOS client errors. |
request_event | Server SDKs; Browser SDK for first-party 5xx network failures; mobile SDKs for scoped first-party requests | HTTP request/response pairs. |
log_event | All SDKs | Structured log entries. |
frontend_breadcrumb | Browser and mobile client SDKs | User interaction, navigation, app lifecycle, and network breadcrumbs. |
deploy_metadata | CLI / API | Deployment information. |
error_suppressed | All SDKs | Aggregated duplicate errors from volume control. |
probe_event | All SDKs | Diagnostic ring buffer snapshots. |
Volume Control
All SDKs implement mandatory volume control to prevent event storms:
Duplicate Suppression
When the SDK captures the same error repeatedly:
- First 3 occurrences in a 30-second window → sent normally
- Subsequent duplicates → aggregated into a single
error_suppressedevent with occurrence count - Window resets after 30 seconds of silence
"Same error" is determined by fingerprinting: error class + message + top stack frame.
Loop Protection
Prevents runaway error loops from flooding the ingestion API:
- Trigger: More than 10 identical errors in 2 seconds
- Action: Force suppression — all events for that fingerprint held in buffer
- Checkpoint: Every 30 seconds, one event released to check if the loop has stopped
- Reset: After 60 seconds with no new occurrences, normal capture resumes
Buffer Retention
- Events are never dropped on transport failure
- SDK respects
Retry-Afterheaders from the ingestion API - Buffer has a hard size limit (configurable per SDK) to prevent memory exhaustion
- On buffer overflow, oldest non-exception events are evicted first
Probes
Probes are diagnostic ring buffers that capture application state over time:
// Node.js
debugbundle.probe('db_pool', () => ({
active: pool.activeCount,
idle: pool.idleCount,
waiting: pool.waitingCount,
}));Probe Types
| Type | Description | Trigger |
|---|---|---|
| Always-on | Captures data at every probe call. | Automatic, based on interval. |
| Lazy | Captures only when an incident is being processed. | On-demand during bundle generation. |
| Heavy | Captures detailed/expensive data. Remote-activation only (paid tiers). | Activated via API/CLI/MCP. |
Ring Buffer
Probe data is stored in a fixed-size ring buffer (default 10 entries). When the buffer is full, the oldest entry is overwritten. This keeps memory usage constant regardless of probe frequency.
Safety Guarantees
Every SDK enforces these guarantees:
- Never throw — SDK methods never throw uncaught exceptions into user code
- Never block — SDK methods never block the request/response cycle
- Never crash — SDK failures are caught internally and swallowed silently
- Graceful degradation — If the ingestion API is unreachable, events are buffered and retried
- Memory bounded — Buffers have hard limits to prevent memory exhaustion
Redaction
All SDKs apply automatic redaction before events leave the process:
Default Redacted Fields
password, secret, token, authorization, cookie, set-cookie, x-api-key, credit_card, card_number, cvv, ssn, social_security
Custom Redaction
debugbundle.init({
projectToken: process.env.DEBUGBUNDLE_PROJECT_TOKEN,
redactFields: ['x-custom-secret', 'internal_id'],
});Custom fields are merged with defaults — you cannot disable default redaction.
SDK Support Snapshot
| Feature | Node.js | Browser | Python | PHP | Java | .NET | Go | Ruby | Android | iOS | React Native |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Status | Shipped | Shipped | Shipped | Shipped | Shipped | Released v1.1.1 | Shipped | Shipped | Released v1.1.0 | Released v0.1.1 | Released v1.1.0 |
| Package | @debugbundle/sdk-node | @debugbundle/sdk-browser | debugbundle-python | debugbundle/sdk-php | Maven com.debugbundle modules | NuGet DebugBundle.Sdk plus DebugBundle.* integrations | github.com/debugbundle/debugbundle-go | debugbundle | Maven com.debugbundle Android modules | https://github.com/debugbundle/debugbundle-swift / CocoaPods DebugBundle | @debugbundle/sdk-react-native |
| Framework integrations | Express, Fastify, Next.js | — | Django, Flask, FastAPI | Laravel, Symfony | Spring Boot, servlet, JAX-RS | ASP.NET Core, gRPC, Worker Service, Hangfire, Azure Functions isolated worker | net/http, Gin, Echo | Rails, Rack, Sidekiq | Android runtime, OkHttp, Ktor, Navigation, Compose | iOS runtime, URLSession, Alamofire, UIKit, SwiftUI | React error boundary, React Navigation, Expo development builds |
| Logger integrations | pino, winston, bunyan | — | logging, structlog, loguru | Monolog | JUL, Logback | Microsoft.Extensions.Logging, Serilog, NLog, log4net | slog, zap, zerolog | Logger, Semantic Logger | Timber | SwiftLog | JS console/log facade plus native foundations |
| Safe backend/runtime facts | Full process facts | — | Full process facts | Full process facts | Full process facts | .NET runtime and hosting facts | Full process facts | Full process facts | Android app/device context | iOS app/device context | React Native app/device context through native foundations |
| Breadcrumbs | — | Yes | — | — | — | — | — | — | Yes | Yes | Yes |
| Relay handler | Express, Fastify, Next.js | Relay client path | Django, Flask, FastAPI | Laravel, Symfony | Spring Boot, servlet, JAX-RS | ASP.NET Core endpoint mapping | net/http, Gin, Echo | Rack middleware + Rails route | N/A | N/A | N/A |
| Probes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
| File transport | Yes | — | Yes | Yes | Yes | Yes | Yes | Yes | Offline queue | Offline queue | Offline queue |
For the public V1 parity matrix, including 5xx request-failure behavior and relay support, see SDKs.
Next Steps
- Node.js SDK — Full Node.js setup and framework integrations
- Browser SDK — Full Browser SDK setup with breadcrumbs and relay
- Python SDK — Full Python setup and framework integrations
- PHP SDK — Full PHP setup and framework integrations
- Java SDK — Full Java setup across Spring Boot, servlet, JAX-RS, and app servers
- .NET SDK — Full .NET setup across ASP.NET Core, Worker Service, gRPC, Hangfire, Azure Functions, and logging adapters
- Go SDK — Full Go setup with HTTP frameworks, logger integrations, and relay support
- Ruby SDK — Full Ruby setup with Rails, Rack, Sidekiq, logger integrations, and relay support
- Android SDK — Full Android setup with crash replay, ANR capture, offline queueing, native HTTP instrumentation, and probes
- iOS SDK — Full iOS and iPadOS setup with SwiftUI, UIKit, URLSession, Alamofire, SwiftLog, offline queueing, crash replay helpers, and probes
- React Native SDK — Full React Native setup with TypeScript APIs, React helpers, navigation, network capture, Expo development builds, and native queues
- Browser Relay Setup — Relay architecture and backend setup
React Native SDK
Install DebugBundle in React Native apps with TypeScript APIs, React helpers, navigation breadcrumbs, fetch/XHR trace propagation, native offline queueing, and Expo development-build support.
WordPress Plugin
Install the DebugBundle WordPress plugin for backend PHP capture and frontend browser capture through a same-origin relay.