BugTracker SDK π Read on Medium
A lightweight JavaScript SDK for automatically tracking frontend errors, API failures, and console issues in your applications. The SDK works seamlessly with both Axios and Fetch APIs.
- β Automatic Error Tracking - Captures JavaScript runtime errors and unhandled promise rejections
- β API Monitoring - Tracks Axios and Fetch API failures with full request/response data
- β Stack Trace Parsing - Extracts file, line, and column information from error stacks
- β Smart Fingerprinting - Groups similar errors automatically
- β Lightweight - Minimal overhead on your application
- β Image Capture - Capture Image At the time Of bug
npm install bug-tracker-sdkimport { initBugTracker } from "bug-tracker-sdk";
import axios from "axios";
initBugTracker({
apiKey: "your-api-key",
axios
});
// That's it! Your app is now tracking errors.To start using , you first need to generate a project API key from the dashboard.
Go to the dashboard and Login:
- Click the "Create Project" button.
- Enter your Project Name.
- Click Create Project.
After creating the project:
- An API Key will be automatically generated.
- Copy the API key from the dashboard.
BugTracker SDK allows you to enable or customize features based on your needs.
initBugTracker({
apiKey: "your-api-key",
axios,
features: {
captureScreenshots: {
fetchErrors: true,
axiosErrors: true,
consoleErrors: true,
},
manualBugReport: {
captureScreenshot: true,
floatingButton: () => {
const btn = document.createElement("button");
btn.textContent = "π¬ Feedback";
btn.style.background = "#6366f1";
btn.style.color = "white";
btn.style.padding = "10px 14px";
btn.style.borderRadius = "8px";
return btn;
},
modalSchema: {
title: "Report an Issue",
fields: [
{ name: "description", label: "Description", type: "textarea" },
{ name: "email", label: "Email", type: "text" },
],
},
},
capturePerformance: true,
},
});| Option | Description |
|---|---|
fetchErrors |
Capture screenshots on fetch failures |
axiosErrors |
Capture screenshots on axios failures |
consoleErrors |
Capture screenshots on console errors |
Customize feedback UI:
manualBugReport: {
captureScreenshot: true,
modalSchema: {
title: "Send Feedback",
fields: [
{ name: "description", type: "textarea" },
{ name: "email", type: "text" },
{
name: "category",
type: "select",
options: ["Bug", "UI Issue", "Suggestion"],
},
],
},
}| Option | Description |
|---|---|
capturePerformance |
Enable performance monitoring |
- Disable screenshot capture in high-performance apps if not needed
- Use manualBugReport to collect user feedback directly
- Enable all tracking in production for maximum visibility
import React from 'react';
import { initBugTracker } from 'bug-tracker-sdk';
import axios from 'axios';
// Initialize early in your application
initBugTracker({
project: 'my-react-app',
axios
});
function App() {
return <div>Your app here</div>;
}
export default App;Automatically catches uncaught exceptions:
// This error is automatically reported
const user = null;
console.log(user.name); // TypeError: Cannot read property 'name' of null// This rejection is automatically tracked
fetch('/api/data').catch(error => {
throw error; // Unhandled rejection caught
});// Failed requests are automatically tracked
const response = await axios.get('/api/users');
// 4xx and 5xx responses are reported// Fetch errors and non-200 responses are tracked
const response = await fetch('/api/data');
if (!response.ok) {
// Non-200 responses are reported
}import { initBugTracker } from "bug-tracker-sdk";
import axios from "axios";
initBugTracker({
apiKey: "sk_live_xxxxx",
axios,
});Once errors are reported to your BugTracker collector, they appear in the dashboard at:
- View all errors - See every error across your application
- Group by type - Similar errors are automatically grouped
- Track occurrences - See how many times an error has happened
- Full stack traces - Click into errors to see complete details
- Timeline - View first seen and last seen timestamps
Initialize the SDK as early as possible in your application, preferably before any other code:
// app.js or main.tsx
import { initBugTracker } from 'bug-tracker-sdk';
import axios from 'axios';
initBugTracker({
project: 'my-app',
axios
});
// Rest of your app initialization...