SANYAM
SANYAMWADHWA.TECH :: PROJECT :: DUET --- SUMMARY ---TITLE............. Duet — Live Coding-Interview RoomDATE.............. November 2026CATEGORY.......... SystemsPROBLEM........... Most interview pads re-send the whole file on every keystroke, so two people typing at once overwrite each other. Duet sends each edit as an operation and transforms concurrent ones against each other, so every edit lands exactly once, even across a dropped connection.WHAT IT DOES...... A live coding-interview room where 2 to 4 people edit one file in the browser, see each other's cursors, and run the code against test cases. The sync engine underneath is my own operational transformation with a central server: no Yjs, ShareDB or Automerge. --- RESULT ---METRIC 1.......... 0 lost keystrokes (re-broadcast: 49%)METRIC 2.......... 1,300 edits/s, p95 under 3 msMETRIC 3.......... 30,000 convergence tests per push --- WHAT I BUILT ---HIGHLIGHT 1....... Own OT engine: retain, insert and delete operations with apply, compose and transform, a client state machine and a server document, checked by 30,000 randomized convergence tests on every push.HIGHLIGHT 2....... Measured on the live deploy against a whole-file re-broadcast baseline: with two people typing over a 90 ms network, re-broadcast lost 49% of keystrokes and Duet lost none, sending 54x fewer bytes per keystroke.HIGHLIGHT 3....... Load-tested the Node WebSocket server with 200 bot editors in 50 rooms: about 1,300 edits a second at p95 under 3 ms on a laptop. --- HOW IT WORKS ---STEP 1............ React + Monaco Front End (Vercel)STEP 2............ Editor ↔ OT BindingSTEP 3............ WebSocketSTEP 4............ Node Server (Docker on Render)STEP 5............ Server Document (transform + revision log)STEP 6............ Rooms of 2 to 4 with PresenceSTEP 7............ Supabase Postgres (saved rooms) --- FEATURES ---FEATURE 1......... 2 to 4 people edit the code and the problem statement together, each seeing the others' cursors in their own colourFEATURE 2......... Interviewer and candidate roles enforced by the server: the interviewer writes the problem, sets the test cases and runs the timerFEATURE 3......... Run JavaScript or Python against the test cases in the browser, and everyone in the room sees the resultFEATURE 4......... Reconnect without losing work: the page gets exactly what it missed, and every edit lands once, none lost and none doubledFEATURE 5......... Randomized TP1, compose and multi-client simulation tests, plus a real-browser exit test with up to four tabs typing at onceFEATURE 6......... Ships a naive re-broadcast mode beside OT, so the comparison can be rerun on the same transport --- STACK ---STACK............. TypeScript, Node.js, WebSocket, React, Monaco, Docker --- LINKS ---CODE.............. https://github.com/SanyamWadhwa07/duetDEMO.............. https://duet-six-rose.vercel.appHUMAN PAGE........ https://sanyamwadhwa.tech/projects/duet