Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the Elm "stack" look like for a full application/site?

Tags:

elm

I'm trying to get an initial understanding of what a full Elm application looks like. In particular what the "stack" looks like. As a concrete example, let's say I have a website that allows users to register/login and then upload pictures and comment on others' pictures and comments. It delivers HTML, JavaScript, and CSS, and uses PHP and/or Perl on the server, The PHP/Perl interacts with MySQL or Oracle. If I were to re-develop this site with Elm, what parts does Elm handle and what are the common/recommended choices for the rest of the stack?

like image 967
joeA Avatar asked May 29 '17 05:05

joeA


2 Answers

Elm handles the frontend responsibilities. You can use it instead of javascript and use its libraries to generate the needed html & css.

For backend you can use whatever technology you want. Since Elm is a functional language, some people chose a functional language for the backend too. Most frequent I've seen are Elixir (Phoenix Framework) and Haskell.

Take a look at Tour of an Open-Source Elm SPA for a real world example of implementing an Elm frontend for an already available backend.

like image 73
pdamoc Avatar answered Nov 20 '22 20:11

pdamoc


Elm is purely the front-end, so you won't need any php to create html code.

It provides broad coverage of standard HTML, but excludes service workers and some other modern web APIs - you can use javascript through Elm's foreign function interface (called Ports).

Elm has out of the box support for json from a REST environment, and powerful parsers if you need to use something else (e.g. xml). As Peter suggest, you might want to use a functional backend, but there is absolutely no necessity (I've Elixir and Node with success to date).

like image 40
Simon H Avatar answered Nov 20 '22 20:11

Simon H