Inspiration

Learning to code is tough. But, it's made better and more fun with your friends.

With the onset of COVID-19, our peers have never felt further apart. We built Discode to gamify the experience of learning to code with those close to you over a famed platform: Discord.

What it does

Discode serves as an end-to-end solution to participate in collaborative Python 3 challenges with friends. It offers the following:

  • An extensible set of basic programming questions
  • A robust remote code execution framework
  • Native support for interactions through Discord's API

How we built it

Discode has two main facets: the Discord bot and the remote code execution engine.

Discord.js is a powerful framework for scripting interactions with Discord servers, and acts as a CLI of sorts. We provide the following:

  • A well-defined interaction scheme (~help for more information)
  • Channel cleanup following challenge completion (gotta keep them servers clean!)
  • An awesome logo

The workhorse of the system is our remote code execution engine for Python3. Here's a brief rundown of what makes Discode work under the hood:

  • A Redis cache to keep track of the status of code execution jobs (useful for long-running questions that could be implemented later)
  • A containerized RabbitMQ messaging utility allows for deferred processing of jobs in an ordered manner
  • An Ubuntu virtual machine hosted in Google Cloud Platform
  • An Express.js web server that acts as the mesh between Discode and the code execution pipeline

Challenges we ran into

Here's a few:

  • In hindsight, dealing with "vanilla" Node.js APIs for fetching was cumbersome due to versioning issues
  • Setting aside a static IP address for the virtual machine
  • Lots of API keys pushed to public repos (woops)
  • Certain languages require a lot of work to run code (compiling java and C++, for example), which caused us to limit the project to Python3 for now

Accomplishments that we're proud of

The fact that this thing works at all. It's a bit of a hodge-podge to say the least, but our team learned a TON from doing this.

What we learned

Well, here's a short list:

  • Managing child processes, and performing adequate cleanup to make sure we don't exhaust resources
  • Maintaining consistent execution environments with docker-compose (more clutch than Damian Lillard)
  • Proper splitting of application logic between sync and async components
  • Testing our code before pushing it (shocking)
  • We need sleep

What's next for Discode

  • More languages
  • A robust schema for giving input (not defaulting to stdin)
  • Coordinating server-wide challenges that run in parallel
  • IPO
Share this project:

Updates