Node.js Dev Center
The platform offers a seamless integration with the fast, lightweight, and highly scalable NodeJS application server right out of the box. It comes equipped with various optimization and management tools designed to make the hosting experience as smooth and convenient as possible for developers.
In this article, we’ll explore the key tools and features the platform provides to ensure top-notch Node.js hosting.
Refer to the table of contents below to quickly locate the information you need in the guide:
- Node.js Environment Hosting
- Node.js Versioning
- Node.js Application Deployment
- Node.js Package Managers
- Node.js Process Managers
- Domains Management
- Automatic Vertical Scaling
- Manual Horizontal Scaling
- Automatic Horizontal Scaling
Node.js Environment Hosting
To launch your Node.js application, start configuring the necessary environment with the user-friendly Topology Wizard. Navigate to the Node.js tab, choose the appropriate engine version for your application server, and include any other required software stack. You can also tweak additional settings, like the number of cloudlets and nodes, and configure Public IPv4 and IPv6 addresses as needed.
Node.js Versioning
Currently (as of this writing), the following Node.js versions are supported:
- 16.20.2
- 18.20.2
- 20.13.1
- 21.7.3
- 22.1.0
You can pick the Node.js version you need when setting up a new environment, and you can also change it for an existing one if necessary.
Node.js Application Deployment
The platform streamlines the deployment of managed NodeJS application servers by offering several options:
- Uploading an application archive from a local machine or via an external URL
- Connecting to a remote VCS repository, such as GitHub
For further details on deploying Node.js applications, refer to the following resources:
Node.js Package Managers
To make things easier, each NodeJS application server includes a built-in development tool called the Package Manager. This tool standardizes and automates tasks like installing, updating, configuring, and removing software.
NodeJS supports two types of package managers:
- npm: This manager handles your project’s dependencies by installing additional modules, packages, and ready-to-use applications.
- Yarn: This operates similarly to npm, so no changes are needed for existing applications, but it offers better speed, reliability, and convenience.
By default, NodeJS uses the npm package manager, but you can switch to yarn if needed. To do this, go to the container variables frame and set the PACKAGE_MANAGER value to either npm or yarn.
Node.js Process Managers
Process managers are essential for controlling the lifecycle of applications, monitoring active services, and ensuring the smooth operation of projects. For the NodeJS stack, our platform supports several process managers:
- Npm: Enables starting the application.
- Pm2: Offers extensive application management features, including monitoring of running Node.js processes.
- Forever: Ensures your Node.js processes run continuously, automatically restarting them if they fail.
Users can select their preferred process manager during container redeployment or by setting the PROCESS_MANAGER variable to forever, npm, or pm2. A container restart is required for the new settings to take effect.
Domains Management
You can easily enhance your Node.js application by assigning it a custom domain name in place of the default one. Depending on your environment setup, you have two options:
- For development and testing environments using a Shared Load Balancer, a CNAME redirect is recommended.
- For production environments with a Public IP, use a DNS A Record to manage higher traffic volumes effectively.
Additionally, you can seamlessly redirect traffic between different environments—such as directing users to a newer version of your application without any downtime—by using the domain swap feature or the SwapExtIps API/CLI method.
Automatic Vertical Scaling
The platform automatically allocates the precise amount of RAM and CPU your nodes need based on the current load, so you don’t have to adjust anything manually.
This ensures you only pay for what you use, saving you both money and time by removing the hassle of managing load adjustments or making architectural changes.
Simply set the maximum number of cloudlets (each cloudlet equals 128 MiB of RAM and 200MHz of CPU) for your NodeJS application server, and the platform takes care of the rest.
For more details, please refer to the documentation on automatic vertical scaling.
Manual Horizontal Scaling
To scale your NodeJS application servers, access the topology wizard and use the +/- buttons in the Horizontal Scaling section to set the desired number of nodes. You can choose the scaling mode:
- Stateless: All new nodes are created from the base image template simultaneously.
- Stateful: The file system of the master container is copied sequentially to each new node.
The maximum number of servers of the same type within a single environment layer is determined by your hosting provider, typically limited to 16 nodes. This limit can be increased by contacting support.
For proper request distribution, a load balancer is automatically added when you scale your NodeJS servers. For more information, refer to the horizontal scaling documentation.
Automatic Horizontal Scaling
To set up special tunable triggers for adjusting the number of nodes based on application load, navigate to Environment Settings > Monitoring > Auto Horizontal Scaling.
Here, you can specify the resource type to be monitored (CPU, RAM, Network, Disk) and define the exact conditions for scaling.
For more details on automatic horizontal scaling refer to the linked document.
Additionally, the platform offers various built-in tools and features, such as:
- Custom or Built-In SSL
- Public IPv4 and IPv6
- A wide range of managed software stacks
- Container firewalls, endpoints, and environment isolation
- User-friendly UI and direct SSH access for management
- Open API and Cloud Scripting for automation
- Pay-as-you-use pricing model
- Collaboration functionality for teamwork
- Multi-cloud distribution
With these features, the platform ensures a seamless Node.js hosting experience!