Giter Site home page Giter Site logo

gargpk / online_judge_api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from judge0/judge0

0.0 1.0 0.0 630 KB

Web API for code compilation and execution.

Home Page: https://api.judge0.com/

License: GNU General Public License v3.0

Dockerfile 0.41% Ruby 33.18% HTML 66.09% Shell 0.32%

online_judge_api's Introduction

Judge0 API

License: GPL v3 Donate

About

Judge0 API is an web API for code compilation and execution. Complete and detailed API documentation is available on https://api.judge0.com.

Content

  1. Supported Languages
  2. Project Organization
  3. Production Setup
  4. Development Setup
  5. Who Uses Judge0 API?
  6. About Docker Images
  7. Adding New Compiler or Interpreter

Supported Languages

# Name
1 Bash (4.4)
2 Bash (4.0)
3 Basic (fbc 1.05.0)
4 C (gcc 7.2.0)
5 C (gcc 6.4.0)
6 C (gcc 6.3.0)
7 C (gcc 5.4.0)
8 C (gcc 4.9.4)
9 C (gcc 4.8.5)
10 C++ (g++ 7.2.0)
11 C++ (g++ 6.4.0)
12 C++ (g++ 6.3.0)
13 C++ (g++ 5.4.0)
14 C++ (g++ 4.9.4)
15 C++ (g++ 4.8.5)
16 C# (mono 5.4.0.167)
17 C# (mono 5.2.0.224)
18 Clojure (1.8.0)
19 Crystal (0.23.1)
20 Elixir (1.5.1)
21 Erlang (OTP 20.0)
22 Go (1.9)
23 Haskell (ghc 8.2.1)
24 Haskell (ghc 8.0.2)
25 Insect (5.0.0)
26 Java (OpenJDK 9 with Eclipse OpenJ9)
27 Java (OpenJDK 8)
28 Java (OpenJDK 7)
29 JavaScript (nodejs 8.5.0)
30 JavaScript (nodejs 7.10.1)
31 OCaml (4.05.0)
32 Octave (4.2.0)
33 Pascal (fpc 3.0.0)
34 Python (3.6.0)
35 Python (3.5.3)
36 Python (2.7.9)
37 Python (2.6.9)
38 Ruby (2.4.0)
39 Ruby (2.3.3)
40 Ruby (2.2.6)
41 Ruby (2.1.9)
42 Rust (1.20.0)
43 Text (plain text)

Project Organization

Judge0 API is a Rails 5 application organized in two major components:

  • Rails API
    • accepts requests and creates background jobs for Worker.
  • Worker
    • accepts new jobs and process them as they arrive. Worker has only one job - IsolateJob, that job runs untrusted programs in sandboxed environment.

Production Setup

Every release has it's own deployment procedure that you can follow.

Development Setup

Setting up your development environment is easy thanks to Docker and Docker Compose. So please install those before continuing.

Because we are running our development environment in Docker you don't need to have Ruby, Rails, PostgreSQL, Redis, etc. installed on your computer. You just need to:

  1. Pull judge0/api image:
    $ docker pull judge0/api
    
  2. Copy judge0-api.conf.default to judge0-api.conf.
  3. Run development shell (it will take a while only first time):
    $ ./scripts/dev-shell
    

scripts/dev-shell script will open you new development shell always in the same container, and if container doesn't exist it will create one for you.

You need to run Rails API and Worker in order to have Judge0 API fully operational:

  1. Open new development shell and in there run Rails API server:
    $ ./scripts/dev-run-server
    
  2. Open new development shell again and in there run Worker process:
    $ ./scripts/dev-run-worker
    
  3. Open http://localhost:3000 in your browser.

This is minimal setup for development environment, now you can open your favorite editor in your host and start developing Judge0 API.

Who Uses Judge0 API?

Following applications successfully use Judge0 API in production:

Do you use Judge0 API? If so, please let me know so I can add you to the list!

About Docker Images

This project has two Dockerfiles:

  1. Dockerfile

    • builds judge0/api:latest image
  2. Dockerfile.dev

    • build judge0/api:dev image

judge0/api:latest is built FROM judge0/api-base:latest image which contains installed compilers and sandbox environment. This image represents production image of Judge0 API.

judge0/api:dev is your local development image built FROM judge0/api:latest. It is not pushed to Docker Hub. That is why you first need to pull judge0/api:latest before building your development environment.

Adding New Compiler or Interpreter

To add new compiler or interpreter you first need to install it into Judge0 API Base image. Instructions on how to do that can be found in documentation for Judge0 API Base.

After you have added your favorite compiler/interpreter to Judge0 API Base image you need to define how this compiler/interpreter is used. This is done in db/seeds.rb file.

You have four attributes:

  • name - name of your language you are supporting, include also compiler name and version
  • source_file - in what file should user's source code be saved before it is compiled
  • compile_cmd - how this file is compiled, interpreted languages won't have this attribute
  • run_cmd - how should we run this compiled or interpreted language

We already provided enough examples for most common languages, be sure to check that out.

Donate

If you like Judge0, please consider making a donation to support this project.

online_judge_api's People

Contributors

aashish-ak avatar alan-navarro96 avatar hermanzdosilovic avatar

Watchers

 avatar

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.