Keep video files out of your repo. Host them with VideoDB from Cursor or Claude Code, then paste in an iframe or a small HLS player. The setup, the upload script and the React code are all here.
- Keep video out of the repo. GitHub blocks files over 100 MiB, and Vercel’s docs say video belongs on a video CDN.
- Step 1: get a VideoDB API key and run
npm install videodb. - Step 2: ask Cursor to write and run a short script. It uploads the file and prints the links.
- Step 3: paste the iframe embed, or add the React player that plays the HLS stream.
- Optional: add the VideoDB MCP server to Cursor and manage your videos by asking.
When Andrej Karpathy named “vibe coding” in a post on X in February 2025, the tool he mentioned was Cursor’s Composer. You describe the app, the agent writes it, and you can “forget that the code even exists.” Collins Dictionary later made it the word of the year for 2025.
Video is a different kind of asset. The agent can write your landing page in a minute, and the demo video still needs a place to live. This guide gives it one.
Why should video stay out of your repo? #
The quick route is to drop demo.mp4 into /public. It works on your laptop and causes trouble later.
- Git. GitHubblocks files larger than 100 MiB and warns from 50 MiB. Every version of a video you commit stays in the history.
- Bandwidth. Vercel ships aconformance rule that flags video files inside a Next.js app, because serving them from the app eats its bandwidth. The rule points to a dedicated video CDN.
- Player code. A video host gives you a stream, a player page, an embed and a thumbnail. You write less code around the file.
Step 1. Get a key and install the SDK #
- Create an account at console.videodb.io and copy your API key. New accounts start with $20 of free credits, and no credit card is needed.
- Put the key in
.env.localat the root of your project. Keep that file out of Git.
VIDEO_DB_API_KEY=your-key
- Install the SDK.
npm install videodb
The key belongs on your machine or your server. Keep it out of browser code. In Next.js, that means no NEXT_PUBLIC_ prefix.
Step 2. Ask Cursor to host the video #
Put your video in a folder such as media/, then give Cursor’s agent this prompt.
Create scripts/host-video.mjs.
It should upload ./media/demo.mp4 to
VideoDB with the videodb package, using
VIDEO_DB_API_KEY, and print the player
URL, the HLS stream URL and the embed
code. Add media/ to .gitignore, then
run the script with Node,
.env.local through --env-file.
This is the script it should end up with. You can also paste it in yourself.
import { connect } from 'videodb';
// reads VIDEO_DB_API_KEY from your environment
const conn = connect();
const coll = await conn.getCollection();
// a file in your project, or coll.uploadURL({ url: 'https://...' })
const video = await coll.uploadFile({ filePath: './media/demo.mp4' });
const stream = await video.generateStream(); // HLS, ends in .m3u8
const embed = await video.getEmbedCode(); // an iframe
console.log('Player page:', video.playerUrl);
console.log('HLS stream:', stream);
console.log('Embed code:', embed);
What you get: three lines in the terminal. The player page is a link you can open and share. The stream and the embed go into your app in the next step.
Working in Python? The same upload is on the video hosting page.
Step 3. Put the video on the page #
You have two options. Start with the iframe, and move to your own player when you want control over the look.
Option A: the iframe embed
The embed code from the script is an iframe. In a React or Next.js component it looks like this.
export function DemoVideo() {
return (
<iframe
src="https://player.videodb.io/embed?v=..."
title="Product demo"
style={{ width: '100%', aspectRatio: '16 / 9', border: 0 }}
allowFullScreen
/>
);
}
Replace the src with the one your script printed. The embed link is the player link with /watch changed to /embed.
Option B: your own player with hls.js
The stream is HLS. Safari plays HLS on its own, and hls.js covers the other browsers. Install it with npm install hls.js, then add this component.
'use client';
import { useEffect, useRef } from 'react';
import Hls from 'hls.js';
export function VideoPlayer({ src, poster }: { src: string; poster?: string }) {
const ref = useRef<HTMLVideoElement>(null);
useEffect(() => {
const video = ref.current;
if (!video) return;
// Safari plays HLS on its own
if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = src;
return;
}
// every other browser uses hls.js
if (Hls.isSupported()) {
const hls = new Hls();
hls.loadSource(src);
hls.attachMedia(video);
return () => hls.destroy();
}
}, [src]);
return <video ref={ref} poster={poster} controls playsInline style={{ width: '100%' }} />;
}
Use it with the stream link your script printed.
<VideoPlayer src="https://.../your-stream.m3u8" />
Or let Cursor do the wiring:
Create components/VideoPlayer.tsx with
hls.js, and put the video at the top of
the landing page, using the stream URL
the script printed.
Step 4. Let the agent manage your videos (optional) #
Add the VideoDB MCP server and Cursor’s agent can work with your library in plain words. Create .cursor/mcp.json in your project, or ~/.cursor/mcp.json to use it in every project.
{
"mcpServers": {
"videodb": { "url": "https://mcp.videodb.io/mcp" }
}
}
Cursor opens the VideoDB login on first use. Then ask:
List my VideoDB videos with
the player link for each.
Host this video and give me
the embed code: [video link]
Make a 720p copy of [video link].
Through the MCP server, the agent hosts a video from a link. For a file in your project, use the script from step 2.
In Claude Code: install the VideoDB plugin with /plugin marketplace add video-db/skills, /plugin install videodb@videodb-skills and /videodb setup. Setup for every client is on the agents page.
Link or embed one moment #
A link can play one part of a video. That helps when a long recording holds the 30 seconds your page needs.
By timestamp. Pass a start and an end in seconds, and you get a stream that plays only that part. Every time range gets its own unique link.
// a stream that plays only 2:10 to 2:40
const part = await video.generateStream([[130, 160]]);
Use it as the src of the VideoPlayer component.
By description. With the MCP server from step 4, describe the moment and let the agent find it.
Make demo.mp4 searchable. Then find
the part where the dashboard is on
screen, and give me the stream link
for that moment.
The same works for what is said, such as “where we are discussing pricing”. Both are covered in how to turn a video into a link.
What does it cost? #
New accounts start with $20 of free credits. After that the published rates apply:
- Uploads: $0.09 per GB
- Storage: $0.03 per GB a month
- Streaming: $0.07 per GB
At these rates, a 300 MB demo video costs about 3 cents to upload and about 1 cent a month to store.
Troubleshooting #
“No API key provided.” The script reads VIDEO_DB_API_KEY from the environment. Run it with node --env-file=.env.local, which needs Node 20.6 or newer.
“Authentication Error.” The key did not match. Copy it again from the console.
The video plays in Safari and stays blank in another browser. The page is using a plain video tag for an HLS link. Use the VideoPlayer component above, or the iframe.
FAQ #
Where should I host video for an app built with Cursor?
On a video host, outside your repo. GitHub blocks files larger than 100 MiB, and Vercel’s docs say video belongs on a dedicated video CDN. VideoDB hosts the file and gives you a player link, an iframe embed and an HLS stream.
Can Cursor upload a video for me?
Yes. Ask the agent to write and run a short upload script that uses the VideoDB SDK and your API key. With the VideoDB MCP server added, the agent can also host a video from a link, list your library and make smaller copies.
How do I embed the video in React or Next.js?
The simplest way is the iframe embed. For your own player, use a video element with hls.js. Safari plays HLS on its own, and hls.js covers the other browsers.
Does this work outside Cursor?
Yes. The upload script is plain Node and the player is plain React, so both work in React projects from Claude Code, Lovable, Bolt or v0. In a browser-based builder, host the video from Claude or ChatGPT and paste the embed. Any MCP client can add the server at mcp.videodb.io/mcp.
What does it cost?
New VideoDB accounts start with $20 of free credits, and no credit card is needed. After that, uploads are $0.09 per GB, storage is $0.03 per GB a month and streaming is $0.07 per GB.
Try it now #
Get a key at console.videodb.io, run the script on one video and paste the embed into your page. The video hosting page lists what else your agent can do with the library.
Next, try: turn a video into a link with Claude or ChatGPT, or have your assistant find moments inside a video.