dev3 ·
FaceAiPro turns a topic or product link into a vertical 1080x1920 reel: script, voice, karaoke captions, scene images and a talking presenter, rendered to MP4.
Stack: Next.js 15 (App Router), MongoDB, Stripe, and a separate ffmpeg render worker sharing one replica set and one private storage folder.
Decisions that mattered
- Long work happens only in the worker. Jobs are leased from MongoDB with heartbeats, retries and a stuck-job reaper, so any number of workers can run.
- A credit ledger that cannot go negative: atomic, idempotent, with credits reserved when a job is queued and refunded on failure or cancellation.
- One shared timeline module is used by both the browser preview and the ffmpeg renderer, so the preview matches the render.
- Voices, presenter frames and clips are cached by content hash, so a caption change does not pay for the voice again.
- Captions are drawn with a canvas library instead of ffmpeg text filters, so rendering works on ffmpeg builds without libass.
- Without Stripe keys, a simulated billing mode runs the same flow.
Limits: rendering and AI generation are switched off in the public demo, which plays bundled sample reels.
Trade-off we chose: credits are reserved when a job is queued and refunded if it fails or is cancelled.
Questions about the queue design are welcome.
0