Skip to content

Overview

The Notification service sends all of Huddle’s transactional email. It’s a TypeScript Temporal worker that renders React Email templates and delivers them through Resend. The Go API triggers its workflows; it fetches the data it needs back from the API through the @huddlesurety/api SDK.

  • Runtime: Node.js (run via tsx) — Bun is the package manager, not the runtime
  • Orchestration: Temporal TypeScript SDK (worker)
  • Email: React Email templates rendered and sent via Resend
  • Data: the @huddlesurety/api SDK, consumed only through src/lib/api.ts
  • Observability: OpenTelemetry traces + metrics over OTLP to Alloy, joined into the API’s distributed trace across the Temporal boundary
  • Directorysrc/
    • worker.ts Entry point — connects to Temporal, polls the queue
    • workflows.ts The 3 workflow definitions + proxyActivities config
    • build.ts Bundles workflows.ts → dist/workflow-bundle.js
    • Directorylib/
      • api.ts The only consumer of @huddlesurety/api
    • Directoryshared/
      • email.ts Resend client + sender address
    • Directoryo11y/
      • otel.ts OTel trace/metric providers, email counter, Temporal runtime metrics
      • workflow-interceptors.ts OTel workflow interceptors (baked into the bundle)
      • identity.ts Activity interceptor stamping org.id + workflow.type on spans
    • Directoryactivities/
      • index.ts Barrel re-exporting the activities
      • send-otp.ts sendOTP
      • send-invite.ts sendInvite
      • send-bond-request.ts sendBondRequest
    • Directorytemplates/
      • components/layout.tsx Shared email Layout (brand, fonts, footer)
      • send-otp.tsx
      • send-invite.tsx
      • send-bond-request.tsx
  • package.json Scripts (there is no mise.toml here)