From prompt to production: a one-day Next.js SaaS build
Shipping a production SaaS in a day isn't magic; it's choosing the right generators, defaults, and guardrails. Here's the path I use to go from a prompt to a revenue-ready Next.js app with orgs, billing, and audit trails.
1) Bootstrap fast
Start with a Next.js app generator that scaffolds app router, TypeScript, testing, and a database layer. I prefer Prisma and Postgres; Neon gives instant branches. Select Auth.js or Clerk for authentication, and include Tailwind and shadcn/ui so product work isn't blocked by CSS.
- Create repo, env templates, and a health check route early; CI should fail fast on schema drift.
- Define your domain objects in /prisma/schema.prisma: Tenant, Membership, User, Subscription.
- Add a seed script that creates an owner user and a demo tenant; you'll reuse it in e2e tests.
2) Multi-tenancy and authorization
Use a multi-tenant SaaS generator or wire it yourself with a TenantId on every row and middleware that enforces it. For app router, decorate request context with user, roles, and active tenant, and map subdomains (acme.yourapp.com) to TenantId. Keep system admins separate from tenant roles.

- Authorization rule of three: resource owner, tenant role, and feature flag.
- Add org invites and role upgrades via signed links that expire in 24 hours.
- Log all role changes to an Audit table with who, when, and IP.
3) Stripe in hours, not weeks
Create Products and Prices in Stripe, then store only the Price ID in your plan config. Use the customer portal for card management on day one; upsells can come later. Link Subscription rows to Tenant by customer ID.

- Run Stripe CLI: stripe listen --forward-to /api/stripe/webhook for local dev.
- Gate features by price tiers; example: reports=pro+, exports=enterprise.
- Prorations off for launch simplifies support; turn on once you stabilize.
4) Webhooks without tears
This is where a webhook builder AI shines. Feed it your event contract, and let it draft handlers for customer.created, checkout.session.completed, and invoice.paid. Keep handlers idempotent using event replay keys and database transactions.
- Normalize events into a WebhookEvent table; process asynchronously with a job queue.
- One source of truth: subscription status computed from latest invoice + product map.
- Emit your own domain events (TenantActivated, SeatChanged) for analytics.
5) Ship, observe, iterate
Deploy on Vercel, attach Neon or RDS, and ship behind feature flags. Add OpenTelemetry, structured logs, and per-tenant rate limits. Daily backups and a test restore are part of "done."
- Playwright covers signup, org switch, checkout, downgrade, and cancel paths.
- Security basics: HTTPS everywhere, Samesite=strict cookies, and rotated keys.
- Measure DAU, conversion to paid, and expansion revenue by tenant cohort.
Ship confidently: generator-driven Next.js, solid tenancy, and sane webhooks turn prompts into revenue within a day.



