A Remotion-based procedural chat animation generator with theme support (teams, whatsapp, imessage, android, discord). JSON in -> MP4 out.
npm install @fullstackcraftllc/chat-engineThe package ships with public/sounds and public/avatars. Copy them into your app public directory:
npx chat-engine-copy-assets ./publicWhen using Remotion staticFile() paths, copy the package assets into your Next.js app public/ directory so media resolves at runtime.
npm installnpm run studio # preview in browser
npx ts-node render.ts ./conversations/example.json # render single video
npx ts-node render.ts ./conversations/example_whatsapp.json
npx ts-node render.ts ./conversations/example_discord.json
npm run render:all # render all conversations
npm run test:visual # run visual regression + smoke checks
npm run test:visual:update # create missing baselines / refresh missing
npm run test:visual:overwrite # overwrite all visual baselinesOutput goes to ./out/.
conversations/ -> JSON chat configs (this is your "input")
public/avatars/ -> profile pictures (referenced in JSON)
public/sounds/ -> send.mp3, receive.mp3, typing.mp3
src/types.ts -> TypeScript schema for JSON configs
src/configSchema.ts -> runtime Zod validation for JSON configs
src/theme.ts -> theme definitions, status style, and sound routing
src/components/ -> bubble, avatar, typing indicator, icons
src/utils/ -> timeline engine, colors & timing constants
render.ts -> batch render script
tests/visual/ -> baseline PNG snapshots and diff output
out/ -> rendered MP4s
- Drop a
.jsoninconversations/(seesrc/types.tsfor schema) - Add avatar images to
public/avatars/if needed - Set
"theme"to one ofteams,whatsapp,imessage,android,discord - Optionally set
"themeMode"tolightordark - Render it
themeis required in every conversation config.themeModeis optional and defaults tolightfor every theme.- Set
"themeMode": "dark"to render the dark palette for a theme:
{
"theme": "whatsapp",
"themeMode": "dark"
}- Version
1.2.0changes the default visual output for themes that previously rendered dark by default. Pin"themeMode": "dark"if you need the older dark presentation. - Sample themed configs are included:
conversations/example_whatsapp.jsonconversations/example_imessage.jsonconversations/example_android.jsonconversations/example_discord.json
- Configs are runtime-validated with Zod (
src/configSchema.ts) in both Studio andrender.ts. - Invalid config files are skipped by
render.tswith field-level validation errors.
- Sounds resolve by theme, then per-sound fallback to Teams defaults.
- Theme sound packs live in:
public/sounds/teams/public/sounds/whatsapp/public/sounds/imessage/public/sounds/android/public/sounds/discord/
- Expected files in each pack:
send.mp3,receive.mp3,typing.mp3. - Current non-Teams assets are temporary placeholders and can be replaced in-place.
Conversation JSON can customize timing and participant chrome without changing source code:
{
"settings": {
"showAvatars": false,
"hideLabels": false,
"timing": {
"typingDurationMs": 850,
"messageBurstDelayMs": 280,
"afterGroupPauseMs": 520
}
}
}showAvatarsdefaults totrue. Set it tofalseto hide portrait images while keeping participant names in every theme.hideLabelsdefaults tofalseand only affects Discord. It hides the Discord participant name and message-group time; other themes ignore it.- Timing values override the corresponding defaults from
src/utils/timing.ts.
Themes are stylized chat presentations rather than pixel-perfect native UI replicas. In particular, avatar rows are available in the Android and iMessage themes even though those layouts are not native to every real conversation view. Use showAvatars: false when a more minimal presentation is appropriate.