Overview
Generative Media Starter is a deployable SaaS baseline for BabySea-powered media generation with auth, prepaid credits, and private output storage. It gives product builders a working Next.js app with Supabase Auth, Stripe Checkout, a credit ledger, BabySea SDK execution, and signed Supabase Storage previews.
Use it when you need the billing and settlement path before building your own creative surface. The starter sells one-time credit packs, grants credits through verified Stripe webhooks, reserves credits before dispatch, and charges or refunds the reservation after the generation reaches a terminal state.
What you can build
- A signed-in generation dashboard backed by Supabase Auth and user-owned records.
- A BabySea SDK generation form using the
bfl/flux-schnellmodel and normalized schema fields. - Prepaid Stripe Checkout credit packs for Starter, Builder, and Production balances.
- A Supabase credit ledger with grant, reserve, charge, and refund events.
- Private generated media storage with signed URLs shown in the dashboard.
What you need
- Next.js for the signed-in dashboard, route handlers, and server actions.
- Supabase for Auth, Postgres tables, database functions, RLS, and the private generated-media bucket.
- Google OAuth for dashboard sign-in through Supabase Auth.
- BabySea for server-side SDK execution with
BABYSEA_API_KEY. - Stripe for Checkout, webhook verification, and one-time credit pack prices.
- Upstash for Redis-backed generation rate limiting.
- Sentry for optional production observability.
- For hosting, you can deploy using DigitalOcean, Heroku, Netlify, Railway, Render, or Vercel.
Description flow
The user signs in through Supabase Auth and enters a private dashboard that routes them to Generate and Billing. Supabase owns the user records, balances, generations, Stripe customer links, and ledger entries while service-role keys, Stripe secrets, and the BabySea API key remain server-side.
In Billing, the user chooses Starter, Builder, or Production credit packs. The app creates a Stripe Checkout session, then the webhook verifies the completed payment and grants credits idempotently through grant_paid_credits, leaving an auditable ledger row.
In Generate, the app loads the BabySea model schema, shows normalized fields such as prompt, ratio, output format, output count, and provider order, then checks the current balance against the configured generation cost. On submit, the server rate-limits the user, creates a generation record, and reserves credits atomically before dispatching to BabySea.
When BabySea returns an output, the server copies the asset into private Supabase Storage and creates a signed display URL for the dashboard. The ledger then records a charge for successful work or a refund for failed work, so the UI shows both the generated media and the complete balance history in one flow.
