Build a self-hostable YouTube clone on Cloudflare

Open-source video pipeline on R2, D1, and Workers — $0 egress.

Storage
Cloudflare R2 · $0 egress
Metadata
D1 SQLite
Runtime
Workers · Assets
Cost
$0 to operate

What TubeForge is

TubeForge is an open-source, forkable YouTube clone implementation you can deploy directly to your own Cloudflare account. Built with Astro, Cloudflare R2, D1 SQLite, and Workers, it demonstrates how a minimal self-hosted video platform stores, indexes, and streams video files without paying per-gigabyte outbound bandwidth fees. Instead of hiding behind a managed SaaS, every route from upload to playback is small enough to read in an afternoon and adapt to your own project.

Choose where to start

Depending on whether you want to study the system design, deploy the code, or model your hosting budget, follow one of the three core guides below:

Need to check how big an exported clip will be before you upload? Use the browser-based Video File Size Calculator to estimate file size from bitrate and duration locally.

Architecture Guide

Deep dive into the four system layers and key engineering tradeoffs.

Fork & Deploy Script

Step-by-step Wrangler setup, routes, and Cloudflare bindings.

Cost & Free Tier

Bandwidth economics and request quota limits on Cloudflare.

File Size Calculator

Estimate video size locally against upload caps before exporting.

Real scope, limits, and how it differs from YouTube

TubeForge is intentionally scoped as a lightweight reference implementation rather than a drop-in replacement for a full commercial video platform. Knowing the exact boundaries up front saves you from surprises when you fork it:

Frequently asked questions

Is TubeForge open-source code or a hosted video service?

TubeForge is open-source reference code, not a multi-tenant hosted platform. You fork the repository, provision your own R2 bucket and D1 database, and deploy it under your own Cloudflare account using the deployment guide.

How much does it cost to run this YouTube clone?

For demos, prototypes, and low-traffic personal libraries, it can run at $0 per month within Cloudflare's free allowances. When traffic scales, Worker request volume — not storage or egress — is usually what triggers a $5/month Workers Paid upgrade, as detailed in the cost analysis.