From Client-side Angular to Server-side Meteor

Comparing Meteor and Angular is a bit difficult since the two are really altogether different right now, other than they are both composed in javascript. Meteor is a full stack framework that can run on server and browser built on top of Node.js whereas Angular can run only on client-side browser as it is not built on top of server-side language like node.js, php etc. They both are very popular, easy to start for beginners. Now a days, developers are very attracted to node.js as it is the only javascript that can run on server side which save programmers from learning multiple languages, able to use single framework on both. But node.js is little bit difficult to understand for the starter. So there are many frameworks built on top of it like express, meteor, sails etc. I think meteor is easy and can be used quickly from angular background programmers. I choose angular because it is the most popular browser language currently.

Most of the time we are looking tools that makes our programming life easier for creating projects, developing, updating and scaling as time demands. Hundreds of helping tools and frameworks are out there but we don’t know which is suitable for our project and try to find best on blogs, forums and searching google. While doing this, I find angularjs and cannot leave it as it is very powerful framework with scope that is used to assign variables and functions, automatic update of views on value changes and vice-versa, concept of directives that can be injected anywhere we want and lot’s of others. But angular is limited to client-side. For the complete project, database and server is needed. So meteorjs attract me which is full-stack frameworks with inbuilt command line tool and server which can be easily started using “meteor”. Let’s compare similarities between these two on features that is needed for new projects.

REST API :

The main problem of any project is how to easily access data. This needs creating of REST API on server side using meteor because it uses publish/subscribe architecture. Queries are send to server from browser using some kind of user interaction on forms or buttons. For those queries, meteor has to define API and publication of result data. You need to observe or subscribe on those data and as soon as server send data, client has to update it’s views with those data. They are all sent from server to client via websockets which are stored in browser’s cache. Meteor server broadcast those updated result to all of it’s connected clients that makes possible to build real-time applications in no time.

Templating System :

Both have it’s templating system which is mainly views related code that automatically changes on update of model. In angular, class-based framework is used like animation. When model changes, it publish required class and update it’s views. Meteor has also the similar functionality. It comes with ‘Spacebars’ template system inspired by ‘Handlebars’. With the help of ‘Blaze’ (Live Page Update Technology), meteor will automatically update it’s views as changes occur on data. This is called ‘Reactive Data Source’. Angular uses scope that is assigned with variables and functions. These variables and functions can be accessed directly from templates and as those scope variables change, the view is automatically updated. Meteor has ‘Cursors’ which is it’s reactive data source. When you query the database, a cursor is returned. It’s pub/sub pattern updates it’s data on both client and server side magically. When view is change on any client, that change is reflected to server and server publish it to all of connected clients to update on them.

Components :

Angular has directives which behave like components. Directives make possible to use independent custom HTML tags with it’s own template that can be injected or transcluded into. Independent events and behaviors can be attached on those tags. They can be reused on any part of HTML code as normal HTML tag. Meteor achieves this behaviors using normal templates.

Tools :

Meteor is more than a framework as it includes a nice command line tool that can be used for anything like starting server, creating projects, source-mapping, concatenation, minification, compiling and publishing them. Running just ‘meteor run’ in your project directory starts up a web server and observes your files and folders for changes and automatically reflected them into browsers. This removes lot’s of pain and concentrate developers only focus on the application. For angular, you have to depend on grunt to do all those extra functions.

Conclusion :

So Meteor is all-in-one framework that is what every developers need and always search for. It is very new and it’s popularity is growing in fast pace. God bless you Meteor.