@fullstackcraftllc/chat-engine
v1.0.0
Published
Procedural chat animation generator using Remotion
Downloads
69
Readme
chat-engine
A Remotion-based procedural chat animation generator with theme support (teams, whatsapp, imessage, android, discord). JSON in -> MP4 out.
Install from npm
npm install @fullstackcraftllc/chat-engineCopy assets
The package ships with public/sounds and public/avatars. Copy them into your app public directory:
npx chat-engine-copy-assets ./publicUsing with Next.js app
When using Remotion staticFile() paths, copy the package assets into your Next.js app public/ directory so media resolves at runtime.
Local setup (this repo)
npm installCommands
npm 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/.
Project Structure
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 MP4sAdding a new conversation
- Drop a
.jsoninconversations/(seesrc/types.tsfor schema) - Add avatar images to
public/avatars/if needed - Set
"theme"to one ofteams,whatsapp,imessage,android,discord - Render it
Config schema notes
themeis required in every conversation config.- 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.
Theme sounds
- 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.
Tuning
Timing constants live in src/utils/colors.ts -> TIMING object. Tweak there, preview with npm run studio.
