{
  "id": "build-a-saas-pricing-page",
  "type": "prompts",
  "category": "prompts",
  "locale": "fr",
  "url": "/fr/prompts/build-a-saas-pricing-page",
  "title": "Prompt pour créer une page de tarification SaaS dans Next.js",
  "description": "Prompt IA prêt à copier-coller pour créer une page de tarification SaaS dans Next.js avec Tailwind, bascule de facturation et données de plan prêtes pour Stripe.",
  "tools": [
    "Cursor",
    "Claude Code",
    "Codex",
    "Windsurf"
  ],
  "stack": [
    "Next.js",
    "TypeScript",
    "Tailwind"
  ],
  "tags": [
    "nextjs",
    "tailwind",
    "typescript",
    "build"
  ],
  "difficulty": "easy",
  "updated": "2026-06-08",
  "markdown": "Utilisez ce prompt pour générer une page de tarification soignée et optimisée pour la conversion, avec une bascule de facturation mensuelle/annuelle, un palier « Most Popular » mis en évidence, et une configuration de plan typée qui se connecte directement à Stripe Checkout — aucune donnée factice.\n\n## Prompt principal\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## Notes d'implémentation\n\n- La page doit être un composant serveur pour être rendue statiquement ; déplacez `'use client'` uniquement vers les composants de bascule et de carte qui nécessitent `useState`.\n- `handleCheckout` doit accepter `(planId: string, interval: 'monthly' | 'annual')` — cette signature correspond au prompt Stripe Checkout, donc gardez-la stable.\n- Tailwind v4 utilise une configuration CSS-first ; évitez `tailwind.config.ts` sauf s'il existe déjà.\n\n## Modifications de fichiers attendues\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## Critères d'acceptation\n\n- `bun run build` se termine avec le code 0 et aucune erreur TypeScript.\n- Le basculement mensuel/annuel met à jour les prix des trois cartes sans rechargement complet de la page.\n- Le badge « Most Popular » est visible sur la carte Pro.\n- `handleCheckout` est appelé avec le bon `planId` et `interval` lorsqu'un CTA est cliqué.\n\n## Commandes de test\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## Erreurs courantes des IA\n\n- Marquer le fichier page lui-même avec `'use client'`, ce qui empêche le rendu serveur.\n- Coder en dur les prix dans le JSX au lieu de les dériver de `PLANS`.\n- Utiliser des motifs `theme.extend` dans `tailwind.config.ts` qui ne s'appliquent pas à Tailwind v4.\n- Oublier d'exporter le type `Plan`, ce qui casse l'intégration Stripe Checkout ultérieurement.\n\n## Prompt de correction\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```"
}