About 8 months ago we decided to completely refactor the FarmBot web app. Today I’m please to announce that we’ve finally finished this system wide re-write and the results are a faster, more stable, more well-written/tested/documented and ready for the future version of the software that powers FarmBot. Here is a summary of the changes we’ve made:
- Switch from a traditional multi-page web application to an SPA (single page application). This allows the web app to load “once” during a session and then not require any page reloads as the user navigates through the app. This makes the application faster to use because everything is loaded and there is not as much network lag or abrupt page refreshing.
- Switch from Angular to React. We weren’t too happy with Angular and its performance with our specific application needs. We decided to switch to React because of its already large and quickly growing user base, as well as its relatively easy learning curve.
- Switch from Foundation to Bootstrap. Foundation was proving to get in our way which required us to override it often and it wasn’t playing nicely with Angular. We decided on Bootstrap because of its ubiquity in the developer world and larger community of support. As it turns out, we’re not using very many of the components that Bootstrap gives us, so we may end up ditching it too for a purely custom solution or for something that provides things we want but could not feasibly build ourselves.
- Switch from Meshblu to MQTT. While Meshblu communication got us up and running quickly in the early days, it began to cause trouble later on. Features we were using (such as logging) got removed, upstream changes for websocket support silently broke our systems, and we were at the mercy of a complicated corporate controlled codebase. Because MQTT is a widely adopted standard with many more simplified brokers out there, we decided to make the switch. Its been much easier to setup, debug, and maintain our systems now.
- Modularization of the frontend, backend, and farmbot.js. Before we had one monolithic codebase called farmbot-web-app. It was difficult to maintain and programmers (especially newbies) had to get the entire thing working to be able to make small changes. For example, to change some css and see the changes in the development environment, one would need to get the entire database working too. Now we have three smaller repositories that handle specific functions. farmbot-web-app is just a backend system and API (the business logic). farmbot-web-frontend is the entire frontend which is compiled into a single javascript file via react magic. And farmbot-js which is a library enabling the frontend to communicate via MQTT with the FarmBot device.
Phew! Lots of changes huh? That’s why it took about 8 months to do this huge refactor. But now, we have a better software system that will be able to grow with us into the future. Want to see the new app for yourself? Check it out atmy.farmbot.io or see the screenshots below. Note that a lot of features still don’t work, but the foundation is there :). Over the next few months we’re going to be laser focused on getting sequence building, regimen building, and the farm designer working so that we can demo those features at the time we launch later this year!
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.