Code Monkey home page Code Monkey logo

rce's Introduction

RCE

Remote Code Executor WebApp and API to execute code in docker containers. Developed with Socket.io, React, Dockerode.

Live Demo

Currently Suppored Languages

java8, java11, python2, python3, typescript, javascript, golang, c, c++

Development

Install dependencies in both backend / frontend

yarn install

cd frontend/

yarn install

Run Development Servers

# open two seperate terminals
# in backend server
yarn run start:dev

# in the other terminal
cd frontend/

yarn run watch

Environment Variables

DOCKER_SOCK=<socket to docker daemon | default is /run/docker.sock>
DOCKER_TIMEOUT=<time in ms for dockerode to timeout | default is 5000>
SERVER_PORT=<port for server to run | default is 3000>

Endpoints

GET /api/v1/runtimes 
POST /api/v1/execute

GET /api/v1/runtimes

[
  {
    "language": "java",
    "dockerImage": "openjdk:11-jdk-slim",
    "aliases": [
      "java11"
    ]
  },
  {
    "language": "python3",
    "dockerImage": "python:3-alpine",
    "aliases": [
      "py3"
    ]
  }
]

POST /api/v1/execute

Example request body

// java example
{
    "language": "java",
    "code": "public class Main { public static void main(String[] args) { System.out.println(\"Hello World\");}}",
    "filename":"Main.java"
}

// python example
{
    "language":"python3",
    "code":"print('hello world')",
    "filename":"test.py"
}

Example response

{
    "language": "java",
    "output": {
        "stdout": "Hello World\n",
        "stderr": ""
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.