deploy/reference/builds.md
In Deno Deploy, each version of your application code is represented as a revision (or build). When deploying from GitHub, revisions generally map one-to-one to git commits in your repository.
Builds can be triggered in three ways:
Automatically from GitHub: When a new commit is pushed to a GitHub repository linked to your app.
Manually from the CLI: Using the deno deploy command.
Manually from the UI: Using the "Deploy Default Branch" button on the
builds page, which deploys the default git branch (usually main). The
dropdown menu lets you select a different branch.
A revision goes through these stages before becoming available:
If any step fails, the build enters a "Failed" state and does not receive traffic.
Build logs are streamed live to the dashboard during the build process and remain available on the build page after completion.
Build caching speeds up builds by reusing files that haven't changed between
builds. This happens automatically for framework presets and the DENO_DIR
dependency cache.
You can cancel a running build using the "Cancel" button in the top-right corner of the build page. Builds automatically time out based on application configuration. By default, builds time out after 5 minutes, but this can be increased for users on the Pro plan.
App configuration defines how to convert source code into a deployable artifact.
There are two places you can set app configuration:
deno.json or deno.jsonc file in the
application directory.If you specify both options, settings in the source code take precedence over those in the dashboard. You will be unable to edit any of the app configuration values in the dashboard if the most recent successful build used configuration from source code.
The application directory must be configured through the dashboard. This setting is not configurable from source code, as it determines where to find the source code itself.
You can modify app configuration in three places:
When creating an app, app configuration may be automatically detected from your repository if you're using a recognized framework or common build setup.
App directory: The directory within the repository to use as the application root. Useful for monorepos. Defaults to the repository root.
Framework preset: Optimized configuration for supported frameworks like Next.js or Fresh. Learn more about framework integrations.
Install command: Shell command for installing dependencies, such as
npm install or deno install.
Build command: Shell command for building the project, often a task from
package.json or deno.json, such as deno task build or npm run build.
Pre-deploy command: Shell command that runs after the build is complete but before deployment, typically for tasks like database migrations.
Runtime configuration: Determines how the application serves traffic:
dist, .output)index.html for paths that
don't match static files instead of returning 404 errorsBuild timeout: Maximum time allowed for the build process. Defaults to 5 minutes, can be increased to 15 minutes on the Pro plan.
Build memory: Amount of memory allocated to the build process. Defaults to 3 GB, can be increased to 4 GB on the Pro plan.
To configure your application from source code, add a deno.json or
deno.jsonc file to the root of your application directory with a deploy key.
If any of the following app configuration options are specified under this key,
the entire configuration will be sourced from the file instead of the dashboard
(any configuration specified in the dashboard will be ignored).
deno.json optionsdeploy.framework (required unless deploy.runtime is set): The framework
preset to use, such as nextjs or fresh. Setting this option automatically
configures defaults for the framework. Available presets are listed in the
framework integrations docs.deploy.install (optional): Shell command to install dependencies.deploy.build (optional): Shell command to build the project.deploy.predeploy (optional): Shell command to run after the build is
complete but before deployment, typically for tasks like database migrations.deploy.runtime (required unless deploy.framework is set): Configuration
for how the app serves traffic. The app can either be static or dynamic, as
defined below:
deploy.runtime.type: Must be set to "dynamic", or omitted (dynamic is
the default).deploy.runtime.entrypoint: The JavaScript or TypeScript file to execute.deploy.runtime.args (optional): Command-line arguments to pass to the
application.deploy.runtime.cwd (optional): The working directory for the application
at runtime.deploy.runtime.memory_limit (optional): The maximum amount of memory the
application can use at runtime. Defaults to 768 MB, can be increased to 4
GB on the Pro plan.deploy.runtime.type: Must be set to "static".deploy.runtime.cwd: Folder containing static assets (e.g., dist,
.output).deploy.runtime.spa (optional): If true, serves index.html for paths
that don't match static files instead of returning 404 errors.deploy.runtime.memory_limit (optional): The maximum amount of memory the
application can use at runtime. Defaults to 768 MB, can be increased to 4
GB on the Pro plan.Example dynamic app configuration from deno.json:
{
"deploy": {
"install": "npm install",
"build": "npm run build",
"predeploy": "deno run --allow-net --allow-env migrate.ts",
"runtime": {
"type": "dynamic",
"entrypoint": "./app/server.js",
"args": ["--port", "8080"],
"cwd": "./app"
}
}
}
Example static app configuration from deno.jsonc:
{
"deploy": {
"install": "npm install",
"build": "npm run build",
"runtime": {
"type": "static",
"cwd": "./public",
"spa": true
}
}
}
Example framework preset configuration with Next.js from deno.json:
{
"deploy": {
"framework": "nextjs",
"install": "npm install",
"build": "npm run build"
}
}
The build environment runs on Linux using either x64 or ARM64 architecture. Available tools include:
deno (same version as at runtime)nodenpmnpxyarn (v1)pnpmgittargzip:::info
All JavaScript inside of the builder is executed using Deno.
The node command is actually a shim that translates Node.js invocations to
deno run. Similarly, npm, npx, yarn, and pnpm run through Deno rather
than Node.js.
:::
Environment variables configured for the "Build" context are available during builds, but variables from "Production" or "Development" contexts are not. Learn more about environment variables.
The following environment variables are additionally always available during builds:
CI: trueDENO_DEPLOY: true - Indicates that the code is running in Deno Deploy.DENO_DEPLOY_ORGANIZATION_ID: The ID of the organization that owns the
application. This is a UUID.DENO_DEPLOY_ORGANIZATION_SLUG: The slug of the organization that owns the
application. This is the human-readable identifier used in URLs that was set
when creating the organization.DENO_DEPLOY_APPLICATION_ID: The ID of the application. This is a UUID.DENO_DEPLOY_APPLICATION_SLUG: The slug of the application. This is the
human-readable identifier used in URLs that was set when creating the
application, or changed later in the application settings.DENO_DEPLOY_BUILD_ID: The ID of the currently running build.Builders have the following resources available during the build process: