coderpad editor and repl

Coderpad is a website that provides a collaborative coding environment for interviews. There is an editor and means of running code, as well as built-in conferencing.

Looking through the JS bundle, which doesn’t have a publicly available sourcemap, didn’t yield anything of much interest. There is a large amount of logic handling the syntaxes of languages, probably related to the code editor.

Technologies

Examining the JS bundle, the website HTML, and the networks connections revealed that the following technologies are in use.

REPL

The frontend of the REPL uses xterm.js. A websocket connection ties the browser REPL to server. Each keypress is sent over the websocket connection. Additionally, when the user runs the code in their editor, it’s sent to the REPL server for evaluation.

The REPL server is a Docker container. From a little poking around (cat /proc/cpuinfo and cat /proc/meminfo) we see that the container is running on a host machine with 4 Xeon CPUs with 16GB of RAM. The Google owned IP address points to the containers running on Google Compute Cloud.

It’s not clear how the connection is made between the websocket and the container, but it’s reasonable to assume there is some daemon acting as a bridge.

According to the FAQs, the Docker containers have 512MB of RAM, two CPUs for 5 seconds, and one CPU after. There is a network bandwidth limit of 0.75MB. And for databases, upload is limited to 5MB of raw SQL.

Editor

The editor is Firepad, an editor built on Firebase. Firebase works to sync the editor contents between participants.

Firepad supports Ace and CodeMirror. Coderpad uses CodeMirror, which provides features like vim keybinds automatically.

Playback

coderpad playback

On playback, keystrokes are retransmitted through the Firebase websocket connection. Scrubbing through playback works on this data, without downloading and sending anything else.

Interview notes are not played back, but creation uses the same Firebase websocket.