18 Oct 2016
Choosing GraphQL to build Drift’s messaging
platform
Like most internet companies today, we built our platform starting from a RESTful JSON API. But even with a clean slate, we still ran into familiar challenges that all API developers face: schema definition and introspection, versioning, paging, data aggregation and response shaping.
GraphQL allows you to create a schema that exposes your entire organization’s data model via read and write operations. This creates a single point of entry into your API and enables clients to ask in a single call what most REST JSON APIs take many calls to fulfill.
GraphQL is the post-REST API.
I did some work putting together GraphQL servers in Node and Elixir and really enjoyed the ease that clients had in getting the exact data they needed in a single call. It has a learning curve (but so did REST), but it really made for a better API experience.
Relay (and Apollo) are the client side companions for GraphQL. The learning curve for Realy was steep – it is very specific about its expectations for schema which is sometimes not so clear – but getting past the steep learning curve (it is very early) I was amazed that I had written no network/data code for my client app. That’s about 30% of the code for a comparable app that just isn’t there.
18 Oct 2016
Why I believe GraphQL will come to replace
REST
With REST, there is a continuous tension between efficiently satisfying the data needs of specific clients, and keeping the number of endpoints manageable. The reason for this tension is that a server defines what data an endpoint returns, and the client merely requests it. Especially in mobile apps, the overhead of performing separate requests or of requesting extraneous data is often unacceptable, so we’re forced to add ad-hoc endpoints with custom response structures.
This is something I’ve been thinking for a while now. I have spent many years building and advocating for RESTful APIs, but I’m ready to give them up. (although that’s not likely to happen yet)
18 Oct 2016
Elixir ETS vs Redis
Learning Elixir has a way of challenging everything you know about programming. Redis is becoming an assumed part of many web stacks, in the same breath as your database. But with Elixir, do you need it? Do you even need a database?
15 Oct 2016
joshwcomeau/redux-vcr
A Redux devtool that lets you replay user sessions in real-time.
13 Oct 2016
Addy Oasami has written an excellent new series on creating progressive web apps with React. Theres a lot to digest here…
There’s much new in the world of Progressive Web Apps (PWAs) and you might be wondering how compatible they are with existing architectures using libraries like React and JS module bundlers like Webpack. Does a PWA require a wholesale rewrite? What web performance metrics do you need to keep an eye on? In this series of posts I’ll share my experience turning React-based web apps into PWAs. We’ll also cover why shipping just what users need for a route & throwing out all other scripts are good ideas for fast perf.