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)
| Variable | Description |
|---|---|
| NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY | Clerk publishable key (from Clerk dashboard) |
| CLERK_SECRET_KEY | Clerk secret key (server-side only) |
| NEXT_PUBLIC_CLERK_SIGN_IN_URL | Sign-in page path (default: /sign-in) |
| NEXT_PUBLIC_CLERK_SIGN_UP_URL | Sign-up page path (default: /sign-up) |
Database (Supabase / Prisma)
| Variable | Description |
|---|---|
| DATABASE_URL | Pooled PostgreSQL connection string |
| DIRECT_URL | Direct connection for Prisma migrations |
Storage (Cloudflare R2)
| Variable | Description |
|---|---|
| R2_ACCOUNT_ID | Cloudflare account ID |
| R2_ACCESS_KEY_ID | R2 API access key |
| R2_SECRET_ACCESS_KEY | R2 API secret key |
| R2_BUCKET_NAME | Primary bucket name |
| R2_PUBLIC_URL | Public URL for serving images |
AI Providers
| Variable | Description |
|---|---|
| OPENAI_API_KEY | OpenAI key for gpt-image-1 infographic generation |
| GEMINI_API_KEY | Google Gemini key for NanoBanana generation |
| REPLICATE_API_TOKEN | Replicate token for Flux Kontext Pro cartoon generation |
Payments (Stripe)
| Variable | Description |
|---|---|
| STRIPE_SECRET_KEY | Stripe secret key (server-side) |
| NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | Stripe publishable key (client-side) |
| STRIPE_WEBHOOK_SECRET | Webhook signing secret (from Stripe dashboard or CLI) |
| NEXT_PUBLIC_STRIPE_PRODUCT_3_CREDITS | Price ID for the 3-credit pack |
| NEXT_PUBLIC_STRIPE_PRODUCT_10_CREDITS | Price ID for the 10-credit pack |
| NEXT_PUBLIC_STRIPE_PRODUCT_30_CREDITS | Price 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
- Open
lib/db.tsand update thecreditsvalue in thesyncUserfunction. - Optionally update
prisma/schema.prisma— change@default(3)on thecreditsfield to match. - Run
npx prisma db pushto 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:
Admin password
The password is currently hardcoded in two files:
app/nanobanana/showcase/admin/page.tsx—ADMIN_PASSWORDconstantapp/api/prompt-library/route.ts—ADMIN_PASSWORDconstant
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
- Edit
prisma/schema.prisma - Run
npx prisma db pushto apply changes - Run
npx prisma generateto regenerate the client
Database models
| Model | Table | Purpose |
|---|---|---|
| User | users | User accounts synced from Clerk, stores credit balance |
| GeneratedImage | generated_images | Stores URLs of user-generated images |
| CustomPrompt | custom_prompts | User-created prompt templates |
| Subscription | subscriptions | Stripe subscription tracking |
| image_generation_jobs | image_generation_jobs | Async generation job tracking (status, progress, errors) |
| ShowcaseImage | showcase_images | Images 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
| Provider | Model | Endpoint | Use Case |
|---|---|---|---|
| OpenAI | gpt-image-1 | /api/generate | Infographic generation |
| Replicate | flux-kontext-pro | /api/flux-generator | Cartoon generation |
| gemini-3-pro | /api/nanobanana | NanoBanana 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
| Task | Where to change |
|---|---|
| Change admin password | app/nanobanana/showcase/admin/page.tsx & app/api/prompt-library/route.ts |
| Change default credits | lib/db.ts (syncUser) & prisma/schema.prisma |
| Update Stripe prices | Stripe dashboard + .env.local price IDs |
| Add/edit showcase prompts | /nanobanana/showcase/admin |
| Swap AI provider | New route in app/api/ + key in .env.local |
| Change database schema | prisma/schema.prisma → npx prisma db push |
| Enable build checks | next.config.js (set ignore flags to false) |