Quickstart
You'll connect your repository, install the SDK with your API key, and get a pull request from Bugstack when your app throws an uncaught error. Connecting the repository also starts repository scanning for vulnerable packages, secrets and outdated packages. Pick your stack below.
1. Get your API key
- Sign in at dashboard.bugstack.ai with your GitHub account and start the 14-day trial: $50 of credit and a first security audit on us. A card is required, and nothing is charged that day.
- Connect the repository you want Bugstack to maintain: install the Bugstack GitHub App on it. Bugstack then runs your test suite once in its isolated sandbox, with the network cut; when every test passes, the project’s settings show the repository as sandbox-ready, and every fix is proven there before you see it.
- Copy the API key from the project settings and set it as an environment variable:
export BUGSTACK_API_KEY="bsk_..."
2. Install and initialize
Pick your stack. Each example is the minimal setup that reports errors. Pass endpoint as shown: the published SDK versions do not default to it yet.
JavaScript / TypeScript
Install
npm install bugstack-sdk
Express
const { initBugStack, bugstackErrorHandler } = require('bugstack-sdk/express')
// After app creation:
app.use(initBugStack({
apiKey: process.env.BUGSTACK_API_KEY,
endpoint: process.env.BUGSTACK_ENDPOINT || 'https://dashboard.bugstack.ai/api/ingest/sdk',
}))
// ... your routes ...
// Before app.listen:
app.use(bugstackErrorHandler())
Next.js — App Router route handlers
// lib/bugstack.ts
import { ErrorCaptureClient, withErrorCapture } from 'bugstack-sdk'
ErrorCaptureClient.init({
apiKey: process.env.BUGSTACK_API_KEY!,
endpoint: process.env.BUGSTACK_ENDPOINT ?? 'https://dashboard.bugstack.ai/api/ingest/sdk',
})
export { withErrorCapture }
// app/**/route.ts: wrap each route handler
import { withErrorCapture } from '@/lib/bugstack'
export const GET = withErrorCapture(async (request) => {
// ...your handler, unchanged
return Response.json({ ok: true })
})
Only the route handlers you wrap are reported. Errors in server components, server actions, middleware and the browser are not captured.
Python
Install
pip install bugstack
FastAPI
# In your main app file, after the FastAPI app is created:
import os
import bugstack
from bugstack.integrations.fastapi import FastAPIMiddleware
bugstack.init(
api_key=os.environ.get("BUGSTACK_API_KEY", ""),
endpoint=os.environ.get("BUGSTACK_ENDPOINT", "https://dashboard.bugstack.ai/api/ingest/sdk"),
)
app.add_middleware(FastAPIMiddleware)
Flask, Django and plain Python
See the Python installation guide.
Ruby
Install
bundle add bugstack --version '~> 1.0'
Rails
# config/initializers/bugstack.rb
require "bugstack/integrations/rails"
Bugstack.init(
api_key: ENV["BUGSTACK_API_KEY"],
endpoint: ENV.fetch("BUGSTACK_ENDPOINT", "https://dashboard.bugstack.ai/api/ingest/sdk")
)
# Inside Rails' own error pages, so bugstack sees the error before they answer it:
Rails.application.config.middleware.insert_after(
ActionDispatch::DebugExceptions,
Bugstack::Integrations::RackMiddleware
)
Go
Install
go get github.com/MasonBachmann7/bugstack-go@v1.1.0
net/http
// In main.go:
import bugstack "github.com/MasonBachmann7/bugstack-go"
endpoint := os.Getenv("BUGSTACK_ENDPOINT")
if endpoint == "" {
endpoint = "https://dashboard.bugstack.ai/api/ingest/sdk"
}
bugstack.Init(bugstack.Config{
APIKey: os.Getenv("BUGSTACK_API_KEY"),
Endpoint: endpoint,
})
defer bugstack.Flush()
// Report panics from your handlers:
import "github.com/MasonBachmann7/bugstack-go/middleware"
http.ListenAndServe(":8080", middleware.NetHTTP(mux))
3. What happens next
When an uncaught error reaches the SDK, it sends the error, its stack trace, the route and method, and environment details to Bugstack. Each SDK sends the same error at most once every five minutes, and Bugstack folds repeats within 24 hours into the same piece of work.
Bugstack then works on the fix. It reads the files named in the stack trace and works out the cause. In an isolated copy of your repository, it writes a test that reproduces the bug and watches it fail on your current code, then writes the change and shows that the test passes and the rest of your tests still pass.
The change arrives as a pull request on your GitHub repo with the root cause, the change, the reproduction test and its proof: the error it failed with before, and your other tests still passing. Your CI runs on it. New repositories start on Review: you review and merge. You can change the level per repository later.
Crashes are not the only thing Bugstack watches. Connecting the repository also starts repository scanning: vulnerable packages every four hours, secrets nightly, outdated packages daily. For the full breakdown, see How it works.