Mina: AI-Powered Interactive Storytelling for Children

Inspiration

Every parent knows the magic of bedtime stories—that precious moment when a child's imagination takes flight. But we noticed a problem: children today are passive consumers of pre-written content. They watch, they listen, but they rarely create.

We asked ourselves: What if every child could be the hero of their own story?

Mina was born from the belief that storytelling should be interactive, personalized, and limitless. We wanted to harness AI not to replace human creativity, but to amplify a child's imagination—letting them make choices that shape their adventure, see their stories come to life with beautiful illustrations, and hear their tales narrated aloud.

The name "Mina" means "love" in many languages, and that's exactly what we built: a labor of love for the next generation of storytellers.

What It Does

Mina is an AI-powered interactive storytelling platform for children ages 5–10. Users can:

  • Create Stories: Describe a story idea, and AI generates a complete branching narrative with multiple paths and endings
  • Make Choices: At each chapter, children choose what happens next—every decision leads to a unique adventure
  • See Illustrations: AI-generated artwork brings each scene to life with consistent character designs
  • Hear Narration: Professional text-to-speech reads the story aloud (perfect for bedtime)
  • Share & Discover: Browse community stories or share your creations with others

Key Innovation: Our proprietary Story Memory System ensures narrative coherence across all branches—characters remember events, plot threads resolve naturally, and the story feels crafted, not random.

How We Built It

Tech Stack

Layer Technology
Frontend React 18 + TypeScript + Vite + Tailwind CSS
Backend Supabase (PostgreSQL, Auth, Edge Functions, Storage)
AI Story Generation Google Gemini 2.5 Flash
AI Image Generation Google Gemini Imagen
Voice Narration ElevenLabs Text-to-Speech
Payments Stripe (subscriptions, webhooks)

Architecture Highlights

Two-Phase Story Generation:

$$ \text{Story} = \underbrace{\text{Outline Generation}}{\text{Phase 1}} + \underbrace{\text{Chapter Generation}}{\text{Phase 2}} $$

Phase 1: Outline Generation

  • Complete story structure upfront
  • Character definitions (appearance, personality)
  • Plot threads with resolution points
  • Chapter summaries for coherence

Phase 2: Chapter Generation

  • References outline + accumulated memory
  • Maintains character consistency
  • Resolves plot threads naturally
  • Generates matching illustrations

Kiro-Driven Development: We leveraged Kiro's full feature set:

  • Specs (.kiro/specs/): Detailed requirements for story generation, subscriptions, and gamification
  • Steering (.kiro/steering.md): Project-wide coding standards and architecture decisions
  • Hooks (.kiro/hooks/): Automated workflows for pre-commit validation, schema checks, and migration safety

Database Design

  • $50+$ migrations with Row Level Security on all tables
  • Branching story structure: stories → story_nodes → story_choices
  • Memory persistence: Story outline and memory stored for coherent generation
  • Gamification tables: Points, quests, reading progress, completions

Challenges We Faced

1. Narrative Coherence Across Branches

Problem: Traditional AI generates each chapter independently, causing characters to change appearance, forget events, or leave plot holes.

Solution: We designed a Story Memory System that:

  • Generates a complete outline before any chapters
  • Tracks character states, key events, and unresolved threads
  • Updates memory after each chapter generation
  • Forces final chapters to resolve all open plot threads

The memory state can be represented as:

$$ \mathcal{M}_t = {C_t, E_t, U_t, R_t} $$

Where:

  • $C_t$ = Character states at chapter $t$
  • $E_t$ = Key events accumulated
  • $U_t$ = Unresolved plot threads
  • $R_t$ = Resolved plot threads

2. Visual Consistency in AI Images

Problem: AI image generators produce inconsistent character designs across multiple images.

Solution: We store detailed character appearance descriptions in the outline and include them in every image prompt:

"A 7-year-old girl named Luna with curly red hair, 
green eyes, wearing a blue dress with silver stars..."

3. Child-Safe Content Generation

Problem: Ensuring AI never generates scary, violent, or inappropriate content for ages 5–10.

Solution: Multi-layer safety:

  • System prompts explicitly prohibit harmful content
  • Content validation step checks each generated chapter
  • Image generation uses child-safe parameters
  • Community reporting for shared stories

4. Background Generation Performance

Problem: Full story trees ($40+$ nodes) take too long to generate synchronously.

Solution: Queue-based background generation:

  • First chapter generates immediately (user sees story in $<30s$)
  • Remaining branches generate in background
  • Real-time progress updates via database polling
  • Users can start reading while generation continues

What We Learned

  1. Spec-Driven Development Works: Writing specs before code reduced ambiguity and made Kiro conversations more productive. Complex features like subscriptions and story generation were implemented faster with clear requirements.

  2. Steering Documents Save Time: Instead of repeating project context in every conversation, the steering doc let Kiro understand our patterns automatically—RLS policies, Edge Function structure, TypeScript conventions.

  3. AI Memory is Essential for Coherence: The biggest technical insight was that AI-generated narratives need explicit memory systems. Without tracking state across generations, stories feel disjointed and random.

  4. Children's Content Requires Extra Care: Every prompt, every validation, every output must be designed with child safety as the primary constraint. We learned to build safety into the architecture, not bolt it on after.

  5. Progressive Enhancement: Show users something fast (first chapter), then enhance in the background (remaining branches, images, audio). This pattern dramatically improves perceived performance.

Accomplishments We're Proud Of

  • Production-Ready SaaS: Live at heymina.app with real users and Stripe subscriptions
  • Story Memory System: Novel architecture for maintaining narrative coherence in branching AI stories
  • Complete Kiro Integration: Specs, steering, and hooks working together for efficient development
  • Multi-Language Support: Stories can be generated in any language with automatic detection
  • Polished Dark UI: Beautiful, child-friendly interface with smooth animations and intuitive flow

Built With

Share this project:

Updates