8 Facts of why METEOR is Awesome

Lets start describing the most common moment that every developer have face at least 90% of the time when creating an app from scratch.

Of course the first thing whe think is what is the stack that we are going to use to create a fully functional app, that might need to be scalable, robust, and also the stack that could be a good fit for our app.

  • Is this going to be a mobile app?
  • Should be a web app too?
  • How are we going to program the Front-end?
  • how about the Back-end?
  • What should I use to storage my data?
  • What language should I use for this app.
  • How much time is this going to take me?

And yes, in the meantime while figuring out the answer to this questions.
There will be some developers around the world that might have completed a fully functional app from scratch this could be a Todo app or something basic with all the functionality, by funcitonal I mean a complete app where you can save data, retrieve data, access to the web app, create an iOS App and a Android app at the same time.

How is this possible?

Well it's possible! by Using Just ONE framework, this is called METEOR

What is Meteor?

Meteor is a complete open source platform for building web and mobile apps in pure Javascript

Yes!, This is awesome! And here some of the reasons.

Fact 1 - Time

Building Apps with Meteor speeds up your project more than you think, your front-end, backend and mobile app at the same time.

How easy is to create a Meteor App?

Install Meteor
curl https://install.meteor.com/ | sh  
Create the app.

As easy as typing:

meteor create short-example  

this will amazingly create for you 4 starting files that will enable you to start developing your app.

the files will be the following

short-example.js       # a JavaScript file loaded on both client and server  
short-example.html     # an HTML file that defines view templates  
short-example.css      # a CSS file to define your app's styles  
.meteor                # internal Meteor files (You don't need to touch this)
Now that you have the most important files

You can go to the created folder "short-example" on your terminal and type.

meteor  

This will run your app on some port of your computer, by default the port will be 3000.

Running my first Meteor App

Go to http://127.0.0.1:3000/ or to http://localhost:3000/
So at this moment you have a basic running app, that can be shown in any type of device, but because you don't have much to show we will refer this as the starting point.

Fact 2 - Managing databases

Managing databases, especially with mongo its just like creating an object and adding key-value pairs.

// short-example.js
Things = new Mongo.Collection("things");  

This is how you declare a new collection (by collection I mean some kind of data storage for a specific group of data, on SQL this could be compare as a Table) that will be holding all the items you've save.

Fact 3 - Distinguish when is client or is a server

In all your javascript files you will be able to write code to be interpreted by the server or by the client whenever is needed.

This is how your client will understand a client side code

if (Meteor.isClient) {  
  // Some code inside
}

If you want to create a server side code will be as easy as this.

if (Meteor.isServer) {  
  // Some code inside 
}

So, this means that by writing a condition that checks if the app should interpret the code as a server (Meteor.isServer) or as a client (Meteor.isClient), you will be able to write any code you want in just one file if you'll like, rather than creating a whole new server configuration (for example a node server with all the express code on it), or a whole directory of files and folders for each of them.

Fact 4 - Package manager

Yes, Meteor has its own package manager, Atmosphere which is just like Bower, NPM, Gem, etc.

this is how you add new packages on your app.

To add:

To Remove:  

meteor remove ```

the list of packages will be saved on a file, located inside of the hidden folder '.meteor' named 'packages' with no extension on it.

Fact 5 - Users

Singing up and logging in is very simple. You could just install one of the different packages available on Atmosphere instead of creating all the user creation and validation, you will find those packages at their website Atmosphere.

One of the most downloaded packages for Accounts management is accounts-ui, which will handle the sign-up and sign-in process as well as the process for resetting a password, this will give you the basic login form, for a styled UI interface you could install one of the following packages

meteor add accounts-ui-bootstrap-3  

This will install with the look and feel of the boostrap framework.
If you prefer to keep it simple and/or with your own styles you could install the unstyled version.

meteor add accounts-ui-unstyled  

Fact 6 - Styling

You can use many different styling packages like Bootstrap or Semantic-ui, but be sure that you are installing a meteor dependency for those instead of the normal packages this packages can be found at Meteorite

The command for the Bootstrap package will look like this

meteor add mizzao:bootstrap-3  

typing this command on your terminal, will give you all the bootstrap power to style your app!

Fact 7 - Deploying your app

Want to see some magic?, yes, Magic...

meteor nameOfTheAppYouCreated.meteor.com  

And this will deploy your app to a real website!

Fact 8 - Deploying to mobile is even easier!

Just a few commands will take your web app to a "Native iOS or Android App"

To run on Android Emulator

As simple as going to the terminal and typing:

meteor install-sdk android  

This will help you install all of the necessary tools to build an Android app from your project. When you are done installing everything, type:

meteor add-platform android  

After you agree to the license terms, type:

meteor run android  

After some initialization, you will see an Android emulator pop up!

To run on Android Device

As easy as typing

meteor run android-device  
To run on iOS Emulator (Mac Only)

If you have a Mac, you can run your app inside the iOS simulator.
Go to your app folder and type to install the meteor sdk for iOS:

meteor install-sdk ios  

This will run you through the setup necessary to build an iOS app from your project. When you're done, type:

meteor add-platform ios  
meteor run ios  

You will see the iOS simulator pop up with your app running inside.

Running in a real iOS Device (needs a developer account)

If you have an Apple developer account, you can also run your app on an iOS device. Run the following command:

meteor run ios-device  

If you have any Questions, Comments, Sugestions let me know @chitopolo

Rene J Polo

Read more posts by this author.

Cochabamba - Bolivia

Subscribe to Chito Tech Tips

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!