POSTED 25th January 2018 / IN: Technology / BY Bernardino Frola

FarmHedge tech stack

Hello! My name is Bernardino Frola and I am the CTO of FarmHedge. I would like to spend some time talking about the technology that powers FarmHedge.

First of all, a few words to explain what are the main components and functionalities of FarmHedge.

  • FarmHedge is a platform that aims to improve the communication between farmers and agribusinesses as well as facilitate the exchange of goods between them.
  • FarmHedge provides a mobile app for farmers on iOS and Android and a web-based portal for agribusinesses, called “Customer app” (see it here).
  • Agribusinesses can submit offers on the customer app and notify farmers with push notifications. Offers can be about selling a specific product or buying a certain type of crop.
  • Farmers can also submit requests on what they would like to buy or sell.

These are only a few of the features FarmHedge currently support. We are working everyday on improving and adding something new.

FarmHedge architecture

I took over the FarmHedge project from contractors who build the first proof of concept. To be honest, they did a great job in setting up the main components in a lean and organised way, but I had little help on knowledge transfer and therefore understanding what was actually done or not. So I reversed engineer the whole system and one of the first thing I did, was to draw a picture of the architecture that would help me, our stakeholders and for future employees to have a quick idea of how FarmHedge works:

Both the Customer app and the mobile apps uses the FarmHedge RESTful API to access data such as users and transactions. In the following sections I grouped the main technologies showed in the drawing, briefly described. I’ll talk in details about some of them in future, for example, I found particularly interesting learning about push notifications.

Node.js, AngularJS & Ionic Framework: lots of Javascript..

Most of code of the platform is written in Javascript. Node.js is the foundation of FarmHedge API; AngularJS 1.6 powers the Customer App; The particularly interesting Ionic framework (v1) is behind both the app on iOS and Android.

Ionic v1 uses AngularJS to build the content on native devices in webview. The large amount of plugins available for Ionic makes the limitation of non-native implementations almost unnoticeable – at least for our use cases. By the way, Ionic’s CSS components documentation is just classy.

MongoDB: DB made easy

Ever had that sense of oppression when thinking about DataBases? Creation of tables that are hard to modify, normalizations, strict relations.. And if you’re coming from Java background like me, the depression goes even deeper when thinking about Hibernate, JPA and auto-generated queries. Well, all of this is mostly related to relational databases and SQL and when I used for the first time MongoDB(in this project) I felt a sense of freedom.

Jokes aside, MongoDB and NoSQL DBs in general gives you the kind of flexibility we needed at FarmHedge. Of course the ever-changing data model requires to periodically slow down and think about big picture design, indices and optimisations, but I would say this DB and it’s wrapper for Node, Mongoose, was one the happiest learning on this project.

More to come..

The following points will be touched following posts:

  • Heroku: scalability and continuous integration.
  • Redis: distributed and quick tables.
  • OneSignal: push notification under control.
  • MixPanel: user behaviour at hand.

Hope you had a good read!