Develop reactive web apps with Meteor.js

Redmint Blog
Meteor Hammer
Published in
5 min readOct 29, 2015

Imagine this situation: you open the same folder on two explorer windows on your computer. When you delete a file in one of them, does it disappear from the other window too?

When you modify something in your local system file, that change is applied everywhere without the need of reloading or doing any callbacks.

Let’s think what would happen in the same situation but on the web. We open the same WordPress in two different tabs or windows and write a post in one of them. The changes won’t show up in the other one unless you refresh that window.

We got used to the idea that a website needs to be refreshed to see the results of our actions. That’s when Meteor comes in handy, being a set of new frameworks and technologies destined to develop reactive web apps.

What is Meteor.js?

Meteor is a development platform for creating webs in real time built over Node.js . It’s located between the app’s database and its user interface, enforcing synchronization between them.

As Meteor is built over Node.js, Javascript is used both on the client and the server. It even allows to share code between both environments.

The result is a simple but powerful platform. Meteor abstracts lots of difficulties we encounter when developing web applications.

It also allows you to create a reactive web app in a couple of hours. And if you already have experience on web developing, you will be familiarized with JavaScript, so you won’t need to learn a new language.

Meteor has native support for MongoDB. Mongo is an open source non-relational database (NoSQL) which saves the data in JSON files (JavaScript Object Notation) but in binary (BSON) to make the integration faster.

Because of its flexibility, it’s perfect for scaling products and it helps to agile development of web projects. On the other hand, there are third-party packages that provide support for MySQL and PostgreSQL.

Is Meteor MVC?

If we have used other frameworks like Ruby on Rails, we might be asking ourselves if Meteor apps adopt the MVC (Model View Controller) pattern. The short answer is no. Unlike Rails, Meteor does not impose any predefined structure for its application.

Meteor supports three view engines: React, Angular, and its own Blaze.

Ecosystem

Atmosphere, Meteor’s package repository, holds over 5,000 packages. Meteor can also tap into the more than 130,000 packaged modules in the Node.js ecosystem.

This makes Meteor a much richer framework than Backbone, which expressly states that, “You can read and understand the source in an afternoon.”

Highlights:

  • Components: When it comes to building custom components, you don’t need to automatically use React. You can use the built-in block helpers or one of the several community packages for building reusable UI components like components.meteor.com
  • Tooling: There’s no need for Grunt, Gulp or Bower. Meteor includes SASS/LESS compilation, CoffeeScript to JavaScript conversion, and CSS/JS concatenation and Minification. All these happen automatically and transparently when you meteor run your application, and when you change your code. Deployment tools include automatic restart, process monitoring, load balancing and scaling to multiple CPU core on one server with Phusion Passenger, the most popular application server for Ruby, horizontal scaling across multiple machines with Meteor Cluster and performance instrumentation with Kadira: CPU and RAM consumption, subscription latency and throughput etc.
  • Testing: Meteor’s official testing framework is called Velocity, and it enables real-time integration and unit testing with Jasmine or Mocha syntax. Tests are re-run reactively as you save your code, and the testing status is indicated live by a green or red dot in the upper-right corner of the app.

When you shouldn’t use Meteor?

  • If you want to build a website, not a web application.
  • When you already have a back-end you don’t want to rewrite in JavaScript, and all you need is a client library for the front-end.
  • When all you want is to build a web-service / REST API, without a client.
  • When you need to squeeze every last bit of performance from your app. For applications with very large numbers of concurrent connections, Meteor might require larger amounts of RAM than other solutions.
  • If you value control over your code base and your own ability to make decisions about what is right for your infrastructure and what isn’t, you should absolutely stay away from Meteor.

What alternatives do we have?

Only full-stack frameworks are directly compatible with Meteor. It’s mistaken to compare Meteor to AngularJS or Sails, because Meteor provides both the server and client part of the web app equation, while Angular/Backbone/Ember/React are client libraries, and Sails/Express/Hapi are server frameworks.

Many think that the MEAN stack is a comparable alternative to Meteor.js. Nowadays, the MEAN stack is just a group of technologies used together. It offers far less than Meteor, and you have to do all the wiring between Mongo, Express, Node and Angular yourself. But you have the freedom to join the parts as you wish, Meteor is less flexible in this way.

If you are interested in Meteor.js, give it a chance!

Adrian Escat

Software Engineering Student at UTN (Universidad Tecnológica Nacional). Creative and tech fan. I love learning new stuff.

You should follow us on Twitter, Facebook or Linkedin!

--

--

Redmint Blog
Meteor Hammer

We are a web and mobile development shop based in Buenos Aires. We provide high quality tech teams on demand for startups. http://redmintlabs.com/what_we_do