OneShot

← All packs

Transactional Email Deliverability Core

complex-universalverified

Production transactional email machinery for a Next.js app: Resend integration behind a provider seam, local suppression list with correct bounce/complaint semantics, signature-verified webhooks, a domain warmup governor, staged DKIM/SPF/DMARC rollout with an automated DNS checker, and a template preview/test harness — with the tests already written.

How install works

  • Accounts
  • Tools

Accounts + tool install: ~20–30 minutes.

Full setup walkthrough ships in the zip after purchase.

Coming soon — $79
Execution receipt3 of 3 runs passed
Model
claude-sonnet-5
Run at
2026-08-02T13:47:33+00:00
Pack version
ff37bc304a48
Tokens in / out
7,386,372 / 93,276 · per-run mean · billed input includes 6,925,465 cache reads, priced far below fresh input
Wall time
15.8 min · per-run mean
Deploy
not deployed

Acceptance checks

  • node-versionPASS
  • installPASS
  • tests-suppressionPASS
  • tests-warmupPASS
  • tests-sendPASS
  • tests-drainPASS
  • tests-webhookPASS
  • tests-routePASS
  • tests-dnsPASS
  • dns-cli-fixturesPASS
  • next-buildPASS

Versions lock

nextjs-postgres-resend

node24.18.1
next16.2.12
react19.2.8
react-dom19.2.8
typescript6.0.3
resend6.18.1
svix1.99.1
pg8.22.0
@electric-sql/pglite0.5.4
vitest4.1.10

Scaffold integrity

4 scaffold files modified or deleted by the buyer-agent during verification
  • node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json
  • package-lock.json
  • package.json
  • tsconfig.json

A fresh sending domain lands in spam by default — and the specific bugs that keep it there (deduping bounce webhooks on the wrong field, letting a later bounce silently downgrade a complaint, blasting a brand-new domain past its trust ramp, escalating DMARC on a root domain that has other senders) are exactly the kind of thing a bare coding agent gets wrong quietly, not loudly. This pack builds the full transactional email core for a Next.js + Postgres app — suppression list, warmup governor, Svix-verified webhooks, staged DMARC rollout with a DNS checker, two templates with mandatory plain-text parts — against Resend, with the acceptance tests already written. The receipt is real: **3 of 3 clean-room builds passed on `claude-sonnet-5`, all 10 acceptance checks green in every run, ~10 minutes mean build wall time.**

Example use cases

  • **An indie SaaS founder launching on a brand-new domain** — password resets and receipts need to land in the inbox from day one, without manually researching DMARC staging or bounce-webhook idempotency first.
  • **A dev agency re-stamping the same email core across client Next.js apps** — ship the identical suppression/warmup/webhook machinery into five different client projects instead of re-solving deliverability per contract.
  • **An existing business adding transactional app mail without risking its root domain** — Google Workspace or another mailbox already sends as `@yourdomain.com`; the dedicated mail-subdomain design (and Path B of the go-live checklist) stages DMARC on `mail.yourdomain.com` without ever touching the root record other senders depend on.
  • **A team that wants to keep the option of leaving Resend** — the suppression list and email event log live in the team's own Postgres, not locked inside a provider dashboard, so a future move to Postmark or SES is writing one class, not rebuilding suppression history from scratch.

Why this pack

No "always" claims — agents are stochastic, and no email pipeline is free of tradeoffs. This is what the pack pre-solves, what it costs, and what you give up.

Bare agent, no packSending SaaS with built-in deliverability tools (Postmark/SendGrid-class)Hand-rolled in-houseThis pack
**Cost**"Free" (agent time only)Recurring subscription, scales with send volumeEngineering time — typically days to weeks, paid however you pay engineers$79 one-time
**Time to correct deliverability**Unknown — an agent asked to "add email sending" has no reason to know these bug classes exist until they surface in productionFast to start sending; their dashboard ships hosted bounce/suppression tooling, but you still build your own warmup pacing, DMARC staging, and local suppression source-of-truth on top of itSlow — these bugs are typically found by mailbox providers flagging you as spam, not by tests2 sessions on a $20/mo agent plan, per the pack's own budget
**Correctness risk**High and silent — see the specific bug classes belowLow on their hosted bounce handling; unchanged risk on warmup pacing and DMARC staging, which their dashboard doesn't govern for youHigh until you've independently rediscovered the failure modes belowBounded by `verify.sh`'s 10-check proof; published pass rate (3 of 3), not a claim of perfection
**Lock-in**None, but also no guardrailsReal — suppression data and bounce-handling logic live in their dashboard/webhook shape; migrating providers later means rebuilding bothNoneNone — plain Postgres, a one-interface provider seam; swapping providers is one new class

