# Node.js app requirements (https://developer.godaddy.com/en/docs/api-users/hosting/app-requirements)

---
title: Node.js app requirements
description: >-
  The structure and configuration a Node.js app must have before uploading to
  GoDaddy Hosting.
keywords: >-
  package.json, build script, start script, process.env.PORT, node_modules,
  dependencies, devDependencies, zip requirements, deploy requirements, hosting
  requirements, node version, engines
related:
  guides:
    - title: How to deploy your Node.js app
      href: /docs/api-users/hosting/workflows/deploy-nodejs-app
  concepts:
    - title: Hosting core concepts
      href: /docs/api-users/hosting/concepts
---

## Overview

This page describes the structure your Node.js app must have before you upload it to GoDaddy Hosting. An app that skips any of these requirements fails at build or startup when you publish.

Go to [How to deploy your Node.js app](https://developer.godaddy.com/docs/api-users/hosting/workflows/deploy-nodejs-app) for the full deployment walkthrough.

## package.json

The zip must contain a `package.json` at the root. It must include non-empty `name` and `version` fields. The `main` field is optional but recommended when your entry point differs from `index.js`.

Specifying a Node.js version is also recommended:

```json
{
  "name": "my-app",
  "version": "1.0.0",
  "engines": {
    "node": "20.x"
  }
}
```

## Scripts

`package.json` must define both a `build` script and a `start` script.

**Build script:** The platform runs `npm run build` during deployment. If your app has no compile step, define a no-op placeholder:

```json
"build": "echo build"
```

Frameworks (Next.js, NestJS, TypeScript projects) need a real build command.

**Start script:** The platform starts your app with `npm start`. The command must point to a file that exists in the zip:

```json
"start": "node index.js"
```

A complete minimal `package.json`:

```json
{
  "name": "my-app",
  "version": "1.0.0",
  "engines": {
    "node": "20.x"
  },
  "scripts": {
    "build": "echo build",
    "start": "node index.js"
  }
}
```

## Port binding

Your app must listen on the port the platform assigns. Read it from `process.env.PORT`:

```js
const port = process.env.PORT || 3000;
server.listen(port);
```

The platform sets `PORT` at runtime. An app that binds to a hardcoded port won't receive traffic.

## Dependencies

Every package the app needs at runtime must be in `dependencies`, not `devDependencies`. The platform installs only `dependencies` before running build and start.

```json
{
  "dependencies": {
    "express": "^4.18.0"
  },
  "devDependencies": {
    "jest": "^29.0.0"
  }
}
```

A runtime package left in `devDependencies` causes `MODULE_NOT_FOUND` errors at startup.

## Zip contents

Include source files and `package.json`, but exclude `node_modules`. The platform runs `npm install` after extracting the zip.

Files to include and exclude:

| Include                             | Exclude                     |
| ----------------------------------- | --------------------------- |
| `package.json`, `package-lock.json` | `node_modules/`             |
| All source files                    | `.env` files with secrets   |
| Static assets                       | Uncommitted build artifacts |

Including `node_modules` in the zip slows upload and might conflict with the platform install.
