Getting Started

Tutorial: Building with CleaveDB

Expiring Bonds

Temporary permissions, guest invites, trial subscriptions, and short-lived tokens often require relationships that expire automatically after a set duration. CleaveDB supports native TTL (time-to-live) expiration on graph bonds via EXPIRING IN.

Setting a time-bound bond

Specify a TTL duration using standard time units (SECONDS, MINUTES, or HOURS) appended after AS "<label>":

CleaveQLExample · Grant temporary access
BOND "users:guest" TO "rooms:conf_a" AS "access" EXPIRING IN 4 HOURS

CleaveDB timestamps the edge and records its expiration deadline in the _bonds catalog.

Short-lived session bonds

Expiring bonds are ideal for associating session tokens with active accounts:

CleaveQLExample · Session authentication bond
BOND "sessions:sess_99" TO "users:jane" AS "active_session" EXPIRING IN 30 MINUTES

Traversals verifying active sessions will immediately treat the edge as expired once the 30-minute threshold passes.