How I built a page like sudo-flix from scratch
Every so often a project grabs hold of you and refuses to let go until it's real. This is the story of one of those: a from-scratch streaming framework I built end to end, inspired by the shape of projects like sudo-flix but rebuilt from the ground up with my own architecture, my own performance obsessions, and a very deliberate stance on where code stops and where a self-hoster's own choices begin.
Before anything else, one important framing note. What I built is a framework, not a pirate ship. The code is a neutral, hollow vessel: there are no third-party scrapers, resolvers, playlists, or pre-loaded streams anywhere in the public repositories. The only media the backend ever serves is media the operator already controls, and any third-party sources a self-hoster chooses to wire in live in their own private repository and resolve inside the viewer's own browser. My scrapers, resolvers and sources are private and stay that way. What's public is the engine, and the engine alone.
The shape of the thing
At a high level the project splits into two halves that talk to each other over a deliberately thin contract. There's a FastAPI backend that acts as the brain, metadata, identity, secret custody, orchestration and a React client that acts as the face, and increasingly, the muscle. The guiding principle that shaped almost every decision was simple: keep the backend's bandwidth footprint as close to zero as possible. Metadata is cheap; video bytes are ruinously expensive and painful to scale. So the whole system is engineered to keep video off the backend and route it CDN-to-viewer wherever it possibly can.
The backend: a metadata brain, not a byte pipe
The backend is a FastAPI app running on Python 3.10+, backed by a single PostgreSQL database reached through a process-wide psycopg 3 connection pool. Because all state lives in Postgres, e.g. the metadata mapping, the API cache and the accounts, favorites and progress, the API itself holds no local state. That makes replicas interchangeable, so the whole thing scales horizontally behind a load balancer without any sticky-session gymnastics.
The piece I'm most fond of is the metadata engine. It natively maps TMDB shows and seasons to their AniList IDs per season, with a graceful fallback to TMDB when a mapping doesn't exist, using the Fribb dataset as its source of truth. That mapping is what lets a single title unify anime, non-anime TV, and movies under one coherent metadata model, with posters, titles and episode summaries enriched from both sources. A scheduled resync rebuilds only the mapping tables inside a transaction, so it never touches user data.
The heart of playback is an endpoint I'm quietly proud of. Instead of making the client wait for every source to resolve before returning a single fat JSON blob, the watch endpoint streams results progressively as NDJSON, one JSON object per line, flushed the instant each source resolves. A meta line always comes first, then zero or more stream lines, then a terminal done line. The practical payoff is that the fastest source starts playing first, and each operator-owned source runs as its own cancellable task with a shared de-dupe set across them. It feels instant even when some sources are slow.
The sources the backend itself serves are all operator-owned: a local media engine that streams browser-playable files straight off a registered directory or NAS mount with HTTP Range support, a cache engine that remuxes episodes onto your own storage with a background ffmpeg worker and then replays them, and a Jellyfin integration that reverse-proxies your own self-hosted server while injecting the access token server-side so it never reaches the browser. There's also a documented no-op template source that spells out the contract for wiring in another operator-owned source, so extending it is a copy-paste-and-implement job.
Accounts without a password vault
Two sign-in methods coexist behind a site-wide, opt-out login wall implemented as a pure-ASGI middleware, so the whole API is members-only by default. The first method is a mnemonic scheme: an account is simply an Ed25519 public key derived from a 12-word BIP39 seed phrase that lives entirely on the client. The server stores only the public key and verifies signatures over one-time challenges, so the private key never reaches the backend at all. The second is a more conventional invite-gated email and password flow with SMTP verification and reset, hashed with PBKDF2-HMAC-SHA256. Favorites and per-episode progress live in their own tables, untouched by mapping resyncs, and the schema upgrades itself on boot through idempotent migrations.
The client: a face that grew muscles
The client is a React 19 app built with Vite, styled with Tailwind CSS 4 in a neon-crimson theme, routed with React Router 7. The interesting evolution is that the client stopped being a passive consumer of the backend's watch stream. It can now scrape and resolve sources itself, in the viewer's own browser, so video flows CDN-to-viewer and the backend leaves the byte path entirely. This client-side engine runs alongside the backend stream and emits the byte-identical line shape, so a locally-resolved source is indistinguishable from a backend one, and the frontend simply de-dupes the two by source and language. With no companion and no proxy configured, it falls back to the backend stream exactly as before. Every part of this is a pure upgrade, never a requirement.
Getting bytes off the backend
This is where the design really pays off. The backend stays the brain but hands the client small, login-gated grants that give it only what it can't derive on its own: a title bundle for the client-side sources, a signing endpoint, and a secret-bound resolve grant. Crucially, secrets never leave the server. To actually deliver those client-resolved streams to viewers who have nothing installed, I built two more pieces.
The first is a self-made proxy: a signed, HLS-aware CORS relay designed to run on free edge hosting like Netlify or Cloudflare Workers. Its one job is to move stream-segment bandwidth off the backend while staying impossible to abuse as an open proxy. Every link carries an HMAC over the URL, referer, origin and user-agent, signed by the backend with a shared secret, so forged links are rejected outright. It's HLS-aware, rewriting every variant, segment and key URI in a playlist back through itself so the player only ever talks to the proxy, and it injects the referer, origin and user-agent that gated CDNs demand — headers a browser can't set on its own media fetches. The backend carries only a few hundred bytes of signing per play; the video never touches it.
The second delivery path is a self-made companion browser extension. A tiny Chromium MV3 extension whose only job is local CORS unblocking and header injection. It's the most capable execution environment of the three, because it runs from a real Chrome on the viewer's own residential IP. Where the edge proxy is a datacenter IP with a non-Chrome TLS fingerprint that can't clear Cloudflare's checks or fetch tokens bound to a specific network, the extension sidesteps all of it. It exposes a privileged cross-origin fetch that can set the forbidden headers a page never can, installs tab-scoped media rules so the player streams gated CDN segments directly, and for the nastiest SPA or proof-of-work hosters it can even resolve in a hidden background tab by watching the network and capturing the real stream URL. It holds no secrets and signs nothing; the page drives every primitive, and everything is gated behind a single user-toggled button.
The neat part is how these degrade. The client tries the most capable path available and falls back gracefully: extension if present, edge proxy if configured, backend stream otherwise. A source whose token is bound to a residential IP is never routed to a datacenter edge that would just get a 403 — the client's capability router knows the difference and picks accordingly. The result is a system that always works, and works better the more the viewer has installed, without the backend ever paying for the bytes.
Shipping it
Everything is infrastructure-as-code. The backend and client both ship as multi-stage Docker builds. The client compiled by Vite and served by a hardened Nginx with security headers and immutable asset hashing, the backend running as a non-root user with a health check. Both come with Docker Swarm stacks that run multiple replicas, self-heal, and do zero-downtime rolling updates with automatic rollback. The edge proxy auto-deploys to Netlify and Cloudflare from CI on every push. The one rule that ties the deployment together is that the signing secret must be identical on the backend and every proxy host, because the signature covers the query fields and not the host, which is exactly what lets the backend round-robin across proxy hosts for free load-balancing and failover.
What I learned
The single most valuable decision was drawing a hard line between metadata and bytes, and then engineering relentlessly to keep bytes off the backend. Once that was the north star, everything else followed: the progressive streaming contract, the three-tier delivery model, the signed edge relay, the residential-IP extension, the secret custody rules. It's also a project that taught me how much cleaner a system becomes when every capability is an optional upgrade layered over a path that always works on its own. Build the fallback first, make everything above it strictly additive, and the whole thing stays robust no matter what the viewer is running.
If you want to poke at the public framework, the code lives under the crimsonhaven-to organization on GitHub, the backend, client, proxy and extension are all open source under the MIT license. You can find them here: gitlab.ramon.moe/crimsonhaven-to The documentation is here: https://docs.crimsonhaven.org.