Resend

Sends transactional email through Resend and stores delivery status in your database. Webhook events update each message's state from queued through delivered, bounced, or failed.

  • TypeScript
npm i @spacetimedb/resend

A submodule that connects a SpacetimeDB application to the Resend email delivery service, handling outbound sending, delivery tracking, and webhook ingestion. It lives inside your module's schema and keeps all email state, credentials, and event history in your own database tables.

  • Transactional email: An app that sends welcome messages, password resets, or receipts and needs delivery confirmation stored alongside its other application data.
  • Multi-tenant SaaS: A product where each organization or user should only see their own email history, enforced at the database level rather than in application code.
  • Audit-sensitive workflows: A compliance-conscious app that needs an append-only log of every delivery event, including delays, bounces, and complaints, for later review or replay.
  • Webhook-driven status updates: An app that wants delivery status to update automatically in the database as Resend fires events, without polling an external API.
  • Operator-controlled sending: A platform where only privileged identities may trigger email sends or inspect raw delivery data, while end users see only scoped views of their own history.

When your application requests an email, the submodule records it immediately in your database with a queued status, then forwards the request to Resend. From that point on, delivery status lives in your database and is updated by incoming webhook events from Resend. Each event is verified for authenticity before being applied, and the submodule ensures that status only moves forward: a later delivery stage cannot be overwritten by an earlier one, and duplicate events are ignored.

Webhook events arrive over HTTP and are processed as database transactions. The submodule stores every event it receives, whether it applies to a known email state or not, so you have a complete forensic record. Events that represent terminal outcomes (delivered, bounced, failed) update the main status field, while engagement signals like opens and clicks are recorded as separate flags without disturbing delivery status.

All email content, recipient addresses, credentials, and raw webhook payloads are kept in private tables that your application code cannot subscribe to directly. Your module is expected to expose narrower, caller-scoped views so that each user or tenant sees only their own history. This separation means the submodule handles the mechanics of sending and tracking while your application retains full control over authorization and what data is visible to whom.

Related submodules

VoIP

Voice chat with no media server: rooms and proximity voice that run inside your module. Opus packets travel through an event table, and row-level security delivers each one only to its listeners.

Lethalchip0/wkCommunity

Authz

Roles, scopes and grants for multi-user modules: wildcard permissions, role inheritance, scope trees, expiring grants, invite links, an audit log and row-level security, with no privilege escalation.

Lethalchip0/wkCommunity

Cron

Schedules recurring tasks in a SpacetimeDB module using calendar expressions or fixed intervals. Supports time zones, per-job arguments, failure limits, and runtime schedule changes.

SpacetimeDB0/wk
Submodule

Edit details

One short paragraph describing the submodule.

A few bullets for scenarios where this is a good fit.

A few short paragraphs at the conceptual level.