# Julia online compiler

**URL:** <https://discourse.julialang.org/t/julia-online-compiler/122782>\
**Category:** Tooling\
**Created:** [November 18, 2024, 4:10pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782 "2024-11-18T16:10:01Z")\
**Posts on this page:** 17\
**Page:** 3

<div class="post-metadata">

**Author:** ![Eben60](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/eben60/32/13475_2.png) [@Eben60](https://discourse.julialang.org/u/Eben60)\
**Post date:** [November 20, 2024, 3:10pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/41 "2024-11-20T15:10:42Z")

</div>

> [@hack3rcon](#):
>
> How do I notify the core Julia developers?

Why that?

It’s open source! You just buy a domain, rent and setup a server, and provide access to those who want play with Julia online compiler. 😉

In the meanwhile the core Julia developers can continue to work on improvement of Julia for the rest of us. They still have a lot to do.

P.S. Sorry, just a bit allergic towards

> [@hack3rcon](#):
>
> It doesn’t cost much

if it’s about other peoples money.

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Post date:** [November 24, 2024, 6:48am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/42 "2024-11-24T06:48:17Z")

</div>

Hi,  
So how did the Rust-Lang team do it?

---

<div class="post-metadata">

**Author:** ![xiaoxi](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Post date:** [November 24, 2024, 7:17am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/43 "2024-11-24T07:17:32Z")

</div>

> [@hack3rcon](#):
>
> how did the Rust-Lang team do it?

Rust’s playground has several limitations.

> ### Network
> 
> There is no network connection between the compiler container and the outside world.
> 
> ### Memory
> 
> The amount of memory the compiler and resulting executable use is limited by the container.
> 
> ### Execution Time
> 
> The total compilation and execution time is limited by the container.
> 
> ### Disk
> 
> This sandbox **does not** provide any disk space limits. It is suggested to run the server such that the temp directory is a space-limited. One bad actor may fill up this shared space, but it should be cleaned when that request ends.

It’s unclear how much the Rust Foundation spends on the Rust playground, but the Rust Foundation’s 2023 report reveals that they spend about $400,000 on infrastructure. While I could imagine that most of the money goes to compiling crates, I don’t expect the Rust playground to be cheap.

> **[Rust Foundation](https://foundation.rust-lang.org/news/rust-foundation-annual-report-2023/)**
>
> The Rust Foundation is an independent non-profit organization to steward the Rust programming language and ecosystem, with a unique focus on supporting the set of maintainers that govern and develop the project.

Running Julia directly in the browser would provide more opportunities. We just have to wait a little longer.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [November 24, 2024, 8:38am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/44 "2024-11-24T08:38:45Z")

</div>

> [@hack3rcon](#):
>
> So how did the Rust-Lang team do it?

Do what exactly? If you mean their Rust playground, then I only know what the developers have written on their README and a few forum threads. If you want to learn how to implement your own playground for Rust or possibly another AOT-compiled language, you should contact the playground’s maintainers or ask Rustaceans in a Rust forum.

If you mean an online REPL with JIT compilation, then they never did that. My point was that Julia has fundamental differences, so many of the Rust playground’s approaches like its user limitations will not work. The upcoming AOT-compiled juliac might be similar enough to use the same approach, but its limitations will be the opposite of beginner-friendly. It’s better to instead research successful online REPLs for other languages with a heavily used built-in REPL.

Another option is that some online “compilers” run (mostly) interpreted languages by closing sessions after executing a script once, so the user cannot interact with the REPL. While less common for languages with REPLs, it’s idiomatic and friendly enough for beginners, and the user limitations might be easier. JuliaScript.jl or something similar can be used to save compilation for reruns of scripts with no edits, which will be more beneficial in Julia than most interpreted languages.

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [November 26, 2024, 8:47pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/45 "2024-11-26T20:47:42Z")

</div>

I took a stab at this:

![julia-playground](https://global.discourse-cdn.com/julialang/original/3X/b/f/bfcff8bc5a56c00084f308f92e9dbaf4d4335da8.gif)

(If you right-click the .gif and open it in a new tab, it’s much easier to see)

The frontend is a Vue.js app that incorporates a [Monaco Editor](https://microsoft.github.io/monaco-editor/). It sends the code to a Node.js API which executes it in a Docker container and returns the result back to the frontend app. Here are the repos:

- [GitHub - mthelm85/julia-playground-frontend](https://github.com/mthelm85/julia-playground-frontend)
- [GitHub - mthelm85/julia-playground-api](https://github.com/mthelm85/julia-playground-api)

The Dockerfile is in the repo with the API.

I’d be more than happy to invest time in this project if anyone is seriously interested in trying to stand this up, but there are a ton of issues that would have to be worked out. For example, I think you would want to have a preloaded set of packages in the Docker image for it to be a nice experience. There is also plenty to discuss regarding security and scalability of this approach. And then the elephant in the room is obviously funding. Running this wouldn’t be free and somebody would have to be willing to pay for it…

To run this locally, you would do the following:

1. Make sure you have Node.js and Docker installed.
2. Clone the repos
3. For the web app, run `npm install` to install the dependencies, then `npm run dev` to run the app on localhost.
4. For the API, you would first need to build the Docker image from the included Dockerfile, then run `npm install` to install the dependencies and, finally, start the API with `node index.js`.

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Post date:** [November 27, 2024, 9:37am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/46 "2024-11-27T09:37:42Z")

</div>

Hi,  
I think it’s worth spending money on this because it will help grow the Julia community.

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discourse.julialang.org/u/hack3rcon)\
**Post date:** [November 27, 2024, 9:39am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/47 "2024-11-27T09:39:22Z")

</div>

Hi,  
Why Docker? Containers have some problems. For example, installing packages in containers is not very easy and you have to build your own image. I think a virtual machine in Xen is both fast and secure.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [November 27, 2024, 10:18am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/48 "2024-11-27T10:18:45Z")

</div>

> [@hack3rcon](#):
>
> I think it’s worth spending money on this because it will help grow the Julia community.

Who’s money, more exactly, do you want to spend?

---

<div class="post-metadata">

**Author:** ![xiaoxi](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@xiaoxi](https://discourse.julialang.org/u/xiaoxi)\
**Post date:** [November 27, 2024, 11:06am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/49 "2024-11-27T11:06:45Z")

</div>

> [@hack3rcon](#):
>
> I think it’s worth spending money on this because it will help grow the Julia community.

A website to teach Julia using Julia in WASM similar to Rustfinity would have greater impact and lower cost.

> **[Rustfinity | Learn and Practice the Rust Programming Language](https://www.rustfinity.com)**
>
> Rustfinity is a platform to learn and practice the Rust programming language. It provides a collection of tutorials, exercises, challenges, and many other features to help you learn Rust.

We must be more patient until Julia in WASM can be used in production.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [November 27, 2024, 11:57am UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/50 "2024-11-27T11:57:31Z")

</div>

Note there’s already (and we sort of compete with that unsuccessfully…):

> **[VS Code and WebAssemblies](https://code.visualstudio.com/blogs/2023/06/05/vscode-wasm-wasi)**
>
> Running WebAssemblies in VS Code for the Web.

> VS Code for the Web ([https://vscode.dev](https://vscode.dev)) has been available for some time now and it has always been our goal to support the full edit / compile / debug cycle in the browser. […] It is harder for other languages since we must be able to execute (and therefore debug) the code. For example, to run Python source code in a browser, there needs to be an execution engine that can run the Python interpreter. […] To find out what is possible with WebAssemblies today, we decided to take a Python interpreter written C/C++, compile it to WebAssembly, and run it in VS Code for the Web.

I believe the VS Code is cut-down, and maybe even Python in it too (but not too much).

Julia has already been run in WebAssembly. Julia is huge so it’s slower to start, but it can be cut down a lot, e.g. OpenBLAS left out (was done that way already?).

LinearAlgebra.jl is not longer part of Julia, or its repo, at least. I think cutting out as much as possible, and making it work that way for a start is a good goal, without VS Code, then with.

Even though mthelm85’s demo for Julia on the web, just posted here was cool, it wasn’t really on the web only, since connecting to a server, i.e. using Docker there, and we should just not try, too hard (IMHO), to make such a playground work, to eliminate all the (server) costs.

Running in WebAssembly, i.e. in the browser, mean more development cost, but worth it since it’s work we want to day anyway, make Julia even smaller, for small binaries, already making huge progress there. All web browsers support GC now for WebAssemly, in case we want to adopt it, not provide our own GC, and I see there’s also some work to allow exceeding the 4 GB limit.

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [November 27, 2024, 1:21pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/51 "2024-11-27T13:21:50Z")

</div>

JuliaHub seems to provide some kind of Julia IDE, with VS Code or Pluto, as part of its cloud products. I believe there’s a free tier once one is logged into JuliaHub, not sure how much compute does the free tier offer. These seems to be the docs:

> **[Julia IDE · JuliaHub](https://help.juliahub.com/juliahub/stable/tutorials/julia_ide/)**
>
> Documentation for JuliaHub.

---

<div class="post-metadata">

**Author:** ![roflmaostc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/roflmaostc/32/30123_2.png) [@roflmaostc](https://discourse.julialang.org/u/roflmaostc)\
**Post date:** [November 27, 2024, 1:46pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/52 "2024-11-27T13:46:57Z")

</div>

> [@hack3rcon](#):
>
> I think it’s worth spending money on this because it will help grow the Julia community.

If I’m really interested in a language, I just install it. I certainly don’t contribute to grow the language by using a restricted online tool.

To make Julia grow, I need to install it locally anyway. And with juliaup (or downloading the portable) it takes less than 2min to install Julia on any machine (no admin rights required).

For me, I believe more newcomers are impressed by pages like

> **[The Newton Method — Interactive Computational Thinking — MIT](https://computationalthinking.mit.edu/Fall24/images_abstractions/newton_method/)**
>
> This lecture explains a method for finding the root of a function, but using code an illustrations instead of a chalkboard! We will illustrate the Newton method using the ForwardDiff.jl package to carry out automatic differentiation, but we will also...

which are based on PlutoSliderServer.jl.

---

<div class="post-metadata">

**Author:** ![JM\_Beckers](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jm_beckers/32/22482_2.png) [@JM\_Beckers](https://discourse.julialang.org/u/JM_Beckers)\
**Post date:** [November 27, 2024, 1:58pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/53 "2024-11-27T13:58:59Z")

</div>

I actually see an interest for an online tool when I’m traveling without my computer but with a smartphone. Having access to an online tool would allow me to quickly test/develop code snippets which I can then later incorporate in my main system.

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [November 27, 2024, 2:42pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/54 "2024-11-27T14:42:26Z")

</div>

Github Codespaces?

---

<div class="post-metadata">

**Author:** ![mthelm85](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mthelm85/32/224164_2.png) [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Post date:** [November 27, 2024, 4:15pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/55 "2024-11-27T16:15:12Z")

</div>

> [@hack3rcon](#):
>
> Why Docker? Containers have some problems. For example, installing packages in containers is not very easy and you have to build your own image. I think a virtual machine in Xen is both fast and secure.

It’s just what I know how to do - no other reason. I didn’t mention in my post that every request made by the frontend to the API spins up a new container, executes the code, then kills the container. I was quite pleased with how quickly it can do so for code that only uses pre-loaded packages. The only problem I found executing code that `Pkg.add`s stuff is that it takes much longer (as you would expect). Other than that, installing packages worked fine.

I’ve read in a few places that VMs are more secure, but that they are generally slower to spin up/down than containers…I don’t have any experience with that though.

I was hoping to be able to get a live demo that everyone could access, but all the cloud providers want your credit card number for “free tier” accounts and I also couldn’t find any cloud provider that allows you to set a limit on the amount of cost that an app can incur. For example, I’d love to get all this running in the cloud if I could limit my monthly expenses to an amount I’m comfortable with, and the service would just become unavailable after that point…the only thing I found is the ability to receive notifications when you reach a certain amount. I don’t want that though, I want an automatic kill switch.

---

<div class="post-metadata">

**Author:** ![benz0li](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benz0li/32/37040_2.png) [@benz0li](https://discourse.julialang.org/u/benz0li)\
**Post date:** [November 27, 2024, 5:48pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/56 "2024-11-27T17:48:30Z")

</div>

> [@mthelm85](#):
>
> I was hoping to be able to get a live demo that everyone could access

@mthelm85 Check out [https://demo.jupyter.b-data.ch](https://demo.jupyter.b-data.ch)  
→ Resources are limited to 2 cores and 8 GB RAM.

Cross reference: [JupyterLab + code-server + Julia](https://discourse.julialang.org/t/jupyterlab-code-server-julia/82808)

---

<div class="post-metadata">

**Author:** ![benz0li](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/benz0li/32/37040_2.png) [@benz0li](https://discourse.julialang.org/u/benz0li)\
**Post date:** [November 27, 2024, 5:56pm UTC](https://discourse.julialang.org/t/julia-online-compiler/122782/57 "2024-11-27T17:56:28Z")

</div>

[https://demo.jupyter.b-data.ch](https://demo.jupyter.b-data.ch) is a _reference deployment_ of [b-data / Docker / Deployments / Jupyter · GitLab](https://gitlab.com/b-data/docker/deployments/jupyter) serving [`glcr.b-data.ch/jupyterlab/julia/pubtools`](https://gitlab.com/b-data/jupyterlab/julia/docker-stack) amongst others.

There are also Julia-based [Data Science dev containers](https://github.com/b-data/data-science-devcontainers) for use with [VS Code](https://code.visualstudio.com/docs/devcontainers/containers) (local/‘remote SSH’) and [GitHub Codespaces](https://docs.github.com/en/codespaces/developing-in-a-codespace/creating-a-codespace-for-a-repository?tool=webui#creating-a-codespace-for-a-repository) (web browser).

[Previous page](https://discourse.julialang.org/t/julia-online-compiler/122782.md?page=2)
