One of the most unique and exciting frameworks out there on the web right now, Meteor is built on top of Node.js. Everything, right from the templates to the database is reactive, so any change at the client-side, or in the database is synchronized instantaneously, requiring no other measures. Meteor has quickly amassed a strong and extremely helpful community, creating a platform that you would love to build on, and give back to. Unlike other frameworks, there are no concepts of MVC or middleware (although you can implement them if it suits you). Everything is based on seven principles that act as guiding principles for the core, and the apps built upon it. One of them is close to my heart:
Embrace the Ecosystem
Meteor is open source and thus integrates, rather than replacing existing open source tools and frameworks.
One can use Meteor with build tools like Grunt, Gulp or Broccoli for various tasks, but the upside to Meteor is that it compiles, minifies and concatenates all assets into a single file on its own. Dependencies are managed, depending on the directory structure. For example, content inside the /lib directory is loaded first and files named ‘main.*’ are loaded last. Another important feature of Meteor is that you can share libraries between the server and client, so if a date-time formatting library like Moment.js is present, it can be used to convert UNIX epoch date-time stamps to human readable formats in the browser, rendering them from view-templates, or on the server before it gets stored in the database.
Following Write Code Every Day, I ended up working on an application to create markdown files last weekend. In the beginning, I used a MEAN stack, but later ended up switching to Meteor. The project was something that I created for personal use but ended up opening it for everyone. Similar to every other Meteor project that I have worked on, I was able to scaffold a prototype in a couple of hours, and was able to invest the rest of the time into refining the user experience, and adding features here and there.
Writ is an application to create notes in Markdown, with live previews on the side. You can store your notes in the databases and access from anywhere. Changes are reactive, and if you update a note on one device the same note, open on a different device, is updated without making any requests. Writ is built upon several packages that Meteor ships with, along with a few third party ones via Atmosphere.js, a few custom helper modules, and Handlebars helpers.
This post was written in Writ. Dogfooding.
As with any other single page application, there was a slight delay in the initial page load for Writ. When a SPA site loads for the first time, templates are rendered at the client side, subscribing to database collection, parsing, and running scripts and styles. This a lot of work, leading to a slow application boot. However thanks to some awesome work on part of the Meteor community, two packages – Fast Render & Iron-Router – come in handy in reducing the page load time exponentially.
Fast Render by @arunoda sends just the data that you need for initial load, thus significantly improving performance. Just drop this into your application, and you are good to go. Note that you will need Meteorite to install the Fast Render package.
Iron Router is a routing package for Meteor – an extremely powerful and extensible one. It ships with some handy predefined functions like layoutTemplate, loadingTemplate, onBeforeAction, onAfterAction, and a whole lot more. A powerful one among these is waitOn, that helps improve performance by subscribing to a collection only when you are on a defined route.
Tests for Writ are written in Mocha, a BDD/TDD testing library. It has support for asynchronous function calls and a handy CLI tool that runs every time you make changes in the source files. There are other Meteor-specific testing frameworks available, like Laika. I chose Mocha simply because I was already familiar with it.
Arunoda released Kadira the same day that I released Writ. I had already signed up for it some time back, and gone through the documentation, and I was able to quickly integrate it with Writ. Kadira is a New Relic-esque app to help you monitor your Meteor application. You get a live feed of data and how your users are using it. It helped me track issues that people were facing with OAuth and redirect-loop.
And on a lighter note:
— jacob (@fat) May 28, 2012