Production-oriented web app that generates comic books from user prompts, keeps visual consistency with reference images, and exports downloadable PDFs.
+-------------------+ HTTPS +-----------------------------+
| Next.js Frontend | -------------------> | FastAPI Backend (Railway) |
| (Vercel + Clerk) | | Auth, API, Validation |
+-------------------+ +---------------+-------------+
| |
| Clerk auth session | enqueue jobs
v v
+-------------------+ +---------------------+
| Clerk | | Celery Worker |
| Identity + JWT | | image/pdf pipeline |
+-------------------+ +----------+----------+
|
+----------------------+------------+------------+
| | |
v v v
+-------------+ +---------------+ +--------------+
| PostgreSQL | | Redis/Upstash | | Cloudflare R2|
| users/comics| | rate/jobs | | assets + PDFs |
+-------------+ +---------------+ +--------------+
|
v
+-----------------------+
| Replicate + Claude API|
| image + story pipeline |
+-----------------------+
- Next.js 14 App Router
- FastAPI
- PostgreSQL
- Redis
- Celery
- Replicate
- Anthropic Claude API
- Cloudflare R2
- Clerk
- Auth with Clerk and verified backend tokens
- Prompt sanitization and content blocking
- User-based rate limiting and daily comic quotas
- Async comic generation with Celery workers
- Per-user ownership checks on comic resources
- Signed URLs for protected R2 assets
- PDF export pipeline with Pillow + FPDF2
- Open the app project folder:
cd comic-generator
- Follow setup guides:
- Backend:
backend/README.md - Frontend:
frontend/README.md
- Backend:
- Or use the full app guide:
README.mdinsidecomic-generator/
From comic-generator/, run each in a separate terminal:
- Backend API:
cd backenduvicorn app.main:app --reload --port 8000
- Celery worker:
cd backendcelery -A app.workers.celery_app.celery_app worker --loglevel=info --concurrency=2
- Frontend:
cd frontendnpm run dev
public/screenshots/home-placeholder.pngpublic/screenshots/generator-placeholder.pngpublic/screenshots/library-placeholder.png
- Backend:
cd backendpytest
- With coverage:
pytest --cov=app --cov-report=term-missing
- Frontend quality checks:
cd frontendnpm run lintnpx tsc --noEmit
- See DEPLOYMENT.md for the full, production-ready variable list and source links.
- Character visual consistency across long runs is approximately 80% and may require retries for best output.
- Queue latency can increase during high load if worker concurrency is low.
Approximate per-comic cost (depends on page count and model settings):
- Replicate image generation:
$0.03 - $0.20 - Claude story generation:
$0.005 - $0.04 - Cloudflare R2 storage + egress:
< $0.01typical per comic - Total rough range:
$0.04 - $0.25per comic