Skip to content

Hooks Overview

Hook events run around CRUD, auth, and files operations.

Execution flow

Add a hook

bash
zeptoz hook add Task before_insert --lang ts --new normalize

What is generated when adding a hook

When you run zeptoz hook add ..., Zeptoz generates:

  • Source file under hooks path (when using --new)
    • Example: hooks/task/before_insert/normalize.ts
  • Compiled artifact for JS/TS hooks
    • Example: hooks/task/before_insert/normalize.compiled.js
  • TypeScript SDK type file (for TS hooks)
    • hooks/_sdk/types.d.ts
  • DB row in hook_definitions (language/source/artifact/checksum/enabled)
  • DB row in hook_bindings (definition_id/collection/event/priority/active)

Supported runtimes in current MVP:

  • Rust (rs)
  • JavaScript (js)
  • TypeScript (ts)

Execution model

  • before_* failure aborts the operation.
  • after_* failure does not roll back primary operation; warning appears in meta.hook_warnings.
  • Timeouts and runtime limits are enforced.