# Creating a Node.js application with the Node.js Selector

> Create and run a Node.js application in cPanel with the Node.js Selector, choosing the version, app root and startup file.

Source: https://helpcenter.ruachost.com/cpanel/software/creating-a-node-js-application-with-the-node-js-selector/

The **Node.js  Selector** in cPanel allows you to easily create and manage Node.js  applications directly from your hosting account. This tool is especially useful for developers who want to run modern JavaScript applications without manually configuring the server environment.

## Steps to Create a Node.js Application

### 1. Access the Node.js Selector

1. **Log in to cPanel.**
2. On the **Tools page → Software section**, click **Setup Node.js  App**.

### 2. Create a New Application

1. Click **Create Application**.
2. Fill in the following fields:

   - **Node.js  Version** → Select the version you want to use (e.g., 16.x, 18.x).
   - **Application Mode** → Choose **Production** or **Development**.
   - **Application Root** → Enter the directory where your app files are stored (e.g., `/home/username/myapp`).
   - **Application URL** → Define the domain or subdomain that will serve the app.
   - **Application Startup File** → Specify the entry point file (e.g., `app.js` or `server.js`).
3. Click **Create**.

### 3. Manage Application Settings

- After creation, you can:

  - **Restart** the application if you make changes.
  - **Stop/Start** the application as needed.
  - **Edit configuration** (change Node.js  version, root directory, or startup file).

### 4. Install Dependencies

1. Navigate to your application root directory using **File Manager** or SSH.
2. Upload your `package.json` file.
3. In the Node.js  Selector interface, click **Run NPM Install**.

   - This installs all required dependencies listed in `package.json`.

### 5. Verify Your Application

- Visit the **Application URL** you configured.
- If everything is set up correctly, your Node.js  app should load.
- Use **Error Logs** in cPanel to troubleshoot if the app doesn’t start.

> **Note:**
- Always use **Production mode** for live applications to optimize performance.
- Ensure your `package.json` file is properly configured with all dependencies.
- Restart the app after making changes to files or dependencies.
