Node JS

Node JS

Description

A lightweight platform ideal for building fast, scalable network applications in Javascript. Similar in design to Ruby's Event Machine or Python's Twisted, and built on Chrome's JavaScript runtime, NodeJS is ideal for data-intensive apps that run across distributed devices.

Software Included

PackageVersionLicense
Node.js12.18.1Custom
NPM6.14.4Artistic License 2.0
NGINX1.17.10Custom
PM24.4.0GNU AGPL v3

Getting started after deploying NodeJS

After you created a Pod, you can navigate to its public IPv4 address to see the sample application live.

You will then be prompted to enter a password. If you created your Pod with a root user password, enter this in the terminal. If you created your Droplet with an ssh key, enter the passphrase associated with your key.

Using MongoDB Database

To connect to the database with your NodeJS 1-Click App, you will need the CA Certificate which is also pre-configured on your Droplet at boot time. You can find the certificate at /root/dbaas_ca_cert.crt.

Here is sample Node.js app showing a connection over TLS using a CA certificate:

javascript
require('dotenv').config() const MongoClient = require('mongodb').MongoClient; // Connection string which you can copy from your database dashboard under "connection details". // Don't forget to replace the password and tlsCAFile parts of the string with the appropriate details. const url = process.env.DATABASE_URL; // Default database name. const dbName = 'admin'; // Create a new MongoClient, passing in the location of your CA certificate. const client = new MongoClient(url, { tlsCAFile: `${__dirname}/ca-certificate.crt`, }); // Use the connect method to connect to the server. client.connect(err => { if (err != null) { console.log("failed: ", err); return; } console.log("Connected successfully to mongodb server"); // Example of connection to the default database. const db = client.db(dbName); client.close(); });

To learn how to make modifications or get your code onto your Pod, here are the steps. You can also follow the sample application for the instructions.

Step 1: Access to your Pod

Open a terminal on your computer to access your Droplet as the root user using the following command:

console
ssh root@your_droplet_public_ipv4

Step 2: Make modifications to the sample application

Modify this script at /var/www/html/hello.js. You can then see the results live by using pm2, a process manager that schedules your code to run at boot time. The application runs as the nodejs user, so changes to pm2 need to be run as the nodejs user.

console
sudo -u nodejs pm2 restart hello

Step 3: Get your code onto the Pod

Clone your NodeJS code onto the droplet, anywhere you like. Note: If you're not using source code control, you can directly upload the files to your droplet using SFTP.

cd into the directory where your NodeJS code lives, and install any dependencies. (For example, if you have a package.json file, run npm install.)

Launch your app

console
sudo -u nodejs pm2 start <your-file>

Map the port your app run on to an HTTP URL

console
nano /etc/nginx/sites-available/default

Edit the existing entry that exposes the "hello" app at port 3000 to the world so that it points to your app's port instead.

Enable your new nginx config.

console
sudo systemctl restart nginx

Call to schedule your code to run at launch.

console
sudo -u nodejs pm2 save

Repeat these steps for any other NodeJS apps that need to run concurrently -- schedule them to run at boot time on whatever internal port you like using PM2, then map that port to an HTTP/HTTPS URL in the nginx config. Build out the URL directory structure you need by mapping applications to URL paths; that's the reverse proxy method in a nutshell!

Now you can delete the sample app we installed on your Pod. Stop running the initial script (that you're viewing now)

console
sudo -u nodejs pm2 delete hello

Stop it from running on Droplet boot.

console
sudo -u nodejs pm2 save

Step 4: Get production-ready

There's a lot you'll want to do to make sure you're production-ready. Here are the popular things that people will do.

Non-root user: Set up a non-root user for day-to-day use

Firewall: Review your firewall settings by calling sudo ufw status, and make any changes you need. By default, only SSH/SFTP (port 22), HTTP (port 80), and HTTPS (port 443) are open.

Domain: Register a custom domain

Storage: You can mount a volume (up to 16TB) to this server to expand the filesystem, provision a database cluster (that runs MySQL, Redis, or PostgreSQL), or use a Space, which is an S3-compatible bucket for storing objects.

New apps added every week

Subscribe to get notified when we launch new 1-click apps — from AI tools to databases and developer stacks.

Browse marketplace

More apps

OpenClaw

OpenClaw is an open-source framework for running autonomous, agentic AI systems that interact with APIs, tools, and messaging platforms in real time.

Read more

Jitsi Server

Jitsi is an open source app for videoconferencing and chat.

Read more