AI Coloring Page — Project Docs

AI Coloring Page — Project Docs

This repository powers aicolor.page (Cloudflare Workers via OpenNext). It’s an AI coloring book studio: generate consistent line‑art pages and export print‑ready PDFs.

What you can do

  • Generate coloring pages from a prompt + optional reference image
  • Export PDFs (and image bundles) for printing and sharing
  • Manage credits, authentication, admin settings, and payments (Creem)

Tech stack (for developers)

  • Next.js 15 + React 19 (App Router)
  • OpenNext on Cloudflare Workers (pnpm cf:deploy)
  • Postgres + Drizzle ORM (Neon recommended; Hyperdrive in production)
  • Payments via Creem (MoR) + webhook handler

Local development

1) Prerequisites

  • Node.js >= 20
  • pnpm >= 9

2) Install dependencies

pnpm install

3) Configure environment variables

Create .env.local (or .env.development) and set at least:

NEXT_PUBLIC_APP_URL=http://localhost:3000
AUTH_SECRET=... # openssl rand -base64 32
DATABASE_URL=postgresql://...

4) Run database migrations

pnpm db:migrate

5) Start the dev server

pnpm dev
open http://localhost:3000

Cloudflare deploy

pnpm cf:deploy

After deployment, verify the core paths:

  • / (landing)
  • /pricing
  • /sign-in
  • /api/payment/callback
  • /api/payment/notify/creem (webhook)
SMOKE_BASE_URL=https://aicolor.page pnpm cf:smoke

Common issues

  • pnpm db:migrate shows url: '': your DATABASE_URL is not loaded. Put it in .env.local and rerun.
  • Logs mention env.IMAGES binding is not defined: your Cloudflare R2 binding is missing. Static assets still load, but enable the binding for upload/storage flows.
  • Checkout shows “no payment provider configured”: set the provider in the admin console and confirm your Creem product ID mapping.

Need help? Email support@aicolor.page.