AI content production & language learning
StoryBrook
Designed & built full-stack by Farivar Zarvandeh
AI studio turning scripts into illustrated bilingual audio-story lessons.
Script · EN / FA
“The lighthouse keeper found a letter…”
نگهبان فانوس نامهای پیدا کرد…
awaiting approval
Episode pack- Studio API routes
- 55
- Illustration styles
- 30
- AI providers integrated
- 5
- Database migrations
- 8
- Files in first live episode pack
- 27
Figures counted from the repository; maturity note: Both apps are implemented and tested locally. The full AI pipeline has produced one complete episode end to end, and the Docker Compose stack has run locally. HTTPS deployment, email delivery, full-season quality review and illustration continuity refinement are still open.
01
Product introduction
StoryBrook is a private AI production studio that turns a story premise into fully produced, illustrated, bilingual audio episodes for English learners. A separate cinematic learner site streams those episodes with read-along text, vocabulary, grammar, quizzes and downloads.
02
The problem
Good listening material for language learners is slow to make. Every episode needs a level-appropriate script, an accurate translation, narration, vocabulary and grammar notes, quizzes and visuals. Generative AI can speed this up, but it brings its own problems: paid calls that fail halfway, malformed or refused outputs, characters that look different in every image, and the risk of exposing keys, drafts or answer keys to the public.
03
The solution
StoryBrook splits the work into two products. The private studio uses LLMs to plan a series and write schema-validated bilingual scripts with lessons and quizzes. Humans edit and approve each versioned revision before any paid production starts. A durable background worker then casts ElevenLabs voices, generates music, illustrates comic panels with character reference sheets, aligns subtitles to the final narration, and renders an MP4, MP3s, a bilingual PDF workbook and a ZIP pack. A separate learner website pulls only published content through a token-protected read-only feed and serves it behind language entitlements and a five-free-episodes preview gate.
04
Core features
AI series planning & episode writing
ImplementedGenerates a season outline and 20–25-line bilingual scripts with vocabulary, grammar and quizzes using Gemini, Claude or OpenAI. All output is validated against one Zod schema.
Versioned script editor with approval gate
ImplementedLine-by-line bilingual editing with immutable revisions and optimistic concurrency. Approval is required before paid production, and any edit invalidates downstream media.
Voice casting, music & forced alignment
ImplementedPer-character ElevenLabs voices with line previews, instrumental music with ducking, and word-level alignment of the final narration that drives the subtitles.
Character-consistent comic panels
ImplementedAn LLM designs fixed character appearances, then style-specific reference sheets guide every panel. Panels can come from Gemini, OpenAI or Higgsfield image models in 30 selectable styles.
Automated media pack
ImplementedFFmpeg renders a 720p comic video with burned-in bilingual subtitles and two MP3 tracks. Headless Chromium produces a bilingual PDF workbook, and everything is bundled into a ZIP.
Durable production worker
ImplementedAtomic job claims, attempt and revision fencing, checkpointed manifests that resume after failure, live progress and instant cancellation. Uncertain paid calls are never retried blindly.
Encrypted runtime integrations
ImplementedAdmins set provider keys, models and defaults in the UI. Keys are AES-256-GCM encrypted, and the API and worker pick up changes without a restart.
Cinematic learner website
ImplementedSSR landing page with an interactive Three.js storybook, a searchable library, a watch page with bilingual read-along, a server-graded quiz, progress tracking and protected downloads.
Free-preview account gate
ImplementedThe first five published episodes of each series are open without login. The studio enforces the cutoff on every text, quiz and media request.
Production deployment & email
PartialDocker Compose (studio, worker, learner) runs locally. The HTTPS domain and SMTP password reset are not yet configured.
Subscriptions & richer discovery
PlannedPaid tiers, multi-shelf discovery, saved lists and autoplay of the next episode are scoped for later.
05
System architecture
The studio is a Node 24 / Express modular monolith with a React SPA and a separate background worker that shares a SQLite (WAL) database and a private media volume. The worker orchestrates the LLM, voice and image providers plus local FFmpeg and Chromium rendering. The learner product is an independent Express + React SSR app with its own database and accounts. It reads only published, current-revision content from the studio through a bearer-token-protected internal API, and the studio manages learner accounts through a second, separate service token.
Hover or focus a component to trace its real connections.
11 components · 11 connections, as found in the repository.
06
Technology stack
- frontend
- React 19TypeScriptViteThree.jsLucide
- backend
- Node.js 24Express 5ZodHelmetexpress-rate-limit
- data
- SQLite (node:sqlite, WAL)File-based media store
- ai
- Google GeminiAnthropic ClaudeOpenAIElevenLabsHiggsfield (Nano Banana)
- infra
- DockerDocker ComposeCaddyGitHub ActionsFFmpegPlaywright Chromium
- integrations
- Gemini generateContentClaude MessagesOpenAI Responses & ImagesElevenLabs TTS/Music/AlignmentHiggsfield CLISMTP (Nodemailer)
07
Product experience

