Skip to main content

Node.js

The Deploio Node.js build environment uses the Paketo Node.js buildpack on the paketo stack, and the Heroku Node.js Cloud Native Buildpack on the heroku stack. See Buildpack Stacks for more information.

Example App

We have a basic Next.js app in our examples repository. You can deploy it with nctl:

nctl create application nextjs \
--git-url=https://github.com/ninech/deploio-examples \
--git-sub-path=heroku-stack/nodejs/nextjs

Paketo Stack Configuration

The build process offers a few env variables to adjust it to your use-case. See the how to section of the documentation for all available variables.

Build an App in a Subdirectory

To specify a subdirectory to be used as the root of the app, you can use the BP_NODE_PROJECT_PATH build variable.

--build-env=BP_NODE_PROJECT_PATH="./node-app"

NextJS

In specific scenarios, such as when utilizing the NextJS router, additional steps are essential to get your application to build.

NODE_ENV

When using the paketo stack, the NODE_ENV environment variable must be explicitly set to production to ensure a successful build. This requirement stems from an existing upstream issue that cannot be rectified.

nctl create app next --git-url=<url> --build-env=NODE_ENV="production" --env=NODE_ENV="production"

This is not required when using the heroku stack.