Getting Started

Tutorial: Building with CleaveDB

Webhooks for Change Data Capture (CDC)

In event-driven architectures, downstream systems often need to react instantly to database updates. Instead of deploying complex external CDC infrastructure (like Apache Kafka, Debezium, or polling workers), CleaveDB includes native HTTP WEBHOOK event dispatch built directly into the storage engine.

Registering a webhook

Register an event trigger with SHAPE WEBHOOK, naming the webhook, binding it to a target bucket, and specifying the trigger action and HTTP endpoint:

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

Whenever a document is inserted into the users bucket via POUR, CleaveDB dispatches an asynchronous HTTP POST payload containing the affected document and session metadata directly to your webhook handler.

Trigger actions

Webhooks can be hooked into any write-phase mutation lifecycle:

ActionExample registrationEvent trigger
POURWHEN action = "POUR"New document creation
CHANGEWHEN action = "CHANGE"Field updates and document modifications
DRAINWHEN action = "DRAIN"Document deletion or recycling to rubbish

Listing registered webhooks

Audit all registered webhooks using SHOW WEBHOOKS:

CleaveQLExample · List webhooks
SHOW WEBHOOKS

Returns a list of all active listeners, target endpoints, and bound event filters: {"count": 1, "data": [...]}.