❯ AI · Platform · 2024
Dramatix
An AI platform where characters tell stories through multi-voice animated scenes — free-form text becomes structured characters, dialogue, and video.
The problem
Story video is slow to produce by hand. A twenty-segment story needs characters who stay consistent, dialogue that matches their mood, scenes that stay coherent, and audio that lines up with it all. Most pipelines make a human the glue between half a dozen tools; I wanted the story text itself to drive the whole production.
The approach
Two-stage generation kept the hard parts separate: scene images anchor the visual context first, then video, audio, and dialogue generate in a unified pass with retry and quality validation. A ModelRouter with per-provider adapters routes to Kling, Veo, Sora, or Gemini behind user-facing tiers (Spotlight, Limelight, Premiere), with capability detection and fallback so a tier promise survives a provider failure. Story parsing is LLM-driven: free-form text becomes structured characters, relationships, scenes, and dialogue in one transaction.
Architecture
- Flutter App
- API Gateway + Lambda
- Story to Scene Pipeline
- ModelRouter (Kling/Veo/Sora/Gemini)
- Continuity Engine
- SQS Queue + Workers
FLOWS
- Flutter Appsubmit storyAPI Gateway + Lambda
- API Gateway + Lambdastructured scenesStory to Scene Pipeline
- Story to Scene Pipelinetier routingModelRouter (Kling/Veo/Sora/Gemini)
- Story to Scene Pipelinetrack stateContinuity Engine
- ModelRouter (Kling/Veo/Sora/Gemini)generateSQS Queue + Workers
- SQS Queue + WorkersFCM progressFlutter App
The backend is serverless on AWS Lambda (Python + FastAPI + Mangum), with an SQS job queue and DLQ for workers and versioned REST plus WebSocket progress streaming. The continuity engine keeps a long story coherent: each character's emotional state, last action, and rolling plot summary are cached in Redis and persisted in PostgreSQL, and stale segments propagate when the story drifts. Flutter is the client (go_router, flutter_bloc), with Firebase Auth, FCM push, and Stripe + IAP credit monetization per tier. Content moderation sits at both doors: regex and ML input filtering, output scanning, and a human review queue. Data residency is eu-central-1 with a 30-day hard delete. Terraform owns the VPC, RDS, Lambda, SQS, ElastiCache, and API Gateway; GitHub Actions runs the Flutter build, Python tests, and terraform plan/apply.
Key decisions
Two stages instead of end-to-end
Images first, then video and audio over them. Quality failures stayed local and retryable; an end-to-end pass would have hidden a bad scene until the whole segment was done.
The ModelRouter owns the tier promise
Spotlight, Limelight, and Premiere are product promises; the router maps each to whatever provider is alive and capable today. Keys stay in flight and are never stored server-side.
Continuity is a service, not a prompt trick
Emotional state and plot summaries live in Redis and PostgreSQL so segments stay consistent even when generated minutes or hours apart.
Serverless because generation is bursty
Short parallel bursts fit Lambda; the DLQ means a failed job is retried without losing the story.
What I'd do differently
The moderation queue was an afterthought. I would design the review workflow alongside the generation pipeline, because screening borderline content before it is produced is cheaper than cleaning it up after. I would also move the tier-to-provider mapping into the database so pricing changes do not need a deploy.