Minimal real-time watch party app. Multiple users load their own local video files and stay in sync on play, pause, and seek — the server relays playback events only; video files are never uploaded or streamed.
SyncWatch is a two-package web application:
syncwatch-client/— React SPA for authentication, room management, and video playbacksyncwatch-server/— Express + Socket.IO backend for user accounts and real-time room sync
Users register or log in, create or join a room with a short code, pick a local video file, and watch together. One user is the host and controls playback; other clients follow via WebSocket events.
For system design, data flow, and API contracts, see ARCHITECTURE.md.
- User authentication — Register and login with email/password (JWT session cookie)
- Room creation — Server generates a 6-character room code
- Room joining — Join by code or via shareable URL (
?room=CODE) - Host-controlled playback — Host drives play, pause, and seek; viewers sync automatically
- Local video loading — Each client selects their own file from disk
- Host failover — If the host leaves, another participant is promoted
- Invite link — Copy room URL from the navbar
- Server health polling — Client waits for backend availability before starting
| Layer | Technologies |
|---|---|
| Frontend | React 19, Vite 7, Tailwind CSS 4, Socket.IO client, Lucide React |
| Backend | Node.js, Express 5, Socket.IO 4 |
| Auth | JWT (jsonwebtoken), bcrypt, HTTP-only cookies |
| Database | PostgreSQL (pg) |
| Language | JavaScript (no TypeScript in application code) |
- Node.js
- npm
- PostgreSQL database
git clone <repository-url>
cd sync-watchcd syncwatch-server && npm install
cd ../syncwatch-client && npm installThe server expects a PostgreSQL users table. No migration files are included in this repository.
TODO: Add and document database schema setup. Required columns inferred from server.js:
idemailusernamepassword_hash
See Environment Variables below.
Start the server first, then the client.
cd syncwatch-server
npm run dev # nodemon server.js
# or
npm start # node server.jsDefault port: 5000 (override with PORT).
cd syncwatch-client
npm run dev # vite --hostVite prints the local URL (commonly http://localhost:5173).
- Server health:
GET http://localhost:5000/health - Open the client URL in your browser, register or log in, then create or join a room
Copy from the example:
cp syncwatch-client/.env.example syncwatch-client/.env| Variable | Required | Description |
|---|---|---|
VITE_BACKEND_URL |
Yes | Backend origin for REST and Socket.IO (e.g. http://localhost:5000) |
Add syncwatch-server/.env.example. Required variables from server.js:
| Variable | Required | Description |
|---|---|---|
JWT_SECRET |
Yes | Secret for signing JWT session tokens |
DATABASE_URL |
Yes | PostgreSQL connection string |
CLIENT_URL |
Yes | Client origin for CORS and Socket.IO (e.g. http://localhost:5173) |
PORT |
No | HTTP listen port; defaults to 5000 |
Example (local development):
JWT_SECRET=your-secret-here
DATABASE_URL=postgresql://user:password@localhost:5432/syncwatch
CLIENT_URL=http://localhost:5173
PORT=5000sync-watch/
├── README.md
├── ARCHITECTURE.md # Architecture and API reference
├── context.md
│
├── syncwatch-client/ # React frontend
│ ├── index.html
│ ├── vite.config.js
│ ├── .env.example
│ └── src/
│ ├── main.jsx # App entry point
│ ├── App.jsx # Auth, routing, health polling
│ ├── hooks/
│ │ └── useVideoSync.js
│ └── components/ # Screens, player, UI primitives
│
└── syncwatch-server/ # Node backend
├── server.js # Runtime entry point
├── lib/db.js # Unused (not imported)
├── middleware/auth.js # Unused (not imported)
└── routes/auth.js # Unused (not imported)
There is no root package.json; client and server are independent npm packages.
HTTP routes and Socket.IO event contracts are documented in ARCHITECTURE.md:
- Request Lifecycle — auth, rooms, and sync flows
- Database Layer — PostgreSQL usage
- Environment and dependency reference
cd syncwatch-client
npm run buildOutput directory: syncwatch-client/dist/
Preview the production build locally:
npm run previewNo build step. Run directly with Node:
cd syncwatch-server
npm startcd syncwatch-client
npm run lint🚧 Work in progress. More features coming soon.
Made with ❤️ by Aditya