This article looks into my experience learning the MeteorJS Application Framework and doing a production project based on that. The article should be useful to you if you are trying to decide whether to invest the time and effort needed to learn Meteor and it could also help you determine whether Meteor is a suitable framework to use on your own projects.
Meteor has a mission of providing a simplified way to produce protypes in a
day or two and production applications in a couple of weeks. I do see Meteor
as a browser/server or mobile app/server product rather than a desktop application.
Meteor is built from a number of subprojects and exisiting codes. It uses an
isomorphic approach to provide both client and server code in the same file.
templating language used for the HTML output.
There is a significant community involved in Meteor and there are a growing number of excellent plugins. There is an official tutorial on the Meteor.com site as well as documentation. There are also blogs, books and other resources to help get an aspiring Meteor developer started.
My own attraction to investigate Meteor had to do with my job in a newsroom at a mainstream daily newspaper. Part of what I do is data driven journalism and that involves creating interactive visualizations on very tight deadlines. I need something that gets a decent quality visualization up really fast. I have also been dealing a lot with maps and in doing that I have found that geojson is a great goespatial code to use. The geojson feature objects can be used in mongodb to create searches that are not available at all in most database. For example, given a geographic coordinate pair, I can search on mongodb for the city, county or state that contains that point.
I heard that Meteor allows really fast development of this sort of mongoDB applications. I tend to shy away from frameworks generally as they tend to obfuscate things I need access to and the can make it really convienent for me to not learn basic sorts of things I need to know. I admit, I am lazy. I do not want unneeded cognitive load. But Meteor seemed so promising that I wanted to try it out.
Doing this first production project in Meteor took about 25 hours. I can see that doing additional projects will be considerably faster. I had to stumble along especially in integrating Meteor with leaflet and to get http queries to work.
The USGS offers hydrological information from a REST api. There are 1000’s of guages all over the US for rivers, lakes and groundwater. The API that I used allowed the extraction of current data for specific guages. I used an array of guage ID numbers to send off the http requests.
The data returned by the USGS comes back in a JSON format. My serverside code parses the incoming USGS data and I built an upsert query to deposit the data into mongoDB. If you are new to noSQL databases, and upsert is a combination of insert and update. If the record exists, it is updated, otherwise it is created.
Meteor monitors the activity in the database, apparently by watching the log. When a datum is modified, ‘subscribers’ to that datum at notified. This notification extends to the frontend clients. There is a websockets implementation that carries the notifications out to the client. The data modification messages can go both ways, such that when data is modified on the client, the server side code and database is updated accordingly which in turn causes all other clients to receive notifications.
In order to integrate with leaflet, I used a package identified as mrt:leaflet-0.6.4.This worked well in getting my intial map. In order to update the map’s markers and popups in real time I needed to ‘subscribe’ to certain data messages and then act on the received information.
Meteor takes a whole lot of the tedium out of coding an application. It not only produces a great skeleton at the outset of a new project, there are lots of very useful facilities baked into the product. In addition to the server and client side codes, the templating is easy to use for data pulled out of the database. There is advice among data visualization people that you should concentrate on presentation first thing into the project. Meteor allowed me to do that.
The way the code handles client and server side communication is great. The deloyment to production was a real breeze. I was able to even bring up a smart phone app on an emulator that was a real match to the web app. All that code is already done via an integration with Cordova. In fact, the way this code can bang out iOS, Android and web apps from the same code base is a real boon in my world of very pressing deadlines and breaking news.
Deployment of my first application went to the Meteor site. It was incredible smooth and easy. I am not sure how this hosting can scale though the docs do say you can aim your own domain name at the hosted app. There is both free and premium hosting at openshift.com. There is also hosting on Digital Ocean starting at $5 per month. An installer call ‘up’ makes it easy to do the installations.
Meteor does provide a great deal of what I need in terms of fast running, scalable applications. It also hits my need for fast to deploy and production quality. The community has provided great plugins that I can use to help out with integrating stuff into Meteor. I found the plugin process easy to use. In fact the whole thing has been quite satisfactory so far.