Presentation
HTTP, SSE, UI, controllersNext.js feature modules and Express controllers translate product actions into use-case requests. Composition stays outside the domain.
presentation/controllers · routes · factoriesKalpanaAI · Founder case study
Choose the format, voice, and visual language. The system turns that intent into a reviewable video project—not one opaque AI request.
Five reader-facing phases. One project moves forward without hiding the decisions.
The product streams a scene-based script, verifies claims, generates voice and visual direction, reveals scene previews progressively, then lets the creator edit and approve the composition before rendering.
The worker is temporary. The project state is not.
When a code-generation worker fails at stage seven, PostgreSQL retains the current stage and completed artifacts. BullMQ retries that stage, and buffered events help a reconnecting browser catch up before returning to live progress.
Every scene crosses explicit gates before it joins the video.
All generated scene code is compiled with esbuild and inspected for known hazards. MCP client scene submissions additionally render the first, middle, and final frame in an isolated worker thread with a five-second timeout.
Chat on the left. Remotion player in the center. Scene controls and timeline around it.

From one prompt to an editable, recoverable production workspace.
Open live productOptional technical depth
Open the appendix for exact architecture, reliability mechanisms, tradeoffs, and the evidence boundary. The main story stays focused on how the product feels and behaves.
Next.js feature modules and Express controllers translate product actions into use-case requests. Composition stays outside the domain.
presentation/controllers · routes · factoriesUse cases coordinate repositories, queues, model ports, storage, and streaming while returning explicit Result values instead of using exceptions for control flow.
application/use-cases · interfaces · servicesPipelineJob owns legal stage transitions, artifact guards, progress state, and failure state. Infrastructure cannot redefine the workflow's business rules.
PipelineJob.transitionTo() · markFailed()Prisma, BullMQ, Redis, model providers, TTS, object storage, Remotion, and FFmpeg sit behind interfaces and are wired at explicit composition roots.
repositories · workers · service adaptersPostgreSQL stores the current stage plus scripts, fact-check reports, audio, transcripts, directions, generated code, edit state, and rendered asset paths. A job can be understood from durable state rather than process memory.
PostgreSQL · PrismaBullMQ applies explicit exponential backoff by stage. Model-heavy steps receive multiple attempts; deterministic mapping and rendering are not blindly retried. Failed jobs can be cleared and resumed from their current stage.
BullMQ · RedisWorkers publish live SSE progress through Redis pub/sub. Scene-generation events are also appended to a Redis list and marked complete with a TTL, allowing reconnecting clients to replay buffered progress.
SSE · Redis bufferA worker-level failure listener checks non-terminal pipeline state, persists a failure, and emits a final progress event. Long media stages use a ten-minute lock with stalled-job checks.
Failure safety netGenerated JSX is compiled with esbuild, checked for known Remotion and runtime hazards, and rejected with targeted repair hints before it reaches a final render.
esbuild · static gatesMCP client scene submissions are transformed and rendered at the first, middle, and final frame in a separate worker thread. A five-second timeout terminates runaway computation without blocking the API event loop.
Worker threads · 5s ceiling