With Front End Hosting - Advanced, one NodeJS application is provisioned with three environments: Development (Dev), Staging (Stage), and Production (Prod).
New environments are provisioned with the default content page.
To verify that a site is working correctly, visit the default URL of a specific environment:
package.json
package.json
file must be located in the root folder of your project that contains the following commands. These are required to host a NodeJS site. Utilize NodeJS Hosting's build system by setting npm install && npm run build
as your build command, assuring a robust and efficient deployment process.
"scripts": {
...
"build": "npm install && next build",
"start": "next start",
},
It is not required to define the dependencies in the build command if they are already installed in the Git branch.
Configure the start script in your package.json file in order to initiate the production server. Use the command that corresponds to your specific framework.
{
"scripts": {
"build": "npm install",
"start": "node index.js"
},
}
To serve production builds of frameworks like Angular, React, and Vue, we recommend using either serve or http-server. These Node.js packages provide simple and efficient ways to host static files.
Install your preferred package using npm:
$ npm install serve
or
$ npm install http-server
After you build the project (typically into a dist directory), start the production server with the following commands:
serve -s dist
http-server dist
You can also include these commands in the start script of your package.json
for easy deployment.
Ensure that your build output is located in the dist directory (or adjust the path in the commands accordingly).
To use the latest environment variable values in your Node.js code, incorporate them during the Node.js build process. Any changes to environment variables will require a redeployment of your Front End Hosting - Advanced site to update both build and runtime environments.
7. Deploy the branch:
In the future, new commits to the new branch trigger its deployment automatically.
For information on viewing your subscription details, refer to Managing subscriptions > Viewing subscriptions.
For monitoring instructions, refer to Using Stack Metrics to monitor activity on your environments.
As part of the code build/deployment process, multiple commands run in the backend to produce a build artifact and deploy it to an environment. These include:
The total build time is tracked as build minutes.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
Tue May 13 2025 22:38:41 GMT+0000 (Coordinated Universal Time)