Skip to content

About

An AI assisted coding response system that is able to streamline incident alert to postmortem.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

IncidentResponse

IncidentResponse is a local, incident response system for production outages. It receives alert webhooks, creates and deduplicates incidents, matches a runbook, estimates customer impact, posts a Slack brief, tracks the response timeline, and generates an AI-assisted postmortem draft after the incident is resolved.

The project is intentionally backend-first: the dashboard is lightweight, while the main value is in the incident workflow, persistence model, worker separation, and operational automation.

Demo

Incident dashboard

Generated postmortem

What It Does

  • Receives mock monitoring alerts through POST /v1/alerts
  • Normalizes alert payloads into a consistent internal format
  • Creates or updates incidents in PostgreSQL using a dedupe key
  • Matches incidents to runbooks
  • Estimates impact from mock metrics
  • Posts concise Slack incident briefs
  • Records incident timeline events
  • Lets responders mark incidents resolved
  • Creates pending postmortem requests after resolution
  • Runs a Python AI worker to generate postmortem drafts
  • Shows incidents, timelines, and postmortems in a plain HTML/CSS dashboard

Local Demo Flow

Start the backend:

make compose-build
make compose-up
make compose-migrate

Start the dashboard:

python3 -m http.server 5173 --directory web

Open:

http://localhost:5173

Then demo the workflow:

  1. Click Send Mock Alert
  2. View the created incident, impact estimate, runbook event, and Slack event
  3. Click Resolve after treating the issue as fixed
  4. Run the AI worker:
make compose-worker
  1. Refresh the dashboard and view the generated postmortem

If port 8080 is busy, start the API on another host port:

API_PORT=8081 docker compose up -d postgres api

Then open:

http://localhost:5173?api=http://localhost:8081

Environment

Create a local .env:

cp .env.example .env

Set these if you want Slack and AI generation:

SLACK_ENABLED=true
SLACK_WEBHOOK_URL=your_slack_incoming_webhook_url
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-5-mini

Keep .env private. It is ignored by git.

Architecture

flowchart TD
    A[Mock Monitoring Alert] -->|Webhook| B[Go API]
    B --> C[Alert Normalizer]
    C --> D[Incident Service]
    D --> E[(PostgreSQL)]
    D --> F[Runbook Matcher]
    D --> G[Impact Estimator]
    D --> H[Timeline Events]
    D --> I[Slack Notifier]
    J[Dashboard] -->|Read / Resolve| B
    K[Python AI Worker] -->|Reads pending postmortems| E
    K -->|Stores generated draft| E
Loading

More detail: docs/architecture.md

Tech Stack

  • Go with net/http for the API
  • PostgreSQL for persistence
  • Python for the AI postmortem worker
  • Slack incoming webhooks for incident updates
  • Plain HTML/CSS/JavaScript dashboard
  • Docker Compose for local development

API Endpoints

GET    /healthz
GET    /readyz
POST   /v1/alerts
GET    /v1/incidents
GET    /v1/incidents/{id}
GET    /v1/incidents/{id}/timeline
GET    /v1/incidents/{id}/postmortem
PATCH  /v1/incidents/{id}/resolve

Development Commands

make compose-build    # build API and worker images
make compose-up       # start Postgres and the Go API
make compose-migrate  # apply SQL migrations
make compose-worker   # run the AI postmortem worker once
make run-api          # run the Go API locally without Docker
make test             # run Go tests
make db-shell         # open psql inside the Postgres container
make compose-down     # stop local services

To reset local demo data:

docker compose down -v
make compose-up
make compose-migrate

What This Demonstrates

  • Backend service design around a realistic incident lifecycle
  • Alert normalization, persistence, and deduplication
  • Operational enrichment through runbooks and impact estimates
  • Async AI workflow separated from the main API
  • Slack integration for responder communication
  • Dockerized local development across API, database, migrations, and worker
  • Simple dashboard consuming real backend APIs

Repository Layout

cmd/api/                 Go API entrypoint
internal/api/            HTTP routes, handlers, CORS
internal/alerts/         Alert payload types, normalization, storage
internal/incidents/      Incident creation, deduplication, lifecycle logic
internal/runbooks/       Runbook persistence and matching
internal/impact/         Mock metric loading and impact estimation
internal/postmortems/    Postmortem persistence
internal/slack/          Slack webhook client and message formatting
internal/db/             PostgreSQL connection and migrations
ai-worker/               Python OpenAI postmortem worker
web/                     Plain HTML/CSS/JS dashboard
runbooks/                Human-readable incident runbooks
mock-data/metrics/       Mock service metrics used for impact estimates

About

An AI assisted coding response system that is able to streamline incident alert to postmortem.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages