How rajin-khan/fliccs works
Purpose and Runtime
Fliccs is a private, real-time watch-party application with two modes: synchronized playback of independently selected local files, and host-to-guest WebRTC streaming. It has a Vite/React browser client and a Node.js real-time signaling/session server. Entry points are client/src/main.jsx, client/src/App.jsx, and server/src/index.js.
Client Application Shell
client/src/App.jsx owns top-level application state and routes users between landing, session, pricing, and legal surfaces. client/src/components/Landing.jsx is the pre-session entry flow; client/src/components/StreamRoom.jsx composes the active watch room; client/src/components/Layout/PageLayout.jsx provides shared layout framing.
Session Lifecycle and Authority
The server maintains ephemeral session state, including host/guest membership, password-gated access, and cleanup when a host leaves. server/src/handlers/session.js implements create/join/leave and participant lifecycle events, while server/src/utils/id.js generates session identifiers. Client controls live under client/src/components/Session/Create.jsx, client/src/components/Session/Join.jsx, and client/src/components/Session/Leave.jsx.
Socket Transport and Event Boundary
Socket-based signaling is the control-plane boundary between browser clients and the server. server/src/index.js registers handlers, and server/src/handlers/chat.js, server/src/handlers/sync.js, and server/src/handlers/session.js separate event domains. On the client, client/src/services/socket.js creates the transport and client/src/hooks/useSocket.js manages socket connectivity and event subscriptions.
Playback Synchronization Mode
In Sync Mode, each participant supplies the same local video file; no media bytes are uploaded. client/src/utils/fileHash.js fingerprints files to validate compatibility. The player in client/src/components/VideoPlayer/index.jsx uses client/src/components/VideoPlayer/useVideoSync.js to emit and apply host playback actions through the server synchronization handler at server/src/handlers/sync.js.
WebRTC Stream Mode
In Stream Mode, the host captures and distributes local media directly to guests over WebRTC; the server is signaling-only rather than a media relay. client/src/hooks/useWebRTC.js owns peer-connection/media negotiation, and server/src/handlers/sync.js likely carries the associated signaling events. External TURN infrastructure is required for NAT/firewall traversal; the README identifies Twilio-provided temporary TURN servers.
In-Room Collaboration UI
The room combines video, participants, invite flow, and chat. client/src/components/VideoPlayer/PlayerControls.jsx provides local playback interaction, while client/src/components/Session/Participants.jsx and client/src/components/Session/InviteButton.jsx expose room state and sharing. client/src/hooks/useChat.js, client/src/components/Chat/index.jsx, and server/src/handlers/chat.js implement real-time text chat as a separate socket event stream.
Deployment and Persistence Model
The repository includes a built static client at client/dist/index.html and a deployable Node server at server/src/index.js; the documented live deployment is Railway. Sessions, membership, chat, and sync state are designed to be transient in server memory: no database, accounts, uploads, or persistent user data appear in the repository tree.
Main entry points: useWebRTC.js WebRTC media peers · index.js Server entry · StreamRoom.jsx Watch room · App.jsx Application shell
Components 17
Browser Client
Vite/React application and room experience.
- Client entry
client/src/main.jsx - Application shell · Routes landing, session, pricing, and legal surfaces.
client/src/App.jsx - Landing flow
client/src/components/Landing.jsx - Watch room · Combines playback, participants, invites, and chat.
client/src/components/StreamRoom.jsx - Session controls
client/src/components/Session/Create.jsx - Socket transport · Creates the connection and manages event subscriptions.
client/src/services/socket.js - Synchronized player · Applies host playback actions to each participant's local file.
client/src/components/VideoPlayer/useVideoSync.js - Local file validation · Validates that independently selected files match.
client/src/utils/fileHash.js - WebRTC media peers · Host media flows directly to guests; the server does not relay media.
client/src/hooks/useWebRTC.js - Chat client
client/src/hooks/useChat.js
Real-Time Server
Node.js session authority and Socket event handlers.
- Server entry · Registers real-time event handlers.
server/src/index.js - Session authority · Maintains ephemeral membership, passwords, host ownership, and cleanup.
server/src/handlers/session.js - Session IDs
server/src/utils/id.js - Sync and signaling · Relays playback synchronization and WebRTC signaling events.
server/src/handlers/sync.js - Chat events
server/src/handlers/chat.js
External Infrastructure
- Twilio TURN servers · Provides temporary relay candidates when direct WebRTC connectivity fails.
- Railway deployment · Hosts the deployable Node real-time server.
Connections 20
- Client entry → Application shell: boots
- Application shell → Landing flow: routes to
- Application shell → Watch room: routes to
- Landing flow → Session controls: starts sessions
- Session controls → Socket transport: uses
- Watch room → Synchronized player: hosts
- Watch room → Chat client: hosts
- Watch room → WebRTC media peers: selects stream mode
- Local file validation → Synchronized player: validates local media
- Socket transport → Server entry: Socket control plane
- Server entry → Session authority: registers
- Server entry → Sync and signaling: registers
- Server entry → Chat events: registers
- Session authority → Session IDs: generates
- Synchronized player → Sync and signaling: playback actions
- WebRTC media peers → Sync and signaling: offer/answer/ICE signaling
- Chat client → Chat events: chat events
- WebRTC media peers → Twilio TURN servers: obtains relay connectivity
- WebRTC media peers → WebRTC media peers: host-to-guest media · Direct peer media stream between browser participants.
- Railway deployment → Server entry: hosts