Alexandru Curiman

Write Go in the browser and run it in seconds. Each run is compiled in its own Docker container with time and memory limits, and the output streams into a console as the program prints it.

Year
2024
Role
design, backend, frontend
Status
live

Overview

Write Go in the browser, hit run, and watch the output stream back into a console. The ACE editor handles syntax highlighting and indentation, and a format button runs gofmt on your snippet so it always looks like idiomatic Go.

Every run is compiled and executed inside a short-lived Docker container with strict time and memory limits, so arbitrary code can be tried safely. Each session gets its own container, so users never interfere with each other.

I built it to have a scratchpad I could open from any machine while learning the language, and it has since become my default place to test small ideas before they land in a real project.

Features

Under the hood

  1. The frontend posts the code to the Go server, which is built on the standard library and the chi router.
  2. The server writes the snippet into a per-session Docker container and runs it with resource limits.
  3. Output is read from the container and streamed back to the browser as it is produced.
  4. Containers are reaped when the session ends or the time limit is hit, so nothing lingers on the host.

Built with

  • Go
  • chi
  • Docker
  • ACE editor
  • JavaScript

What I learned

  • Running untrusted code safely is mostly about limits: CPU, memory, time, network and filesystem.
  • Streaming output instead of buffering it changes how the tool feels, even for programs that finish in milliseconds.
  • Keeping the frontend to one page with no framework made it easy to come back to months later.