Skip to content

Wrangler Bindings

Add these bindings to your existing wrangler.jsonc configuration. Create the D1 database first with wrangler d1 create <name>.

jsonc
{
  // D1 database for check config, incidents, alert rules
  "d1_databases": [
    {
      "binding": "MONITORING_DB",
      "database_name": "my-monitoring",
      "database_id": "<your-database-id>"
    }
  ],

  // Analytics Engine for metrics (90-day retention, 10M events/month free)
  "analytics_engine_datasets": [
    {
      "binding": "MONITORING_AE",
      "dataset": "monitoring_checks"
    }
  ],

  // R2 bucket for hot state (current status for alert state machine)
  // You likely already have an R2 bucket — clawdwatch stores a single
  // state.json file at the configured stateKey path.
  "r2_buckets": [
    {
      "binding": "MOLTBOT_BUCKET",
      "bucket_name": "my-data"
    }
  ],

  // Cron trigger to run checks (every 5 minutes)
  "triggers": {
    "crons": ["*/5 * * * *"]
  }
}

Binding Summary

BindingTypePurpose
MONITORING_DBD1Check config, incidents, alert rules
MONITORING_AEAnalytics EngineCheck result metrics (90-day retention)
MOLTBOT_BUCKETR2Hot state for alert state machine