Build an effective waitlist with email capture, referral mechanics, and viral loop optimization
The Waitlist workflow helps you build anticipation before launch by capturing interested users, implementing referral mechanics, and maintaining engagement through strategic communication.
1// components/marketing/WaitlistSuccess.tsx2'use client';34import{ useState }from'react';5import{Button}from'@/components/ui/button';6import{CheckCircle,Copy,Twitter,Linkedin}from'lucide-react';78interfaceWaitlistSuccessProps{9 position:number;10 referralCode:string;11}1213exportfunctionWaitlistSuccess({ position, referralCode }:WaitlistSuccessProps){14const[copied, setCopied]=useState(false);15const referralUrl =`${window.location.origin}?ref=${referralCode}`;1617asyncfunctioncopyLink(){18awaitnavigator.clipboard.writeText(referralUrl);19setCopied(true);20setTimeout(()=>setCopied(false),2000);21}2223const twitterText =encodeURIComponent(24"I just joined the waitlist for [Product Name]! Join me and get early access:"25);26const twitterUrl =`https://twitter.com/intent/tweet?text=${twitterText}&url=${encodeURIComponent(referralUrl)}`;2728const linkedinUrl =`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(referralUrl)}`;2930return(31<divclassName="text-center space-y-6 p-8 rounded-lg border bg-card">32<divclassName="flex justify-center">33<CheckCircleclassName="w-16 h-16 text-green-500"/>34</div>3536<div>37<h3className="text-2xl font-bold mb-2">You're on the list!</h3>38<pclassName="text-4xl font-bold text-primary">#{position}</p>39<pclassName="text-muted-foreground">Your position in line</p>40</div>4142<divclassName="space-y-3">43<pclassName="font-medium">Move up by referring friends</p>44<pclassName="text-sm text-muted-foreground">45 Each referral moves you up 10 spots
46</p>4748<divclassName="flex gap-2">49<Input50value={referralUrl}51readOnly52className="text-sm"53/>54<Buttonvariant="outline"onClick={copyLink}>55{copied ?<CheckCircleclassName="w-4 h-4"/>:<CopyclassName="w-4 h-4"/>}56</Button>57</div>5859<divclassName="flex justify-center gap-3 pt-4">60<Buttonvariant="outline"size="sm"asChild>61<ahref={twitterUrl}target="_blank"rel="noopener noreferrer">62<TwitterclassName="w-4 h-4 mr-2"/>63 Share on Twitter
64</a>65</Button>66<Buttonvariant="outline"size="sm"asChild>67<ahref={linkedinUrl}target="_blank"rel="noopener noreferrer">68<LinkedinclassName="w-4 h-4 mr-2"/>69 Share on LinkedIn
70</a>71</Button>72</div>73</div>74</div>75);76}
1// lib/email/templates/waitlist-welcome.ts2import{ Resend }from'resend';34const resend =newResend(process.env.RESEND_API_KEY);56interfaceWelcomeEmailProps{7 email:string;8 position:number;9 referralCode:string;10}1112exportasyncfunctionsendWelcomeEmail({13 email,14 position,15 referralCode,16}: WelcomeEmailProps){17const referralUrl =`https://yoursite.com?ref=${referralCode}`;1819await resend.emails.send({20 from:'Your Product <hello@yoursite.com>',21 to: email,22 subject:"You're on the waitlist! Here's how to skip the line",23 html:`24 <h1>Welcome to the Waitlist!</h1>
25 <p>You're #${position} in line for early access.</p>
2627 <h2>Skip the line</h2>
28 <p>For every friend who joins using your link, you'll move up 10 spots:</p>
29 <p><a href="${referralUrl}">${referralUrl}</a></p>
3031 <h2>What's next?</h2>
32 <ul>
33 <li>We'll notify you when it's your turn</li>
34 <li>Early access members get 50% off the first year</li>
35 <li>Follow us on Twitter for updates</li>
36 </ul>
37`,38});39}