LogoMkSaaS Docs
LogoMkSaaS Docs
HomepageIntroductionCodebaseVideo TutorialsGetting Started: Install and Run LocallyEnvironment Setup
Configuration

Integrations

DatabaseAuthenticationEmailNewsletterStorage
Payment
AIAnalyticsNotificationCaptchaChatboxAffiliates

Customization

MetadataFontsThemesImagesSaaS Internationalization with next-intlBlogDocsComponentsCustom PagesLanding PageUser ManagementAPI Key Management

Codebase

IDE SetupProject StructureFormatting & LintingUpdating the Codebase
X (Twitter)

Newsletter

Learn how to set up and use Resend or Beehiiv for newsletter management

MkSaaS supports Resend and Beehiiv for managing newsletter subscriptions.

Setup

Create Resend Account

Create a Resend account at resend.com.

Get API Key

Click API Keys > Create API Key in the dashboard, set the permissions to Send emails or Full access. Get the API key from the dashboard, and add it to the environment variables file:

.env
RESEND_API_KEY=YOUR-RESEND-API-KEY

Update Website Configuration

src/config/website.tsx
export const websiteConfig = {
  // ...other config
  newsletter: {
    enable: true,
    provider: 'resend',
    autoSubscribeAfterSignUp: false,
  },
  // ...other config
}

If you are setting up the environment, now you can go back to the Environment Setup guide and continue. The rest of this guide can be read later.

Environment Setup

Set up environment variables


Usage

import { subscribe, unsubscribe, isSubscribed } from '@/newsletter';

// Subscribe a user to the newsletter
const success = await subscribe('user@example.com');

// Unsubscribe a user from the newsletter
const success = await unsubscribe('user@example.com');

// Check if a user is subscribed
const subscribed = await isSubscribed('user@example.com');

Email addresses are trimmed and converted to lowercase before they are sent to the provider. When autoSubscribeAfterSignUp is enabled, signup schedules the subscription asynchronously after a short delay so newsletter failures do not block account creation. The welcome email is scheduled separately.

The Resend provider uses the Contacts API without an audience ID. It first tries to create the contact and falls back to updating an existing contact, making repeat subscriptions safe.

Extending New Newsletter Providers

MkSaaS supports extending with new newsletter providers:

  1. Create a new file in the src/newsletter/provider directory (e.g., custom-provider.ts).
  2. Implement the NewsletterProvider interface:
src/newsletter/provider/custom-provider.ts
import type {
  CheckSubscribeStatusParams,
  NewsletterProvider,
  SubscribeNewsletterParams,
  UnsubscribeNewsletterParams,
} from '@/newsletter/types';

export class CustomNewsletterProvider implements NewsletterProvider {
  constructor() {
    // Initialize your provider
  }

  public getProviderName(): string {
    return 'CustomProvider';
  }

  async subscribe({ email }: SubscribeNewsletterParams): Promise<boolean> {
    // Implementation for subscribing a user
    return true;
  }

  async unsubscribe({ email }: UnsubscribeNewsletterParams): Promise<boolean> {
    // Implementation for unsubscribing a user
    return true;
  }

  async checkSubscribeStatus({ email }: CheckSubscribeStatusParams): Promise<boolean> {
    // Implementation for checking subscription status
    return true;
  }
}
  1. Add the provider name to NewsletterConfig['provider'] in src/types/index.d.ts, then register its lazy factory in index.ts:
src/newsletter/index.ts
import { CustomNewsletterProvider } from './provider/custom-provider';

const providerRegistry: Partial<
  Record<NewsletterProviderName, NewsletterProviderFactory>
> = {
  resend: () => new ResendNewsletterProvider(),
  beehiiv: () => new BeehiivNewsletterProvider(),
  custom: () => new CustomNewsletterProvider(),
};

FAQ

Which provider should I choose?

  • Choose Resend if you already use Resend for transactional emails and want a simple, unified solution for both email sending and newsletter management.
  • Choose Beehiiv if you need advanced newsletter features like analytics, monetization, referral programs, and growth tools for professional content creators.

RESEND_AUDIENCE_ID Environment Variable

As of November 15, 2025, the RESEND_AUDIENCE_ID environment variable has been removed from the template, and the newsletter module no longer needs this environment variable.

Please refer to the documentation for more details: Migrating from Audiences to Segments

Video Tutorial

Next Steps

Email

Configure email services

Authentication

Configure user authentication

Analytics

Configure analytics

Storage

Configure storage

Email

Learn how to set up and use email functionality with Resend and React Email templates

Storage

Learn how to set up and use cloud storage for file uploads and media handling

Table of Contents

SetupCreate Resend AccountGet API KeyUpdate Website ConfigurationCreate Beehiiv AccountGet API Key and Publication IDUpdate Website ConfigurationUsageExtending New Newsletter ProvidersFAQWhich provider should I choose?RESEND_AUDIENCE_ID Environment VariableVideo TutorialNext Steps