Skip to content

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

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

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

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:13
@otscup

otscup commented Oct 16, 2026

Copy link
Copy Markdown
Author

关闭此 PR:head 分支(feat/resend-email-provider)中混入了不属于该变更的部署配置文件。将用干净的分支 feat/resend-email-provider-v2 重新提交。

@otscup otscup closed this Oct 16, 2026
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