JavaScript/TypeScript client for ActiveRabbit.ai — application monitoring and error tracking. Framework-agnostic core SDK that works in Node.js, browsers, and any JavaScript runtime.
- Event tracking —
trackEvent(name, properties, options) - Exception tracking —
trackException(error, options)with stack traces, context, deduplication and PII scrubbing - Performance monitoring —
trackPerformance,startTransaction/finishTransaction,measure/measureAsync - PII scrubbing — automatic filtering of passwords, emails, phone numbers, credit cards, etc.
- Batching — events are collected and sent in configurable batches
- Universal — works in Node.js, browsers, and any JS runtime with
fetchsupport
npm install activerabbit
# or
yarn add activerabbit
pnpm add activerabbitimport { configure, trackEvent, trackException, captureException } from 'activerabbit';
configure({
apiKey: process.env.ACTIVERABBIT_API_KEY,
projectId: process.env.ACTIVERABBIT_PROJECT_ID,
environment: 'production',
});
// Track events
trackEvent('page_view', { path: '/home' });
// Track exceptions
try {
riskyOperation();
} catch (err) {
captureException(err, { context: { screen: 'checkout' } });
}const { configure, trackEvent, trackException, flush, shutdown } = require('activerabbit');
configure({
apiKey: process.env.ACTIVERABBIT_API_KEY,
projectId: process.env.ACTIVERABBIT_PROJECT_ID,
environment: 'production',
});
trackEvent('job_completed', { jobId: '123', duration_ms: 450 });
// Flush before process exit
process.on('beforeExit', async () => {
await shutdown();
});<script type="module">
import { configure, trackEvent, captureException } from 'activerabbit';
configure({
apiKey: 'YOUR_API_KEY',
environment: 'production',
});
trackEvent('page_view', { path: window.location.pathname });
</script>import { trackPerformance, startTransaction, finishTransaction, measure, measureAsync } from 'activerabbit';
// Direct tracking
trackPerformance('api_call', 150.5, { endpoint: '/users' });
// Transactions
const txId = startTransaction('checkout_flow');
// ... do work ...
finishTransaction(txId, { items: 3 });
// Measure sync/async functions
const result = measure('compute', {}, () => heavyComputation());
const data = await measureAsync('fetch_users', {}, () => fetch('/api/users'));import { configure } from 'activerabbit';
configure({
apiKey: 'your-api-key', // Required
apiUrl: 'https://app.activerabbit.ai',
projectId: 'your-project-id',
environment: 'production', // Default: 'development'
// Batching
batchSize: 100,
flushInterval: 30, // seconds
queueSize: 1000,
// Features
enablePerformanceMonitoring: true,
enablePiiScrubbing: true,
piiFields: ['password', 'email', 'ssn', 'credit_card'],
ignoredExceptions: ['AbortError'],
dedupeWindow: 300, // seconds
// Release tracking
release: '1.2.3',
serverName: 'web-01',
// Hooks
beforeSendEvent: (event) => event, // return null to drop
beforeSendException: (exc) => exc, // return null to drop
});| Function | Description |
|---|---|
configure(config) |
Initialize the SDK with configuration |
configured() |
Check if SDK is configured |
getConfiguration() |
Get current configuration |
trackEvent(name, properties?, options?) |
Track a custom event |
trackException(error, options?) |
Track an exception |
captureException(error, options?) |
Alias for trackException |
trackPerformance(name, duration_ms, metadata?) |
Track performance metric |
startTransaction(name, metadata?) |
Start a performance transaction |
finishTransaction(id, metadata?) |
Finish a performance transaction |
measure(name, metadata, fn) |
Measure sync function execution |
measureAsync(name, metadata, fn) |
Measure async function execution |
testConnection() |
Test connection to ActiveRabbit API |
notifyRelease(params?) |
Notify about a new release |
flush() |
Flush pending events |
shutdown() |
Flush and shut down the SDK |
Compatible with the same endpoints as the Ruby gem (activerabbit-ai):
POST /api/v1/events— eventsPOST /api/v1/events/errors— exceptionsPOST /api/v1/events/performance— performance metricsPOST /api/v1/events/batch— batch eventsPOST /api/v1/releases— release notificationsPOST /api/v1/test/connection— connection test
This is the core SDK. Framework-specific packages are available separately:
| Framework | Package | Status |
|---|---|---|
| React | activerabbit-react |
Coming soon |
| React Native | activerabbit-react-native |
Coming soon |
| Next.js | activerabbit-nextjs |
Coming soon |
| Nest.js | activerabbit-nestjs |
Coming soon |
| Vue | activerabbit-vue |
Coming soon |
See the examples/ directory for integration patterns.
MIT