The Challenge
I wanted to prove that a complete streaming platform could be built with zero monetary investment. No AWS credits. No paid hosting. Just free tiers, automation, and a lot of JavaScript.
The result: 161+ anime titles, 2,733 episodes, 15 languages, and a full admin panel – all running on $0/month infrastructure.
The Stack
Layer Technology Frontend Next.js 14, React, TypeScript, Tailwind CSS Backend API Cloudflare Workers (serverless) Database Cloudflare D1 (SQLite) + Supabase (PostgreSQL) Cache Cloudflare KV (< 50ms response time) Auth Supabase Auth Notifications Firebase FCM Video Player HLS.js with custom CORS-proxy bypass Hosting Vercel (frontend) + Cloudflare Workers (API)
Infrastructure cost: $0/month. Yes, really.
The Hard Parts
1. HLS Streaming with CORS Bypass
Video streams (M3U8 playlists) from third-party sources often block cross-origin requests. I built a custom proxy route that:
- Fetches the M3U8 playlist
- Rewrites all segment URLs to go through the proxy
- Streams back the modified playlist to the client
- Handles CORS headers properly
The proxy handles both .m3u8 playlists and binary segments (.ts, .m4s) while preserving Range headers for partial content.
Code snippet – proxy playlist rewriting:
javascript
const rewritten = text
.split(/\r?\n/)
.map(line => {
const trimmed = line.trim();
if (!trimmed || trimmed.startsWith('#') || trimmed.includes('/api/proxy')) {
return line;
}
try {
const resolved = new URL(trimmed, baseUrl).toString();
return `/api/proxy?url=${encodeURIComponent(resolved)}`;
} catch {
return line;
}
})
.join('\n');