Skip to main content

core-notification-service

Sends transactional emails via Resend and manages notification queues. Used by other services (auth, billing) to deliver team invitations, payment confirmations, and system notifications.

Worker name: crow-core-notification-service Domain (prod): internal.notifications.crowai.dev Domain (dev): dev.internal.notifications.crowai.dev

Schema

No D1 database -- the notification service is stateless. It processes email requests from queues and sends them via the Resend API.

Routes

MethodPathDescription
POST/api/v1/notifications/sendSend an email notification
GET/healthHealth check

Environment Variables

VariableExample
ENVIRONMENTdev
FROM_EMAILnoreply@crowai.dev
FROM_NAMECROW Team (Dev)
AUTH_SERVICE_URLhttps://dev.api.crowai.dev

Secrets

SecretPurpose
BETTER_AUTH_SECRETJWT verification
INTERNAL_GATEWAY_KEYGateway trust validation
RESEND_API_KEYResend email API authentication

Bindings

BindingTypeName
EMAIL_QUEUEQueue (producer + consumer)email-queue
(consumer)Queue (consumer)crow-notification-queue

Queue Configuration

QueueRoleBatch SizeRetriesDLQ
email-queueProducer + Consumer103email-dlq
crow-notification-queueConsumer10--

Message Type

EmailQueueMessage

{
id: string
to: string
template: string
data: Record<string, unknown>
timestamp: number
}

Templates

The service uses HTML email templates located in src/templates/. Templates are rendered with dynamic data from the queue message.

Dependencies

  • Inbound: auth service (team invitations, welcome emails), billing service (payment confirmations)
  • Outbound: Resend API

Key Behaviors

  • INTERNAL_GATEWAY_KEY guard: All API routes require the shared internal key
  • Queue-based: Most notifications arrive via queue messages rather than HTTP requests, making the processing asynchronous and reliable
  • Trusted queue messages: Queue messages are trusted (no additional auth) since only internal services can produce to the queue