Grasswire’s Technology Stack
At Grasswire, we use a number of technologies and tools to power our real-time, crowd-sourced news engine.
Backend
There are three backend services at the core of Grasswire, all of which are written in Scala.
- A RESTful API
- A service that processes all user actions (upvotes, fact-checks, etc)
- A service that consumes/analyzes news content from Youtube, Twitter, etc in real-time
The RESTful API is written using Spray, which describes itself as:
an open-source toolkit for building REST/HTTP-based integration layers on top of Scala and Akka. Being asynchronous, actor-based, fast, lightweight, modular and testable it’s a great way to connect your Scala applications to the world. (spray.io)
All user actions (upvotes, fact-checks) posted to the API are sent to a separate service for processing via a message broker. There are many benefits to using a message broker. Two important ones are:
- Messages can be durable; if a service (as a consumer) goes down and can no longer process those messages, they will stick around until the service is restored.
- A message broker provides an easy way to load-balance message processing across machines.
Grasswire uses Redis for caching (and other things) pretty extensively. Redis is incredibly fast and offers some useful data structures, such as lists, hashes, sets and more.
We use Spray to write our http server, but we also use its http client functionality for consuming content from various APIs. Spray is actor-based so it’s very fast which is important since we have to consume and process lots of content very quickly.
We are increasingly making use of Scalaz in order to do purely functional programming in Scala. Our limited use of it so far has already paid off in a big way. We hope to use Scalaz even more going forward. It will allow us to write code that is more “pure”, more composable, and generally easier to reason about.
All of Grasswire’s backend services are deployed on Amazon Web Services.
Frontend
Grasswire’s website is an AngularJS app. Angular is a JavaScript framework for writing dynamic web applications. Angular has served us well — it is feature-rich, provides us with a lot of flexibility in how we structure our application, and it’s been an essential part of building a modern, real-time web experience on Grasswire.com.
The Grasswire website is a consumer of our RESTful API, just like our Android app; the website is “merely” a client. This makes deploying the site very easy — Grasswire.com is hosted on Amazon S3 as a static website. We make quick changes to the site all the time and pushing those changes to production is simply a matter of uploading a new build directly to S3.
Hopefully this post gives you a basic idea of some the components at work behind the scenes of Grasswire. If there’s anything you’d like us to explore in future posts, please don’t hesitate to ask!