Produce an episode
- 1Create a story with premise, genre, mood and illustration style
- 2Generate the season outline and episode drafts with an LLM
- 3Edit the bilingual lines, vocabulary, grammar and quiz
- 4Approve the script revision
- 5Cast voices and review AI-designed characters
- 6Run production: voices, music, alignment, panels, video
- 7Generate the PDF workbook and ZIP pack, then publish
Learn with a story
- 1Open the storybook landing page and hear a sample
- 2Browse the library and pick a series
- 3Watch the illustrated episode with bilingual subtitles
- 4Read along in English and Farsi, study vocabulary and grammar
- 5Answer the server-graded quiz
- 6Download audio, video or the workbook and continue later
07b
AI capabilities
Story planning
Turns a premise, genre and mood into a story bible and multi-episode season outline.
Bilingual script & lesson generation
Writes graded English scripts with translations, speaker tags, panel descriptions, vocabulary, grammar and quizzes as schema-validated structured output. Later editions must keep the approved canonical text.
Provider-agnostic text generation
Native adapters for Gemini, Claude and OpenAI. The provider and model are snapshotted per job, with no silent failover or blind paid retries.
AI character design & reference sheets
An LLM defines fixed character appearances, and image models render per-style reference sheets that are fed into every panel showing that character.
Styled comic illustration
Generates 16:9 panels in one of 30 art styles with reference images for continuity. Panels refused by safety filters are skipped gracefully.
Voice, music & alignment
Multi-character English/Persian narration, generated background music and forced alignment that produces word-timed bilingual subtitles.
08
Engineering challenges
- 01
Safe paid-job orchestration
Jobs are claimed atomically and fenced by attempt and script revision. A checkpointed production manifest lets an interrupted run resume without re-billing finished audio or images.
- 02
Cross-provider structured output
One Zod schema is converted per provider. Constraints a provider's grammar can't enforce move into descriptions and are re-validated locally, so refusals, truncation or changed canon never save a draft.
- 03
Visual consistency across panels
Characters mentioned in a panel's description or line are matched by name and alias, and their style-specific reference sheet plus the earlier panel are attached to each image request.
- 04
Subtitles that match real audio
Captions are built from forced alignment of the final mixed narration, with spacing tokens filtered out, rather than estimated from text length.
- 05
Hard boundary between studio and learners
The learner server has no provider keys or studio DB access. It reads a token-guarded feed that re-checks publication, revision, language and preview rules on every asset request, including Range requests.
09
Technical differentiators
End-to-end pipeline
A single approved script becomes narration, music, illustrated video, aligned subtitles, a workbook and a downloadable pack with no manual media editing.
Human-in-the-loop by design
Approval gates, immutable revisions and explicit confirmation before paid production keep editors in control of AI output.
Two products, one source of truth
A private production studio and an independent public learner platform with separate accounts, databases and containers.
Bilingual and RTL-aware
Persian text is handled correctly in the UI, PDF and burned-in video subtitles.
10
Explore further
The source repository is private. A live walkthrough is available on request.