{
  "id": "build-a-saas-pricing-page",
  "type": "prompts",
  "category": "prompts",
  "locale": "en",
  "url": "/prompts/build-a-saas-pricing-page",
  "title": "Prompt to Build a SaaS Pricing Page in Next.js",
  "description": "Copy-paste AI prompt to build a SaaS pricing page in Next.js with Tailwind, toggle billing, and Stripe-ready plan data.",
  "tools": [
    "Cursor",
    "Claude Code",
    "Codex",
    "Windsurf"
  ],
  "stack": [
    "Next.js",
    "TypeScript",
    "Tailwind"
  ],
  "tags": [
    "nextjs",
    "tailwind",
    "typescript",
    "build"
  ],
  "difficulty": "easy",
  "updated": "2026-06-08",
  "markdown": "Use this prompt to generate a polished, conversion-optimized pricing page with a\nmonthly/annual billing toggle, a highlighted \"Most Popular\" tier, and a typed plan\nconfig that wires directly into Stripe Checkout — no placeholder data.\n\n## Main Prompt\n\n```txt title=\"Main Prompt\"\nYou are working in a Next.js App Router project using TypeScript and Tailwind CSS v4.\n\nTask: create a `/pricing` page with the following specification.\n\nPlan data:\n- Starter: $0/mo, $0/yr — 1 user, 5 projects, community support.\n- Pro: $19/mo, $190/yr — 5 users, unlimited projects, email support. Mark as \"Most Popular\".\n- Enterprise: $99/mo, $990/yr — unlimited users, SSO, dedicated support.\n\nUI requirements:\n- A client component `<PricingToggle>` with monthly/annual switch; annual shows \"Save 17%\".\n- A `<PricingCard>` component per plan with: name, price, feature list, CTA button.\n- \"Most Popular\" card has a highlighted border and badge.\n- CTA buttons call `handleCheckout(planId, interval)` — stub it for now, we will wire Stripe later.\n- The page file itself must be a Server Component; only the toggle and cards are Client Components.\n- Use Tailwind utility classes only — no CSS modules, no inline styles.\n\nType requirements:\n- Export a `Plan` interface from `src/lib/pricing.ts`.\n- Plan data lives in that same file as a `const PLANS: Plan[]`.\n\nDo NOT install any new packages. Stop and list all files before writing code.\n```\n\n## Implementation Notes\n\n- The page must be a Server Component so it is statically renderable; lift `'use client'` only to\n  the toggle and card components that need `useState`.\n- `handleCheckout` should accept `(planId: string, interval: 'monthly' | 'annual')` — this\n  signature matches the Stripe Checkout prompt, so keep it stable.\n- Tailwind v4 uses CSS-first config; avoid `tailwind.config.ts` unless it already exists.\n\n## Expected File Changes\n\n```txt\nsrc/app/pricing/page.tsx            (new — Server Component)\nsrc/components/PricingToggle.tsx    (new — Client Component)\nsrc/components/PricingCard.tsx      (new — Client Component)\nsrc/lib/pricing.ts                  (new — Plan type + PLANS constant)\n```\n\n## Acceptance Criteria\n\n- `bun run build` exits 0 with no TypeScript errors.\n- Toggling monthly/annual updates all three card prices without a full page reload.\n- \"Most Popular\" badge is visible on the Pro card.\n- `handleCheckout` is called with the correct `planId` and `interval` when a CTA is clicked.\n\n## Test Commands\n\n```bash\nbun run typecheck\nbun run build\nbun run dev\n# open http://localhost:3000/pricing and verify toggle behavior\n```\n\n## Common AI Mistakes\n\n- Marking the page file itself `'use client'`, which defeats server rendering.\n- Hard-coding prices inside JSX instead of deriving them from `PLANS`.\n- Using `tailwind.config.ts` `theme.extend` patterns that don't apply to Tailwind v4.\n- Forgetting to export the `Plan` type, breaking the Stripe Checkout integration later.\n\n## Fix Prompt\n\n```txt title=\"Fix Prompt\"\nThe pricing page has type errors or the toggle doesn't work. Fix in this order:\n1. Remove `'use client'` from `src/app/pricing/page.tsx` — only the child components need it.\n2. Make sure `PricingToggle` uses `useState` for the billing interval and passes it down via props.\n3. Confirm `handleCheckout` signature is `(planId: string, interval: 'monthly' | 'annual') => void`.\nShow the corrected diff only — do not rewrite unrelated files.\n```"
}