Next.js Notion Waitlist Template

repository·yoda·Indexed 43 days ago

https://github.com/lakshaybhushan/nextjs-notion-waitlist-template

A Next.js 14 template for building waitlist pages using Notion as a CMS, Upstash Redis for rate limiting, and Resend for automated email notifications. Version 1.5.0 includes the NotionWaitlistEmail React Email component and a cn utility for merging Tailwind CSS classes.

Tokens
1K
Snippets
4
Records
9
Agent score
55%

What's inside Next.js Notion Waitlist Template

  1. Manual Local Setup

    yoda

    To run the project locally, fork the repository, clone it, and follow these steps. This project uses bun as the package manager.

    1. Install dependencies:
      bun install
    2. Create a .env.local file in the root directory and populate it with the required environment variables.
    3. Start the development server:
      bun dev
    4. (Optional) To run the email server, use:
      bun email
    bun install
    bun dev
    bun email
  2. Configure Notion as a CMS

    yoda

    To use Notion as your waitlist database, follow these steps:

    1. Create a Database: In your Notion workspace, create a new database with exactly these two columns:
      • Name: Type Title
      • Email: Type Email
    2. Get Notion Secret: Create an internal integration at the Notion Integrations page to obtain your NOTION_SECRET.
    3. Get Database ID: Open your database in a browser. The ID is the string in the URL between the workspace name and the question mark.
      • Format: https://www.notion.so/{DATABASE_ID}?v={NUMBERS}
  3. Use the cn utility to merge Tailwind CSS classes

    yoda

    The cn function is a utility used to conditionally merge Tailwind CSS classes and resolve conflicts between them. It combines clsx (for conditional class logic) and tailwind-merge (to ensure the last class in the list wins when there are Tailwind conflicts, such as p-4 vs p-2).

    Use this function whenever you need to apply dynamic or conditional styles to a component while ensuring Tailwind CSS class precedence is handled correctly.

    import { cn } from '@/lib/utils';
    
    // Example usage:
    const className = cn('text-red-500', isActive && 'font-bold', 'p-4 p-2');
    // Result will correctly resolve Tailwind conflicts (e.g., p-2 will override p-4)
  4. Use the NotionWaitlistEmail component

    yoda

    The NotionWaitlistEmail component is a React Email template used to send waitlist notification emails via Resend. It accepts a userFirstname prop to personalize the greeting and the email preview text.

    To use it, import the component and pass the user's first name as a prop. This component is built using @react-email/components.

    import { NotionWaitlistEmail } from './emails';
    
    // Example usage in a Resend sending function
    const emailHtml = render(<NotionWaitlistEmail userFirstname="Tyler" />);