Lets Watch is a local-first watch-party app for self-hosted environments. Each viewer opens the video file from their own machine, while the server only coordinates playback state over Socket.IO.
- Syncs play, pause, and seek events across a room with shared participant control.
- Lets viewers create rooms with their own room code and 6-digit join PIN.
- Offers room chat with viewer-selected names, quick emoji reactions, color emoji from the bundled Noto Color Emoji font, and lightweight image sharing.
- Serves the React frontend and the Socket.IO backend from one Node process in production.
- Keeps media local to each participant instead of uploading it to the server.
- Broadcasts chat messages live without storing chat history on the server.
- Includes basic hardening such as Helmet, payload validation with Zod, and lightweight rate limiting.
- Obfuscates sensitive identifiers in backend logs so room and participant metadata are not written in plain text.
- Applies dedicated authentication throttling to room create/join flows to reduce brute-force attempts, including reconnect-based retries from the same client identity, and locks a room's PIN entry after repeated failures from any mix of clients.
client/: React 19 + Vite frontend.server/: Express + Socket.IO backend.README.md: project overview and development guide.SECURITY.md: current controls, limitations, and security workflow.DEPLOYMENT.md: production setup and hosting notes.
- Node.js 22.18 or newer, which can run TypeScript natively. CI runs on Node 22 and 24, and
.nvmrcpins Node 26 for local development. - npm 10 or newer.
Install dependencies in both packages:
npm run install:allStart the backend:
cd server
npm run devStart the frontend in a second terminal:
cd client
npm run devThe default local URLs are:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:4000
Copy server/.env.example to server/.env:
PORT=4000
NODE_ENV=production
APP_URL=https://www.example.com| Variable | Required | Purpose |
|---|---|---|
PORT |
No (default 4000) |
Port the HTTP and Socket.IO server listens on. |
HOST |
No (default 0.0.0.0) |
Address to bind. Use 127.0.0.1 when a reverse proxy runs on the same machine. |
NODE_ENV |
Yes in production | production enables static frontend serving, HSTS, and strict origin checks. |
APP_URL |
Yes when NODE_ENV=production |
Public origin. Used for CORS, Socket.IO admission, and CSP connect-src. The server refuses to start without it in production. |
TRUST_PROXY |
No (default off) | Number of reverse proxies in front of the server (true means 1). The client address used for rate limiting is read that many entries from the right of X-Forwarded-For. See DEPLOYMENT.md. |
Copy client/.env.example to client/.env if the frontend needs to talk to a separately hosted backend:
VITE_SOCKET_URL=http://localhost:4000In production, the client falls back to window.location.origin when VITE_SOCKET_URL is not set.
Run from the repo root after both packages are installed:
npm run lint
npm run test
npm run buildWhat these commands do:
npm run lint: runs frontend ESLint and backend TypeScript checks.npm run test: runs client and server Vitest suites.npm run build: builds the frontend and type-checks the backend.
- The frontend must be built before starting the server in production.
- The backend serves
client/distwhenNODE_ENV=production. - Static assets under
/assetsare cached aggressively because Vite fingerprints them. index.htmlis served withno-storecaching so browsers always pick up the latest asset references.- In production,
index.htmlis served through a nonce-injecting response path. - Open the app at
/in production. Direct/index.htmlrequests are redirected to/so CSP nonce injection is consistently applied. - Chat images are resized in the browser before they are sent over Socket.IO.
- Joining an existing room requires both the chosen room code and its 6-digit PIN.
- Room codes are normalized to uppercase and PIN inputs are reduced to six digits during create and join.
- Rooms also expose a copyable share link with a room-specific token so invite links can join directly without re-entering the PIN. The token is in the URL fragment (
#token=...), so it is never sent to the server or written to proxy logs. - PIN-based joins rotate the current share token, so older copied links stop working after a fresh PIN join.
- Room state is in-memory only. When the last participant disconnects, room membership and playback state are dropped. Run exactly one server process.
GET /healthzreturns{"status":"ok"}for load balancers and uptime checks.- The server runs TypeScript directly on Node (type stripping), so there is no server build step or runtime transpiler.
- Production Socket.IO admission checks
Originfirst and only falls back to the effectiveHostheader whenOriginis absent. It does not trustX-Forwarded-Hostas an auth signal.
- CSP is emitted as an HTTP response header and uses nonce-augmented
script-srcwith strict-dynamic support (withoutunsafe-inlinefor scripts). - HSTS is enabled in production with long max-age, subdomain coverage, and preload.
See DEPLOYMENT.md for a full deployment walkthrough.
This project is licensed under GPL-3.0-or-later. See LICENSE for details.