Elm and future server side render



So I’m here to talk about the server side render, not how to achieve it now, but what I would like to see in a close future, and I’m available to help.
Elm its an amazing simple “framework” that I strongly beleave that in the future could became the “de facto” web front end. But to achive that we need server side render in a way that we code only once.
What I pretend is a simple way of getting and HTML representation of a given model. For exemple I could have an microserver with an nodejs listing for a JSON with the model data, the server will return the full HTML (with the elm app js linked) and when it loads the elm apps starts as usual but it can skip the first render (hydration).
I would like to know if that is some work beeing done in this direction, or what are the steps necessaries to achive this.



This topic might be relevant to read if you haven’t already: Building Trust: What Has Worked.


Can you elaborate on why you’re making this suggestion, please? Thanks!


I think everything you want to achieve can already be done with 0.19 - but it is not an official part of the platform.

You can render on the server side to jsdom:

That will give you the HTML to serve up.

On the client side you can start Elm and render to a hidden DOM, then once rehydrated sufficiently, you can swap in the active Elm application to replace the static HTML - during an animation frame so appears seamless.

There are some code examples, Ellies or GitHub projects showing how to do all of this, but I don’t have a record of all the names and links - hopefully people who know can post them up?

Of course, this is not part of the Elm platform and some of these things may rely on implementation features that are subject to change. But I do think it is healthy to explore this stuff and perhaps it can help to shape the direction for when/if official support is added.

closed #5

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.