(I have posted this on the elm and on the meteor forums)
This is my attempt to use elm as the view layer for a meteor based project. I tried to keep this example as simple as possible. I want to mention that:
-
The example is a mega-counter example
connected to a db (mongodb) on the server, so the data is persistent.
-
I have not used a meteor-build-plugin to compile elm, because it has not worked out for me. Instead Iām using the
elm make
command in combination withinotifywait
to compile elm to js and then include the output via a meteor package to stop meteor from compiling the elm-output again. -
Meteor owns the state of the published collections, elm is only responsible for displaying the data. (from the elm guide: state should be owned by Elm or by JavaScript, never both)
-
If you want to run the example on your locale machine, you have to install meteor and elm, clone the repo and then run
meteor run watchelm
and in another terminalmeteor run
. -
The data is updated as you click on the numbers, so everyone sees the same counters changing live. You can open another browser window to watch the changes you are making.
live demo: https://meteor-elm-example.herokuapp.com
github repo: https://github.com/ni-ko-o-kin/meteor-elm-example
If this has sparked you interest, let me know if I should post another more comprehensive example with authentication, validation, user permissions, rate limiting aso. Maybe the realworld example.
Feedback is welcome!