Adventures with Meteor

Meteor is a JavaScript Framework
Red Argyle logo

I’ve recently discovered the Meteor web application framework and have been having so much fun building web apps with it that I knew I had to write a blog post about it. Meteor has a number of advantages that made it really quick for me to get up and running, but I think the most important is highlighted in the last of their Seven PrinciplesSimplicity Equals Productivity. While this phrase could be a goal for any framework, library, or other piece of software, I felt immediately that Meteor had accomplished this. Using the framework to create a web app was just plain simple. Everything from the installation and setup, to getting a simple app running, to adding external packages, worked just like I read about in the documentation and often left me wondering, “Wait, that’s really all that I had to do?” I’m going to take this opportunity to outline some key pieces of Meteor, but I have to first say that there is much more to the framework than can be summarized in a single blog post, and I urge you to check it out if you’re at all interested.


Meteor: A JavaScript Framework that Does More

Meteor sets itself apart from other JavaScript frameworks in that it is used for both server- and client-side code. On the client-side, Meteor features a reactive data source design similar to AngularJS. On the server side, Meteor runs on top of Node.js, much like Express or Sails.js. By using the same library for both environments, it’s very simple to write code because the API is the same. The tight coupling between the two environments means that most of the functionality you find yourself building in a typical MEAN stack has already been built into the Meteor API, and it all works right out of the box.

Making things even easier, accessing the database is done via identical API methods whether you’re on the client or server, and making data available between the two is super easy. Just use a simple Meteor.publish() method for a specific data set on the server and a Meteor.subscribe() method on the client side. This establishes reactive data communication between the two, which means each side is updated automatically whenever the other changes.


Adding Packages Just Got a Whole Lot Easier

Another one of my favorite things about Meteor is the ease of adding extra packages and the huge list of packages that already exist. Adding a package to your application requires one line in your terminal: “meteor add <package>”. Then whenever Meteor is run or deployed, all packages you’ve added will be included in the application. This is similar to Node.js and the Node Package Manager, but the available packages are what really made me say “Wow!”

When it came time to add user authentication to my site, I started to Google around to figure out the process in Meteor, and then I realized I just had to add two packages: “accounts-password” and “accounts-ui.” These packages automatically created a user table in my database and made user account information available in the code via API methods. All it took was one line of code in my template to add a login button, account registration, and authentication. It took me less than 5 minutes to set up user accounts and login functionality on my app. It was at this point that I started to really enjoy building an app with Meteor. A few quick clicks, and I was able to move on to building actual features. For a whole catalog of packages available to Meteor, check out Atmosphere.


A Simple Command Line Tool Makes Meteor Even Better

The other element of Meteor that I really enjoy is the command line tool. It’s simple, straightforward, and stays out of your way, yet does exactly what you want it to do. You can use it, of course, to run your web application, but it also does live reloading whenever you change a file. I would normally just install the nodemon module when writing a typical Node.js application, but it’s a nicety that this functionality is built in to Meteor. As I mentioned above, you can use the command line tool to add packages, and you can just as easily list your installed packages or remove them.

Finally, with the “meteor deploy” command, you can deploy to Meteor’s basic hosting service. At the moment, this is free and only works well for running a development site, but the developers behind Meteor are in the process of building a paid hosting service called Galaxy. (In fact, they recently raised $20 million to help them complete Galaxy.)The simple functionality of the Meteor command line tool certainly wasn’t a requirement for me, but it was definitely icing on the cake after having so much fun building my app.

I likely won’t be abandoning my tried-and-true Node.js + ExpressJS + AngularJS stack any time soon, but at the moment I’m having a blast playing around with this new framework, and I’m very excited to see where Meteor goes. It was a great feeling to be able to prototype an idea in a matter of hours and to have everything work as expected right from the start. If you’re interested in checking it out, I found the online book “Your First Meteor Application” to be incredibly helpful. Meteor also has a tutorial on its website. I was able to move through both of these resources very quickly thanks to my knowledge about JavaScript programming and web application development. For the most part, the only other reference I’ve needed has been the official Meteor documentation. I’d encourage you to check out all 3 of these resources if you’re new to the Meteor platform. If you’ve already tried Meteor, or are curious about it, or even if you think it stinks, I’d love to hear your thoughts below!

Red Argyle logo
Red Argyle logo

Related Blog Posts