What in the universe is Meteor?
“Fastest” is claimed to be achieved by Meteor through:
Reduced code bloat
Accomplish in 10 lines what would otherwise take 1000.
One repository, multiple devices
Use the same code whether you’re developing for web, iOS, Android, or desktop.
This is very appealing and would obviously save a lot of time, but should we consider how many solutions actually require an application to be consistent across web and mobile? Would this feature be redundant for those clients seeking a mobile-enhanced solution?
A powerful, large ecosystem of packages
Use popular frameworks and tools, right out-of-the-box.
As an open-source platform, Meteor does have a collaborative community base. As we’ll discuss later, the package system implemented in every Meteor installation provides a simple and effective way of incoporating modules, addons, plugins (or whatever else you would like to call them) into a site by using a simple CLI. I’m always in favour of not having to re-invent the wheel everytime I write code.
Three top-level directories
client- all code used by the client/browser/user
server- all code used by the server
imports- all other code/assets/files including the important
A typical Meteor installation file structure
I wouldn’t say that exactly - Meteor uses MongoDB to hold a persistent data layer which exists as long as the server is running. If you are unfamiliar with MongoDB, “collections” (tables) are used to hold “documents” (records).
Here’s where it get’s interesting, a collection can either be created for use on the server or use on the client. Client collections are used to store local data for yes you guessed it, the client! These collections act as cached versions of the server side collections. Server collections represent stored data in the MongoDB database and act the same as a standard table.
Meteor is built from the ground up on the Distributed Data Protocol (DDP) to allow data transfer in both directions. Building a Meteor app doesn’t require you to set up REST endpoints to serialize and send data. Instead you create publication endpoints that can push data from server to client.
By defining a publication in the
api directory (see above), a list of documents stored in a collection is available for the client to subscribe to and receive real-time results. This allows Meteor applications to be reactive and adapt to ever changing data immediately.
Meteor officially supports three user interface (UI) rendering libraries, Blaze, React and Angular.
Blaze was created as part of Meteor when it launched in 2011, and hence is claimed to be most integrated among the three with Meteor architecture. It uses a handlebarsJS-like templating syntax with HTML known as Spacebars.
React with Meteor can be achieved simply by adding the npm React dependency to the installation. This allows you to write React components in JSX as with any other React application.
Angular with Meteor is officially supported and there is even a separate dedicated community at Angular-Meteor.com. Although it seems to be a lot more work (bootstrapping) to get both working together effectively than with React or Blaze.
When does a Meteor become an Asteroid?
As mentioned before, Meteor employs its own fantastic packaging system known as AtmosphereJS, previously developed as an NPM package known as Meteorite (you can read their full story here).
Atmosphere packages are written specifically for Meteor and have several advantages over npm when used with Meteor.
As you can imagine, this makes Meteor a pretty powerful platform, and encourages the open-source community to collaborate and improve on the platform over time.
One can simply browse the AtmosphereJS website and use the Meteor CLI to install packages:
Meteor integrates with Cordova, a well-known Apache open source project, to build mobile apps from the same codebase you use to create regular web apps. With the Cordova integration in Meteor, you can take your existing app and run it on an iOS or Android device with a few simple commands.
Cordova wraps HTML/CSS and JS into a native container to target multiple platforms. As a web app in itself, it means the Meteor application can simply be wrapped to support mobile devices immediately. However, as mentioned before - what if the client wants to expand on the mobile version of an application? Fortunately, there are neat conditionals that can be used to identify the user’s device:
However, depending on how different the mobile version is desired to be, one could argue that keeping both together with countless device conditionals would be counter-intuitive. It may make more sense to split the code into two applications and use some funky routing - but that’s for another discussion.
It’s rather easy to find a wide range of resources, tutorials and even books for learning how to use Meteor effectively. It’s great to see that a fairly new platform already has such a large and passionate community.
IDE’s & Tools
Many Integrated Development Environments (IDE) have started to incorporate working with Meteor with new plugins and tools. You can see some of these below:
JetBrains Webstorm 9
WebStorm 9 integrates with Meteor including automatic recognition of Meteor projects, coding assistance, running and debugging apps.
There are several packages available in the Atom ecosystem to assist Meteor development. Meteor API offers autocomplete, code snippets, color-coded grammar and syntax highlighting, while Meteor Helper enables launching and killing Meteor within Atom.
Books and Learning Resources
Do you like reading? Then look no more, there’s as many as 4 books available for you to digest - if that takes your fancy:
Learn Meteor and build faster & simpler web apps, as we teach you how to build a real-time Meteor app from scratch.
Your First Meteor Application
Meteor In Action
Let us show you how to make the most of this amazing platform to impress users, reduce development time, and turn your ideas into code.
An easy to follow, step-by-step approach to learning how to build modern web applications with Meteor.
Try Meteor out by installing it from their website - it may just be a game changer.