Rapid development using Elixir, GraphQL and React

I have been extremely lucky, my first job has been using the bleeding edge in technologies. When I was out looking for a job I just wanted anything and technically I worked part-time at other places but my first full time position was with Our Very Own (OVO) a digital consultancy in Melbourne Australia. What made it even better is at the time we were basically a startup, I was there almost right at the beginning, in fact I was the first developer hired, the only other developer in the company was one of the founders, my boss! I liked to joke that I was the lead developer at OVO. The company was approached by this startup to build a product from scratch, technically it was an excel prototype that we have transformed into the web based application that we will be releasing soon, but it was from scratch still. I’ve been really lucky as a recent graduate to be put on this project and not some boring, legacy code that you typically get thrown on as a graduate. Instead I’ve been working with the amazing technologies of Elixir, GraphQL and React, going from zero lines of code to a sellable product. The beauty of the project was how fast we did it, for the first little while we had my boss and I who have both never touched Elixir, with a frontend developer that had never done anything real with React. Then we contracted two more developers who had a lot more experience for 2 months. In a little over two months we went from a barebones Elixir api that wasn’t even hooked up to the frontend, a react frontend that was static only, no real data getting passed to it. To a sellable product, used by paying customers, or at least it will be in three weeks when its released.

 

This is my first project and even I know that, that was extremely fast to bring a product to market, Elixir and React made it so easy to get a tonne of functionality up and running. My boss keeps telling me how much longer it would have taken in dotnet and how much worse the performance would be in Ruby. We produced an MVP in 3 months, with a total of 4 backend devs and one and a bit frontend devs. The project wasn’t small either, it performs some pretty complicated things, in fact the algorithm used is essentially a k-means clustering algorithm, written from scratch by a very smart excel guy, rewritten in Elixir by my boss and another very talented developer. With such a small team, the rapid development was essential, we have a hard deadline to hit, only a few developers, no dev ops (the boss had to wear a few hats for this one), rotation of frontend developers as the OVO crew grew, one immensely talented and hardworking UX designer and a recent graduate On top of that one of the devs was in Poland and the other one was in Sydney. We took all these things and turned them into a product that could be sold in the market, in fact prerelease it already has users for day one, which is a testament to the owners of the product and how well they can sell it.  

 

Yet how did Elixir, GraphQL and React make all this possible? The power of Ecto the dsl for talking to databases in Elixir, meant that many things that become very complicated in most projects, such as many-to-many relationships and associations become extremely easy in Ecto. React can be set up quickly, with a few components you can produce something that can actually do something and the speed with which it gives you, allows you to perform some more complicated things in your web application. Then comes GraphQL, the brain child of Facebook, it meant we could write queries that got certain data, then if you needed more data that was related to the data you needed from the query, you could drill down. An example would be: You perform a query for a list of blog posts in a database, so you can show them on the website. Well you have the posts, but i now I also need the comments for those, well a post has a one-to-many relationship with comments, so you can simply grab the associated comments to the post. This is only possible if you build it properly, meaning that you build it like best practices say to do it. The beauty of GraphQL is that you build the queries so that all your return objects, for example, `posts`, can also drilled down to grab all their associations, so your `comments` for each post. This allows you to do things like one page just needs to show all the `posts` titles, so you can call the same query as before, yet only call the titles, but another page requires you to get all the `posts`, then you also need to get the associated `comments` which are in another table, so you simply and the extra fields you want in the return and you call the same query, simple!! I’ll do a follow up post to really show the beauty of GraphQL, but for now this example will do. The write one flexible query that can serve multiple uses really cuts down on development time, if we had to do the traditional rest method, it could be done in a generic query, but it would be slow as all hell, because even if we just needed the `posts` title we would have to get all the associated `comments` and any other associations you might need rarely, or write another query.

 

In my very limited personal opinion, believe that this tech stack is the future, maybe not React, there are other really interesting Javascript frameworks and in all honesty there’s a new one each week, but Elixir and GraphQL are here to stay. They provide too much upside, compared to their alternatives, to fast, to easy, to rapid. It sounds like another Fast and the furious movie title, but it’s really just the future of rapid development.

Previous
Previous

Company culture

Next
Next

Daily exercise