My experience with Phoenix, GraphQL, and SPAs

Last update: January 6th 2019

I used GraphQL and Apollo a lot in 2018 but in the end, I decided to rely more on Phoenix. What I am about to say only applies to an application I am currently making. My opinion would probably be different on other projects.

Phoenix channels are great and it overshadows the benefits of GraphQL. As I didn't need a complex API, I decided to just use them and stop using GraphQL.

Caching is hard enough, but Apollo is still too immature and managing the cache when you also have real-time features and complex permissions is a nightmare.

Rendering HTML with Phoenix is so fast, you don't really need to bother with caching. Any part of the application that doesn't require JavaScript will benefit from it.

But going back to server-side HTML rendering has a few downsides. When you get used to managing components with a frontend framework, going back to the view layer of Phoenix is a big step back.

Also, I still have to use React for some parts of the application and sharing code between my HTML templates and React is a bit awkward. There are several ways to do it, like using web components, but they all have downsides.

I don't think I have found the right balance yet between server-side and client-side rendering. It's still bothering me but I hope I can improve my productivity again in 2019.