Logic

Run handlers, jobs and webhooks under the caller’s permissions.

Deploy custom code in five languages without running a separate worker fleet. Background jobs commit in the same transaction as your writes, and notify rules send signed webhooks.

Read the actions docs

Actions

Gatekeeper queries check access before your handler wakes.

Each action runs a read query under the caller’s permissions first and returns 403 nothing_found when zero rows match. Inside the handler, call.db() opens a short-lived database session bound to that caller.

Actions
handlers/refundOrder.ts
import type { Handler } from 'napalm-client' type Order = { id: string; total_cents: number; stripe_charge_id: string } const refundOrder: Handler<Order> = async (call) => {  const [order] = call.rows  const refund = await stripe.refunds.create(    { charge: order.stripe_charge_id, amount: order.total_cents },    { idempotencyKey: call.job?.id ?? `refund:${order.id}` },  )  const db = await call.db() // 60-second session as the caller  await db.fetch(`${call.address}/query/markOrderRefunded`, {    method: 'POST',    headers: { 'Content-Type': 'application/json' },    body: JSON.stringify({ variables: { order: order.id } }),  })  return { refundId: refund.id, status: 'refunded' }} export default refundOrder

Hosted handlers

Deploy TypeScript, Python, Go, Rust or Dart beside your data.

Push handler source straight from the CLI or deploy a container image by digest. Idle handler instances sleep between requests and wake in milliseconds.

Terminal
napalm queries push shopnapalm handlers secrets set shop STRIPE_SECRET_KEYnapalm handlers deploy shop
Hosted handlers

Cron schedules

Schedule queries or actions in any time zone.

Attach a five-field cron expression in any IANA time zone to a deployed query or action. Scheduled runs authenticate with a chosen service key under your schema’s access policies.

Terminal
napalm schedules add shop rollUpUsage '0 3 * * *' \  --time-zone America/Los_Angeles \  --key $SERVICE_KEY_ID
Jobs and schedules

Transactional jobs

Queue background work in the same commit as your write.

Insert an ext::napalm::Job record inside your mutation statement so the row change and the queued job commit or roll back together without a message broker or outbox poller. Failed attempts retry from 10 seconds up to 1 hour.

Jobs and schedules
dbschema/queries/placeOrder.edgeql
# Place an order and atomically enqueue receipt deliverywith  order := (    insert Order {      buyer := assert_exists(global caller),      total_cents := <int64>$total_cents,      status := OrderStatus.Paid,      stripe_charge_id := <str>$charge_id,    }  ),  receipt_job := (    insert ext::napalm::Job {      query := 'sendReceipt',      variables := <json>(order := <str>order.id),    }  ),  followup_job := (    insert ext::napalm::Job {      query := 'checkDelivery',      variables := <json>(order := <str>order.id),      run_time := datetime_of_statement() + <duration>'72 hours',    }  ),select {  order_id := order.id,  receipt_job_id := receipt_job.id,}

Signed webhooks

Push HMAC-signed events from commit triggers.

Add a notify declaration to any type. After a matching transaction commits, Napalm sends an HMAC-signed ping or an access-filtered batch of changed rows and retries failed deliveries.

dbschema/default.gel
type Order {  required buyer: ext::auth::Identity;  required status: OrderStatus;   access policy buyer_can_read    allow select using (.buyer ?= global caller);   notify order_changed after insert, update, delete;}
Notifications and webhooks

Job progress

Stream job state to the UI like any other record.

Queued jobs live as typed records in your graph. Callers read status and attempt history under standard access policies, and live subscriptions stream progress without polling.

dbschema/queries/jobStatus.edgeql
# Watch a queued job and its attempt historyselect ext::napalm::Job {  id,  query,  status,  run_time,  finish_time,  runs: {    status,    start_time,    finish_time,    error,  } order by .start_time desc,}filter .id = <uuid>$job
Jobs and schedules