Skip to main content

Node.js

The deplo.io build environment makes use of the Paketo Node.js buildpack.

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=nodejs/nextjs

Build env considerations

The build process offers a few env variables to adjus 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

To ensure the seamless build of your NextJS application, it's crucial to explicitly define the NODE_ENV environment variable as production.

This requirement stems from an existing upstream issue that cannot be rectified.

To address this, utilize the --build-env and --env options in nctl as follows:

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