Admin Settings Guide

Reference for configuring and managing Pop-cam.

1. Environment Variables

All secrets and configuration live in .env.local (never committed to git). After changing any value, restart the dev server or redeploy.

Authentication (Clerk)

VariableDescription
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYClerk publishable key (from Clerk dashboard)
CLERK_SECRET_KEYClerk secret key (server-side only)
NEXT_PUBLIC_CLERK_SIGN_IN_URLSign-in page path (default: /sign-in)
NEXT_PUBLIC_CLERK_SIGN_UP_URLSign-up page path (default: /sign-up)

Database (Supabase / Prisma)

VariableDescription
DATABASE_URLPooled PostgreSQL connection string
DIRECT_URLDirect connection for Prisma migrations

Storage (Cloudflare R2)

VariableDescription
R2_ACCOUNT_IDCloudflare account ID
R2_ACCESS_KEY_IDR2 API access key
R2_SECRET_ACCESS_KEYR2 API secret key
R2_BUCKET_NAMEPrimary bucket name
R2_PUBLIC_URLPublic URL for serving images

AI Providers

VariableDescription
OPENAI_API_KEYOpenAI key for gpt-image-1 infographic generation
GEMINI_API_KEYGoogle Gemini key for NanoBanana generation
REPLICATE_API_TOKENReplicate token for Flux Kontext Pro cartoon generation

Payments (Stripe)

VariableDescription
STRIPE_SECRET_KEYStripe secret key (server-side)
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYStripe publishable key (client-side)
STRIPE_WEBHOOK_SECRETWebhook signing secret (from Stripe dashboard or CLI)
NEXT_PUBLIC_STRIPE_PRODUCT_3_CREDITSPrice ID for the 3-credit pack
NEXT_PUBLIC_STRIPE_PRODUCT_10_CREDITSPrice ID for the 10-credit pack
NEXT_PUBLIC_STRIPE_PRODUCT_30_CREDITSPrice ID for the 30-credit pack

2. Credit System

New users receive 5 credits on first sign-up (set in lib/db.ts). The Prisma schema default is 3, but the application code overrides it to 5.

How to change default credits

  1. Open lib/db.ts and update the credits value in the syncUser function.
  2. Optionally update prisma/schema.prisma — change @default(3) on the credits field to match.
  3. Run npx prisma db push to sync schema changes.

Stripe credit packs

Credit pack pricing and quantities are managed in the Stripe dashboard. The three product price IDs are stored as environment variables (see above). To change pack sizes or prices, update the products in Stripe and set the new price IDs in .env.local.

3. Showcase / Prompt Library

The showcase prompt library is managed through a password-protected admin panel:

/nanobanana/showcase/admin

Admin password

The password is currently hardcoded in two files:

  • app/nanobanana/showcase/admin/page.tsx ADMIN_PASSWORD constant
  • app/api/prompt-library/route.ts ADMIN_PASSWORD constant

To change the admin password, update the ADMIN_PASSWORD value in both files. For better security, consider moving this to an environment variable.

Showcase admin capabilities

  • Add, edit, and delete showcase prompts
  • Manage preset prompts
  • Upload and manage images per prompt (drag & drop)
  • Reorder prompts

Seeding prompt data

Run the seed script to populate default presets:

npx tsx scripts/seed-prompt-library.ts

4. Database Management

Schema changes

  1. Edit prisma/schema.prisma
  2. Run npx prisma db push to apply changes
  3. Run npx prisma generate to regenerate the client

Database models

ModelTablePurpose
UserusersUser accounts synced from Clerk, stores credit balance
GeneratedImagegenerated_imagesStores URLs of user-generated images
CustomPromptcustom_promptsUser-created prompt templates
SubscriptionsubscriptionsStripe subscription tracking
image_generation_jobsimage_generation_jobsAsync generation job tracking (status, progress, errors)
ShowcaseImageshowcase_imagesImages linked to showcase prompts

Useful commands

npx prisma studio        # Visual database browser
npx prisma db push       # Push schema to database
npx prisma generate      # Regenerate Prisma client
npx prisma migrate dev   # Create migration (development)

5. AI Providers

ProviderModelEndpointUse Case
OpenAIgpt-image-1/api/generateInfographic generation
Replicateflux-kontext-pro/api/flux-generatorCartoon generation
Googlegemini-3-pro/api/nanobananaNanoBanana style generation

To swap or add a provider, create a new API route under app/api/ and set the corresponding API key in .env.local.

6. Build & Deployment

Build configuration

Configured in next.config.js:

  • TypeScript errors — ignored during build (ignoreBuildErrors: true)
  • ESLint — ignored during build (ignoreDuringBuilds: true)
  • Image optimization — disabled (unoptimized: true)

Stripe webhook (local dev)

stripe listen --forward-to localhost:3000/api/webhook

Copy the webhook signing secret printed by the CLI into STRIPE_WEBHOOK_SECRET in your .env.local.

7. Quick Reference

TaskWhere to change
Change admin passwordapp/nanobanana/showcase/admin/page.tsx & app/api/prompt-library/route.ts
Change default creditslib/db.ts (syncUser) & prisma/schema.prisma
Update Stripe pricesStripe dashboard + .env.local price IDs
Add/edit showcase prompts/nanobanana/showcase/admin
Swap AI providerNew route in app/api/ + key in .env.local
Change database schemaprisma/schema.prisma → npx prisma db push
Enable build checksnext.config.js (set ignore flags to false)