CodeCube is a new service and open source project that aims to improve collaboration by allowing developers to both share and run code samples in a secure manner via the browser.
The initial release of the service, available at codecube.io, supports sharing and running of Ruby, Python, Go and C code. Creator Harry Marr has also released it as an open-source project on GitHub, though without any specific license.
In a recent post announcing the project, Harry noted that many development communities collaborate and share code using Gists, a service from GitHub that allows the sharing of snippets and pastes of code. However, Gists do not have the ability to be run without first downloading and setting up the shared code locally. As Harry states, “Reproducing the output is often extremely difficult, as it can be hugely dependent on the environment the code was run in.”
In creating CodeCube, Harry was inspired by similar tools used by developers in Go (Go Playground) and in JavaScript (JSFiddle) that allow users to run the code entered within the editor. He aimed to recreate this for other languages, but had to overcome the security complications of running arbitrary, user-submitted code on the server.
In order to overcome this security limitation, CodeCube relies on an open source project called Docker. As Harry explains:
[Docker] enables creation and teardown of relatively secure sandboxed environments in a fraction of a second. Each time a code snippet is run, a docker container can be created, started, used to run the untrusted code, then killed and destroyed.
While the CodeCube service and project are already available, future updates are planned to include user authentication, collaborative editing, additional language support and an improved user interface.
Reaction to the announcement has been almost universally positive on Hacker News and across Twitter, where it received the most attention.