Plans & Getting Started

How to Deploy a Node.js App

By the StarDomain teamPublished 2 min read
Knowledge base article
Contents (4 sections)

You can run a Node.js app on StarDomain in three ways. The App Platform is the simplest for most projects.

Key takeaways

App Platform: connect your GitHub repository and click Deploy Now. Your app must listen on the PORT environment variable. DirectAdmin Growth: use the Node.js app selector. VPS: install Node.js and run your app as a service. Container Hosting does not run Node.js apps.

  1. Create an app
    under Services › App Platform.
  2. Connect GitHub.
    In your app, open Access › GitHub, choose your repository and click Deploy Now.
  3. Listen on the right port.
    Read the port from process.env.PORT and bind to 0.0.0.0.
  4. Add settings
    such as NODE_ENV=production as environment variables.
  5. Add your domain
    when the app works. Free SSL is set up for you.

Node.js is detected from your package.json. A PostgreSQL database is included on every plan. To deploy from your own CI instead of GitHub, use a deploy token. See Getting Started with the App Platform, Environment Variables and Custom Domains.

2. DirectAdmin Growth hosting

The Growth plan includes a Node.js app selector for small apps. See Running Node.js Apps in DirectAdmin.

3. VPS

Install Node.js, run your app with a process manager or a systemd service, and put a web server such as nginx in front of it. See Connecting to Your VPS over SSH.

4. Troubleshooting on the App Platform

  • Build fails: read the build log in the Deploy section. The version already running keeps running.
  • App crashes on start: check that it listens on PORT, and that every setting it needs is set as an environment variable.
  • Domain shows no HTTPS: check that DNS points as shown in the app's domain settings.
Can I run Node.js on Container Hosting?

No. Container Hosting runs PHP websites. Use the App Platform for Node.js.

Does pushing to GitHub deploy my app automatically?

Not by itself. Click Deploy Now, or use a deploy token from your CI so each pipeline run deploys.

Was this article helpful?

Your answer helps us decide what to improve next.

Still need help? Open a support ticket and our team will reply.

Prefer an app? Add this site to your home screen.Get the app
How to Deploy a Node.js App on StarDomain