CodeariaAcademy
AI
Codearia Academy

This Is More Than Just One Guide

11 courses and 25 free guides on AI automation for business — and beyond.

Video as Code: a Remotion Template That Rebuilds Itself From Data
Remotion + Claude Code

Video as Code: a Remotion Template That Rebuilds Itself From Data

Change one number and the whole video rebuilds: the headline, the chart, the final frame. Here is the starter template from the reel: three scenes, data in a separate file, ready prompts for Claude Code, and the setup that keeps a new headline from running off the screen.

FreeAbout 15 minutesNo editing skills needed
Get the template
The idea

A video built like a program

In a normal editor every scene is made by hand. Change the headline and you open the project, find the layer, retype it, check the timing. In Remotion a video is a React project: layout and animation are written in code, and the text, numbers and colours come in from outside as data. The scenes do not know what the headline says. They know where it goes, how big it can be and how it moves.

So the work splits in two. Once, you build the template. After that you only edit a small data file, and the template assembles a new version on its own. Claude Code writes most of the template for you; your part is to describe the scenes and to set the rules.

1 file

with all the text and numbers

3 scenes

title, chart, final frame

1 command

to render a new version

A glowing dial changes one number, and three glass video frames (a title card, a bar chart and an end frame) rebuild together
One value in the data changes, and every scene that uses it updates: the headline, the bar in the chart, the end frame.

Never opened Remotion? Our guide "Motion video with Claude" covers installation and your first scene step by step. This one assumes you have seen it and goes further: one template, many videos.

Remotion basics guide
Starter template

The template: three scenes and a data file

This is the structure Claude Code will build from the prompts below. Small on purpose: three scenes are enough to see how one data file drives the whole video, and easy to extend later.

Project structure

video-template/
video-template/
├── src/
│   ├── index.ts          # entry point
│   ├── Root.tsx          # registers "Report" + the data schema
│   ├── Video.tsx         # plays the 3 scenes in a <Series>
│   ├── limits.ts         # all the rules in one place
│   └── scenes/
│       ├── TitleScene.tsx
│       ├── ChartScene.tsx
│       └── EndScene.tsx
├── data/
│   ├── example.json      # default props
│   ├── stress.json       # the worst case
│   └── week-42.json      # a new version = a new file
└── public/
    └── music.mp3

The data file

data/week-42.json
{
  "title": "Online store: week 42",
  "subtitle": "Sales, Oct 13-19",
  "chart": [
    { "label": "Mon", "value": 120 },
    { "label": "Tue", "value": 95 },
    { "label": "Wed", "value": 140 },
    { "label": "Thu", "value": 160 }
  ],
  "highlight": "+18% vs last week",
  "cta": "Full report in the channel"
}

Everything that changes from video to video lives here. A new week, a new client, a new lesson means a new JSON file next to this one. The scenes stay untouched.

The rules file

Limits live in one place so you can tune them without hunting through the scenes: how long a headline may be, how small its font may get, how many bars the chart can hold.

src/limits.ts
export const LIMITS = {
  titleMaxChars: 48,
  titleMaxLines: 2,
  titleFontMax: 120,   // px
  titleFontMin: 64,    // px, never smaller
  chartMaxBars: 7,
  scenes: { title: 3, chart: 5, end: 3 }, // seconds
  musicVolume: 0.35,
};
01

Title

The headline and subtitle from the data. The font size is picked so the text fits the frame, and the line breaks follow the words, not the pixels.

02

Chart

Bars grow from the values in the data. Change one number and its bar, its label and the scale move together. No manual redrawing.

03

Final frame

The key result and the call to action. It pulls the same data, so the final number always matches the chart.

A glass data card with rows of values pours light into a machine that prints three finished video frames
The data lives apart from the template. The template only knows where things go and how they move.
Ready prompts

Prompts for Claude Code

Run them one by one in an empty folder, with Claude Code open in the terminal. After each step, open the preview and look before moving on.

Step 0. Give Claude Code the Remotion rules

Remotion publishes official skills for coding agents: best practices for animation, layout, fonts and audio. Install them in the project folder once, then Claude Code follows them automatically.

terminal
npx skills add remotion-dev/skills

Step 1. Build the template

Creates the project, the three scenes, the data schema and the rules file.

>Create a Remotion project in this folder for a 1080x1920 vertical video, 30 fps. Structure: src/Root.tsx registers one composition "Report"; src/Video.tsx plays three scenes in a row with <Series>: TitleScene (3 s), ChartScene (5 s), EndScene (3 s). All text and numbers come from props, described with a zod schema: title, subtitle, chart (array of {label, value}, up to 7 items), highlight, cta. Put an example in data/example.json and use it as defaultProps. Put every limit (max title length, min and max font size, max bars, scene durations) in src/limits.ts. No hardcoded text inside the scenes. When done, start the preview and tell me how to open it.

Step 2. Make it robust

The step that separates a template from a one-off video. Without it, the first long headline breaks the layout.

>Harden the template against any data. 1) Title: pick the font size with fitText from @remotion/layout-utils, but never below the minimum from limits.ts; if it still does not fit, wrap onto at most 2 lines by words, and if that is not enough either, show a clear error in the preview instead of cutting the text. 2) Chart: the scale adapts to the largest value, labels never overlap, and more bars than allowed raise an error. 3) Motion: the same ease-in-out entrance for all elements, timings from limits.ts. 4) Sound: background music from public/music.mp3 with a fade-in and fade-out, the volume set in limits.ts. Then create data/stress.json with the longest headline, the biggest numbers and the maximum number of bars, and check every scene with it.

Step 3. Adapt it to your topic

When the mechanics work, change the look and the content. Describe your own case instead of the example in brackets.

>Adapt the template to my topic: [weekly sales review for an online store / monthly report for a client / a short lesson with three key points]. Change the data schema to fit it, restyle the scenes: dark background, one accent colour [#a855f7], a large condensed font for headlines. Keep the rules from limits.ts and the stress test. Show me what changed in the schema so I know which fields to fill in.

Claude Code may name files a bit differently or suggest a better structure. That is fine; what matters is that the text and numbers stay in the data file and the limits stay in one place.

Before the first new version

Tune the template, or the headline runs off the screen

A template only saves time if new data never breaks it. Four things to set up once, before you trust it with a real video.

Text length

Decide how many characters a headline, subtitle and label may have. Too long should be an error you see in the preview, not a video that quietly ships with half a sentence.

Line breaks and font size

The font shrinks to fit the width, but not below a readable minimum. After that, the text wraps by words onto a second line. Check it in every language you publish in: Russian and Hebrew words are longer, Hebrew runs right to left.

Motion

One easing and one set of timings for the whole template. Then a new video moves exactly like the last one, and a long headline does not need extra time to read, because the duration is calculated from the data.

Sound

Music with a fade-in and fade-out and a fixed volume, so it does not clip when the video gets a few seconds longer. If there is a voice-over, the music goes quieter under it.

Stress test

Keep a data file with the worst case: the longest headline, the biggest number, the most bars. Run it after every change to the template. If it looks fine, real data will too.

Two vertical video frames side by side: on the left a headline breaks out past the edge of the frame, on the right the same headline wraps neatly inside it
The same long headline: without limits it runs off the frame, with fitted size and wrapping it stays inside.
Rendering

A new version from new data

Once the template is tuned, a new video is a new data file and one command.

  1. 01

    Copy the data file

    Duplicate data/example.json, rename it (for example week-42.json) and change the values.

  2. 02

    Check it in the preview

    Open the studio, paste the new values into the props panel on the right and play the video through. This is where you catch a headline that is too long.

    terminal
    npx remotion studio
  3. 03

    Render

    Pass the data file to the render command. On Windows use a file, not inline JSON: the shell strips the quotes.

    terminal
    npx remotion render src/index.ts Report out/week-42.mp4 --props=data/week-42.json
  4. 04

    Many at once

    A folder of data files becomes a folder of videos with a short loop. Or ask Claude Code: "add an npm script that renders every file in data/ into out/".

    bash
    for f in data/*.json; do
      npx remotion render src/index.ts Report "out/$(basename "$f" .json).mp4" --props="$f"
    done
One glowing template machine sends out a row of finished vertical videos, each with a different chart and colour
One template, many versions: each data file becomes its own finished video.
Where it pays off

When a video template is worth it

The template takes an evening to build and tune. It pays back where the format repeats and only the content changes.

Recurring reviews

Weekly news, market or product updates: the same structure every time, new numbers and headlines.

Reports

Monthly results for a client or a team: sales, traffic, progress. Data from a spreadsheet goes straight into the JSON.

Lessons

Short teaching videos in a series: a topic, three key points, a takeaway. The look stays consistent across the whole course.

When not to bother

A one-off creative video with unique scenes is faster to make by hand or in a normal editor. A template wins from roughly the third video in the same format.

Remotion licence

Remotion is free for individuals, non-profits and companies with up to 3 people. Larger for-profit companies need a company licence. Terms, versions and prices change, so check the current licence on remotion.dev before you use it commercially.

What the guide leaves out

The template is the start

This guide gives you a working data-driven template. In the course we go further:

  • Planning a video with Claude: script and storyboard before any code
  • Multi-scene composition and transitions between scenes
  • Music, sound and voice in sync with the picture
  • Rendering, export and publishing the finished video
Next step

Course: motion video with AI

From the first title card to a finished video: planning, scenes, transitions, sound and rendering in Remotion with Claude Code.

Remotion, its agent skills and Claude Code update often: commands, package names and licence terms may change. If something does not match, check the current documentation on remotion.dev.

Free Guide

This guide is 100% free

The whole template and all the prompts are free. If you want to go deeper, we have 11 courses on AI, content and automation. Full access for $44.90.

Comments

Video as Code: a Remotion Template Built From Data | Codearia Academy