There are three fundamental things behind the choice of a technology stack for your software product. First, your business priorities and objectives. Second, the specifics of your business domain and market. Third, the specifics of the stack itself. All of these must be properly considered without contradicting each other.
The server side—the back end of your product—is arguably its most important part. Among all possible back end development technologies to choose from, Node.js is one of the essentials. It encompasses the vast majority of modern business domains and actual cases.
This is the subject of today's story – when and why Node.js should (or should not) be used in your software product development.
Top 6 technologies for back end development
First and foremost, it is a wise move to carefully consider all the available options. Here is a brief overview of six main back end languages to base your project on.
• PHP is mostly used for small to mid-sized projects, although larger examples do appear. Despite the progressive capabilities and performance of the most recent 7th version, over the last couple of years PHP has become a kind of anti-trend. Having a number of commercially successful PHP-based products, we do not share this point of view. PHP is based on scripts and requires event-driven architecture, that is why real-time features are not its forte. However, it's still popular, being the simplest language that has a huge community and numerous frameworks for the majority of tasks.
• Python—arguably the easiest language to understand—is mostly used for mid-sized and large projects, although it's just as renowned for being a quick solution for startup products (for example, MVPs). Development with Python is fast, highly productive for the developer, and offers high quality of the outcome. Python is not that great at performance; however, a specific PyPy implementation allows to solve this problem.
• Ruby is one of the fastest and most popular solutions for startups that implement small and mid-sized projects and plan early market entry. It can be a good option for projects with lasting support and frequent changes in the logic.
• Java development takes time and is costly. Projects are typically large, with specific requirements. Complex calculations and data processing are its forte.
• C# is a superior alternative to Java with similar execution flows. It is used for large projects, being particularly good for the sphere of financial technology.
became a trend over the last several years. It currently offers a huge number of off-the-shelf solutions, and it works for a wide variety of projects, including games. It was typically used for mid-sized projects; however, only recently its capabilities took a major leap forward. It is an asynchronous platform based on non-blocking input-output operations. As a result, the advantages of Node.js include exceptional scalability and a good ratio between product performance and developer effort. As a result, the advantages of Node.js include exceptional scalability and a good ratio between product performance and developer effort to follow the best web development practices
What types of software projects is Node.js suitable for?
Considering the specifics of this technology and its accompanying stack, we outlined types of software projects where Node.js often becomes the optimal solution.1. The Internet of Things
Node.js is the best candidate for supporting a huge number of connections and small messages from IoT
2. Real time communication & collaboration tools | WebSockets | WebRTC
The reason why Node.js should be used for WebRTC
-based and other real-time communication software is the same: a huge number of simultaneous connections and distribution of messages across channels. Other technologies struggle hard to match the efficiency and the ratio between functional complexity, scalability, and speed of development, which can be easily achieved with Node.js.
3. Audio/video processing via external tools
The asynchronous input-output of Node.js makes it a perfect tool to upload this kind of content to the server, which in turn will process it. Implementation of streaming software is also possible; the actual possibility depends on the selected streaming implementation, types of data and processing.
4. Integration with C++ code
5. Serverless architecture | BaaS | PaaS
This is a popular solution that saves huge amounts of money and effort on fluctuating server load and DevOps.
6. Microservice-based architecture
If the software is divided into functional modules in containers, optimal technologies can be selected for each. With Node.js it becomes easier and cheaper to parallelize development, test separate modules, and conduct ongoing support.
7. List of cases from the official Node.js repository
• Back-end API services
• Service-oriented architectures
• Microservice-based applications
• Generating/serving dynamic web page content
• SPA applications with bidirectional communication over WebSockets and/or HTTP/2
• Agents and Data Collectors
• Web Developer Tooling
• Small scripts
All of these cases can be implemented with other technologies; however, for Node.js it's the official focus of the platform, which is continuously developed and optimized by the community.
What are the cases when Node.js should not be used?
Applications with monolith architecture
Node.js is a single-threaded platform, and monolith apps contain lots of functionality. When something is being executed in a single thread, the remainder has to wait. Server capacities are used in a suboptimal way, since one thread utilizes one processor core. Therefore large Node.js applications are created as sets of microservices or under a service-oriented architecture made of several services. Monolith applications of any complexity are acceptable if there is no high load involved.Complex CPU calculations
Node.js is not the best solution when it comes to work with highly loaded threads that involve CPU. A good example is when audio and video processing is written on the back end—as opposed to the abovementioned recommended use of external processing tools, e.g. ffmpeg or imagemagic.
Unfortunately, the financial sphere is the single sphere where Node.js is definitely not recommended because of the specifics of work with the floating decimal point—it can lead to accumulation of errors in variables that deal with finances, which is unacceptable. There are tools that allow to build logic with high-precision calculations; however, all of them have drawbacks and must be used wisely. Our own good example of a financial management solution
is based on Ruby.
What are the criteria to consider when selecting back end technologies for your software project?
- Size of your project and your business domain
You can tackle projects of any size with Node.js. However, it's the architecture that matters, whether it is a content management framework, a small monolith, or microservices. As for your business domain, we have already described the dos and don'ts above.
- Complexity of your product
There can be any complexity as long as it does not involve monolith architecture. Division of functional parts into microservices is much more flexible.
Node.js is quite on par with other technologies and depends on your business case. In some cases well-established processes, such as full-stack development, can reduce spent time.
The latest version of Node.js shows absolute flexibility and excellent fault tolerance (from version 6 on); the biggest community of developers among back end technologies and, as a result, cheaper support costs; high availability of open source developer tools; over 400,000 off-the-shelf NPM solutions; excellent documentation and fast pace of evolution. Additionally, Node.js can comply with the strictest load and security requirements in your product.
To sum it all up, Node.js development services can be involved for any business sphere with a couple of exceptions mentioned above. Over the last 3 years it rapidly advanced from a specific solution for runtime communications to a full-fledged back end technology with a number of powerful high-level frameworks (e.g. Express, Koa, Next or Nuxt). This evolution made it even more attractive for businesses and any Node.js development company there is; software developers speak highly of it. And if you'd like to know what companies are using Node.js in production, the list will be impressive, including such giants as PayPal, Netflix, Uber, LinkedIn, Ebay, Walmart, Medium, NASA, Mozilla, and Trello.
"There are no "good" or "bad" technologies as such. Each one is good for its particular set of tasks. Every software product owner has to identify the most important criteria of choice, according to business goals and existing constraints—and after that, the choice will be much more obvious.
If you have any specific questions regarding your own project, feel free to ask!"