Builds are a step of deployments that transform sources into production ready outputs. Builds result in either Static Files, or Lambdas (which execute code and serve a dynamic response for every request).

Builds are defined in the now.json configuration file using the builds property:

  "builds": [{ "src": "*.js", "use": "@now/node" }]

The above example instructs Now to consider all files with a .js extension (the pattern is defined in the src property) and pass them to an npm module named @now/node.

This @now/node module is called a Builder.

Builders take in all the files matched by the src property and transform those source files to a production-ready output.

Sources are files that already exist in your project before deploying and can be used to define the output.

Outputs are files that are used for the deployment. The output can be either a list of static files, Lambdas, or of both. The output is defined entirely by which, if any, Builder is used.

When deploying with Now, if your project has no now.json file, or has one but no builds property defined, the projects source files will be deployed directly as the output.

However, if you define a builds step, Now will only include the outputs that the Builders produce in the resulting deployment.

Note: Now will only include Builder outputs as a security precaution, if there are builds defined, to avoid serving unintended files to the public.

Creating a now.json file in a project, as mentioned above, will allow Now deployments to utilise the source and create a production-ready output through the builds property.

The builds property is an array that contains Build steps, consisting of at least a src and a use property.

The files matched by the src property, as a glob, defined in the Build object of the builds property are called the source. The output is what gets generated by a Builder which can consist of:

  • Static Files - Files that are immediately available without any invocation of code.
  • Lambdas - Serverless functions that are invoked upon request and serve a dynamic response.

The Builder responsible for handling the source is defined in the use property, within a build step of the builds array.

The driving force behind the builds step of Now are the Builders. Each Builder takes the source it is given and produces an output, depending on the purpose of the builder.

To get you started with your project quickly and easily, we have made a set of official Builders. You can find the full list of official builders in the sidebar to the left.

If you would like to learn how to create a custom Builder, follow the Builder Developer Guide.

Every file matched by the src property (mentioned above) will trigger a new Build. All of those builds are going to run in parallel after the deployment is created.

This means that each Builder defined in the builds property will run asynchronously of each other and produce their intended output without being blocked on a thread.

Ultimately, the build step will produce the output much faster than running the Builds in series.

Each deployment can support up to 256 Builds, where the Build is generated depending on the src property and the source files by extension.

If a Build is in progression for 15 minutes, the Build will timeout and throw an error.