Node.js One-Click Application

DigitalOcean’s One-Click application installs Node.js for a lightweight and efficient platform for building fast, scalable network applications. Similar in design to Ruby’s Event Machine or Python’s Twisted, and built on Chrome’s JavaScript runtime, it’s a great fit for data-intensive apps that run across distributed devices.

Components

Component Version
Linux Ubuntu 18.04.1
Node.js Latest from APT
NPM Latest from APT

In addition to the package installation, the One-Click also:

  • Enables the UFW firewall to allow only SSH (port 22, rate limited), HTTP (port 80), and HTTPS (port 443) access.

Quickstart

After you create a Node.js One-Click Droplet, Node.js and NPM will both be installed. This One-Click application is ideal for learning and exploring with Node.js, but isn’t configured for production use. For example, some steps you should take before using Node.js One-Click Droplets in production include:

  • Using PM2, a process manager for Node.js that lets you daemonize applications so they can run in the background as a service.

  • Using a reverse proxy, like Nginx, to give users a way to access the application.

  • Adding SSL to the reverse proxy for additional security.

  • If your application supports it, using multiple Droplets to add redundancy.

The guide How To Set Up a Node.js Application for Production on Ubuntu 18.04 explains these steps and more, like using the NodeSource PPA to get the latest LTS releases of Node.js.

If you’re not building a production app, you can use the built-in development server to begin learning Node.js. For the example in the linked Node.js documentation, make sure to open port 3000, as this One-Click’s UFW configuration doesn’t allow that port by default:

ufw allow 3000

API Creation

In addition to creating a Droplet from the Node.js One-Click application via the control panel, you can also use the DigitalOcean API.

You can list all One-Click application images using the API. As an example, to create a 4GB Node.js Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your API access token to an environment variable or substitute it into the command below.

curl -X POST -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer '$TOKEN'' -d \
    '{"name":"choose_a_name","region":"sfo2","size":"4gb","image":"nodejs-18-04"}' \
    "https://api.digitalocean.com/v2/droplets"

Next Steps

For more information on Node.js, you can read the official Node.js documentation.