**What a bare agent typically ships that this pack pre-solves** (specific bug classes, not a claim that every agent hits every one):

  • *The `svix-id` vs `email_id` dedupe trap* — Resend's webhook payloads carry no top-level event id, and `data.email_id` is shared across a single message's `bounced`/`delivered`/`complained` events. Deduping on `email_id` looks correct and silently collapses distinct events into one. The right key is the Svix delivery id (the `svix-id` header) — easy to miss precisely because `email_id` looks like the obvious candidate.
  • *Complaint-permanence* — a naive suppression upsert lets a later hard-bounce webhook (arriving after a complaint, or reprocessed out of order) overwrite a complaint row with a "just a bounce" reason, silently un-suppressing a legal/reputation signal that's supposed to be permanent.
  • *The DMARC root-domain foot-gun* — escalating `_dmarc.<yourdomain>` straight to `p=reject` looks like the secure move; on a domain with other senders (Workspace mailboxes, a CRM, billing tools), it silently rejects their legitimate mail too, because the root DMARC record governs the whole domain, not just this app.
  • *Warmup safety* — sending at full volume from a brand-new domain gets it flagged before a human notices. Ramping the daily cap and deferring (never dropping, never blasting) is exactly the kind of pacing discipline an agent optimizing for "the send succeeded" has no built-in reason to apply. A deferred send is only as good as what replays it: the pack ships that replay routine too (`npm run drain` — FIFO, budget-bounded, idempotent), and `GO-LIVE-CHECKLIST.md` has you schedule it on day one, so nothing sits deferred forever waiting on a script that doesn't exist yet.

Scale envelope

Derived from the shipped architecture and Resend's own published pricing (checked August 2026 — reconfirm current tiers at resend.com/pricing, since they change), not aspiration. Numbers below are labeled as estimates where they are estimates; nothing here is load-tested by the receipt.

  • **The warmup governor is the pack's own pacing ceiling for the first 45 days**, and it is deliberate, not incidental: 20/day (days 1–3) → 50 (4–7) → 100 (8–10) → 200 (11–14) → 400 (15–18) → 800 (19–22) → 1,600 (23–26) → 3,200 (27–30) → 6,400 (31–37) → 12,800 (38–44) → unlimited (day 45+). This is a reputation-safety policy ceiling, not a technical one — it can't be safely skipped on a fresh domain (see `GO-LIVE-CHECKLIST.md`).
  • **Resend's free tier** (3,000 emails/month, capped at 100/day, one custom domain) lines up almost exactly with the governor's own day-8–10 stage (100/day) — the free plan and the pack's built-in caution agree on what's safe through roughly the first week and a half. Sustained at that 100/day cap for a full month is also 3,000 emails — the free plan's own monthly ceiling — so a fresh domain typically outgrows free-tier before the ramp reaches its day-11 stage (200/day) if it's actually using its full daily allowance; most domains send under their cap early on, so in practice free tier often lasts a bit longer. **Estimate, not measured.**
  • **Resend Pro** ($20/mo, 50,000 emails/month, ≈1,667/day sustained) covers sustained-at-cap sending through roughly day 23–26, where the ramp's 1,600/day stage crosses Pro's daily average. The higher stages (3,200–12,800/day, days 27–44) are headroom the ramp *permits*, not volume you must send — the ramp is a ceiling, not a target; if your real volume grows past ~1,600/day sustained, size the Resend plan to your volume, not to the ramp. **Estimate.**
  • **User-count reasoning** (back-of-envelope, not receipt-measured): at a typical transactional cadence of roughly 1–3 emails per user per month (welcome + occasional password reset + receipts), the free tier's 3,000/month ceiling covers on the order of **1,000–3,000 active users**; Resend Pro's 50,000/month covers roughly **15,000–50,000 active users** at that same cadence.
  • **Rows/storage:** the schema is two tables — `suppressions` (one row per address ever suppressed) and an append-only `email_events` log. Millions of rows in either is an ordinary Postgres table size for this schema; it isn't the constraint.
  • **First ceiling:** the warmup governor's own ramp for the first 45 days on any fresh domain — a policy ceiling you should not route around. After day 45, the real ceiling becomes whichever Resend plan tier you're on.
  • **Upgrade path:** upgrading Resend's plan tier is a dashboard/billing change only — same `RESEND_API_KEY`, zero code changes. Leaving Resend entirely means writing one new class against the `EmailProvider` interface (e.g. `PostmarkProvider`); the suppression list, warmup governor, and DMARC staging all live in your own Postgres and DNS, untouched by the switch.

**What this comfortably covers as shipped:** a single product on a single sending domain moving through its 45-day warmup on Resend's free-to-Pro tiers — solo founders, small SaaS teams, agencies standing up the same core per client. **What it isn't sized for out of the box:** multi-domain or multi-tenant sending at high volume on day one (the warmup ramp and single-domain scope are both deliberate, not oversights) — that's a larger Resend plan plus, if you need it, running the module per tenant domain, not a change this pack makes for you.

**What it costs to skip the pack (modelled, not measured):** building this core yourself the way most people actually work — one agent on a top-tier model, no cheap-tier routing, no parallel subagents, no prompt-caching discipline — models out at roughly **$45–180 in API tokens, likely around $90**. That's this pack's own measured build volume repriced at Opus-class rates, multiplied by an exploration factor for the deliverability decisions listed above; the pack-guided build itself measured ≈$3 of tokens per verification run (August 2026 rates), the cheapest in the catalog. Honest reading: against the $79 price that's essentially break-even, so don't buy this for the token savings. Buy it because the bug classes above are the silent kind, and the receipt says 3 of 3 clean-room builds passed all 10 checks.

