Skip to main content

Email & Notifications

What emails the site sends, and how to customize them.

DirectoryKit sends transactional emails via Resend. All templates are React components (from @react-email/render) — edit them in your IDE with live preview.

Emails the site sends

EventRecipientTrigger
WelcomeNew signupUser signs up
Submission receivedSubmitterUser submits a project
Submission approvedSubmitterAdmin clicks Approve
Submission rejectedSubmitterAdmin clicks Reject
New submissionAdminA project is submitted
Payment receiptBuyerStripe checkout.session.completed
Account notificationUserCron-scheduled reminders
Newsletter subscribedNew subscriber/api/newsletter/subscribe

Previewing a template

Example email template rendered

Where templates live

lib/email.ts builds each email. Style tweaks (colors, logo, signature) happen there or through siteConfig / emailConfig.

External webhooks (optional)

On top of email, DirectoryKit can fire outbound webhooks to Discord/Slack when events happen. Controlled by the webhooksExternal flag.

Configure in the admin panel → Settings → Integrations (stored in DB). Events currently emitted:

  • project.submitted
  • project.approved
  • project.rejected
  • user.registered

In code:

import { webhookEvents } from '@/lib/webhooks';
 
await webhookEvents.projectSubmitted(project);

Configuration

See Email Config for the full Resend setup (API key, domain verification, dev redirect).

Dev-safety: redirecting emails locally

When NODE_ENV=development and RESEND_DEV_REDIRECT=true (default), every email is redirected to RESEND_DEV_REDIRECT_TO. This prevents accidents where testing sends real emails to users.

Set it once in .env.local:

RESEND_DEV_REDIRECT=true
RESEND_DEV_REDIRECT_TO=you@example.com

With AI

AI Prompt· Customize the welcome email

Rewrite the welcome email template in lib/email.ts for my brand.

Brand: {brand name} Niche: {what kind of directory — e.g. "AI writing tools"} Tone: {friendly / professional / playful / editorial} CTA goal: {what do you want the reader to do first? — e.g. "submit their first tool", "follow on Twitter", "verify email"}

Keep:

  • The existing send/transport logic
  • getFromAddress() helper (don't replace)
  • Use siteConfig from @/config/site.config for brand name and contact email — don't hardcode

Produce a plain-text and HTML version. Keep it under 100 words. Add one clear CTA button.