What is your favourite JS library for the UI front-end?

Tags: #<Tag:0x00007f1142296580> #<Tag:0x00007f1142296418> #<Tag:0x00007f11422962d8>


That is indeed true, but something that gets mitigated by loading less JS and less CSS in each request (and also by internet speed). Having a clean, non-bloated design that does not use fancy JS for effects and what have you, is in my opinion, a better experience (it also makes the page easy to navigate by screen readers for people with disabilities).

Another advantage to this approach is that the initial load of the page does not have to load all your JS framework code and your own code in order to run, which will make the initial load really slow. Subsequent loads will be cached, but still…


Then use a javascript shim. :slight_smile:

Something like unpoly is such a shim, it loads pages from the server async then swaps the needed parts in the DOM, it is quick, still all server-side rendered, you can even add transitions and more. :slight_smile:

/me uses a lot of unpoly.js, wishes it was module-based though, but eh


Phoenix is fast, that time delay effect of page transitions is not a big deal compared to all that needs to be cared for using a complete VueJS solution on the front-end: state store, routing etc… no to mention webpack and npm and as you have said the possibly huge JS file that needs to be loaded on first visit.


How big is your js file with vuejs? The last time I used it, it was prettry small, about 50kb gzipped, and it included router, vuex, vue, and my application.

And downloading 50kb is hardly noticeable unless you are on a modem (http://www.download-time.com says it’d take 7 seconds)…

Right now though I’m looking into preact, which, together with a router and redux, fits in 10kb.


Have you encountered any limitation with Phoenix on API backend and VueJS on UI? Have you implemented user authentication on that setup?


Have you encountered any limitation with Phoenix on API backend and VueJS on UI?

No, but if I were doing it again, I would probably use graphql for talking to the backend. VueJS was nice for UI, I really liked its styled components.

I might even use a different setup in the future, with cowboy websockets (or something of my own) for app logic and nginx for sending out js chunks from webpack. That would make the website extra fast, I guess. And scaling extra hard.

Have you implemented user authentication on that setup?

Yes, I sent a phoenix token to the client and stored it there. And then included it with every request in the Authorization header as a Bearer token.


Have you used re:dom with large aplications ?


Not yet, I’m currently working on my web service’s frontend with RE:DOM but it won’t be a single page application, but rather it will be used to enhance some places, to draw graphs and stuff. I’m still quite new with it so don’t yet have good rules how to organise stuff. But the smaller things I have made with it have worked well and it has been fun to write.


It seems like all the preferences are geared towards landing/info page sites.

What about full on Facebook / Gmail / Forums / CRM type web-apps?

How they have front-end user experiences and full on admin specific user experiences that are completely different. With all kinds of users in different companies, where there are all kinds of views depending on the action of the current user. Adding/removing features based on users or group memberships etc

I like the Ember.js framework ideology. My biggest annoyance with these frontend frameworks is the all or nothing part. If someone loads up the signup page, they don’t need the admin app or the full logged in user part yet, even if they are logged in, there needs to be a balance between first response and quick 2nd page. Ember has engines finally to help with this.

On a page by page basis I like the simplicity of other frameworks/libraries, however to get some efficiency across the whole app, spending time making components inside a full framework and stitching them together in the page as needed has been great. For example with a simple information game (think rpg, clan, army kinds), while the REST way was fine every single resource on its own page works it was super slow to get anything done. I needed lots of information from many endpoints on the page in their own little space on the screen and they all needed to update based on actions happening in the backend.

This is where I see a full framework like Ember.js being a great fit. If I were building a landing page/informational product site I’d go pure HTML with a helper if needed to make something appear instantly responsive to actions.


I’ve been working with mithriljs for more than a year now. Thats super cool, easy to use and fast. Recommended!!


Couldn’t agree more. While I have no special love for JS, when i do need to use it, I use VanillaJS wherever possible.


Can you point me in the direction to learning more about using JS shims?


I would suggest Ember.js. It’s fast, easy to learn, has a great tooling story (ember-cli) and can be easily extended through addons (see Ember Observer for existing addons).


The post mentions Unpoly specifically which has a tutorial.

In terms of terminology it is interesting to note that people often use the term “shim” when they mean “polyfill” (What is the difference between a shim and a polyfill? - i.e. not every shim is polyfill) - Unpoly isn’t polyfill (unless it’s poly-filling “it’s own imaginary standard”). The creator’s tagline:

It’s not you, It’s Us
We’re Breaking Up With JavaScript Frontends
Henning Koch, makandra GmbH




Thanks for that, I really appreciate it. I have some playing around to do now :slight_smile: