14th December 2023

Load Balancing Algorithms in Node.js

Load balancing is crucial for distributing incoming network traffic across multiple servers, ensuring no single server is overwhelmed. In this article, we’ll delve into three popular load-balancing algorithms, their implementation in Node.js, and the scenarios where each is most beneficial. 1. Round Robin Round Robin is the most straightforward load-balancing algorithm. Each server is selected in turns, looping back to the first server after the last. The benefit of Round Robin is that it is simple and predictable. You don’t need to keep track of server load or number of simultaneous connections etc. Scenarios for Use: 2. Least Connections The […]
16th October 2023

Role-Based Access Control in Nodejs

Introduction This article will help you set up RBAC i.e Role-Based Access Control in your node application. RBAC allows us to provide permission to users based on their roles. We are often required to provide different roles to users to improve the security of the application. Thus, we will be discussing an application with 3 roles for the user — client, moderator and admin. The user with the admin role will have access to a special route which will allow him to change roles of other users as well as view profiles of all the users. Pre-Requisites Following are the […]
3rd October 2023

Advance Building a Load Balancer using Node JS + Express

Building a Scalable Load Balancer with Node.js and Express Load balancing is a critical component of any scalable web application. It helps distribute incoming client requests evenly across multiple backend servers, optimizing resource utilization and ensuring high availability. In this comprehensive tutorial, we will build a highly flexible load balancer using Node.js and Express that can handle multiple heterogeneous backend servers. Overview Here are the core features we will implement in our load balancer: We will use a modular design pattern to make it easy to modify or extend components later. Our load balancer will run as a standalone Node.js […]
16th September 2023

NestJS vs Go: Performance comparison for JWT verify and MySQL query

Introduction After publishing a record number of articles on comparing performance of various technologies like Node.js, Deno, Bun, Rust, Go, Spring, Python, etc. for a simple hello world case, I consistently got comments that the articles were good, but weren’t applicable directly for real-world use cases. I was asked to do the same for more ‘real-world’ cases. The articles also (and still) attracted a record number of views. However, the point was well taken. Hello world was the best starting point, but definitely not a ‘real-world’ case. Real-world use case This article is a part of the series where I’m […]
21st June 2023

5 Common Server Vulnerabilities with Node.js

Introduction Node.js is a powerful and widely-used JavaScript runtime environment for building server-side applications. However, like any other software, Node has its own set of vulnerabilities that can lead to security issues if not properly addressed. Please do note that these vulnerabilities are not unique to Node, they can be found in every backend programming language. This article will explore 5 common vulnerabilities: 1. Injection Vulnerabilities Node applications are vulnerable to injection attacks, such as SQL injection, NoSQL injection, and Command Injection. These types of attacks occur when an attacker inputs malicious code into a vulnerable application and the application executes it. An injection vulnerability […]