How to Deploy Node.js Application

In this chapter, we discussed the fundamentals of JavaScript and explored its applications in both the frontend and backend, as well as how to created a full stack web application using JavaScript. As we reach the end of this chapter, it is time for us to discuss how to deploy the app to the cloud so that it is accessible on the internet.

There are several options available, each suited for different needs and flexibility. For example, you can deploy your app to a VPS (virtual private server), a could service such as AWS, or a PaaS (platform-as-a-service) such as Vercel.

Among these options, the VPS offers the most control and flexibility, as it is essentially a remote computer of which you have total control. But it also requires higher level of expertise on server management and it does not scale automatically. You have to buy more servers as your app attracts more users.

If you opt to use cloud services like AWS or Google Cloud Service, you are technically borrowing the computing power from Amazon or Google. Of course you are not going to have control of these servers, but it also saves you the trouble of managing them yourself, and the app will scale automatically without you doing anything.

As for PaaS such as Vercel and Netlify, they are platforms built on top of cloud services such as AWS by abstracting more backend services and infrastructures, making it easier for developers to deploy applications. Similarly, the app will scale automatically, and you will also be charged on the amount of resources consumed, but usually at a higher price for the convince they bring.

In this lesson, we will focus on deploying a Node.js application manually on a VPS, because our goal is to deepen your understanding of the inner workings of web applications.

Choose a VPS provider

A VPS (virtual private server) is a remote computer that you can use to host your web application. When your web app is visited, that computer will transfer the necessary resources to the client. As for the name "virtual", it means this computer utilizes the virtualization technology to split one physical server into multiple virtual servers so that they would be more affordable.

There are many companies that provide VPS services, such as Digital Ocean, Vultr, and Linode. They may offer different functionalities, but all three of them are big names in the industry, and offer decent and reliable services.

In this lesson, we're going to use Vultr as an example. You can use this link to claim $300 to get you started. Just in case you decide to use a different provider, we won't be using any of its special functionalities. Let's stick to the basics and set up everything manually.

Wait, there is more!

You need an account to access the rest of this lesson. Our course is 50% off for limited time only! Don't miss the opportunity!

🎉 Create an Account 🎉