Transform incident investigation from hours to seconds with AI-powered analysis, automatic pattern detection, and a growing knowledge base of resolutions.
IncidentOps is an AI-powered incident analysis platform that helps QA and engineering teams answer "Why did this fail?" in seconds instead of hours.
Three ways to integrate:
- SDK – Drop-in error reporting for Node.js applications
- Express Middleware – Automatic error capture with zero code changes
- REST API – Direct integration from any language or platform
When an error occurs, IncidentOps will:
- Capture the error with full context (stack trace, metadata)
- Fingerprint and deduplicate similar errors automatically
- Analyze using AI to identify root cause and suggest fixes
- Notify your team via n8n webhooks (Discord, Slack, email)
- Learn from resolutions to improve future suggestions
- AI-Powered Analysis – Uses Claude via Vercel AI Gateway to analyze errors and suggest root causes
- Automatic Pattern Detection – Groups similar errors using intelligent fingerprinting
- MCP Tools Integration – Model Context Protocol server provides AI with database access for deep analysis
- TypeScript SDK – Zero-dependency client with Express middleware support
- Real-time Dashboard – Next.js web interface to browse incidents and patterns
- Docker Ready – One-command setup with Docker Compose
- n8n Notifications – Flexible webhook integration for alerts
- Open Source – Self-hosted, no external dependencies, your data stays private
The fastest way to get started is with Docker Compose.
- Docker and Docker Compose installed
- Vercel AI Gateway API key (for AI analysis)
-
Clone the repository
git clone https://github.com/matiasvallejosdev/incident-ops.git cd incident-ops -
Configure environment variables
cp .env.example .env
Edit
.envwith your configuration:# Required API_KEY=your-secure-api-key-here AI_GATEWAY_API_KEY=vck_your_vercel_ai_gateway_key # Optional N8N_PASSWORD=your-n8n-password ALLOWED_ORIGINS=http://localhost:3001
-
Start all services
docker-compose up -d
-
Access the applications
- Dashboard: http://localhost:3001
- API: http://localhost:3000
- n8n: http://localhost:5678 (admin / your-password)
- Prisma Studio: http://localhost:5555
-
Report your first incident
curl -X POST http://localhost:3000/api/incidents \ -H "Content-Type: application/json" \ -H "X-API-Key: your-secure-api-key-here" \ -d '{ "service": "my-service", "environment": "production", "severity": "high", "error": { "type": "DatabaseError", "message": "Connection refused to primary database" } }'
# Stop all services
docker-compose down
# View logs
docker-compose logs -f
# View logs for specific service
docker-compose logs -f api
docker-compose logs -f dashboard
# Restart services
docker-compose restart
# Rebuild after code changes
docker-compose up --build -d
# Stop and remove everything (including data)
docker-compose down -vFor development without Docker:
- Node.js 20+
- pnpm 9+
- PostgreSQL 16
-
Install dependencies
pnpm install
-
Configure environment
cp .env.example .env # Edit .env with your database URL and API keys -
Setup database
pnpm db:push
-
Start development servers
pnpm dev
-
Run tests
pnpm test
Install the SDK in your Node.js application:
npm install @incidentops/sdkimport { IncidentOps } from '@incidentops/sdk';
const incidents = new IncidentOps({
apiUrl: 'http://localhost:3000',
apiKey: 'your-api-key',
service: 'my-service',
environment: 'production',
});
// Report an error
try {
await riskyOperation();
} catch (error) {
await incidents.report(error, {
severity: 'high',
context: { userId: '123', operation: 'checkout' }
});
}import express from 'express';
import { IncidentOps } from '@incidentops/sdk';
import { errorMiddleware } from '@incidentops/sdk/express';
const app = express();
const incidents = new IncidentOps({
apiUrl: process.env.INCIDENTOPS_URL,
apiKey: process.env.INCIDENTOPS_KEY,
service: 'api-server',
});
// Your routes here...
// Add error middleware (must be last)
app.use(errorMiddleware(incidents, {
severity: 'high',
excludePaths: ['/health'],
includeHeaders: false,
}));┌─────────────────────────────────────────────────────────────────────┐
│ Client Application │
│ (SDK / REST API / Middleware) │
└─────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Express API │
│ (Port 3000) │
├─────────────────────────────────────────────────────────────────────┤
│ • Incident ingestion & validation │
│ • Fingerprint generation │
│ • Pattern detection & grouping │
│ • AI analysis orchestration │
└─────────────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌────────────┐ ┌─────────────┐ ┌─────────────┐
│ PostgreSQL │ │ MCP Server │ │ n8n │
│ (5432) │ │ (stdio) │ │ (5678) │
└────────────┘ └─────────────┘ └─────────────┘
│ │ │
│ ▼ ▼
│ ┌─────────────┐ ┌─────────────┐
│ │ Vercel AI │ │ Discord/ │
│ │ Gateway │ │ Slack │
│ └─────────────┘ └─────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────┐
│ Next.js Dashboard │
│ (Port 3001) │
├─────────────────────────────────────────────────────────────────────┤
│ • Incident list & details │
│ • Pattern visualization │
│ • AI analysis results │
└─────────────────────────────────────────────────────────────────────┘
- Incident Received → Validate with Zod schema
- Fingerprint Generated → Normalize message, hash with SHA-256
- Pattern Matched → Find or create pattern, increment count
- Incident Stored → Save to PostgreSQL with Prisma
- Notification Sent → POST to n8n webhook (async)
- AI Analysis Triggered → MCP tools query database, Claude analyzes (async)
| Component | Technology | Purpose |
|---|---|---|
| Runtime | Node.js 20 | Server runtime |
| Language | TypeScript 5 | Type safety |
| API | Express 4 | HTTP server |
| Database | PostgreSQL 16 | Data storage |
| ORM | Prisma 6 | Database access |
| AI | Vercel AI SDK | Claude integration |
| MCP | @modelcontextprotocol/sdk | AI tool protocol |
| Frontend | Next.js 14 | React dashboard |
| Styling | Tailwind CSS 3 | UI styling |
| Monorepo | Turborepo + pnpm | Build system |
| Notifications | n8n | Workflow automation |
incident-ops/
├── apps/
│ ├── api/ # Express backend API
│ │ ├── src/
│ │ │ ├── routes/ # API endpoints
│ │ │ ├── services/ # Business logic
│ │ │ ├── agent/ # AI analysis
│ │ │ └── middleware/ # Auth, errors
│ │ └── prisma/ # Database schema
│ │
│ ├── mcp-server/ # MCP tools for AI
│ │ └── src/tools/ # findSimilar, analyzeError, etc.
│ │
│ ├── web/ # Next.js dashboard
│ │ └── src/app/ # Pages and components
│ │
│ └── test-sdk/ # SDK integration tests
│
├── packages/
│ └── sdk/ # @incidentops/sdk
│ ├── client.ts # Main SDK client
│ └── express.ts # Express middleware
│
├── bruno/ # API testing collection
├── docs/ # Architecture documentation
└── docker-compose.yml # Full stack setup
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/incidents |
Create new incident |
GET |
/api/incidents |
List incidents (with filters) |
GET |
/api/incidents/:id |
Get incident details |
POST |
/api/incidents/:id/resolve |
Mark as resolved |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/patterns |
List all patterns |
GET |
/api/patterns/:id |
Get pattern details |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/health |
Health check (no auth) |
All endpoints except /api/health require the X-API-Key header.
The MCP server provides AI with these tools for analysis:
| Tool | Purpose |
|---|---|
findSimilar |
Find similar past incidents |
getPatternHistory |
Get pattern occurrence history |
getServiceContext |
Get service-specific context |
analyzeError |
Parse error type and category |
assignIncident |
Assign to team member |
getResolutionHistory |
Get past resolutions |
| Variable | Required | Description |
|---|---|---|
DATABASE_URL |
Yes | PostgreSQL connection string |
API_KEY |
Yes | API authentication key |
AI_GATEWAY_URL |
Yes | Vercel AI Gateway URL |
AI_GATEWAY_API_KEY |
Yes | Vercel AI Gateway key |
N8N_WEBHOOK_URL |
No | n8n webhook for notifications |
ALLOWED_ORIGINS |
No | CORS allowed origins |
PORT |
No | API port (default: 3000) |
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch
- Make your changes:
- API: Edit files in
apps/api/ - Dashboard: Edit files in
apps/web/ - SDK: Edit files in
packages/sdk/ - MCP Tools: Edit files in
apps/mcp-server/
- API: Edit files in
- Run tests:
pnpm test - Run build:
pnpm build - Commit and push
- Open a Pull Request
Guidelines:
- Include tests for new features
- Update documentation if needed
- Follow existing code style
- Author: Matías Vallejos
- Website: matiasvallejos.com
- Twitter: @mativallejosdev
This project is open source and available under the MIT License.
"The best incident is the one you prevent. The second best is the one you resolve in seconds."