Credit-based generative media app with auth, prepaid credits, and private storage.
Project details
Checks
Built with
One-click deploy
BabySea open source projects are organized into three categories:
| Category | Description |
|---|---|
| SDK | Typed developer entry points for creating, tracking, and managing BabySea workloads from application code. |
| Primitive | Reusable infrastructure boundaries extracted from BabySea's execution control plane. Each primitive focuses on one system concern. |
| Starter | Deployable reference applications that combine product UI, auth, storage, and BabySea execution patterns. Some starters may also include billing. |
BabySea OSS projects are published into three status levels:
| Status | Description |
|---|---|
| Working | Fully implemented and deployable. All documented capabilities function as described. Suitable for personal and small-team use. No breaking-change guarantees between versions. |
| Production | Working plus a hardened public runtime contract. Validated against a stated infrastructure stack with deterministic behavior, explicit failure modes, and a documented upgrade path. |
| Alpha | Early-stage implementation. Core structure exists but some capabilities may be incomplete, undocumented, or subject to breaking changes. Not recommended for production deployments. |
See CHANGELOG.md to track releases and public contract changes.
Run locally:
git clone https://github.com/babysea-community/generative-media-starter.git
cd generative-media-starter
pnpm install --frozen-lockfile
cp .env.example .env.localFill .env.local from .env.example, apply the migrations in supabase/migrations, then start the app:
For local sign-in, add http://localhost:3011/auth/callback to Supabase Auth Redirect URLs.
pnpm run doctor
pnpm devOpen http://localhost:3011.
Set BABYSEA_API_KEY server-side so the app can call the BabySea SDK for model metadata, cost estimates, and generation execution.
Create one active Stripe Checkout Price for each credit pack in lib/app-config.ts:
| Pack | Credits | Amount | Lookup key |
|---|---|---|---|
| Starter Pack | $10 | $10 | generative_media_starter_starter_usd_1000 |
| Builder Pack | $25 | $25 | generative_media_starter_builder_usd_2500 |
| Production Pack | $50 | $50 | generative_media_starter_production_usd_5000 |
Set UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN for production rate limiting. Completed media is copied into the private generated-media Supabase Storage bucket and displayed with signed URLs.
| Surface | Purpose |
|---|---|
| Dashboard | Review balance, recent generations, and starter readiness from the signed-in workspace. |
| Generate | Submit prompts, estimate BabySea cost, reserve credits, and create private generated media. |
| Billing | Buy one-time Stripe credit packs and inspect credit ledger activity. |
| Login | Sign in with Google through Supabase Auth before entering the private dashboard. |
- Supabase Google OAuth protects user dashboard routes.
- Stripe Checkout grants prepaid credit packs through verified, idempotent webhook events.
- Generation requests load BabySea model metadata, reserve credits before dispatch, and charge or refund after terminal status.
- BabySea API keys, Stripe secrets, Supabase service role keys, Upstash tokens, and Sentry auth tokens stay server-side.
- Generation records, credit balances, ledger events, Stripe customer links, and private storage paths persist in Supabase.
- Upstash rate limits protect production generation requests.
- Generative Media Starter is not a managed BabySea service, hosted SaaS product, provider marketplace, billing platform, queue, or cron-based execution service.
Keep the checked-in vercel.json framework settings. Configure Supabase auth callback URLs with the final Vercel domain or custom domain, then redeploy after changing env values.
.do/deploy.template.yaml defines the DigitalOcean App Platform service, build command, start command, and environment prompts. Add every runtime variable from .env.example, set NEXT_PUBLIC_SITE_URL to the DigitalOcean or custom domain, and configure Supabase auth callback URLs before production use.
netlify.toml builds with pnpm build and the Next.js plugin. Add every runtime variable from .env.example, set NEXT_PUBLIC_SITE_URL, and validate the deployment with pnpm run doctor before promoting it.
render.yaml builds with pnpm build and runs pnpm start -- -p $PORT. Fill the blueprint environment values, set NEXT_PUBLIC_SITE_URL to the Render or custom domain, and configure Supabase auth callback URLs before production use.
Use the Deploy on Railway button above to start from the published Generative Media Starter template, or create a new Railway project from the public repository. Add every runtime variable from .env.example, set NEXT_PUBLIC_SITE_URL to the Railway or custom domain, and configure Supabase auth callback URLs before production use.
Point Stripe webhooks at https://your-app.example.com/api/stripe/webhook and listen for checkout.session.completed plus checkout.session.async_payment_succeeded. See docs/stripe.md for CLI commands and the production webhook checklist.
| Change | Files |
|---|---|
| UI | app/page.tsx, app/login/page.tsx, app/dashboard/** |
| Auth | app/login/_lib/server-actions.ts, app/auth/callback/route.ts, supabase/migrations/001_starter.sql |
| Billing | lib/billing/prices.ts, lib/billing/stripe.ts, app/dashboard/billing/**, app/api/stripe/webhook/route.ts |
| Credits | app/dashboard/_lib/server-actions.ts, supabase/migrations/001_starter.sql |
| Generation | lib/inference/babysea.ts, app/dashboard/generate/**, lib/generation/descriptions.json |
| Storage | lib/storage/index.ts, supabase/migrations/004_harden_generated_media_bucket.sql |
| Rate limits | lib/security/rate-limit.ts |
| Monitoring | instrumentation.ts, instrumentation-client.ts, lib/monitoring, scripts/sentry-project-check.mjs |
| Deploy | .do/deploy.template.yaml, .env.example, app.json, netlify.toml, render.yaml, vercel.json, scripts/doctor.mjs |
| Symptom | Fix |
|---|---|
doctor fails |
Read the missing env var or file printed by doctor; env names live in .env.example. |
| Google sign-in redirects fail | Add the final /auth/callback URL to Supabase Auth Redirect URLs. |
| Stripe Checkout returns to the wrong host | Align NEXT_PUBLIC_SITE_URL, Stripe redirect URLs, and your deployed domain. |
| Checkout succeeds but credits do not appear | Verify the Stripe webhook URL, event type, and STRIPE_WEBHOOK_SECRET. |
| Generation is disabled | Set a valid server-side BABYSEA_API_KEY. |
| Generation says insufficient credits | Complete a test Checkout session or grant credits in Supabase for development. |
| Assets fail to display | Confirm the generated-media bucket exists and migrations ran. |
| Rate limit exceeded | Wait for the configured Upstash window or tune lib/security/rate-limit.ts. |
| Sentry source maps are not uploaded | Confirm SENTRY_ORG, SENTRY_PROJECT, and SENTRY_AUTH_TOKEN exist only in build/CI secrets. |
The project publishes its trust signals through public GitHub, GitLab, or other CI provider checks so contributors can inspect the actual CI configuration, jobs, and reports.
Generative Media Starter is an Apache-2.0 open-source starter in babysea-community/generative-media-starter. Issues, pull requests, design discussion, and security reports should follow CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.
Apache License 2.0. Use it, fork it, ship it.