Skip to main content


Clustering Node.js

Node.js is single-threaded. As every design decision this one has its benefits and drawbacks. A benefit is - it is significantly harder to "shoot yourself in a foot" with multithreaded code. With languages like C++ or Java, multithreading is a separate subject that is rather advanced and even considered to be a form of a black magic by some developers. So in JavaScript you don't even have to think about scary terms like "deadlock", "race condition" or "memory barrier". What's the downside?

Writing UDP Client/Server Application with Node.js

Writing UDP server with Node.js Different application require different design of networking protocols. Everything that is built for web is using HTTP (recently WebSockets and WebRTC too for real-time data). If your clients are not browsers and you need reliable and guaranteed channel your choice is TCP/IP. There's however one more protocol that is often used for the cases when the speed is more important that delivery guarantees and ordering: UDP. UDP stands for Unified Datagram Protocol and it shines in the applications like fast-paced online gaming.

Building TCP/IP Applications with Node.js

Most of the times Node.js is used for HTTP-based servers. There are times however when you need to go one level deeper, and write your software based on TCP/IP protocol instead of HTTP. Indeed, HTTP was originally designed as a request-response protocol, and it is text-based. TCP/IP is more "raw": it is binary (meaning, more effective) and also it is full-duplex persistent connectinon (which again means it is more effective). If you are building an application that is not targeted specifically at browsers, there's a good chance that TCP/IP will be a better choice to you than HTTP.

Real-time Geographical Data Visualization with Node.js, Socket.IO and Leaflet

Data visualisation is becoming an increasingly important subject. As the complexity an volumes of data increase, it is getting harder and harder to make sense of bare arrays of numbers without relevant visualisation models. Let me give you a good example. Right now I work in China. Few months ago there appeared a new startup: bycicle sharing service that used GPS sensors on each bike to track it in the city. Now let's imagine, you need analyse how evenly your bikes are distributed around the city and how many of them are in motion right now.

Using Azure DocDB with Node.js

Moving your project to a cloud might be a difficult task especially since there are so many different cloud services out there. AWS is the most popular one and Azure is a very close competitor. In this article I will show you how to start using Azure, namely its NoSQL database service - DocDB. NOTE: Azure is a great platform, however it has significantly less tutorials and examples available online (compared to AWS). Before we start to write the code we will need to prepare the dependencies.

Uploading data to Amazon S3 from Node.js

What can be simpler than uploading file to the server and saving it to hard drive, right? Open read stream, read bytes, open write stream, write bytes, done. Now let's explore the same question but from a high-load high-availability service perspective. You're designing new Instagram, where will you store the photos? Remember, at a bare minimum you need to make sure that a failure to a single node in a data center will not interrupt your service (you can't allow to lose those precious cat pictures that your users are uploading).

Implementing Facebook Authentication With Node.js

In this small project we'll see how to implement Facebook authentication for your Node app with a help of Passport.js. Facebook authentication might sound like a lot of work but with the help of Passport, it is a surprisingly easy task. To give you a good feeling about the volume of code that you're about to write: It is about 80 lines of JavaScript and couple more lines of HTML. Before we start let's see how our application will look like. This is a truely minimalistic app with two pages: a login page and a "secret" page that only authenticated users are allowed to see.