Skip to content
Skip to main content
CONTACT SALESSTART BUILDING

Build settings and environment variables

Builder Code

When you publish with Builder Cloud, Builder builds your Project using the settings in your Project's builder.config.json file. Use the Project's hosting settings to override how the site is built and to provide environment variables at build time or at runtime.

Open build settings

  1. Open your Project and go to Project settings.
  2. Select the Hosting tab.
  3. Expand Advanced Settings.

Settings here override builder.config.json when you publish. Leave a field blank to use the value from your config file or the default.

Build settings

The Build settings section has the following fields:

FieldDescriptionExample

Build command

The command that builds your site.

npm run build

Output directory

The folder your build writes the finished site to.

dist

Node version

The Node.js major version to build with.

22

Environment variables

Builder Cloud has two kinds of environment variables:

TypeAvailableUse for

Build environment variables

While Builder builds and publishes the site.

Values your build step needs, such as public API URLs compiled into your bundle.

Production environment variables

To the published site at runtime.

Server-side values, such as API keys and database connection strings.

Add a variable

  1. In the build or production variables table, click Add Variable, then enter a key, such as API_KEY, and its value.
  2. Select Secret if the value is sensitive. To change an existing secret later, enter a new value.
  3. Click Save.

Each production variable value can be up to 5,000 characters long.

You can also paste the contents of a .env file into a Key field. Builder splits each KEY=value line into its own row. For example:

API_URL=https://api.example.com API_KEY=abcd1234 FEATURE_SEARCH=true

Apply your changes

Build settings and environment variables take effect the next time you publish. After you save changes to a published site, the Publish button changes to Publish update to show that your live site is using older settings. Click it to redeploy with the new settings.

Settings are locked during a publish. You can't edit build settings while the site is publishing or while other Project changes are in progress. Wait for the current operation to finish, then try again.

For the full publishing flow, visit Publish with Builder Cloud.

Was this article helpful?