CodeEditor: a collaborative pad for coding interviews

A website for coding interviews, built and run as a side project: interviewer and candidate edit the same code in real time, see each other's cursors, and run it on the server. It also has a problem bank with an automatic judge. The source is public.

Side project 2024 – 2026 Design, development and operations

137automated tests
29built-in problems with generated tests
4languages run in the sandbox
  • Django
  • Channels / WebSocket
  • Operational transformation
  • Sandboxing
  • Online judge
  • Open source
On this page

What it is

A remote coding interview needs three things in one place: a shared editor, a way to run the code, and the problem statement. CodeEditor puts them on one page. Creating a room takes one click; whoever has the link is in. There is nothing to install and no account is needed.

An interview room: the problem on the left, the shared code on the right, input and output below
An interview room. The highlighted selection and the name tag belong to the other participant.
  • Shared editor with remote carets and selections, and an undo that only undoes your own edits.
  • Run: the server compiles and runs the code and sends the output, CPU time and peak memory to everyone in the room.
  • Problem panel in Markdown. A problem can be sent to the room from the built-in bank or from the interviewer's own saved problems.
  • Shared timer, light and dark themes, and a layout for phones.

Keeping two editors in sync

The first version sent the whole text on every keystroke. That is simple, and it is wrong whenever two people type at once: the later message overwrites the earlier one, and the other person's cursor jumps. The current version uses operational transformation (OT).

Keystroke
Operationkeep / insert / delete, against revision n
Server transformsover everything accepted since n
Broadcast + acknowledge
Other editors apply itcarets stay put
  • One operation in flight. The browser waits for the acknowledgement of one operation and merges further edits into a buffer. Operations from the server are transformed over both before they touch the editor.
  • Undo is transformed too. The undo stack holds inverse operations, and every remote operation is transformed into them, so Ctrl+Z never removes the other person's text.
  • Reconnecting. The server keeps recent history, so a client that comes back only receives what it missed. If the server was restarted in between, the client merges three ways, with the last confirmed text as the common ancestor.
  • Two implementations, one behaviour. The server side is Python and the browser side is JavaScript. Both count lengths in UTF-16 code units, so an emoji does not shift positions.

Running other people's code

The site runs whatever a visitor types. Each run goes through a small stand-alone launcher process:

  • its own throw-away directory and a clean environment;
  • limits on CPU time, address space, file size and open files, plus a wall-clock timeout that kills the whole process group;
  • output written to size-capped files, so a flood can neither block nor fill the server process;
  • when the service runs as root: a separate unprivileged user for each concurrent run, a limit on the number of processes, and an empty network namespace.

Problem bank and judge

29 built-in problems, each with a statement, samples, hidden tests and a reference solution. The expected outputs are produced by running the reference solution when the problems are loaded, so statement, tests and solution cannot drift apart. A submission is compiled once and run against every test; the page shows a verdict per test, with input and output for the sample cases only.

A problem page: statement on the left, editor and console on the right
A problem page: statement, editor, and a console for custom input and judge results.

How it is verified

  • Cross-checked OT. The Python and JavaScript implementations get the same random operations and must produce identical results.
  • A simulator for the client. Several simulated browsers edit at random, messages arrive in random order, connections drop and come back, users undo. At the end every client must hold exactly the server's text. Deliberately broken variants of the code are caught by it.
  • Every reference solution is judged for real as part of the test-suite.
  • The root code path of the sandbox (user switch, network cut-off, clean-up) is run as root in a throw-away container.

Design notes

  • Send what changed, not the document. Whole-document sync does not survive two people typing; small operations that can be transformed do.
  • Measure the child, not the server. A forked child starts with a copy of its parent's pages, so memory read from the web process describes the web process. The launcher forks once more and reports the usage of exactly the program.
  • Test the clean-up as hard as the run. A program that creates thousands of nested directories must not be able to block later runs; there is a test for it.

The 2026 rewrite (collaboration protocol, sandbox, problem bank, interface) was developed with an AI coding assistant.