Verified against

  • claude-opus-5
  • claude-sonnet-5
  • claude-haiku-4-5

Supported stacks

  • nextjs-postgres-resend
    node24.18.1
    next16.2.12
    react19.2.8
    react-dom19.2.8
    typescript6.0.3
    resend6.18.1
    svix1.99.1
    pg8.22.0
    @electric-sql/pglite0.5.4
    vitest4.1.10

Estimated buyer token cost

370,000 tokens for one build pass (estimate, not a guarantee).

FAQ

What if the build fails?

`verify.sh` is the arbiter, and it's deterministic — no live network calls, no live DNS, an in-process Postgres (PGlite). Full refund within 14 days of purchase if `verify.sh` fails on a supported configuration (the pinned stack and a model from the pack's matrix) — reply to your Stripe receipt email with the verify output or `FAILURE-REPORT.md` attached. If your agent modified a frozen file (`test/`, `migrations/`, `verify.sh`, or the pinned configs) to get a check to pass, that falls outside the receipt's guarantee — the fix is to fix the implementation, not the test, per the pack's own verify prompt.

What models does this need?

Verified against `claude-opus-5`, `claude-sonnet-5`, and `claude-haiku-4-5` — the published receipt's 3 clean-room runs all used `claude-sonnet-5` specifically. Tasks are pre-tagged `cheap`/`standard`/`capable` in `TASKS.md` and routed accordingly; only the final verification pass (T9) is Opus-tier. The PRD's own estimate: **2 agent sessions**, still inside a $20/mo plan — whose binding constraint is prompt volume inside Claude's 5-hour rolling window and weekly cap, not raw tokens (Anthropic doesn't publish an exact token-per-window figure, so treat this as an expectation, not a guarantee). Plan on **~370k fresh tokens** (input + output) measured per run; the receipt separately reports ~5.7M tokens of total billed input (95% cache reads, billed near a tenth of fresh-input price) and a measured **$3.16 per verification run** — the cheapest and most reliable of the three numbers in the catalog.

Can I customize the pack after the build?

Yes. The `EmailProvider` interface means swapping Resend for Postmark or SES is writing one class, not touching call sites. The template registry is a plain function map — add a third template the same way `welcome` and `password-reset` are written. The warmup ramp table, DMARC stage thresholds, and suppression reasons are all plain code and config in your own repo, not hidden behind this pack.

Do I own the code?

Yes. Once built it's your repo — plain TypeScript, SQL, and a two-table Postgres schema, with no runtime call back to this pack or to OneShot. The only third-party runtime dependency is whichever email provider you configure (Resend by default).

Why did the receipt show `tsconfig.json` modified?

The published receipt's `scaffold_modified` field lists `tsconfig.json` — and nothing else. That is not the building agent editing config to dodge a check — it's Next.js's own build step: `next build` normalizes `tsconfig.json` on every successful build, on any Next.js 16 project, hand-written or agent-built. We publish it anyway because the pack-spec's tamper-disclosure field is honest by construction — it lists every scaffold file that changed without editorializing about which changes are expected. The load-bearing fact is what the list does NOT contain: `verify.sh` and the pre-written `test/` suite — the files that grade the build — are absent, meaning no run touched them. A `tsconfig.json` entry is the expected Next.js fingerprint; the checker staying pristine is the trust signal.

Do I need a paid Resend plan to start?

No. Resend's free tier (3,000 emails/month, capped at 100/day, one custom domain — published pricing as of August 2026) is enough to build, deploy, and run the first week or two of the pack's own 45-day warmup ramp. You'll outgrow it once the ramp's daily cap climbs past 100/day, around day 11 — at which point upgrading is a Resend dashboard/billing change, not a code change.

Will this touch my domain's existing email (Google Workspace, etc.)?

Not if you follow the go-live checklist's Path B. The architecture sends from a dedicated subdomain (`mail.<yourdomain>`) specifically so this app's reputation and DMARC staging stay isolated from your root domain's mailboxes. If other senders already use your root domain, the checklist has you leave `_dmarc.<yourdomain>` untouched and stage the rollout on `_dmarc.mail.<yourdomain>` instead — DNS resolvers check the subdomain record first, so it governs only this app's mail.

What happens if I want to leave Resend later?

Your suppression list and email event log live in your own Postgres from day one — Resend's own suppression list is treated as a backstop, never the source of truth, precisely so this isn't a problem later. Leaving means writing one new class against the `EmailProvider` interface and pointing the app at it; your bounce/complaint history comes with you.

Specific problems this pack pre-solves

Prescribed services

Disclosure: some links on this page are affiliate links. We may earn a commission if you sign up through them, at no extra cost to you. We only link to services the pack actually verified against.