Skip to content

feat(email): add Resend as transactional email provider - #125

Open
otscup wants to merge 2 commits into
StringKe:mainfrom
otscup:feat/resend-email-provider-v2
Open

otscup wants to merge 2 commits into
StringKe:mainfrom
otscup:feat/resend-email-provider-v2

Conversation

@otscup

@otscup otscup commented Oct 16, 2026

Copy link
Copy Markdown

Summary

Self-hosted deployments on Cloudflare Workers Free cannot use the Email Service (send_email binding) for arbitrary recipients. This adds a ResendEmailProvider implementing the existing EmailProvider abstraction, so operators can send transactional email via the Resend HTTPS API instead.

Changes

  • packages/types/src/env.ts: add 'resend' to EmailProviderName
  • apps/server/worker/queues/email.ts: new ResendEmailProvider class + resolveEmailProvider handles EMAIL_PROVIDER=resend
  • apps/server/worker/env.d.ts: declare optional RESEND_API_KEY Workers Secret

Configuration

EMAIL_PROVIDER=resend        # Workers variable
RESEND_API_KEY=<key>         # Workers Secret
EMAIL_FROM_ADDRESS=noreply@example.com  # must be a verified Resend domain

The API key never touches code or D1; failures throw (fail-closed) and flow into the existing DLQ/persistence path.

Test

Deployed on a live Workers Free instance: password-reset and OTP emails delivered via Resend.

Signed-off-by: otscup otscup@gmail.com

- 接入 Resend 邮件通道(EMAIL_PROVIDER=resend,RESEND_API_KEY)
- Argon2 迭代 3->2,适配 Workers Free 10ms CPU 上限(改密双哈希不超限)
- wrangler 配置:主账号资源(auth.otscup.com 域名、xid-db/kv/r2/queues)
- console 经 core service binding 转发,CANONICAL_HOST 改为 auth.otscup.com
- 移除 Analytics Engine binding(账号未启用)与超限 cron triggers
- .gitignore 加入 .xid-secrets

Signed-off-by: otscup <otscup@gmail.com>
@otscup
otscup requested a review from StringKe as a code owner October 16, 2026 11:16

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant