Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

React
  • Backend vs Frontend: What Runs Where, and Why the Server Is the One You Trust
  • One Request, Two Answers: the Same Post as an HTML Page and as JSON
  • A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx
  • How a Web Page Works: HTML Tags, Elements and Attributes
  • Semantic HTML: header, nav, main, aside and footer as Page Landmarks
  • HTML Forms: Labels, Names, Input Types and Where the Data Goes (GET vs POST)
  • CSS Basics: Selectors, Which Rule Wins, and the Box Model
  • CSS Flexbox vs Grid: A Nav Bar, a Card Row and a Dashboard
  • Responsive CSS: Viewport, Mobile-First Media Queries, clamp() and Dark Mode with Tokens
  • JavaScript for People Who Already Code: Syntax, Modules and Five Surprises
  • JavaScript Arrays the Functional Way: map, filter, reduce, find, sort and Object.entries
  • Async JavaScript: Promises, async/await, fetch and Promise.all
  • JavaScript in the Page: the DOM, querySelector and Events
  • npm, package.json and Vite: What npm install Fetches and How Vite Serves and Builds Your Page
  • TypeScript Essentials: Types Checked, Then Erased (Interfaces, Unions, Generics)
  • Why React, JSX and Components: The Page as a Function of Data
  • React Props and Composition: Data Down, Calls Up, Children in the Slot
  • Routing With React Router: One Page, Many Addresses
  • React Component Tests With Vitest and Testing Library: Test What the User Sees
  • End-to-End Tests for a React App With Playwright: A Full Dress Rehearsal
  • Why AI-Built Websites All Look the Same, and Four Levels That Fix It
  • Visual Hierarchy, Spacing and the 8-Point Grid: Tell the Eye What to Read First
  • Colour, Contrast and Dark Palettes: 60-30-10, Semantic Tokens and Ratios You Can Compute
  • Typography That Sells: Type Scale, Line Length and Free Font Pairings
  • The UI Element Catalogue: Buttons to Toasts, Their Jobs, States and shadcn/ui Names
  • Design Tokens: Primitive and Semantic Tokens, from Figma to CSS to Tailwind
  • Tailwind CSS 4 in React: Utility Classes, Responsive Prefixes, Hover and Dark Mode
  • shadcn/ui in React: Components You Own, Edit and Commit
  • Design Tokens to a Tailwind Theme: Light and Dark Mode with @theme inline
  • Motion in React: Entrance, Hover, Exit and Layout Animations
  • A React Dashboard: Stat Cards, a Recharts Line Chart and a Sortable Table
  • Accessibility in Practice: Dialogs, Menus and the Keyboard in React
  • Reference-Driven Design: Extract a DESIGN.md From a Site You Admire and Build From It
  • Components, Variants and Variables: One Design System in Figma and in CSS
  • Figma MCP Server: Build a React Component From a Frame, Then Write It Back
  • Claude Design: From a Brief to a Clickable Prototype, Then Hand It Off to Claude Code
  • Critiquing AI-Generated UI: Six Checks for Every Screen
  • The AI Design Landscape: Prompt to UI, Prompt to App, and Design to Code
  • Your Brand Rules Folder: One Folder Every AI-Built Page Follows
  • The Best-Practice UI Prompt: Plain Sentences That Beat the Average AI Page
  • UI Ideas From Figma Make, Google Stitch and ChatGPT: One Prompt, Three Designs
  • Google Stitch From a Sketch or Screenshot: Show the Layout, Say What to Keep
  • Stitch to Figma to Code: Turn a Stitch Screen Into Code That Uses Your Tokens
  • Figma Make: Prompt to Prototype With a Four-Part Prompt
  • Upgrade a Dated UI From One Screenshot (or a Reference Image)
  • States and Feedback: Make Every Click Get an Answer
  • A Design-Loop Skill: Claude Screenshots, Scores and Fixes Its Own UI
  • Copy Without the AI Tells: A Copy Pass on a Landing Page
  • Running a Next.js Admin Starter Kit: Route Groups, Theme Tokens and npm run dev
  • Remotion Basics: A Video as One Composition Object, Frames, Sequences and the Player
  • Spline: Put a 3D Scene on a Landing Page Without Writing 3D Code
  • Framer: A Launch Page Without Code, From a Free Animated Template
  • Three.js: What It Can Do on Real Sites, and How to Let Your AI Agent Use It
  • Animated Component Libraries (Magic UI, Aceternity UI): Copy-In Motion and When It Becomes Noise
  • WebGPU and Three.js Shaders in TSL: A Living Gradient, 4,500 Particles and a Hover Ripple
  • Deploy Many Vite Demos as One Static Site: A Gallery Page, One Build Command and import.meta.env.BASE_URL
  • React State, Events, Lists and Conditional Rendering: Follow One Click
  • React useEffect: When It Runs, What Cleanup Is For, and When You Don't Need One
  • Lifting State Up, Refs and React DevTools: Put State Where It Is Needed
  • Forms and Actions in React 19: Controlled Inputs, Form Actions, useActionState and useFormStatus
  • React Context and Custom Hooks: Share One Value, Reuse the Logic
  • Finishing a Remotion Video Editor: Timeline Sync, Track Order, Trims and Fades, and the Server MP4 Render
  • A 3D Product Page in React and Three.js: Scroll Becomes a Number, One Camera Shot per Panel, One Choice Drives Everything
  • A Personal 3D Portfolio Room in React Three Fiber: Hover Glow, Click to Open, Pointer Drift and a Contact Form to FastAPI
  • Server State With TanStack Query: One Key, One Request, One Cache
  • Mutations and Optimistic Updates in TanStack Query: Change Data, Then Tell the Cache
  • Generate TypeScript Types, Query Hooks and Zod From an OpenAPI Spec With Orval
  • A Mock Backend in the Browser With Mock Service Worker, Generated From the Spec
  • A React Client for a FastAPI API: The CORS Wall, CORSMiddleware and the Vite Proxy
  • Forms With React Hook Form and Zod: The API's Rules in the Browser, the Server's Errors Under the Field
  • JWT Auth in a React Client With a FastAPI Backend: Log In, Carry the Token, Let the Server Decide
  • Supabase as a Backend: Postgres, Instant APIs, Row Level Security and the Two Keys
  • Email Login With Supabase in Next.js: Three Clients, Server Actions, the Callback Route and Middleware
  • Google Sign-In With Supabase in Next.js: Which Address Goes Where
  • hCaptcha on a Supabase Login Page: Site Key in the Browser, Secret in Supabase
  1. Blog
  2. /
  3. React
  4. /
  5. Fundamentals

Remotion Basics: A Video as One Composition Object, Frames, Sequences and the Player

Grow the Supabase starter kit into a browser video editor with one agent prompt, then read how Remotion works: a Composition object in frames, a Root that reads its size from props, a Sequence per clip that restarts the frame count, typewriter text at 0.6 characters per frame, and the Player preview.

Chaand Sheikh

·27 November 2026·Updated 29 November 2026Fundamentals

What you will learn

  • Explain how Remotion turns a React component and a frame number into video
  • Describe a whole project as one serializable Composition object, stored in frames
  • Register a dynamic composition with calculateMetadata so one entry renders any size
  • Use Sequence, useCurrentFrame and interpolate for per-clip animation, and Player for the preview

Before you start

  • React components and props
  • The Supabase starter kit (sign-in, storage)

In this part we build our own video editor in the browser, with Remotion and vibe coding. We start from the starter kit we built earlier and let a coding agent grow it into an editor. Then we open up what it built, so you understand how Remotion turns code into a video.

Start from the starter kit

The Supabase starter kit already has login, sign-up, password reset and Google sign-in, plus the middleware that protects pages. It also has sample pages (dashboard, customers, users, settings) that an editor doesn't need. So the plan is simple: keep the authentication exactly as it is, remove the sample pages, and build the editor on top. The sign-in part is done and tested, so we spend our time on the new idea.

What Remotion is

Remotion is a library for making videos with code, in React. A video is a lot of still pictures shown quickly one after another. Each picture is a frame. In Remotion you write a normal React component, and it asks one question: which frame am I on right now? From that number it decides what to draw, where the text sits, how faded it is, how big it is. Play those frames at 30 a second, and you have a video. That's why many AI video tools use Remotion behind the scenes: a video becomes code you can write, save and change.

Frame in, picture out frame 45 a number React component useCurrentFrame() picture one still video 30 per s 150 frames / 30 fps = 5 seconds
A frame number goes in, a picture comes out.

One prompt, and the questions it asked

We open the project folder in the coding agent with a four-part prompt. Role: a full stack Next.js developer. Context: our starter kit with Supabase sign-in. Task: remove the sample pages, keep the authentication, and turn the app into a video editor with Remotion, where a user signs in, creates projects, uploads video, audio and images, edits, saves and deletes projects, and renders the video from the page. Format: plan first, ask before big decisions, and give us the SQL to run in Supabase ourselves.

Before building, the agent asked:

  • An MP4 export on the server? Yes.
  • Where should uploads go? Supabase Storage, one folder per user.
  • Who runs the SQL? We do.

That's vibe coding done well: you describe the outcome, answer the questions, and stay in charge of the decisions.

The storage answer is a real decision. Every time a file moves between providers there can be a transfer cost, called egress. With a few users you won't notice; with a lot of video traffic it adds up quickly. Keep files close to where the app runs: R2 on Cloudflare, S3 on AWS, Cloud Storage on Google Cloud. Supabase Storage is enough for testing. On the free plan one file can be up to 50 MB, so keep test videos small.

We create a new Supabase project for this app so the tables don't clash with the starter kit's, and copy its URL, anon key and service role key into the env file the same way as before. Then we run the agent's schema.sql once in the SQL editor. It creates two tables, projects and renders, with row level security so every user sees only their own rows, and two storage buckets, media for uploads and renders for finished videos, with a folder per user.

What the agent added

  • A remotion folder with the video itself.
  • lib/composition.ts, which describes a project.
  • The projects page, and the editor page with its components: preview player, timeline, properties panel.
  • An API route, render, that turns a project into an MP4 on the server.

The authentication folders are untouched.

The whole project is one object

From lib/composition.ts:

export interface BaseClip {
  id: string;
  type: ClipType;
  /** Start frame on the project timeline. */
  from: number;
  /** Length of the clip, in frames. */
  durationInFrames: number;
  /** Track lane index (0 = top). */
  row: number;
}

export type Clip = TextClip | ImageClip | VideoClip | AudioClip;

export interface Composition {
  width: number;
  height: number;
  fps: number;
  durationInFrames: number;
  background: string;
  clips: Clip[];
}

A clip can be text, an image, a video or audio. Every clip has a start frame (from), a length in frames, and a row, its track on the timeline. This one object goes to three places: the preview in the browser reads it, the render on the server reads it, and Supabase stores it as JSON in the projects table. One description of the video, and everything else just reads it.

Here's the default project the editor starts with:

    width,
    height,
    fps: 30,
    durationInFrames: 150, // 5s @ 30fps
    background: "#0b1020",
    clips: [
      {
        id: uid(),
        type: "text",
        from: 0,
        durationInFrames: 90,
        row: 0,
        text: "Your title here",
        fontSize: 96,
        color: "#ffffff",
        // ...
        animation: "slide-up",
      },
    ],

1920 by 1080 for the landscape preset, 30 frames per second, 150 frames long: 150 divided by 30 is 5 seconds. One text clip, "Your title here", from frame 0 for 90 frames (3 seconds), sliding up. The editor shows you seconds, but the file always stores frames.

Root: one entry renders any size

export const RemotionRoot: React.FC = () => {
  const fallback = defaultComposition();

  return (
    <Composition
      id="MainVideo"
      component={MainVideo}
      durationInFrames={fallback.durationInFrames}
      fps={fallback.fps}
      width={fallback.width}
      height={fallback.height}
      defaultProps={{ comp: fallback }}
      calculateMetadata={({ props }) => {
        const comp = props.comp as Comp;
        return {
          durationInFrames: comp.durationInFrames,
          fps: comp.fps,
          width: comp.width,
          height: comp.height,
        };
      }}
    />
  );
};

Root.tsx is the list of videos Remotion can render. It registers one Composition, MainVideo. The interesting part is calculateMetadata: it reads the comp prop and takes the size, frame rate and length from it. So a square project renders square and a portrait project renders portrait.

Sequence: each clip gets its own clock

MainVideo.tsx wraps each clip in a Remotion Sequence:

export const MainVideo: React.FC<{ comp: Composition }> = ({ comp }) => {
  const maxRow = comp.clips.reduce((m, c) => Math.max(m, c.row), 0);

  return (
    <AbsoluteFill style={{ backgroundColor: comp.background }}>
      {comp.clips.map((clip) => (
        <Sequence
          key={clip.id}
          from={clip.from}
          durationInFrames={clip.durationInFrames}
          layout="none"
        >
          <ClipRenderer clip={clip} zIndex={maxRow - clip.row + 1} />
        </Sequence>
      ))}
    </AbsoluteFill>
  );
};

Before its start the clip isn't drawn, and after its length it's gone. The clever part: inside a Sequence the frame count starts again from zero, so every clip can animate as if it's the only thing in the video. The row decides which clip sits on top; track 1 is the front layer. (This is the finished version, with the explicit zIndex the agent added in a later round; see the editor, continued.)

A frame number goes in, a picture comes out

