Getting Started

Tutorial: Building with CleaveDB

Webhooks for CDC

In event-driven architectures, downstream systems (such as search indexes, notification dispatchers, cache invalidators, and third-party APIs) must react to database writes in real time. Rather than running cumbersome Kafka or Debezium clusters, CleaveDB provides native Change Data Capture (CDC) via HTTP Webhooks.

Configuring a webhook

Register an automated event hook on any bucket using the SHAPE WEBHOOK command:

CleaveQLExample · Registering a CDC webhook
SHAPE WEBHOOK "user_created" ON users WHEN action = "POUR" POST TO "https://api.example.com/hooks"

Whenever a new document enters the users bucket via POUR, CleaveDB dispatches an HTTP POST request containing the event metadata and document payload.

Supported lifecycle actions

Webhooks can listen to any phase of the document lifecycle:

ActionTrigger EventUse Case
POURNew document insertedSend welcome emails, initialize profile caches
CHANGEFields modified or updatedSync inventory, notify billing services
DRAINDocument moved to rubbish binPurge user storage, invalidate session tokens

Auditing registered webhooks

Inspect all active webhook listeners across your buckets using SHOW WEBHOOKS:

CleaveQLExample · List registered webhooks
SHOW WEBHOOKS

Returns an array containing each listener's name, target bucket, subscribed action type, and remote destination URL.

HTTP payload format

CleaveDB transmits standard JSON payloads directly to your endpoint:

CleaveQLExample · Dispatched webhook payload
{
  "event": "POUR",
  "bucket": "users",
  "id": "u42",
  "data": {
    "name": "Jordan Lee",
    "tier": "enterprise"
  },
  "timestamp": 1728561230,
  "tenant": "default"
}

The tenant key automatically inherits the current authenticated user context from AUTHENTICATE AS.