What’s the deal with Node.js?
03 Dec 2020Development
Node.js is a lightweight solution for real-time apps working simultaneously on distributed devices. It’s efficient thanks to its non-blocking, event-driven I/O. It’s not exactly universal, and it won’t solve all your problems, but it’s great for fulfilling specific needs. Here’s what you have to need.
Node.js was laughing stock back in the day
However, once upon a time Ryan Dahl got really annoyed. It was when he couldn’t see the progress of uploading his photos to Flickr. This was the spark that inspired him to create Node.js, a simple solution that anyone can implement. It quickly gathered a following and was used in the following projects.
- 2010 – Express and socket.io use Node.js based solutions
- 2011 – Hapi, LinkedIn, and Uber express their interest in Node.js
- 2013 – Koa and Ghost (the first JS-based blog platform) are created
- 2015 – Node.js Foundation is established
- 2016 – Yarn, Node.js 6
- 2017 – Node.js 8, HTTP/2, 3 BILLION downloads weekly
- 2018 – Node.js 10
- 2019 – Node 12
- 2020 – Node 14 & 15
Now, why should YOU have any interest in Node.js?
To answer this, let’s establish the foundation. A typical application consists of:
- Access to a server-based file system
- Operations on files
- Advanced support for web protocols
- Sharing the code and package managers
Another thing that makes Node.js so effective and fast is the event-driven, non-blocking I/O model.
Let’s take a look at Node.js actually working. Here’s a shortlist of frontend solutions with Node in the background:
- Bundlers that combine dependencies into a single whole (Webpack)
- Test-runners that enable you to test the code (Mocha, JEST, Jasmine, Karma, Puppeteer)
- Linters and tools for static code analysis (ESLint)
- Tools that support the projects from the console level (Angular CLI, Svelte CLI)
Now let’s see who uses Node.js!
Everyone knows the brands from the left column, right? That’s because the giants really like Node.js. It’s because it allowed them to achieve some outstanding feats.
You already know why technical folks fall in love with Node.js. Now it’s time to explain, how Node.js has been working for these big companies:
- Reducing the number of hosting devices 10x
- Reducing the number of servers from 30 to 3
- Doubling the traffic capacity
- Increasing the performance significantly and lowering the memory use
- Increasing the speed of the new mobile app up to 20x in some scenarios
- Merging the frontend and backend teams
- Getting a safety margin that allows supporting 10x the resource usage
- Quick and flawless processing of extremely large amounts of data
- Eliminating the errors without having to restart
- Quick implementation of new code
- Accessing the strong open source community to develop new solutions with
- Quickly responding to changing business needs
- Building a Node.js app two times faster and with a smaller team than on the previous Java-based app
- Doubling the query-per-second rate
- Reducing the average server response time by 35%
- Reducing the code length by 33%
- Reducing the number of files by 40%
- Reducing the app opening time by 70%
- Improving further development and shortening the time to create a new version of the app
- Reducing the environment launch time from 40 minutes to under 1 minute
- Reducing the number of steps in the process from 28 to 7
- Moving all the data from the cloud to the corporate architecture of Node.js
- Using a single database for everything
- Reducing the time needed to access the data by 300%?!?!?!?!?!?!?!
- Switching to Node.js for designing the EVA suit
(it’s the largest information portal about the transport industry in Europe, we wrote more about our contribution to the project here)
- Improved visibility in Google due to SSR
- Reducing the page load time from 12 to 3 seconds
- Increasing the control over the application
- Server-based authentication
- Uninterrupted operation of the application during deployment, making it invisible to the user
And here’s the simplest HTTP server in Node.js
Node.js support for template engines includes the following:
- EJS (the most frequently used one)
So why would you want to use Node.js?
- It’s scalable and well-performing
- It’s versatile
- It offers fast development
- You can use a proxy server
- You can effectively use your code
- It eliminates the need to use other programming languages
- It has a non-blocking I/O process
- You can implement changes without interruptions
- Processing is incredibly smooth
- Data streaming is way more effective, as proven by Netflix
- Testing new functionalities becomes quick and easy
- You can have one team taking care of frontend and backend
- It’s open-source, with countless libraries in the NPM
What will be the challenges?
- You have to work out the ORM transactions
- It requires technical prowess. The more experienced your programmers, the faster your cases get done
- This is an open-source project and there are many solutions and you must choose one correct
- There is no framework like Spring
- The client environment must be well prepared for metrics
Node.js for enterprise applications?
The Node.js runtime environment is becoming a popular choice for developing server-based apps. But is it good for enterprise projects, which tend to be more complex? It is used for microservices, after all.
Most organizations need two groups of IT people. One to take care of traditional IT operations, encompassing CRM, ERP, mainframe apps, etc. And one to research and develop next-gen apps that require dynamic changes. For them, Node.js is a viable option. But only for them. For the first group, you really need something easy-going and predictable.