I want to get an email when someone posts here, how can we set this up?
Email for new posts
Nothing in the app sends email today (no provider, no SMTP, no per-user preference), so this needs a small feature rather than a config flag. Proposed setup, which I'll build now:
Delivery: Resend over its plain HTTPS API — no new npm dependency, works from Vercel functions, free tier is 3k emails/month. Two env vars: RESEND_API_KEY and EMAIL_FROM (e.g. Evenings <notify@yourdomain>; the domain must be verified in Resend — or onboarding@resend.dev for testing, which only delivers to your own Resend account email). If either is unset, notifications are silently off, so nothing changes for local dev.
Who gets mailed, and when (new lib/notify.ts, fired after the post is stored, via waitUntil like sandbox launches):
- a human replies in a thread → everyone who has participated in that thread (creator + previous human posters), minus the author
- a new thread is created in a workspace → that workspace's members, minus the author (general threads: nobody, there's no membership)
- Claude posts → only its terminal posts (
done,question_back,failed) go out to participants; plan/progress/diff posts don't, to avoid 5–10 mails per run
Email = author + thread title in the subject, the post body (truncated) and a link to the thread. Addresses come from users.email, which GitHub already provides (we request user:email).
Opt-out: new users.notify_email column (migration 0004, default on), a /settings page with the toggle (header avatar/name becomes the link to it), PATCH /api/me. Footer of every email links there.
Will update .env.example + README with the two env vars. You'll need to create the Resend account/API key and add the vars in Vercel — I'll spell out those steps in the done post.
Code is in and typechecks (commit dd3e978 on thread/661ee38a):
lib/email.ts— Resend over plain fetch; no-op unlessRESEND_API_KEY+EMAIL_FROMare setlib/notify.ts— recipient rules + email text/HTML;scheduleNotify(postId)is called fromcreateThread,forkThread,addHumanPostandaddAgentPostinlib/data.ts, deferred withwaitUntillike sandbox launchesdrizzle/0004_email_notifications.sql—users.notify_email boolean default true/settingspage (header avatar/handle links there) with the toggle →PATCH /api/me.env.example+ README
Now verifying against a real Postgres in the sandbox (migration + "who gets mailed" with a stubbed Resend) and taking a screenshot of the settings page.
threadide@dd3e978Email notifications are built and pushed on thread/661ee38a (commit dd3e978). Nothing is sent until you add two env vars — steps at the bottom.
What it does
- Human replies in a thread → everyone who has participated in it (creator + anyone who posted), minus the author.
- New thread in a workspace → that workspace's members, minus the author. General (workspace-less) threads: nobody on open; replies go to the participants.
- Claude → only its terminal posts (
done,question_back,failed) go out, to participants. Plan/progress/diff posts don't, so a run is one email, not ten. - Subject reads
osebo replied in “Email for new posts”/Claude has a question on “…”; body is the post (clipped at 2500 chars) + an "Open thread" link + an unsubscribe link to/settings. - Every user can turn it off on /settings (header avatar/handle now links there). New
users.notify_emailcolumn, default on. A user whose GitHub email is private gets nothing (the page says so). - Sending is deferred with
waitUntilafter the post is stored, so posting latency is unchanged and a Resend outage only logs[notify] failed.
Verified
Ran migration 0004 and all four post paths against a real Postgres in the sandbox with Resend stubbed: new-thread→members, reply→participants, opted-out and no-email users skipped, agent progress→nobody, agent question→participants, general-thread rules. All pass; sample email attached.
To turn it on (you)
- Create a free account at resend.com → Domains → Add your domain and add the DNS records it shows (SPF/DKIM). Verification is usually minutes.
- API Keys → Create (sending-only is enough). Copy it.
- In Vercel → Project → Settings → Environment Variables (Production), add:
RESEND_API_KEY= the keyEMAIL_FROM=Evenings <notify@yourdomain>(must be on the verified domain)- make sure
APP_URLis the real deployed URL — it's what the links in the email use.
- Merge this branch.
npm run buildapplies0004on the production deploy (preview deploys skip migrations, so the/settingspage will 500 on the preview until then — expected).
No domain yet? Set EMAIL_FROM=onboarding@resend.dev to try it; Resend then only delivers to the email on your Resend account, which is fine for a solo test.
Files
lib/email.ts (new), lib/notify.ts (new), lib/data.ts (4 scheduleNotify calls), db/schema.ts + drizzle/0004_email_notifications.sql, app/settings/page.tsx, app/api/me/route.ts, components/notification-toggle.tsx, components/user-menu.tsx, app/globals.css, .env.example, README.md.
Not done, deliberately: per-thread mute, digests/batching, and @mention-only mode. Easy to add on top of lib/notify.ts if the volume gets annoying. Want me to open the PR?

