Alexander Beletsky's development blog

My profession is engineering

NPM for Everything

JS ecosystem is famous for it’s wide range of packages and tools. Besides the default package manager, which comes with Node.js – NPM (node package manager), there are Bower.js, Jam.js and many more.

For a quite long period, my default setup was like – NPM for all server-side components and Bower.js for client-side stuff. It worked quite good together, especially in conjunction with Require.js.

But recently, I switched to NPM only setup. That allowed me to use CommonJS style both front and back ends and got rid of task runners as Grunt and Gulp.

Configuring Front-End Applications

Typically front-end applications have particular configuration, depending on environment. It could be access tokens, API URL’s, applications settings etc. For quite long period of time I solved that problem by exposing window.env variable, populated either by server rendering or by plugins as html-build .. or just directly referencing <script src="config/my.env.js">, where my.env.js needed to be updated before actual deployment.

Spending much time on backend and working with Node.js/CommonJS I liked simplicity of config pattern and wanted to reuse that pattern on frontend. It’s really straightforward and framework-agnostic approach.

Health Monitoring of Services and Databases

Once you are up and running your primary job is to monitor that all your services are in good health. If something bad happens, network issue or crashes – you have to be notified on that as soon as possible. Hardering of the HTTP services and databases became a one of primary activities for any startup.

There few products on market that can do that, Pingdom and New Relic probably the most know. But they are paid and not that flexible as I want. So, I’ve created likeastore/heartbeat that for a month or so helps me to provide quality service.

Email, SMS and Push Notifications Server

I recently came up with very convenient component – likeastore/notifier. Notifier is easy to setup Email, SMS and Push Notifications Server. It’s been open sourced few month, very specific to Likeastore needs, but due to great contributions it became very generic and can be used in your projects as well.

Once you need to setup infrastructure for notifications in your application, it will be really easy to do. It provides transport of Mandrill, Twilio, Android and iOS push notifications.

Secure Deployment of ElasticSearch

Remember my success story of moving from MongoDB full text search index to ElasticSearch? After about one month of work our search service unexpectedly stopped. I received a bunch of emails from Logentries and NewRelic that server is no longer responsive.

Once I logged on to DigitalOcean account, I’ve seen message from administrators that server is sending a lot of traffic (UDP Flood), very likely compromised and therefore stopped. The link they give as instructions to fix the problem was quite comprehensive, but the most important info was in comments. A lot of people who were hit by problem had ElasticSearch deployed on their machines.

Using Mixpanel from Chrome Extensions

Recently we’ve released Google Chrome extension for Likeastore that allows to extend your Google search results with relevant information from your likes. Development of Chrome extensions appeared to be interesting process, but essentially it’s nothing more as web development, since primary technologies are still HTML/CSS/JS.

The most important thing for every startup are metrics. In web application we use Mixpanel together with Google Analytics and Seismo. For browser extension I also needed some simple metrics, like “usage”, “clicks”, “shares” etc. Unfortunately, if you just try to reference mixpanel-2.2.min.js it won’t work.

Got Tired of MongoDB Full Text Index

We use MongoDB as our primary data source in Likeastore and went the way of MongoDB Full Text Search. Everything were fine initially, but after a while it became obvious that MongoDB FTS could not satisfy me any more.

I knew about search oriented storages as ElasticSearch, Sphinx, Solr, etc. but the migration process always seemed a bit scary to me. After a bit of elaboration I decided to go with Elastic and the migration was quite fun and not so difficult as I initially expected.

Integration or Unit Tests Trade-Off

Recently, I’ve released small Express.js extension for easy switching application to maintenance mode. Sometimes, you just want to run patch against database or change the infrastructure of product, but instead of showing blank nginx 503 error page, you want to have nice looking HTML, saying will be back soon.

The maintenance package is now available on npm and you welcome to use it. But I would like to share the way I developed and test it.

Side-Project to Startup in One Year

Today is exactly one year as we started Likeastore project. It went through a different stages, from hack to side-project and finally transformed to real startup.

The year, seems to be a huge period of time. It is, but I have to say it’s only few last months (from the middle of December till today), we are fully dedicated to project. It’s been great ride so far, so I wish to share some interesting moments.