feat: add resend service emulator#7
Conversation
|
@mvanhorn is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
ctate
left a comment
There was a problem hiding this comment.
Thanks for this excellent contribution! The Resend emulator follows existing service patterns really well, the inbox UI is a great differentiator, and all 23 tests pass cleanly. A few small things before merging:
-
Remove unused
resendId()—helpers.ts:9-11definesresendId()as an alias forgenerateUuid()but it's never called anywhere. Let's remove the dead code. -
Type the
as anycasts —routes/emails.ts:137androutes/domains.ts:93useas anyinupdate()calls, andformatEmail/formatDomainuse(email: any)params. Would be good to use the proper entity types (ResendEmail,ResendDomain) instead.
None of these are blocking — happy to merge once addressed. Great work!
|
Addressed in 2764090:
|
Rebased onto main and migrated from @internal to @emulators scope. Registered resend in SERVICE_REGISTRY. All 23 resend tests + full suite passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2764090 to
9993e06
Compare
|
Thanks for the updates @mvanhorn |
Add okta to SERVICE_NAME_LIST alongside resend. Regenerate lockfile.
Merge upstream/main into feat/stripe-emulator, incorporating the resend emulator (vercel-labs#7) and microsoft v1 OAuth updates (vercel-labs#30) alongside the stripe emulator in the service registry and package dependencies.
|
yay |
|
Thanks for merging both emulators! |
|
Thanks for the quick merge! |
|
Thanks for merging both, @ctate. |
Summary
Adds a Resend email API emulator with a web inbox UI for viewing sent emails locally. Emails, domains, API keys, audiences, and contacts are all stateful and persist in memory.
Why this matters
Every Next.js SaaS app sends transactional email (signup, password reset, receipts). Resend is the standard choice in the Vercel ecosystem - it's in vercel-labs/workflow-builder-template (1,074 stars) and has deep React Email integration.
Currently developers either use real API keys in dev (costs money, sends real emails) or skip email testing entirely. The only local tool is resend-local (11 stars) which mocks only the send endpoint. Resend's SDK supports
RESEND_BASE_URLfor drop-in emulator redirect.Changes
New package:
@internal/resend(~500 lines across 14 files)Endpoints:
POST /emails- send email, validate required fields, dispatchemail.sent+email.deliveredwebhooksPOST /emails/batch- send up to 100 emailsGET /emails/GET /emails/:id- list and retrieve with Resend's cursor pagination formatPOST /emails/:id/cancel- cancel scheduled emailsre_prefix tokensInbox UI at
/inbox- the differentiator:Uses only core CSS classes (zero inline styles). HTML email preview rendered in a sandboxed iframe.
Integration: All 7 points wired in
start.ts+list.tsSERVICE_DESCRIPTIONS updated.Testing
23 tests covering all endpoints, error format (
{ statusCode, name, message }), batch send, cursor pagination, inbox UI rendering, and seed config.Dogfooding
Ran the emulator, sent 3 test emails (welcome, invoice, password reset), verified inbox shows from/to/subject/status, clicked through to detail page with HTML preview. Screenshots above are from the running emulator.
This contribution was developed with AI assistance (Claude Code).