The text layer reads the current frame, and each animation is a small bit of maths on that number:

  const frame = useCurrentFrame();
  // ...
  switch (clip.animation) {
    case "fade":
      opacity = interpolate(frame, [0, 12], [0, 1], { extrapolateRight: "clamp" });
      break;
    case "slide-up":
      opacity = interpolate(frame, [0, 12], [0, 1], { extrapolateRight: "clamp" });
      translateY = interpolate(frame, [0, 16], [40, 0], { extrapolateRight: "clamp" });
      break;
    case "typewriter": {
      const charsPerFrame = 0.6;
      const shown = Math.floor(frame * charsPerFrame);
      visibleText = clip.text.slice(0, shown);
      break;
    }
  }

Fade takes opacity from 0 to 1 over the first 12 frames. Slide up does the same and moves the text up into place over 16 frames. Typewriter shows 0.6 characters per frame. In the lecture's render, the subtitle starts at frame 30, so at frame 45 of the video it's 15 frames into its own Sequence. 15 times 0.6 is 9, so you see nine characters, "built wit", and that's exactly what the rendered frame shows. No hidden trick.

The preview uses the same component

    <Player
      ref={playerRef}
      component={MainVideo}
      inputProps={{ comp }}
      durationInFrames={Math.max(1, Math.round(comp.durationInFrames))}
      fps={comp.fps}
      compositionWidth={comp.width}
      compositionHeight={comp.height}
      style={{ width: "100%", height: "100%" }}
      controls
      acknowledgeRemotionLicense
    />

preview-player.tsx passes MainVideo as the component and the project as the input props, with length, fps and size from the same project. controls gives play, pause and the seek bar. The render route on the server bundles the same MainVideo with the same project, so what you see in the preview is what you get in the file.

The editor, first version

On the left, the add panel for text, image, video and audio. In the middle, the player. At the bottom, the timeline with one row per track and a red playhead. On the right, the properties of the selected clip, with start and duration in seconds (the editor converts to frames). At the top, the project's size, fps, length and the export button.

With the playhead at 1.5 seconds, clicking Text makes a new 3-second text clip starting at the playhead. Tracks 1 to 3 were busy at that moment, so it went on the first free track, track 4. The top bar says saving: the editor waits a little over a second after your last change, then saves the project to Supabase.

Then we tested it. Sign-in worked, with the captcha and with Google. We made a landscape project, changed the title colours, uploaded a 12 MB sample video (under the 50 MB limit) and added a text overlay. But on play, the title didn't show before the video, and the timeline didn't keep up with the playback. The export did render, with our edits. A good first try, not a finished editor. Test, find the gaps, ask again.

Quick recap

PieceJob
Composition objectThe whole video in frames; shared by preview, render and database
Root.tsx + calculateMetadataOne entry, size and length from props
SequenceStart and length per clip; frame count restarts at zero inside
useCurrentFrame + interpolateAnimation as maths on the frame number
PlayerThe browser preview of the same component

Try it yourself

Add a new text animation, like a slide in from the left, or prompt your agent to add it. Then read every line it gives you: it should be one more case with an interpolate on translateX.

Tried the exercise? Share your answer or ask a question.

The StudyEasy AI Community is free to join, with the lesson files, notebooks and code.

Join free on Skool

Keep going in React · 50 of 75

Previous
Running a Next.js Admin Starter Kit: Route Groups, Theme Tokens and npm run dev
Next post
Spline: Put a 3D Scene on a Landing Page Without Writing 3D Code

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Related posts

Backend vs Frontend: What Runs Where, and Why the Server Is the One You Trust

Every web app has two halves. The front end runs on the user's device and is trusted with nothing; the back end holds the data, the secrets and the rules. Checked with real requests to a Django blog.

One Request, Two Answers: the Same Post as an HTML Page and as JSON

Ask a Django blog for the same post twice: once as a 12,731-byte HTML page built by a template, once as 2,976 bytes of JSON built by a serializer. Compare the headers, see who builds the page, and why the server still owns every write.

A Blog Design from a Prompt: Downloading Figma Make Code and Reading App.tsx and BlogCard.tsx

Make a blog design from a prompt in Figma Make, download src.zip, unzip it with Python's zipfile module, and read the two files that matter: App.tsx with its selectedPost state and BlogCard.tsx with its props.

How a Web Page Works: HTML Tags, Elements and Attributes

A web page is a text file full of labelled pieces. Learn tags, attributes and nesting with three tiny pages, and see what breaks when an attribute or a closing tag is wrong.

On this page

  • Start from the starter kit
  • What Remotion is
  • One prompt, and the questions it asked
  • What the agent added
  • The whole project is one object
  • Root: one entry renders any size
  • Sequence: each clip gets its own clock
  • A frame number goes in, a picture comes out
  • The preview uses the same component
  • The editor, first version
  • Quick recap
  • Try it yourself
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

The Python Architect Masterclass: Full Stack to AI Engineer

Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.