# Hosting Web Apps in Julia

**URL:** <https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063>\
**Category:** General Usage\
**Tags:** package, webapps\
**Created:** [December 20, 2016, 4:36pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063 "2016-12-20T16:36:52Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 23, 2016, 7:28pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/41 "2016-12-23T19:28:20Z")

</div>

You mentioned something about deploying to gh-pages. But can that actually do any of the Julia parts, or would it just be a preview of the layout?

---

<div class="post-metadata">

**Author:** ![amellnik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amellnik/32/137_2.png) [@amellnik](https://discourse.julialang.org/u/amellnik)\
**Post date:** [December 23, 2016, 7:46pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/42 "2016-12-23T19:46:35Z")

</div>

It just serves a copy of the front-end site to [https://amellnik.github.io/JuliaAPIDemo/](https://amellnik.github.io/JuliaAPIDemo/) so you can access it there instead of at `localhost:4200`. However, there’s not much point in using it until we have a production back-end. You can use it to point at the development back-end running at `localhost:7777` but this will throw an error at the moment because the back-end only works with `http` and the front with `https` (although I can set up the front end to do `http` on one of my domains later today). You would also need to modify [this line](https://github.com/amellnik/JuliaAPIDemo/blob/master/api/srvr.jl#L8) in `srvr.jl` to accept connections from wherever the front-end is served from – right now it assumes the development front-end.

I’m starting to look at setting up an AWS lambda or Heroku app that will run a production back-end now, but it’s going to take a bit of doing, and unless someone beats me to it, I may not have it going until after the holidays.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 23, 2016, 11:05pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/43 "2016-12-23T23:05:19Z")

</div>

Sounds great. I got the plot margins fixed up, so now it’s looking great.

 ![](https://global.discourse-cdn.com/julialang/original/3X/9/2/92777047142bbd6195b393e00a9276cf7380caf5.png)

I’ll keep tweaking this, but we should take this to the issues on the repositories now. I think that the JuliaWebAPI is great and very easy to use. I’ll chat around and see if we can get any help hosting this, but please take your time: we are in no rush here (but it is super cool).

However, if others have alternative solutions, feel free to share.

---

<div class="post-metadata">

**Author:** ![codeneomatrix](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/codeneomatrix/32/21859_2.png) [@codeneomatrix](https://discourse.julialang.org/u/codeneomatrix)\
**Post date:** [December 24, 2016, 7:07am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/44 "2016-12-24T07:07:03Z")

</div>

It’s possible to use heroku:  
[https://github.com/pinx/heroku-buildpack-julia](https://github.com/pinx/heroku-buildpack-julia)

There is also the Julia Openshift Cartridge:  
[https://github.com/codeneomatrix/julia-cartridge](https://github.com/codeneomatrix/julia-cartridge)

Which is operating in this direction:  
[http://julia-tareaito.rhcloud.com/](http://julia-tareaito.rhcloud.com/)

---

<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:** [January 4, 2017, 1:16pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/45 "2017-01-04T13:16:39Z")

</div>

> [@tshort](#):
>
> At one point, Rust compilation used special LLVM passes. I don’t know if that’s needed anymore.

I googled for status:

[https://github.com/mdenchev/langlang/issues/1](https://github.com/mdenchev/langlang/issues/1)

Found also:

> **[Compiling to the web with Rust and emscripten](https://users.rust-lang.org/t/compiling-to-the-web-with-rust-and-emscripten/7627)**
>
> Hey there, you slithery Rustilian. Have you heard the good word? Rust can now target asm.js and WebAssembly (wasm) via emscripten. That means you can run Rust code on the web, and this capability is available on Rust nightlies right now! Let me...

“Have you heard the good word? Rust can now target asm.js and WebAssembly (wasm) via  
emscripten.” [Note, below in Rust 1.14, said to be “experimental”.]

And; didn’t look into:

> **[GitHub - jauhien/iron-kaleidoscope: LLVM tutorial in Rust language](https://github.com/jauhien/iron-kaleidoscope)**
>
> LLVM tutorial in Rust language. Contribute to jauhien/iron-kaleidoscope development by creating an account on GitHub.

“Everything works”

Rest is not directly related to [only[ web/Julia, just interesting, and might be an indirect way to target the web or compiling to assembly in general:

[http://notes.willcrichton.net/rust-the-new-llvm/](http://notes.willcrichton.net/rust-the-new-llvm/)  
“Rust compiles to LLVM” [but stated other way around better] “Rust in this kind of ecosystem offers five primary advantages over LLVM:”

[and disadvanages]

“2. The story for dynamic languages needs refinement. Specifically, it needs a battle-hardened GC (as far as I know, there’s really only one major attempt so far).” [rust-gc]

“To my knowledge, Lia is the first major language that actually compiles directly to Rust.”

[competitor to Julia?]

> **[GitHub - willcrichton/lia: A high-level language for Rust](https://github.com/willcrichton/lia)**
>
> A high-level language for Rust. Contribute to willcrichton/lia development by creating an account on GitHub.

“Lia is a dynamically typed and garbage collected programming language that seamlessly interopts with Rust by using Rust as a compile target.”

one advantage, not for web…, just released Rust 1.14 has over Julia (LLVM?):

> **[Announcing Rust 1.14 | Rust Blog](https://blog.rust-lang.org/2016/12/22/Rust-1.14.html)**
>
> Empowering everyone to build reliable and efficient software.

“MIPS  
and  
s390x-unknown-linux-gnu”

Didn’t look into new MIR for Rust, or if it’s an alternative compiler target:

> **[Introducing MIR | Rust Blog](https://blog.rust-lang.org/2016/04/19/MIR.html)**
>
> Empowering everyone to build reliable and efficient software.

---

<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:** [January 4, 2017, 1:29pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/46 "2017-01-04T13:29:10Z")

</div>

> [@Tem\_Pl](#):
>
> I’d just be happy compiling a small escher web app with a server side backend.

Not sure what you mean, are you answering

1. as you want Julia compiled to JS, or just work in a browser? Escher already makes JS for you (you do not have to write it is CSS or HTML, as far as I understood). It’s just not arbitrary JS generated from Julia.

2. or asking about “server backend”? It has that, but not a possibility of a separate, e.g. Apache as Genie.jl does.

---

<div class="post-metadata">

**Author:** ![Tem\_Pl](https://avatars.discourse-cdn.com/v4/letter/t/8dc957/32.png) [@Tem\_Pl](https://discourse.julialang.org/u/Tem_Pl)\
**Post date:** [January 4, 2017, 3:52pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/47 "2017-01-04T15:52:09Z")

</div>

> [@Palli](#):
>
> n used special LLVM passes. I don’t know if that’s needed anymore.
> 
> I googled for status:

The JS still has to be dynamically generated at the server and sent back.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 17, 2017, 9:41pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/48 "2017-01-17T21:41:29Z")

</div>

For anyone who is curious about where this has ended up, here’s the application:

[http://app.juliadiffeq.org/](http://app.juliadiffeq.org/)

and here’s a blog post about it:

> **[Building a Web App in Julia: DifferentialEquations.jl Online - Stochastic...](http://www.stochasticlifestyle.com/building-web-app-julia-differentialequations-jl-online/)**
>
> Web apps are all the rage because of accessibility. However, there are usually problems with trying to modify some existing software to be a web app: specifically user interface and performance. In order for a web application to perform well, it must...

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [January 17, 2017, 10:57pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/49 "2017-01-17T22:57:10Z")

</div>

This is awesome, @ChrisRackauckas. I’ll definitely look back on this as a reference if I need to host Julia computation in the future. Thanks for the great project and writeup!

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 14, 2017, 9:28am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/50 "2017-03-14T09:28:51Z")

</div>

This is really good. Thank you.

I’d like however to add one perspective I suspect a lot of non-technical people would share:

Being able to build a webapp for your package is a very attractive feature. It would be very useful to have some bare-bones, ultra simple, dumbed-down tutorial that includes some but not all of the components from this project. Maybe a simple sin plot with some input from the user?

My point is that there are scores of scientists that built some cool package they’d like to share in the form of a webapp, but very few of them built a webapp before. They (read: me) don’t know much about the terminology and parts involved in building and deploying a webapp. While this project demonstrates how this can be done, its level of complexity prevents these users from replicating it.

Imagine a template where the user could just replace the sin function with her own, adding or subtracting simple features, and following dumbed-down instructions on how to deploy it all on some standard server (e.g. aws). THAT would elevate the functionality of this effort tremendously!

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [March 14, 2017, 10:15am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/51 "2017-03-14T10:15:38Z")

</div>

+1 to this. It’s the case for me as well but I guess it’s pretty general in research environments. My overall feeling is that for simple stuff the (amazing) package Interact.jl can take care of all the interactivity, without needing to know anything about web programming (javascript html etc…). As soon as it gets more complicated than that it’s not so clear how to proceed. Escher.jl seemed ideal but it doesn’t seem recommended anymore. I could really use a tutorial on “build a webapp for dummies”.

---

<div class="post-metadata">

**Author:** ![amellnik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amellnik/32/137_2.png) [@amellnik](https://discourse.julialang.org/u/amellnik)\
**Post date:** [March 21, 2017, 3:52pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/52 "2017-03-21T15:52:56Z")

</div>

I’ve been planning a package to do just this, and will try to have a minimal working package with a lot of documentation within the next week and a half. My eventual goal is that you should be able to call a single function like

```julia
microservice("my_fn", (x, y) -> x + 2*y)

```

and then be able to go to [http://some.url/my\_fn#?x=2?y=2](http://some.url/my_fn#?x=2?y=2) to get a JSON representation of the output. Doing this for base will be easy, but making it adaptable enough to work for arbitrary packages will be tricky.

---

<div class="post-metadata">

**Author:** ![wookyoung](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wookyoung/32/157_2.png) [@wookyoung](https://discourse.julialang.org/u/wookyoung)\
**Post date:** [March 23, 2017, 3:39pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/53 "2017-03-23T15:39:11Z")

</div>

Here is the example on the REPL using Bukdu.

To get the master branch by  
`Pkg.clone("https://github.com/wookay/Bukdu.jl")`

```julia
julia> importall Bukdu

julia> type CalculateController <: ApplicationController
           conn::Conn
       end

julia> function my_fn(c::CalculateController)
           q = c[:query_params]
           x, y = map(v -> parse(Int, v), (q[:x], q[:y]))
           render(JSON, x + 2*y)
       end
my_fn (generic function with 1 method)

julia> Router() do
           get("/my_fn", CalculateController, my_fn)
       end

julia> Bukdu.start(8080)
INFO Listening on http://127.0.0.1:8080

```

Now you can request as  
[http://127.0.0.1:8080/my\_fn?x=2&y=3](http://127.0.0.1:8080/my_fn?x=2&y=3)

thanks.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 23, 2017, 3:51pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/54 "2017-03-23T15:51:36Z")

</div>

Looks great!

> [@wookyoung](#):
>
> Now you can request as

I would like to see that example in the repo somewhere. From the repo example in the README, I cannot see how one would do such a request.

> Bukdu can be deployed on Heroku. Go to the demo site ([https://bukdu.herokuapp.com](https://bukdu.herokuapp.com)).

It would be more helpful to give a step by step for this. The deployment part is tricky, and you already found out how to do it!

---

<div class="post-metadata">

**Author:** ![datnamer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/datnamer/32/3471_2.png) [@datnamer](https://discourse.julialang.org/u/datnamer)\
**Post date:** [March 23, 2017, 5:35pm UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/55 "2017-03-23T17:35:53Z")

</div>

I’m also looking for azure hosting instructions. Anyone know if the Data Science VM can be used out of the box for this purpose?

---

<div class="post-metadata">

**Author:** ![wookyoung](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wookyoung/32/157_2.png) [@wookyoung](https://discourse.julialang.org/u/wookyoung)\
**Post date:** [March 24, 2017, 4:17am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/56 "2017-03-24T04:17:41Z")

</div>

I’m thinking of a better way such as having `conn::Conn` in the controller.  
would you mind post an issue to the Bukdu repository.  
thanks!

---

<div class="post-metadata">

**Author:** ![amellnik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amellnik/32/137_2.png) [@amellnik](https://discourse.julialang.org/u/amellnik)\
**Post date:** [March 31, 2017, 2:20am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/57 "2017-03-31T02:20:26Z")

</div>

@yakir12 – A general method of deploying an API from within a notebook or the REPL will take a while longer, but [https://github.com/amellnik/JuliaHerokuEndpoint](https://github.com/amellnik/JuliaHerokuEndpoint) now has a minimal but functional example as well as fairly detailed descriptions. If you have any trouble or if the instructions are unclear at any point please file and issue there and I would be glad to help.

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [March 31, 2017, 7:55am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/58 "2017-03-31T07:55:44Z")

</div>

OMG, thank you! Awesome, I’ve booked off all next week to play around with this. Thanks!

---

<div class="post-metadata">

**Author:** ![avik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/avik/32/17_2.png) [@avik](https://discourse.julialang.org/u/avik)\
**Post date:** [March 31, 2017, 9:15am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/59 "2017-03-31T09:15:39Z")

</div>

Some very nice code and documentation in this thread.

For completeness, I will point out [JuliaWebAPI.jl](https://github.com/JuliaWeb/JuliaWebAPI.jl) which allows you to expose any Julia function via ZMQ or HTTP transports. It’s a small but robust codebase, and has been used in production for many years.

## Regards

Avik

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [May 31, 2017, 10:19am UTC](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063/60 "2017-05-31T10:19:39Z")

</div>

This is awesome! Thanks again!

[Previous page](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063.md?page=2)

[Next page](https://discourse.julialang.org/t/hosting-web-apps-in-julia/1063.md?page=4)
