Skip to main content
20% off 3 months · code LAUNCH20 · until 31 October

A waitlist with referral links for a Next.js app

A waitlist is a promise with a queue. Referrals turn the queue into distribution: people share their link. The mechanics are the part you do not want to write on a launch week.

How do I add a waitlist with referrals to a Next.js app?

Render a form that POSTs to /v1/waitlist/signups with a publishable key, or drop in the script-tag widget. Every signup gets a referral code and a position; a visitor who arrives with ?ref=CODE is credited to the referrer, and the leaderboard shows who brought the most people. Invite in batches when you open, and export the list as CSV.

01Register the origin, get a publishable key

Under Project → Allowed origins add your site's origin, then create a publishable key. It is safe to ship to the browser; the API only lets it create signups, not read them.

02The form

A client component that reads ?ref= from the URL, posts the email, and shows the position and the person's own referral link from the response.

"use client";
import { useState } from "react";

export function Waitlist() {
  const [result, setResult] = useState<{ position: number; referral_code: string } | null>(null);
  async function submit(e: React.FormEvent<HTMLFormElement>) {
    e.preventDefault();
    const email = new FormData(e.currentTarget).get("email");
    const ref = new URLSearchParams(location.search).get("ref");
    const r = await fetch("https://api.nordva.dev/v1/waitlist/signups", {
      method: "POST",
      headers: { Authorization: `Bearer ${process.env.NEXT_PUBLIC_NORDVA_PUBLISHABLE_KEY}`, "Content-Type": "application/json" },
      body: JSON.stringify({ email, referrer_code: ref ?? undefined }),
    });
    const { data } = await r.json();
    setResult(data);
  }
  if (result) return <p>You are #{result.position}. Share {location.origin}/?ref={result.referral_code} with friends.</p>;
  return <form onSubmit={submit}><input name="email" type="email" required /><button>Join</button></form>;
}

03Or the widget

One tag on any page. It captures the referrer and UTM values for attribution as well, without a cookie.

<script src="https://cdn.nordva.dev/v1/waitlist.js" data-key="nv_pub_live_…" async></script>

04Launch day

Invite the first N in position order with POST /v1/waitlist/invites, or ask the agent to invite_from_waitlist. Then send one announcement email to everyone still waiting from Dashboard → Waitlist → Announce, previewed first, one a day at most.

Questions

Can someone game the referrals?

Each referral is scored when the signup is created: the same normalised email, the same IP within five minutes of the referrer, or more than five credits to one referrer in an hour count against it. A high score stores the signup without crediting it; a middling one credits it and flags it, and flagged referrals are listed in a daily alert so you can remove them before inviting.

Does the position change?

Yes. Each credited referral moves the referrer up. The response to a signup and GET /v1/waitlist/signups/<id> return the current position.

Can I import a list I already have?

Yes, CSV import on every plan, with the option to skip the confirmation email for people who already confirmed elsewhere.