MeteorJS – Introduction and Setup

What is MeteorJS?

MeteorJS is a javascript framework to create web applications. It is built on the top of NodeJS and uses MongoDB as a storage layer.

Components of Meteor


Components of Meteor

There are 5 major components on which MeteorJS is built upon.


This library of MeteorJS is helpful to give live updates to user. This library is responsible for updating DOM. It is just like AngularJS where in DOM you have to just tell what you want and if there is any update then it will take care of that.


Meteor project comes with MongoDB, without writing any configuration file. It can be accessed from remote by adding 2 in the Meteor server port. For instance, if Meteor is running at 3000 then MongoDB will run at 3002 port. The MongoDB files are in .meteor directory of Meteor project.


Distributed Data Protocol(DDP), is a communication layer between client and server. It is based on web sockets. Everything that happens between client and server is only through DDP. Client and server do not know each other. It is not mandatory that client and server both should be of Meteor. Meteor client can talk to other servers who understand DDP and Meteor server can talk to other clients who understand DDP.

Live Query

It is a communication layer between and server and database. It continuously listens to database and sends updates to the server if anything happens in the database. So if anything happens in the database then without hitting the refresh button you will get updated results on the screen. In general, it requires a separate implementation for each database.

Benefits of Meteor

1. You can get real-time updates without writing an extra code for it.
2. Packaging system – You can save lots of time by using MeteorJS packages. There are many built-in packages that can be used as it is. Using packages and writing your package for others is also very easy. Rails developers can think of gem as a package.
3. Learning curve is low. You need to have command over javascript because MeteorJS uses javascript on both client and server side.
4. Meteor itself minified the javascript and css in production mode.
5. Meteor automatically syncs the state between client and server.
6. The community of Meteor is very active and supportive.

An Example

Below are the few commands that will install MeteorJS and then it will create the project for authentication.


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

To create an application with name authentication

meteor create authentication

The output of above command will be-



Run Application

Go to authentication directory – cd authentication and you will see project structure like this

Run Application
Type command – meteor
Open the browser and go to http://localhost:3000
By executing above commands you will see something like this-

Type command – meteor

Add package

meteor add accounts-base
meteor add accounts-password
meteor add accounts-ui

The above 3 commands will add authentication packages

Display buttons on UI
Add below line in authentication.html and comment {{> hello}} line

{{> loginButtons}}

The above line will give you ‘Sign in’ link on your browser and when you click on that link you will get ‘Sign in Form’ and other links that are required for authentication

create a fully working authentication app

So the above commands will create a fully working authentication app.

Now it’s your time to play with Meteor.

You might also like