A production environment hosts an application where real customers can access and use it. Moving from local development to production means deploying the application to customer-facing infrastructure, such as a cloud Kubernetes cluster. section 2.6.7 section 6.3
A practical production path includes:
- Install only runtime dependencies with npm install --omit=dev, excluding packages needed solely for development. section 2.6.7
- Start the Node.js service through the conventional npm start script, which hides the application’s specific entry file. section 2.6.7
- Package and publish the service with Docker, then deploy it to a Kubernetes cluster. section 6.11.9 section 12.9
- Automate testing and deployment so code changes can reach production after validation. section 8.9.12
Separating production environments
Terraform can create distinct development, test, and production instances by receiving an environment value and deriving names such as flixtube-production. Blue-green deployment extends this approach by routing customers to one production environment while developers prepare and test another, then switching DNS when it is ready. section 12.2.5 section 12.4.5
Listing 2.6 Adding a start script to package.json
{
"name": "example-1",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js" #1
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^5.0.0-beta.1"
}
}
Inspect a complete package.json start script showing how a Node.js service is made runnable through npm start. section 2.6.7







