Web apps

Waitlist and referral page builder

Remix app where owners launch waitlist pages, signups get referral links and climb the list, with a leaderboard and CSV export.

remixtypescriptpostgresdrizzlezodvitest

Built 1 time, downloaded 0 times.

Install from your terminal

Run this in your project folder. It signs you in, shows what changes and asks before it overwrites a file.

npx claude-lab add waitlist-and-referral-page-builder-816abb
10 filesDownload zip
CLAUDE.md
# Waitlist and referral builder

## Purpose

Owners create a waitlist campaign page at /w/:slug. Visitors sign up with an email, get a unique referral link, and move up the list when friends sign up through it. Owners see a leaderboard and export emails as CSV.

## Stack

- Remix with TypeScript
- Postgres 16 via docker compose
- Drizzle ORM with drizzle-kit migrations
- Zod for validation
- Vitest for unit and integration tests
- Playwright for one e2e smoke

## Commands

- `docker compose up -d db`: start local Postgres
- `npm run dev`: dev server on localhost:3000
- `npm run typecheck`
- `npm run lint`
- `npm run test`: Vitest, including integration tests
- `npm run build`
- `npm run test:e2e`: Playwright smoke
- `npm run db:generate`: create a migration from schema changes
- `npm run db:migrate`: apply migrations (asks first)
- `npm run db:seed`: demo campaign (asks first)

## Folder map

- app/routes: Remix routes
- app/db: schema and client
- app/lib/referrals: ranking and codes
- app/lib/auth: session
- app/lib/csv: CSV escaping
- tests/: integration tests
- e2e/: Playwright tests

## Domain rules

- Email is trimmed and lowercased into email_normalized.
- One signup per (campaign_id, email_normalized).
- referral_code is 8 random url-safe characters.
- Position is computed at read time with a SQL window function, ordered by referral_count desc, then created_at asc. Never store it.

## Referral rules

- ?ref=CODE is saved in a cookie for 30 days.
- Self-referral and unknown codes are ignored silently.
- A signup credits only its first referrer.

## Security rules

- Owner routes check the session and that the campaign belongs to the signed-in owner.
- Public leaderboard masks emails as a***@domain.com.
- CSV export prefixes cells starting with = + - @ with a single quote. All cells go through the helper in app/lib/csv.
- Never log full emails.

## Gotchas

- Remix loaders and actions run on the server only. Keep DB imports in .server.ts files.
- Run integration tests against DATABASE_URL_TEST, never the dev database.
- Migrations are generated, never hand-edited after they are applied.
- Never read or print .env. Use placeholders like YOUR_DATABASE_URL and YOUR_SESSION_SECRET in docs and examples.

## Workflow

- Explore, plan, code, then run /verify before saying anything is done.
- Use /clear between unrelated tasks.
- Ask before adding a dependency.
- The phase list is in PLAN.md.
- Skills: verify, referral-logic, db-migration.

## Imports

@SPEC.md
@REVIEW.md
Use for my project