An AI-integrated SaaS product for a consumer health platform. Next.js + Supabase build with Stripe billing and an OpenAI-backed personalization layer. Shipped under NDA — visuals and product name omitted; the engineering context below is the case study.
Brief
The client had product-market fit on a v0 hand-coded by their founder and needed to ship a v1 that could carry six-figure monthly active users without the founder rewriting it every two months. The contract scope: replatform to Next.js + Supabase, add a billing layer, integrate the AI personalization the v0 had been faking with hand-tuned rules.
Approach
Server-rendered Next.js application with the App Router, Supabase for auth, database, and storage. Stripe for subscription billing. A small backend service in Vercel Edge Functions handles the OpenAI calls — streaming responses to the client where latency matters, batched async for the nightly personalization recompute.
Key decisions
Supabase Row Level Security as the entire authorization layer. We did not write a separate authorization service. Every table has RLS policies that encode the access rules; the application reads and writes through the authenticated Supabase client, and the database enforces correctness.
OpenAI calls are wrapped in a small abstraction that handles retries, timeouts, and per-user rate limits backed by Supabase. The abstraction records every prompt + completion to a logs table — both for compliance and for later fine-tuning if the client wants to move off OpenAI.
Stripe webhooks land at a Vercel Edge Function that idempotency-checks against a Supabase events table, then updates the user’s subscription record in a transaction. We do not trust webhook delivery order; the function uses Stripe event timestamps as the source of truth.
The personalization recompute runs nightly as a Supabase scheduled function. It reads user activity from the previous day, runs an OpenAI embedding pass, and writes pre-computed recommendations into a separate table the application queries during page render. This keeps user-facing latency below 100ms even when the recommendation set is fresh.
Outcome
Replatformed in six weeks. The product has been live for several months under the new stack with the founder back to product work instead of code. The client has publicly acknowledged the engagement; the product itself remains under NDA per the founder’s preference.
For your agency
White-label appropriate for: SaaS replatform projects, AI-integrated products where the AI is a feature rather than the product, any consumer-facing build that needs auth + billing + a credible personalization story. The Supabase + Stripe + OpenAI integration patterns transfer cleanly to the next client in this shape — we’ve reused the same billing + RLS spine on two subsequent engagements.