News

Open Source Horizon Claims Edge over Google's Firebase Mobile Back-End

Much fanfare accompanied Google's elevation of its Firebase mobile back-end platform last week, but slipping under the radar was the quieter unveiling of Horizon, an open source JavaScript back-end for Web and mobile apps that claims advantages over Firebase.

Horizon was developed by the team behind the RethinkDB database, upon which it runs.

"Think of it as an open-source Firebase," says a comment on Hacker News. "Not only you can host your own data, you can also do complex queries because it uses RethinkDB underneath."

Another comment lauded the Horizon team's statement that "Horizon is distributed as a standalone server for browser-based JavaScript apps. When you're ready to write custom back-end code, you can load the Horizon modules directly in Node.js."

"This is key," said the reader. "Firebase seems great for quick prototypes, but I never built against it because it was unclear (to me at least) how to deal with cases where you want to leave the sandbox and add custom backend functionality that they haven't built out for you. Horizon seems ideal -- it gives you the ease of use of a turnkey system starting out, with the flexibility to customize back-end logic/validation later when you need to. That, plus the fact that it's put together by the awesome RethinkDB team, makes it very interesting to me!"

The Horizon team even addressed the Firebase comparison in a FAQ, under the title, "How is Horizon different from Firebase?":

  • Horizon is open source. You can run it on your laptop, deploy it to the cloud, or deploy it to any infrastructure you want.
  • Horizon will allow you to build complex enterprise apps, not just basic applications with limited functionality. Since Horizon stores data in RethinkDB, once your app grows beyond the basic Horizon API, you can start adding back-end code of arbitrary complexity that has complete access to a fully featured database.
  • Since Horizon is built on RethinkDB, we'll be able to expose services that are much more sophisticated than simple document sync (e.g. real-time analytics, streams on joined tables, etc.)

For the record, here's what we reported last week about Google's upgrade of and increased emphasis on Firebase during its I/O developer conference:

"Google also announced that it will be adding features to its Firebase back-end-as-a-service product, which it acquired in 2014. The company plans to integrate Firebase fully with its existing products and services, and says that many previously paid-for features, such as Cloud Messaging, will be free going forward. The new Firebase is a single SDK that provides analytics, remote config, crash reporting, test lab, notifications, dynamic links, invites, AdWords and AdMobs. One notable new feature, Crash Reporting, provides reports to help diagnose and fix problems that show up in Android or iOS apps. The feature is based on Firebase Analytics, which allows developers to see information about how and where an app is being used."

The RethinkDB Admin Interface Spun Up for Horizon
[Click on image for larger view.] The RethinkDB Admin Interface Spun Up for Horizon (source: David Ramel)

The Horizon team, meanwhile, believes its product has advantages stemming from its dependency on RethinkDB, described as "the first open-source, scalable JSON database built from the ground up for the real-time Web. It inverts the traditional database architecture by exposing an exciting new access model -- instead of polling for changes, the developer can tell RethinkDB to continuously push updated query results to applications in real-time. RethinkDB's real-time push architecture dramatically reduces the time and effort necessary to build scalable real-time apps."

The Horizon documentation states: "Horizon reduces the amount of friction that developers face when they build and scale Web applications. It eliminates repetitive boilerplate and tedious steps like hand-writing CRUD endpoints, authentication and session management. We set out to flatten the space between the persistence layer and the front-end client, freeing the developer to focus on application logic instead of continually reinventing the wheel."

While Horizon literature (what scant little there is of it) feature Web apps prominently, the product is also positioned as a mobile app back-end, an area that some view as surpassing the Web and likely to see more development with the increasing use of JavaScript to build mobile apps with frameworks like React Native and NativeScript.

"Horizon ships with a JavaScript client library that can be used for building Web and mobile apps with frameworks like React, Angular or React Native," the FAQ states. "We're also working on specific platform client libraries that support the Horizon protocol. Client libraries for iOS and Android are coming soon."

However, even though mobile development with Horizon may eventually have a bigger upside than Web development, mobile development with React Native isn't quite ready for prime time yet. A Horizon forum discussion details how developers are trying to get it to work.

Horizon is made up from three components, according to a blog post announcing the product:

  • Horizon server: a back-end server built with Node.js and RethinkDB that supports data persistence, real-time streams, input validation, user authentication and permissions.
  • Horizon client: a JavaScript client library that developers can use on the front-end to store JSON documents in the database, perform queries and subscribe to live updates.
  • Horizon CLI: a command-line tool that can generate project templates, start up a local Horizon development server, and help you deploy your Horizon application to the cloud.

"The Horizon server is a complete back-end that developers can use to power their applications," the post said. "It's great for rapid prototyping: simply run the Horizon server from the command-line and develop your front-end user experience with the Horizon client library. Front-end developers can use Horizon to create full applications without writing any back-end code."

In addition to characterizing Horizon as superior to Firebase in some aspects, some industry pundits positioned it as a replacement for the Parse back-end service that was killed by creator Facebook -- leaving many developers in a lurch -- and subsequently resurrected as an open source project of its own.

The Horizon team said interested developers can sign up to be among the first to use a private beta of Horizon Cloud, a purpose-built cloud infrastructure to host and manage Horizon apps, planned to launch by year's end.

For right now, the team said: "Developers can learn how to download and install the Horizon framework by visiting the Horizon.io landing page. Via a promotion with Digital Ocean, developers can run their Horizon apps for very little, or choose to host their apps anywhere they like. RethinkDB provides commercial services, including development, production and training support, with managed services coming soon with the launch of Horizon Cloud."

About the Author

David Ramel is an editor and writer for Converge360.