Meteor quick look

Created: April 21, 2016

Hello JavaScript lovers!

Today we have a lot of libraries and frameworks written in JavaScript, and it has become a bit chaotic, especially when we want to combine more technologies together. Sometimes it can take a lot of time to set up all these things to work together, and can cause a frustration. Fortunately, our headache disappeared after the arrival of Meteor. Now we can assemble all the pieces into one ecosystem, which allows us to develop application in one language, JavaScript, so cool ;)

Short intro about Meteor and its architecture

Meteor is a full-stack JavaScript platform which is great for modern single-page and mobile applications, it can compile apps into iOS and Android packages, using Apache Cordova and those packages can be installed through the App Store (iOS) and Google Play (Android). Meteor is powered by Node.js on the server side, MongoDB is used to store data. The communication within application goes over both HTTP and WebSocket. The initial request and static files are transferred over HTTP protocol. In that way client is calling a server function which then sends back its response as JSON object over DDP.

Let’s describe each of these components called Isopacks:

DDP

Distributed Data Protocol, known as DDP, is dedicated protocol based on JSON. It is websocket-based and is one of the core elements of Meteor. Clients talk to Meteor servers over DDP protocol. On query a server is sending the results down to the client, and then pushing changes to the client when anything changes in the database. DDP is simple to use and can be used with many other programming languages like PHP, Python, Objective-C or Java as well.

Livequery

Simply put, Livequery is responsible for changes detecting and pushing all changes to the subscribed clients over DDP.

Tracker

Tracker is powerful library for transparent reactive programming in JavaScript, it provides functional reactive programming (FRP). It watches for those changes and triggers DOM updates in the UI layer via Blaze.

DB drivers

Blaze is reactive UI library which uses template engine known as Spacebars. If you prefer to work with other libraries or frameworks like Angular, React or Ember, feel free to use them, but Blaze is simpler than any other.

DB drivers

Meteor comes with database that simulates actual database inside the browser, called Minimongo. On the server side Meteor uses MongoDB.Connection between Minimongo and MongoDB is reactive, data is kept in sync.

Setting a project

Meteor also supports CLI (Command Line Interface), allows developers to quickly set up an entire development environment like:

  • Create new app
  • Add/Remove packages
  • Run, reset and monitor app
  • Access MongoDB shell
  • Deploy application

Meteor supports OSX, Windows and Linux, but I will show you how Meteor can be installed and how it works under Linux. So, open your terminal and simply install latest Meteor release:

curl https://install.meteor.com/ | sh

Now you can create a project:

meteor create myapp

Meteor creates three files (myapp.css, myapp.html, myapp.js). Now,you can run your application with the following commands:

cd myapp
meteor npm install
meteor

You can access the application with your browser at http://localhost:3000. If you want to change the port you can do it with following command:

meteor run --port 8080

And now you can see your page in your browser at http://localhost:8080. That was easy, right? :)

Benefits of using Meteor

If you are using Meteor, you will be able to develop very fast web application. There are a lot of benefits using Meteor framework as following:

  • You are able to develop with just one language
  • CLI interface
  • You are able to build hybrid mobile applications using Apache Cordova
  • Integration with smart packages
  • By default applications are reactive
  • Great and supportive community

Conclusion

Meteor is one of the best frameworks for one-page app development we have today and I highly recommend you to start using it, because It is completely open source and it’s the easiest and fastest way to create a full stack online application like real time collaboration tools, customer support, multiplayer web games and more. . Simply put, Meteor is the future.

Go back to the homepage