Watchtower Control Room

Integration Guide

Monitor connected apps, review incidents, onboard new projects, and keep your operational contract in one calm place.

Guide

How to Add a New App to Watchtower

  1. Create public /api/health or /api/health/live so Watchtower can verify basic uptime.
  2. Create protected /api/health/ready for deeper checks like database, storage, or queue readiness.
  3. Set a shared WATCHTOWER_HEALTH_TOKEN in the app and the same token in Watchtower.
  4. Make sure real server bugs log with console.error and expected auth/session churn stays at console.warn or is suppressed.
  5. Add the project in Watchtower with container pattern, health URLs, token, and alert emails.
Env Contract

What the App Needs

WATCHTOWER_HEALTH_TOKEN=shared-secret-from-watchtower
Example

Live Endpoint

app/api/health/live/route.ts
import { NextResponse } from 'next/server'

export async function GET() {
  return NextResponse.json({
    status: 'ok',
    service: 'your-app',
    environment: process.env.NODE_ENV ?? 'production',
    timestamp: new Date().toISOString(),
  })
}
Example

Ready Endpoint

app/api/health/ready/route.ts
import { NextRequest, NextResponse } from 'next/server'

export async function GET(req: NextRequest) {
  const token = req.headers.get('authorization')?.replace(/^Bearer\s+/i, '').trim()
  if (!process.env.WATCHTOWER_HEALTH_TOKEN || token !== process.env.WATCHTOWER_HEALTH_TOKEN) {
    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
  }

  return NextResponse.json({
    status: 'ok',
    service: 'your-app',
    checks: { env: 'ok', database: 'ok' },
    timestamp: new Date().toISOString(),
  })
}