- The stack: Resend (sending + subscriber list) · Supabase (storing campaigns and events) · Vercel (Next.js hosting + scheduling).
- No complex database: Subscribers are stored in a Resend Audience, and campaigns/events are stored as JSON files in Supabase Storage.
- What you get: a signup form, a welcome email, newsletter sending, open/click tracking, an admin dashboard, and automatic scheduling.
This newsletter system runs with no dedicated server and not a single SQL table: Resend stores the subscriber list, Supabase Storage holds the campaigns and events, and Vercel Cron sends automatically every week. Starting cost: 0 ILS.
Building an internal newsletter system with Vercel + Supabase + Resend lets you send emails, track opens and clicks, and manage subscribers, without paying hundreds of shekels a month and without giving up ownership of your data. This guide shows you how to build it step by step, with real code, exactly like the system running the newsletter at tzedek.me.
In short (TL;DR)
- The stack: Resend (sending + subscriber list) · Supabase (storing campaigns and events) · Vercel (Next.js hosting + scheduling).
- No complex database: Subscribers are stored in a Resend Audience, and campaigns/events are stored as JSON files in Supabase Storage.
- What you get: a signup form, a welcome email, newsletter sending, open/click tracking, an admin dashboard, and automatic scheduling.
- Starting cost: 0 ILS, everything on free tiers.
What exactly are we building? (The architecture)
The system is made up of three services, each doing one thing well:
| Component | Role |
|---|---|
| Resend | Sends emails, stores the subscriber list (Audience), and delivers webhooks for every event |
| Supabase | Stores campaigns and open/click events (as JSON in Storage), and later leads and users as well |
| Vercel | Hosts the Next.js app, runs the API, and handles scheduling (Cron) |
The core insight: You don't need a single SQL table to get started. Resend is already the "database" for your subscribers, and Supabase Storage is enough to save campaigns and events as files. That cuts setup time from days to hours.
Step 0: Prerequisites
Before you start you need three accounts (all with free tiers) and a Next.js project:
- A Vercel account + a Next.js project (App Router).
- A Supabase account (new project).
- A Resend account + your own domain for sending (critical for deliverability, explained in Step 2).
Install the Resend SDK:
npm install resend zod
Step 1: Environment Variables
All keys are stored as environment variables in Vercel (Settings → Environment Variables) and in .env.local for local development:
# .env.local
RESEND_API_KEY=re_xxxxxxxxxxxx
RESEND_AUDIENCE_ID=xxxxxxxx-xxxx-xxxx # the ID of your Resend subscriber list
RESEND_WEBHOOK_SECRET=whsec_xxxxxxxx # for webhook verification (Step 6)
LEAD_FROM_EMAIL="Your Name <news@yourdomain.com>"
NEXT_PUBLIC_SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_SERVICE_ROLE_KEY=eyJxxxx # server-side only, never expose to the client
In Resend, create a single Audience (Audiences → Create) and copy its ID. That is your subscriber list.
Step 2: Verifying Your Domain in Resend (don't skip this)
If you send from an unverified domain, your emails will land in spam. This is the single most important step for deliverability. In Resend → Domains → Add Domain, add your domain and Resend gives you DNS records to add with your domain provider:
- SPF: confirms that Resend is authorized to send on your behalf.
- DKIM: a digital signature that proves the email was not forged.
- DMARC (recommended): a policy that tells mail servers what to do with suspicious email.
After DNS propagates (up to 48 hours), the domain is marked "Verified" and you can send from it. Use a subdomain address like news@yourdomain.com.
Step 3: Signup Form + Adding a Subscriber
Now we build the heart of the system: when someone signs up, we add them to the Resend Audience. First, a helper function that adds a subscriber (idempotent, so a duplicate add won't break anything):
// lib/newsletter.ts
import { Resend } from "resend";
const AUDIENCE_ID = process.env.RESEND_AUDIENCE_ID!;
export async function addSubscriber(email: string) {
const resend = new Resend(process.env.RESEND_API_KEY);
const { error } = await resend.contacts.create({
audienceId: AUDIENCE_ID,
email,
unsubscribed: false,
});
// subscriber already exists, treat as success
if (error && !/exist/i.test(error.message)) {
return { ok: false, reason: error.message };
}
return { ok: true };
}
Next, a Server Action that receives the form, validates the email, and adds the subscriber. Note the honeypot (a hidden field that bots fill in and humans don't): simple, free spam protection:
// app/actions/newsletter.ts
"use server";
import { z } from "zod";
import { addSubscriber } from "@/lib/newsletter";
const schema = z.object({ email: z.string().trim().email() });
export async function subscribeToNewsletter(_prev: unknown, formData: FormData) {
// Honeypot, bots fill hidden fields
if ((formData.get("company_website") as string)?.length) {
return { ok: true, message: "Thank you!" };
}
const parsed = schema.safeParse({ email: formData.get("email") });
if (!parsed.success) return { ok: false, message: "Please enter a valid email address" };
const res = await addSubscriber(parsed.data.email);
if (!res.ok) return { ok: false, message: "Signup failed, please try again." };
return { ok: true, message: "You're subscribed! 🎉" };
}
And the form component (Client Component) using useActionState:
// components/NewsletterForm.tsx
"use client";
import { useActionState } from "react";
import { subscribeToNewsletter } from "@/app/actions/newsletter";
export function NewsletterForm() {
const [state, action, pending] = useActionState(subscribeToNewsletter, { ok: false, message: "" });
return (
<form action={action}>
{/* honeypot, hidden from humans */}
<input type="text" name="company_website" tabIndex={-1} className="hidden" aria-hidden />
<input type="email" name="email" required placeholder="Your email" dir="ltr" />
<button disabled={pending}>{pending ? "Subscribing…" : "Subscribe"}</button>
{state.message && <p>{state.message}</p>}
</form>
);
}
Step 4: Welcome Email
Immediately after signup, send a confirmation email. It builds trust and improves deliverability. Add this at the end of the Server Action (as best-effort, so a failure won't block the signup):
import { Resend } from "resend";
try {
const resend = new Resend(process.env.RESEND_API_KEY);
await resend.emails.send({
from: process.env.LEAD_FROM_EMAIL!,
to: email,
subject: "Welcome to the newsletter! 🎉",
html: `<div style="font-family:Arial;max-width:560px;margin:auto">
<h2>You're in!</h2>
<p>Every week you'll get updates, tips, and new content. See you in the first email.</p>
</div>`,
});
} catch { /* does not block the signup */ }
Step 5: Sending a Newsletter to the Entire List
To send an issue, fetch all active subscribers from Resend and send. Resend supports batch sending (up to 100 emails per call), so we split into chunks:
// lib/send-newsletter.ts
import { Resend } from "resend";
export async function sendNewsletter(subject: string, html: string) {
const resend = new Resend(process.env.RESEND_API_KEY);
// 1. fetch all active subscribers
const { data } = await resend.contacts.list({ audienceId: process.env.RESEND_AUDIENCE_ID! });
const emails = (data?.data ?? []).filter((c) => !c.unsubscribed).map((c) => c.email);
// 2. send in chunks of 100 (Resend batch limit)
for (let i = 0; i < emails.length; i += 100) {
const chunk = emails.slice(i, i + 100);
await resend.batch.send(
chunk.map((to) => ({
from: process.env.LEAD_FROM_EMAIL!,
to,
subject,
html,
headers: { "List-Unsubscribe": "<mailto:unsub@yourdomain.com>" }, // required for deliverability
})),
);
}
return emails.length;
}
Deliverability tip: Always include a
List-Unsubscribeheader. Gmail and Outlook require it for bulk senders, and it dramatically reduces the chance of landing in spam.
Step 6: Tracking Opens and Clicks (Resend Webhooks)
This is where the magic happens. Resend sends a webhook for every event (delivered, opened, clicked, bounced). We receive it, verify the signature (Resend signs with Svix), and save the event to Supabase Storage.
In Resend, go to Webhooks, add an endpoint pointing to https://yourdomain.com/api/webhooks/resend, and copy the Signing Secret into RESEND_WEBHOOK_SECRET.
The route handler that verifies and saves:
// app/api/webhooks/resend/route.ts
import { NextRequest, NextResponse } from "next/server";
import crypto from "node:crypto";
import { appendEmailEvent } from "@/lib/events";
export const dynamic = "force-dynamic";
// Resend signs with Svix, we verify HMAC-SHA256
function verify(secret: string, req: NextRequest, body: string): boolean {
const id = req.headers.get("svix-id");
const ts = req.headers.get("svix-timestamp");
const sig = req.headers.get("svix-signature");
if (!id || !ts || !sig) return false;
const key = Buffer.from(secret.split("_")[1] || "", "base64");
const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${body}`).digest("base64");
return sig.split(" ").map((s) => s.split(",")[1]).some((p) => p === expected);
}
const TYPES: Record<string, string> = {
"email.delivered": "delivered",
"email.opened": "opened",
"email.clicked": "clicked",
"email.bounced": "bounced",
};
export async function POST(req: NextRequest) {
const body = await req.text();
const secret = process.env.RESEND_WEBHOOK_SECRET;
if (secret && !verify(secret, req, body)) {
return NextResponse.json({ ok: false }, { status: 401 });
}
const payload = JSON.parse(body);
const type = TYPES[payload.type];
const email = payload.data?.to?.[0] || "";
if (type && email) {
await appendEmailEvent({ type, email, at: payload.created_at });
}
return NextResponse.json({ ok: true });
}
And saving the event to Supabase Storage (a JSON file, no SQL):
// lib/events.ts
import { createClient } from "@supabase/supabase-js";
const sb = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.SUPABASE_SERVICE_ROLE_KEY!);
export async function appendEmailEvent(ev: { type: string; email: string; at?: string }) {
const path = "events/email-events.json";
// Read existing events, append the new one, and save
const { data } = await sb.storage.from("newsletter").download(path);
const events = data ? JSON.parse(await data.text()) : [];
events.push({ ...ev, at: ev.at || new Date().toISOString() });
await sb.storage.from("newsletter").upload(path, JSON.stringify(events), {
contentType: "application/json",
upsert: true,
});
}
Why Supabase Storage and not a table? Because events don't need complex queries, just aggregation and display. A single JSON file is simpler to set up, and you can always migrate to SQL later if the volume grows. (In Supabase, create a bucket named
newsletterunder Storage.)
Step 7: Admin Dashboard (Statistics)
Now we build an admin page that shows the numbers. We pull recipients from Resend and events from Supabase, then calculate:
// Calculate open/click rates from events
const delivered = events.filter((e) => e.type === "delivered").length;
const opened = events.filter((e) => e.type === "opened").length;
const clicked = events.filter((e) => e.type === "clicked").length;
const openRate = delivered ? Math.round((opened / delivered) * 100) : 0;
const clickRate = delivered ? Math.round((clicked / delivered) * 100) : 0;
Display this in cards: total subscribers, new subscribers this week, open rate, click rate. Protect the page behind admin authentication (a signed cookie) so it stays private.
Step 8: Automated Scheduling (Vercel Cron)
The final step: send the issue automatically every week. Vercel Cron calls a route on a schedule you define in vercel.json:
{
"crons": [
{ "path": "/api/cron/newsletter", "schedule": "0 7 * * 4" }
]
}
(0 7 * * 4 = every Thursday at 7:00 UTC.) And the route that gets triggered:
// app/api/cron/newsletter/route.ts
import { NextResponse } from "next/server";
import { sendNewsletter } from "@/lib/send-newsletter";
export async function GET(req: Request) {
// Vercel sends an authorization header, we verify this is actually the Cron
if (req.headers.get("authorization") !== `Bearer ${process.env.CRON_SECRET}`) {
return NextResponse.json({ ok: false }, { status: 401 });
}
const count = await sendNewsletter("Weekly Issue 🤖", "<h1>Hello!</h1>...");
return NextResponse.json({ ok: true, sent: count });
}
Set CRON_SECRET in Vercel and Vercel will inject it automatically on every run, so nobody can trigger the send manually.
Step 9: Deliverability and Best Practices
The system works. Now make sure the emails actually land in the inbox and not spam:
- Verified domain (SPF + DKIM + DMARC), covered in Step 2. This is non-negotiable.
- List-Unsubscribe header on every email, mandatory for bulk senders.
- Gradual warm-up: do not send 10,000 emails on day one. Increase volume incrementally.
- List hygiene: remove bounced addresses to protect your sender reputation.
- Real content: avoid spam trigger words, balance text and images, and run everything through a spam checker before sending.
The bottom line
With Vercel, Supabase, and Resend you can build a complete newsletter system, subscription, sending, tracking, and scheduling, that is entirely yours: the data, the code, and the ownership. Start for free and upgrade only when your list grows. You can write all the code quickly with Claude Code, exactly the way we built the system that powers this site's newsletter.
Want us to build a custom automated marketing system for your business? That is exactly what we do.
Continue reading: What is Claude Code · AI Automations for Business · A Claude Agent That Collects Invoices · Free Claude Code Course · Recommended AI Tools

