Mes Grandes Aventures

Personalized children's books, generated by AI

Live Demo
FastAPI LLM AI Images Celery Supabase Docker GCP Terraform Kubernetes
Mes Grandes Aventures — a beautifully illustrated open book with a magical landscape emerging from its pages, surrounded by sparkling stars

What is Mes Grandes Aventures?

A web application that lets parents create fully personalized children's books — with AI-written stories and AI-generated illustrations — all uniquely tailored to their child. Every book is one-of-a-kind: the child's name, photo, personality, chosen universe, and preferred art style shape the result from start to finish.

The goal is simple: make every child the hero of their own story, at the press of a button.

How it works — the 5-step creation tunnel

1. The Hero — your child

Parents set up the main character: name, age, gender, a photo, and up to three personality traits (brave, curious, humorous, etc.). The photo is used later by the AI to give the illustrated character a recognizable resemblance.

2. The Universe

Choose a world: enchanted forest, outer space, deep ocean, medieval castle, pirate adventure, and many more. This sets the stage for the entire story.

3. Secondary characters

Add up to 4 supporting characters — siblings, pets, best friends — each with a name, role, and optional photo. The AI weaves them naturally into the narrative.

4. Graphic style

Pick from 6 illustration styles: watercolor, cartoon, Studio Ghibli-inspired, flat vector, vintage, or detailed oil painting. This defines the visual identity of every page.

5. Preview & generate

A realistic book viewer shows a live preview with double-page spreads (illustration on the left, text on the right). Once satisfied, the user triggers full generation. The book is dispatched as an async job — the user can leave and come back when it's ready.

AI Generation Pipeline

Generating a coherent, illustrated children's book requires more than a single LLM call. The pipeline is split into carefully orchestrated stages:

  • Story generation: GPT-4o writes the full story — title, narrative arc, and one text block per page — constrained by age-appropriate vocabulary and story structure.
  • Visual bible (bible-first strategy): Before any illustration, the AI generates a "bible" — reference character portraits in the chosen art style, with the child's facial features woven in via images.edit. This ensures visual consistency across all pages.
  • Page illustrations: Each page gets a dedicated illustration. The child's photo is integrated at generation time for facial resemblance. Multiple providers are supported (OpenAI gpt-image-1, fal.ai Nano Banana) for cost/quality trade-offs.
  • Pluggable strategies: The generation engine supports multiple strategies (bible-first, bible-first-v2, decor-anchored, etc.) selectable at runtime for A/B comparison and iterative improvement.

A key design principle: a failed illustration doesn't kill the whole book. The worker handles partial failures gracefully — one missing image means one page with text only, not a lost generation job.

Architecture

The system follows a clean hexagonal architecture with a monorepo structure:

Frontend (React 18, TypeScript, Vite)
  ├── features/auth
  ├── features/creation      (5-step tunnel)
  ├── features/home
  ├── features/pricing
  └── shared/                (shadcn/ui, TanStack Query, Zod)
          │
          ▼  (REST API — same origin via Caddy)
     Backend (Python 3.12, FastAPI)
       ├── domain/            (pure business logic)
       ├── ports/             (abstract interfaces)
       ├── adapters/          (Supabase, OpenAI, fal.ai, Redis)
       └── routers/           (API endpoints)
          │
          ▼
     Celery Worker (async book generation)
       └── Redis broker
          │
          ▼
     Supabase (PostgreSQL + Auth + Storage)

     Infrastructure:
       GCP Compute Engine (e2-small VM)
       Docker Compose (API + Worker + Caddy)
       GitHub Actions (CI/CD + Workload Identity Federation)
       Terraform (provisioning)

Tech stack

  • Frontend: React 18, TypeScript, Vite, Tailwind CSS, shadcn/ui, React Router v6, TanStack Query, Zod
  • Backend: Python 3.12, FastAPI, hexagonal architecture (Ports & Adapters)
  • Async tasks: Celery + Redis
  • AI: OpenAI GPT-4o, OpenAI gpt-image-1, Anthropic Claude (adapter), fal.ai Nano Banana
  • Database & Auth: Supabase (PostgreSQL via PostgREST, Auth with Google OAuth, Storage)
  • API contract: OpenAPI spec, shared TypeScript types via openapi-typescript
  • Reverse proxy: Caddy (automatic Let's Encrypt TLS)
  • Deployment: GCP Compute Engine, Docker Compose, GitHub Actions, Terraform

Deployment & Infrastructure

Everything runs on a single GCP e2-small VM (~15–18 USD/month). Caddy serves the frontend static build and reverse-proxies the API under /api/ — same origin, no CORS headaches. The Celery worker and Redis broker run alongside on the same machine via Docker Compose.

Secrets are stored in Google Secret Manager. CI/CD uses GitHub Actions with Workload Identity Federation (no long-lived keys). Deployments are triggered manually from the Actions tab.

The domain mga-staging.dev is registered through Cloudflare Registrar.

What's next

  • Stripe integration: payment flow for the pricing tiers (PDF at 9 EUR, Standard at 29 EUR, Premium at 49 EUR).
  • Two-stage generation (freemium): users preview low-resolution thumbnails for free, then pay to unlock full-quality generation.
  • AI quality improvements: ongoing work on visual consistency between pages, better character expression variety, and faster generation times.
  • French-first, then multilingual: the app is built in French with plans for English and other languages.

Links

Live Demo (staging)

Back to projects