How to Host a Node.js App in cPanel
Run a Node.js app on cPanel hosting without a VPS: create the app in Setup Node.js App, upload your code, install packages, set environment variables and start it.
Create a PostgreSQL database and user in cPanel with the wizard, connect your app on localhost, and manage and back up your database.
To create a PostgreSQL database in cPanel, open PostgreSQL Database Wizard, give the database a name, create a user with a strong password, and give that user access to the database. Your app then connects on localhost with the full database name and user name, which both start with your cPanel username. At HostGrap, PostgreSQL is included on cPanel Plus and bigger plans in Europe and Singapore, and on every Business cPanel plan. This guide shows each step.
| Plan range | PostgreSQL databases |
|---|---|
| cPanel hosting, Europe | Plus: 5, Prime and Max: unlimited |
| cPanel hosting, Singapore | SG Plus: 5, SG Pro and SG Max: unlimited |
| Business cPanel hosting | Business Lite: 5, Business Plus: 10, Business Pro and Business Elite: unlimited |
The smallest plans, Core and SG Lite, include MySQL but not PostgreSQL. cPanel hosting on our Sri Lanka servers includes MySQL only, so for PostgreSQL choose Europe or Singapore, or a VPS where you install the database yourself.
Use the database your app was built for. WordPress, WooCommerce and most PHP apps need MySQL. Many Python, Node.js and Ruby apps, and frameworks such as Django, work best with PostgreSQL, and some only support it. If your app's install guide asks for PostgreSQL, use PostgreSQL.
shop, and click Next Step. cPanel adds your cPanel username to the start, so the full name becomes something like cpuser_shop.Copy the full database name, user name and password somewhere safe. You need them for your app.
Your app runs on the same server as the database, so it connects locally:
| Setting | Value |
|---|---|
| Host | localhost |
| Port | 5432 |
| Database | Your full database name, such as cpuser_shop |
| User | Your full database user name |
| Password | The password you set |
Many apps use a single connection string instead. It looks like this:
postgresql://cpuser_appuser:YOUR_PASSWORD@localhost:5432/cpuser_shopKeep this string in an environment variable or a settings file outside public_html, never in a public file. For a Node.js app, add it under Environment variables in Setup Node.js App: see how to host a Node.js app in cPanel.
Open PostgreSQL Databases in cPanel. There you can create more databases and users, change a user's password, add a user to another database and delete a database you no longer need. Deleting a database removes all its data, so take a backup first.
HostGrap backs up your account, including your databases, with daily and weekly backups on Europe, Singapore and Business plans. If you need a database restored from a backup, message our team. For your own copy, you can export the database from the terminal with pg_dump:
pg_dump -U cpuser_appuser -h localhost cpuser_shop > shop-backup.sqlIf your database connection fails, check that the user has been added to the database and that you used the full names with your cPanel username at the start. If it still fails, message HostGrap AI on live chat or WhatsApp, or open a ticket, and our team will check it with you.
Run a Node.js app on cPanel hosting without a VPS: create the app in Setup Node.js App, upload your code, install packages, set environment variables and start it.
Send automatic replies such as "We are away until Monday" from any email address in cPanel. Step by step with pictures, plus how to edit or turn it off.
Create an email address on your domain in cPanel in under a minute, and change its password later from Manage. Step by step, with pictures.