Tech | Building a WebApp in 2017 — Why and How Meteor
During these last couple of years, I have learnt a lot about web apps. Though I started with Meteor because of its simplicity, I have tried and weighed many frameworks since then, including Webpack, Feathers, MERN, NextJS, SailsJS etc.
Still, even today, I will prefer to use Meteor over anything else. The post is not about comparisons with other frameworks, but simply about the reasons why I would use Meteor again.
Why
Community support
This is a prime mover for me. I will always prefer [even] a not-so-good framework which has a decent community support, rather than the best one with none. And Meteor, Meteor is definitely good, if not the best.
Knowing that someone is out there to help me whenever I will falter, gives me enough confidence to use the framework for a big production ready app.
Most of the frameworks I mentioned above have a decent to good community support, but Meteor is the winner.
Reactivity (Pub-sub)
While I could use sockjs, the de-facto reactivity provided by Meteor is definitely a heart winner. It has its own quirks (see, https://medium.com/settlin-tech/meteor-2-years-of-relationship-7d7e345afad9) but it simple means that I must improve my coding skills.
Minimongo
The meteor team landed a great blow to array data manipulation through this gem. Using isomorphic mongo styled queries to traverse through the data is way more cooler than filtering arrays received via ajax or sockets.
Coupled with reactivity, minimongo becomes an even greater tool.
Users and Authentication
Creating a well thought out authentication mechanism with session management is one of the first hiccups of a prod app, and Meteor takes care of all that in a jiffy.
React
When Meteor dethroned Blaze, like most of the users, I too was quite sad. I had experience with Angular, and I knew the pitfalls. I was happy with Blaze and its simplicity, though there were some performance problems.
Later I moved to react and have never been happier. After I got over the initial hesitation, I have found that it yields excellent control over the reactivity and is actually easier and simpler to write (than blaze).
The benefits are from React, and not Meteor itself. But the fact that Meteor supports it excellently with its createContainer is definitely a driving factor.
How
This is not a tutorial. While the default Meteor tutorial may have lost its magic, there are lots available on the net.
This is a post to explain how I developed a small development app into a full blown production app, using Meteor (and other tools).
Use /imports/client
While Meteor’s official tutorial/guide encourages the use of /imports/ui , using imports/client ensures that any changes in the sub-files reloads only the client code. Much Much Faster!
Packages
Some of my favorite ones are:
mickaelfm:vermongoAn old and unknown, but extremely useful package. Extremely useful for maintaining the versions and updations of the documents.jagi:astronomyThe ultimate ODM, with a great documentation. Łukasz Jagodziński did a great job in creating this package to be much more feature-rich and useful thansimple-schema. With events, helpers, meteorMethods, indexes and behaviors on top of schema, this is the complete package to rival SailsJS.
The package is a bit heavy (190kb minified), but I have still not been able to convince myself to ditch it to make settlin.in lighter. I definitely cannot imagine our internal portal without it.ssrwpo:ssrRelatively a new kid on the block, the package is an extremely awesome work by PEM. The package works with react-router, and it’s development version works great for rendering dynamic html on the server. SSR has been the weakest link in Meteor, and this package is the answer.reywood:publish-composite,alanning:roles,simple:json-routes,ground:db v2,aslagle:reactive-tableare some other great but popular packages.
Regular .meteor/local/bundler-cache cleanup
The bundler-cache contains the cached bundle files prepared during various hot reloads. It is not automatically cleaned though. So regular cleaning ensures space conservation as well as performant meteor. I have personally put a slick rm -rf in my deployment script itself.
Multiple apps with same DDP connection
This is again a great feature. Whenever you think you may need an API for your app so that your other app may talk to it, go for DDP.connect . Good way to keep your mobile webapp bare-to-bones.
Meteor DevTools
The powerful chrome extension.
The above hacks/tools have helped me a lot during the last couple of years. Hope they help someone else too.
