← back

WatchTower.

Drop-in Express middleware that pushes metrics to a collector and alerts on Slack, Discord, and email.

Node.jsExpressprom-clientResendnpm
your Express app watchtower-agent middleware POST /ingest every 15s · Prom text watchtower-collector :9090 ring buffer 60 entries · per metric alert evaluator every 30s · alerts.json dispatch · 5m dedup Slack Discord Resend GET /metrics/:service /services · /health
architecture, roughly

why

Datadog and Grafana Cloud are overkill for a side project. Setting up Prometheus + Grafana + Alertmanager is a weekend. WatchTower is the in-between: drop a middleware into your Express app, stand up a collector somewhere, and start getting Slack pings when things break.

the agent

watchtower-agent is Express middleware. One line of bootstrap and you’re done:

import { watchtower } from "watchtower-agent";

app.use(watchtower({
  serviceName: "my-api",
  collector: "http://localhost:9090",
}));

It captures, via prom-client:

It then pushes Prometheus text to the collector every 15 seconds. (Yes, push, not scrape. The collector doesn’t need to reach into your network.) The agent can also expose a local /metrics endpoint if you want to keep Prometheus in the loop later.

the collector

watchtower-collector listens on :9090:

Samples land in a ring buffer so memory is bounded. Every 30 seconds an alert evaluator walks the rules in alerts.json:

{
  "name": "high-p95-latency",
  "service": "*",
  "metric": "http_request_duration_ms",
  "condition": "p95 > 400",
  "window": 4,
  "channels": ["slack", "discord", "email"]
}

When a rule fires, dispatch fans out to Slack webhook, Discord webhook, and email via Resend. Each rule has a 5-minute dedup window so a flapping condition doesn’t carpet-bomb your channels.

what this isn’t

A replacement for Prometheus + Grafana in production. WatchTower is a focused agent / collector / alerting pipeline for teams that want observability without the setup overhead. For real scale, use OpenTelemetry.

choose a palette