You are a senior full-stack engineer tasked with generating a fully working Playwright-based Web Proxy application.

Goal:
Build a secure, scalable, production-grade PLAYWRIGHT-POWERED BROWSER-PROXY APP that allows public users to browse external websites through our system.

System Requirements:
- Node.js backend (TypeScript preferred)
- Uses Playwright (Chromium) as the rendering engine
- User traffic should be proxied through a dedicated browser context (session stickiness)
- Ability to handle ~200 concurrent sessions
- Must allow both Desktop and Mobile emulation modes
- Proxying should use STREAMING of DOM changes to the client in real time (avoid full snapshots unless unavoidable)
- Session persistence: cookies, localStorage, IndexedDB
- Support WebSockets, HTTP/2, and modern JS apps
- Should detect and rewrite relative links so browsing continues through the proxy
- Must provide an HTTP REST interface + WebSocket/API channel for DOM streaming
- Implement browser pooling + autoscaling design
- Include session cleanup, idle timeout, memory leak protection
- Support optional residential proxy rotation upstream
- Include anti-bot mitigation options (header spoofing, UA randomization, timezone spoofing)
- Add authentication middleware so only logged-in users can proxy
- Add rate-limiting to avoid abuse
- Include server-side anti-DDoS throttle and IP-ban list
- Add logging + metrics (Prometheus or Grafana-friendly)
- Include Docker + Helm charts for deployment to Kubernetes

Deliverables the AI must output:
1️⃣ Full backend Node.js folder structure
2️⃣ Complete TypeScript server code including:
     - BrowserPool manager
     - BrowserSession abstraction
     - Proxy API routes
     - WS streaming engine
3️⃣ Example client web UI code (Next.js or React) allowing:
     - User enters URL
     - Select desktop or mobile mode
     - Displays live proxy stream
4️⃣ Instructions for deployment on:
     - Docker
     - Kubernetes (200 concurrent users)
     - Load balancing approach
5️⃣ Security architecture explanation
6️⃣ Scaling + cost optimization guidance

Your output should be:
- 100% complete, runnable code, no pseudo-code
- Add comments inside code explaining internals
- Include README.md documenting setup, run, deploy