Prerequisites
- For Resend: a Resend account, API key, and an Audience created in the dashboard.
- For Beehiiv: a Beehiiv publication and an API key from Settings → Integrations → API.
- The newsletter feature flag (
siteConfig.newsletter.enable) set totrue.
Step-by-step (Resend)
-
Create an Audience at resend.com/audiences.
Copy its ID — looks like
aud_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -
Set env vars in
.env.local: -
Confirm the config in
src/config/site.ts(Resend is the default): -
Restart
pnpm dev. Submit the footer signup form — the contact should appear in your Resend Audience within seconds.
Step-by-step (Beehiiv)
-
Get your publication ID from Beehiiv → Settings → Integrations. It’s
shaped like
pub_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -
Set env vars in
.env.local: -
Switch the provider in
src/config/site.ts: -
Configure double opt-in inside Beehiiv (Settings → Subscribers →
Confirmation). vibestrap passes
reactivate_existing: trueandsend_welcome_email: false, leaving Beehiiv to send the confirmation email per your publication’s policy.
Pick the right provider
| Provider | When to pick |
|---|---|
| Resend | You already use Resend for transactional mail, you want one less vendor, and a basic Audience is enough. |
| Beehiiv | You want a real newsletter product — landing pages, paid subs, referrals, broadcast scheduling, analytics. |
Verify it works
- Submit the footer signup form with a fresh email.
- Resend: check the Audience in the Resend dashboard — the contact
should be there with
unsubscribed: false. - Beehiiv: check Subscribers → All — the email should appear with
status
pending(until they click the double-opt-in link) oractiveif you’ve disabled confirmation. - Submit the same email again. Both providers handle this gracefully (Resend dedupes; Beehiiv reactivates) — no error toast should appear.
Common pitfalls
- Resend: missing
RESEND_AUDIENCE_ID. The provider silently no-ops when either env var is unset (logs[newsletter/resend] Skippedin dev). Form submissions look successful but nothing is stored. Always check both env vars are set in production. - Beehiiv:
reactivate_existingbehaviour. If a contact previously unsubscribed, vibestrap reactivates them on the next signup. Some jurisdictions require a fresh opt-in for re-subscription — flip the flag insrc/newsletter/provider/beehiiv.tsif your legal team objects. - GDPR for EU traffic. Use Beehiiv with double opt-in enabled (the default) and add a consent checkbox to the form. Resend Audiences default to single opt-in; you’ll need to wire your own confirmation email if you sell to EU customers.
- Same key, different env. Public Resend keys are per-environment.
The same
RESEND_AUDIENCE_IDmay not exist in both your dev and prod Resend projects — keep two audiences or use the same project across both. - Switching providers. Existing subscribers in the old provider stay there. There’s no automatic migration — export from the old, import to the new.
Add an inline form anywhere
The form is a server action. Mount it wherever — a blog sidebar, a CTA section, a modal. Look at the home page footer for the existing usage, copy the component, and the server action will route through the active provider automatically.Official docs
- Resend Audiences: resend.com/docs/dashboard/audiences/introduction
- Resend API: resend.com/docs
- Beehiiv API v2: developers.beehiiv.com
- Provider source:
src/newsletter/provider/{resend,beehiiv}.ts