Nice — I’ll give you a developer-focused, under-the-hood architecture + concrete implementation plan you can execute in 4–5 days. I’ll keep it practical, with the exact layers you’ll touch, data formats, algorithms, failure modes, tests, and short code skeletons/hints (not full copy-paste app, since you prefer understanding the mechanics). Ready? Let’s go.
✅ High-level summary (1 line)
Use WebTransport (HTTP/3 / QUIC) as the transport; split the app into Chunker → FEC → Priority Scheduler → WebTransport Streams → Receiver reassembly + Verify + Resume. Add a small control channel for metadata/commands and a monitoring stream for live stats.
1) System components & responsibilities
- Client (browser / CLI)
- Chunk files, compute per-chunk hash, send metadata.
- Apply FEC encoder producing parity shards.
- Open multiple WebTransport streams (control, priority, data, fec, stats).
- Scheduler decides chunk → stream mapping and retransmits.
- Persist resume metadata locally (bitmap of received/sent shards, Merkle root).
- Server / Receiver (edge node or relay)
- Accept WebTransport sessions.
- Manage streams: accept control, data, FEC shards.
- Validate chunk hashes; store chunks temporarily or pipe to storage.
- Run FEC decoder when enough shards arrive.
- Handle resume requests; serve missing chunks.
- Emit realtime stats over a dedicated stream.
- Optional Relay / Store-and-forward node
- Buffer in lossy networks; acts like a tolerant relay (useful for intermittent connections).
- UI / Dashboard (React)
- Show stream-level throughput, retransmit counts, FEC recovery stats, ETA per file.
- Visualize health (packet loss estimate, inferred RTT).
- Persistence / Metadata store
- Minimal: file manifests (Merkle root, chunk count/size, FEC params). Could be memory for short runs.
2) Protocol & stream layout (logical)
Use 3–4 logical WebTransport streams (mapped to QUIC streams):
- Control stream (bidirectional) — metadata exchange, manifest, resume handshake, ACKs (small, reliable).
- High-priority stream — small chunks/headers/manifest chunks (low latency).
- Data streams (one or more unidirectional/bidirectional) — bulk chunk payloads.
- FEC stream(s) — parity shards (can be unidirectional).
- Stats stream (optional bidirectional/unreliable datagrams) — live telemetry (byte/sec, packet loss estimates, decode events).
WebTransport supports datagrams (unreliable) as well — use datagrams for live metrics and low-priority non-critical messages; use streams for chunks that must be reassembled.