Indian Empires

Inspiration

India’s history is filled with remarkable ports, workshops, trade routes, forts, inventions, communities, and cultural exchanges. Yet younger readers often encounter this history primarily through dates, rulers, and examinations.

Indian Empires was inspired by a simple question: What if children could experience the past through the eyes of someone their own age?

The project transforms historical settings into illustrated fictional adventures. Readers might follow a young navigator through a Chola harbor, an apprentice along a Mauryan highway, or a messenger near a Maratha hill fort. The characters are fictional, but their surroundings are inspired by real places, occupations, materials, and practices.

The goal is not to replace storybooks or textbooks. It is to spark enough curiosity that readers want to explore museums, books, and reliable historical sources afterward.

What It Does

Indian Empires is an interactive historical-fiction storybook for children and teenagers.

It provides:

  • Illustrated stories spanning multiple Indian empires.
  • Fictional young protagonists with culturally and historically appropriate names.
  • Responsive reading experiences for desktop, tablet, and mobile.
  • Adjustable typography and a simplified reading mode.
  • Bookmarks and reading progress.
  • Firebase authentication and protected reader features.
  • An animated Story Helper for questions about the history behind each tale.
  • Clear notices distinguishing AI-generated fiction from verified history.
  • Dynamic empire availability: empires become live when stories are published and remain marked “Coming soon” otherwise.

The Story Helper is restricted to relevant historical and story-related questions. It receives the currently open story as context, asks follow-up questions when a request is unclear, and is rate-limited to prevent misuse.

How I Built It

The frontend is built with Next.js, React, TypeScript, and Tailwind CSS. It includes a responsive story reader, authentication flows, profile and consent management, accessibility controls, and the interactive question panel.

The backend uses Python and FastAPI, with a multi-stage story-generation pipeline. Different model roles handle planning, creative prose, structural review, historical plausibility, literary editing, repetition detection, and image prompting.

The platform uses:

  • Firebase Authentication for user identity.
  • Cloud Firestore for empires, stories, pages, user preferences, and generation memory.
  • Google Cloud Storage for story illustrations.
  • Cloud Run for the frontend, backend, and long-running generation jobs.
  • Image-generation models for non-photorealistic, page-specific storybook illustrations. gemini nano and gpt image gen 2.0

Before publication, stories pass structural, historical, coherence, tone, repetition, and literary-quality checks. Firestore memory records existing plots, protagonists, settings, page counts, and story shapes so future stories within an empire do not repeat the same ideas.

Challenges

The largest challenge was discovering that a technically successful generation is not necessarily a good story. Early versions passed schema validation while still containing repetitive phrases, stiff dialogue, excessive exposition, or weak emotional endings.

Another challenge was reliability. Long model responses could time out, produce incomplete JSON, exceed token limits, or fail midway through a multi-page story. I redesigned the pipeline around smaller stages, model-specific prompts, flexible page counts, bounded retries, and recoverable jobs. GPT SOL and GPT Terra was a massive help in these parts

Historical fiction required careful balance. Too many restrictions made stories feel like textbooks, while too little grounding created anachronisms. The final pipeline treats historical context as the stage and human conflict as the story.

Illustrations introduced additional problems: missing objects, inconsistent characters, overly realistic people, and repeated compositions. I introduced page-level visual plans, required scene anchors, a consistent ink-and-gouache style, contact-sheet review, and targeted image replacement without rewriting the story.

Deploying authentication, CORS, consent storage, responsive reading controls, and a contextual chatbot across separate Cloud Run services also required extensive debugging.

What I Learned

I learned that model routing matters more than simply selecting the largest model. Structured planning, creative writing, historical review, and conversational assistance require different prompting strategies and model strengths.

I also learned that rigid word and page limits often damage storytelling. Flexible boundaries, clear scene purposes, and whole-story review produce better results.

Most importantly, automated scores cannot replace reading the finished work. Human review remains essential for rhythm, emotional truth, cultural sensitivity, illustration relevance, and the difficult question: Is this genuinely enjoyable to read?

What’s Next

The next steps are to expand the remaining empires, introduce multilingual reading support, improve historical source notes, add educator-friendly collections, and continue refining accessibility and literary quality.

Built With

Share this project:

Updates