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 Principles – Simplicity 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.
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.