Builds
How nesly decides what to build, and how to tell it something different.
Most projects need nothing on this page. On every deploy the platform looks at your source, recognises the framework, installs with the package manager your lockfile names, runs your build and serves the result — as static files when that is what the build produced, as a container when your project is a server.
The rest of this page is for when that is not what you want.
What is detected
| Framework | Build | Output | Served as |
|---|---|---|---|
| Vite (React, Vue, Svelte, Solid…) | npm run build | dist | static site |
| Create React App | npm run build | build | static site |
| Astro | npm run build | dist | static site (a server adapter makes it a container) |
| SvelteKit | npm run build | build | static site with adapter-static, container otherwise |
| Next.js | npm run build | out | static site with output: 'export', container otherwise |
| Nuxt | npm run build | — | container |
| Remix | npm run build | — | container |
| Angular | npm run build | from angular.json | static site |
| Gatsby | npm run build | public | static site |
| Docusaurus | npm run build | build | static site |
| VitePress | npm run build | docs/.vitepress/dist | static site |
| Eleventy | npm run build | _site | static site |
| Plain HTML/CSS/JS | — | — | served as it is |
The package manager is the first that applies: the packageManager field,pnpm-lock.yaml, bun.lock,.yarnrc.yml, yarn.lock,engines.*, then npm. More than one lockfile is not refused; the build log names the one used. A lockfile that is out of date with package.json is installed without the freeze, and the log says so. The Node version comes fromengines.node, .nvmrcor .node-version. Anything not in this table — a Node server, .NET, Go, Ruby, PHP, Python, Rust, Java — is built as a container;Languages says what each one builds on and runs. ADockerfile in the root is always built as written.
nesly.toml
Put the file in the repository root and commit it. It travels with the code, it is reviewed with the code, and it wins over anything set in the console.
[project]
name = "shop" # project this repository deploys into
[build]
root = "apps/web" # directory the build runs in
install = "pnpm install --frozen-lockfile" # install dependencies
command = "pnpm run build" # build the project
output = "dist" # directory to publish as a static siteGenerate it from what is already there:
nesly initEvery field is optional. A field you leave out is decided by the console settings, and then by detection — in that order. nesly build show prints the result, and the build log names the source of every value it used. What then runs — processes, port, health, memory, variables — is runtime (nesly app show).
The settings
| root | Directory the build runs in — the one setting a monorepo always needs. | apps/web |
| install | Command that installs dependencies. Detected from the lockfile. | pnpm install --frozen-lockfile |
| command | Command that builds the project. | pnpm run build |
| output | Directory to publish as a static site. Setting it means “this is a site, not a server”. | dist |
| start | Command that runs the server. Setting it means the opposite, and wins over output. | node server.js |
The same fields (and a release command, run once per deploy before the new version serves) live in the console (project → Settings → Build settings) and in the CLI:
nesly build show
nesly build set --root apps/web --output dist
nesly build set --release "php artisan migrate --force" # "" clears it
nesly build clear outputWith your own Dockerfile the image runs as built (its ENTRYPOINT and CMD). A start you set (in nesly.toml or with nesly build set --start "<command>") replaces both: the container runs it as /bin/sh -c "<command>", and the deploy log says so (start: … (your setting, replaces the image's ENTRYPOINT/CMD)). The command must stay in the foreground. An ENTRYPOINT that is only an init process (tini --) keeps running and receives your start as its arguments.
Old addresses that should keep working
A site that moves onto nesly arrives with its addresses already printed, linked and indexed. Redirect rules keep those addresses working: write them in nesly.toml and they go live with the deployment.
[[redirect]]
from = "/about-us"
to = "/about"
[[redirect]]
from = "/blog/*" # everything under /blog, and /blog itself
to = "/news/:splat" # :splat carries the rest of the path across
[[redirect]]
from = "/shop"
to = "https://shop.example.com"
status = 302 # 301 (default), 302, 307 or 308Rules are tried in the order you wrote them and the first match answers. The query string comes across, so a link with campaign parameters on it still reports the way you expect. One redirect is applied per request: two rules pointing at each other cannot loop.
The rules belong to the deployment, not to the project. That is what makes a rollback whole — the version you roll back to brings its own redirects with it, so the pages and the addresses that lead to them are never out of step. nesly inspect prints the rules a deployment actually shipped with.
A rule that cannot work never reaches visitors, and it does not stop the deploy either: a destination that is not a path or a full address, a status that is not a redirect, a second rule for the same address (the first is kept) or a rule pointing at itself is left out, and the build log has a warning line naming that rule. More rules than the limit is the one case that fails the deploy.
Running one command before the new version serves anything
A schema migration has to happen between the build and the first visitor. Run it yourself after deploying and the new code is already live against the old schema; run it before and the old code meets the new schema. Name it here instead and the platform runs it in the middle, where it belongs.
[deploy]
release = "dotnet ef database update"
timeout = "10m" # optional; 15 minutes by default, 30 at mostNot editing the repository? Set the same command on the project:nesly build set --release "<command>"(--release "" clears it), or the Release command field in the console. A [deploy] releasein nesly.toml wins over it, and it wins over a Procfile release:line and over the framework default (Django, Laravel). Like the file's, it stops the deployment when it fails.
A timeout that is not a duration or is not positive falls back to 15 minutes, and one above 30 minutes is lowered to 30; the build log says which.
It runs once, in the image that was just built, with the same environment variables that deployment will run with — so a preview migrates the preview's database, not production's. Nothing is serving yet: if the command exits non-zero the deployment stops there, no instance is ever started, and the previous release, if the project has one, keeps serving (on a project's first deploy nothing is serving yet, and the failure says so). Its output appears in the deployment log, and the failure and nesly diagnose quote its last lines; when the deploy had said the project needs an addon it lacks, diagnose repeats that.
For ASP.NET, that line is rewritten to a migration bundle the build places at/app/efbundle(the runtime image has no SDK and nodotnet-eftool). Add aMigrationsfolder first; without one the build refuses the release line with a sentence naming what to add.
Rolling back does not run it again. A rollback returns to an older image, and running that version's migration command would move the schema forward, not back — so a rollback stays what it should be: immediate and predictable.
Asking for the memory your application needs
Every application may use up to your plan's ceiling unless it sets a lower limit; the limit is not reserved, and what is used is what is billed. An application over its limit is stopped by the platform, and nesly ps says so. Say the size here and it travels with your code: rolling back to an earlier version restores the size that version was written for.
[resources]
memory = "1Gi" # or 512Mi, 2048Mi — the units you already write limits inA size that is not a size, or larger than any machine, fails the deploy and the message gives the figure. Ask for more than your plan allows and the deployment stops before anything starts, naming both numbers and the line to change. We would rather stop there than hand your application less memory than it asked for and let it fail later for a reason that looks unrelated.
Not editing the repository? Set the same ceiling on the project:nesly build set --memory 1Gi(megabytes, 512Mi or1Gi;--memory "" clears it), or the Memory field in the console. A [resources] memory in nesly.toml wins over it, and it wins over the plan's ceiling as the limit. A size over your plan's ceiling is saved at the ceiling, and the answer says both numbers and the way up; if the plan is lowered later, the deployment runs at the new ceiling and its log says so.
It is not a separate charge. Usage has always been measured from this ceiling, so a larger one costs more on the bill you already have — and `nesly ps` shows what each process is actually using against it.
Deciding when a release is healthy
A deployment is only pointed at your address after the application answers. By default any answer counts, which means an application that starts but cannot reach its database — answering 500 to everything — goes live. Say what healthy means and a release like that stops instead, with the previous one still serving.
[health]
path = "/healthz"
status = 200 # optional; without it, anything that is not a server errorThe same path becomes the readiness check for every instance afterwards, so one that stops answering stops receiving visitors. Write the check to test what your application actually needs — reaching its database, say — rather than only that the process is up, which the platform can already see.
Leave the block out and nothing changes: the root path is requested and any answer is accepted, exactly as before. A release that answers with a server error under that rule now says so in the deployment log instead of going live quietly.
The check belongs to the deployment, like the rules above. Rolling back restores the release and the question asked of it together — a version judged by a later version's health check is one you could not roll back to.
Serving part of your site from somewhere else
A redirect sends the visitor away. A rewrite does not: the content comes from another origin and is served under your own address, with nothing in the address bar to say so. That is how a blog or an API you run elsewhere lives under your domain instead of beside it.
[[rewrite]]
from = "/blog/*"
to = "https://blog.example.com/:splat"
[[rewrite]]
from = "/api/*"
to = "https://api.internal.example.com/:splat"The matching language is the redirects' language, including :splat, so writing both does not mean learning two. Rules travel with the deployment for the same reason redirects do, and the first match answers.
The destination has to be an https address with a public hostname. We reject a plain http address, because a rewrite is invisible and a visitor would have no way to know part of your encrypted page was not; and we reject a bare IP address or a name that only resolves inside our network. The address is checked again at the moment of connecting, so a name that changes where it points between then and now does not get through.
The other origin's own redirects are handed back to your visitor rather than followed, and if it cannot be reached your visitor gets a plain error page that says nothing about what is behind the rewrite.
Response headers
Caching, framing, a content security policy — a static site is served straight from storage, so there is no application of yours in the path to set them. Write them in nesly.toml instead and they go live with the deployment, on static sites and containers alike.
[[header]]
for = "/*"
[header.values]
X-Frame-Options = "DENY"
Referrer-Policy = "strict-origin-when-cross-origin"
[[header]]
for = "/assets/*" # everything under /assets, and /assets itself
[header.values]
Cache-Control = "public, max-age=31536000, immutable"for matches the same way a redirect'sfrom does. Unlike redirects,every rule that matches is applied — broad rules and narrow ones together. Where two rules name the same header, the one further down wins, so write the exception below the rule it excepts.
A rule replaces what your application sent for that header rather than adding a second value beside it. On the platform's own pages — the maintenance page, the paused page, the address that serves nothing — your rules do not apply: those are not your content.
A few names cannot be set here, and a rule that tries is left out with a warning in the build log while the deploy goes on: the ones that describe how a response is framed (Content-Length,Transfer-Encoding,Connection and their neighbours),Strict-Transport-Security, which is the platform's HTTPS guarantee, and Set-Cookie, which a gradual rollout uses to keep a visitor on one side. A rule whose value holds a line break is left out the same way.
Environment variables during the build
Your project's variables are available while it builds, not only while it runs — which is whatVITE_* andNEXT_PUBLIC_* need. Set them before you deploy:
nesly env set VITE_API_URL=https://api.example.com
nesly deployRemember that anything a frontend build reads ends up in the files you ship. Keep real secrets on the server side.
A static site is public, so after the build nesly checks the files it is about to publish for thevalue of each of your project's variables, byte for byte (no guessing from the shape of a token). If one is there the build log says so and the build still succeeds:
warning: secret VALUE of STRIPE_KEY appears in assets/app.jsIt is a warning with the reason BUILD_SECRET_IN_OUTPUT, also shown as the build step's detail in nesly deploy --json. The value is never printed and nothing is blocked or changed: your code stays yours. Remove the value from the output and rotate it. A variable that is meant to be in the page is left out of the check, innesly.toml:
[build]
secrets_scan_omit = ["ANALYTICS_ID"]or with a project variable,SECRETS_SCAN_OMIT_KEYS=ANALYTICS_ID,OTHER_KEY.SECRETS_SCAN_ENABLED=false switches the check off. Variables whose names start withVITE_,NEXT_PUBLIC_,REACT_APP_ and the other framework prefixes for browser values are never checked, nor are values shorter than 8 characters, plain http(s) addresses without credentials, and mode words such as production. Today the check covers sites published as static files.
Dependencies fetched from GitHub
A dependency that points at a GitHub repository ("pkg": "github:owner/repo"or a git+https://github.com/… URL) is fetched with the platform's own read-only GitHub identity, because GitHub sometimes refuses anonymous clones from shared build hosts. This identity can read public repositories only; a private dependency still needs its own credential and fails with GitHub's "Repository not found".
Detected builds get this automatically. If you ship your own Dockerfile, the credential is offered to it as a build secret and only reaches the steps you mount it on — it never becomes a layer, an environment variable, or a line in the log:
RUN --mount=type=secret,id=nesly_git_credentials,target=/root/.git-credentials \
git config --global credential.helper store && npm ciThe step needs git in the image, and the target path is the home directory of the user the step runs as. A Dockerfile that never mounts the secret builds exactly as before.
Background processes
A queue consumer or scheduler (Sidekiq, Celery, Laravel's queue worker) runs beside the server, in the same image with the same environment, and takes no requests. Declare it in the repository with a Procfile line (worker: bundle exec sidekiq) or a[[worker]] table in nesly.toml.
Not editing the repository, or its process list lives in a compose file we do not read? Set it on the project:nesly build set --worker sidekiq="bundle exec sidekiq"(repeat the flag for more; --worker sidekiq= removes one;nesly build clear workers removes all), or the Background processes field in the console. A [[worker]]table in nesly.toml wins over it, and it wins over a Procfile. A name or command that cannot be used (web, an empty command) is refused when you save it.
How many you may run depends on your plan, and the free plan has none. A list over it is refused when you save it, with the next step; if the plan is lowered later, or a repository declares more than the plan holds, the workers over the allowance do not start, the deployment log says which and why, and the web deploy goes ahead untouched. When a Valkey store is attached and your dependencies show Sidekiq, Celery or Laravel's queue but no process consumes it,nesly diagnose says so and names the command.
When the configuration is not quite right
Configuration the platform can interpret is interpreted, and what it cannot is skipped with a warning line in the build log; the build carries on. A warning is never a failed deploy.
- A leading
/in root, output or dockerfile is dropped: the path is read from the repository root. - A Dockerfile that declares an
ARGwithout a default (ARG BASE_IMAGE, thenFROM ${BASE_IMAGE}) gets its values from a[build.args]table, passed as--build-arg. The file is committed: no secrets in it. dockerfileandoutputtogether: the Dockerfile is built.outputandstarttogether: the start command wins.- An install, command or start written over several lines runs as one line, the lines joined with
&&. - A
secrets_scan_omitthat is not a list is ignored. - A
[health]block that cannot work is dropped and the default readiness check is used. - A Procfile line without a colon or a command, or with a name that cannot be used, is skipped; a repeated process type keeps the first; upper-case letters and underscores in a name become lower case and dashes; a worker named
webis ignored. - A prebuilt archive that still has a build script, or has no
index.htmlat its root, is published as uploaded.
What still fails the deploy is what cannot be built at all: a nesly.tomlthat is not valid TOML, a path that leaves the repository with ..(or through a symlink), a root or Dockerfile that is not in the repository, an empty archive, an output directory that does not exist, a memory size no machine has, and more redirects or header rules than the limit.
When a build goes wrong
- “the build finished but produced no dist directory” — your build writes somewhere else. Set
outputto that directory. - “dist looks like it holds a server” — a warning, not a failure: the directory you declared is published as the site anyway. If it really is a server, remove
output, or setstartto the command that runs it. - “build root apps/web is not a directory in this repository” — the path is relative to the repository root, and the deploy is refused before anything runs.
- “no start command derivable for this Python project” — a warning in the build log, not a refusal: the tree has no Django manage.py, no Flask or FastAPI app object and no script that serves, so the platform could not choose a start. The build goes ahead and the rollout reports a process that does not serve; set
start(e.g.uvicorn main:app --host 0.0.0.0 --port $PORT) or add a Procfileweb:line.nesly build showprints the same note before you deploy. - A build has 45 minutes, whether it runs on a build worker or on the control plane itself (a static-site framework build). The build log is kept with the deployment, so you can read it after the fact:
nesly logs.
When the platform repairs a build or a start
When a build fails, or the app builds but does not start or answer, for a reason the platform's own rules do not cover, an automatic repair may look at the cause. It works on the platform's own copy of your source, never on your repository, and says so in the build log: platform fix: <cause> — changed <files> in the platform's build copy; your repository is unchanged. What it changed is recorded with the deployment (nesly fix show), and your environment values are never sent to it. To keep the change in your code, ask for it as a pull request:nesly fix pr opens one on your connected GitHub, GitLab or Forgejo repository (a new branch from the deployment's commit, aimed at your production branch; it is never opened on its own and nothing is pushed to the production branch). On GitHub the App needs Contents and Pull requests write access, which an owner approves in the installation settings. A start failure gets one repair round per deployment; if it cannot fix the cause, you get the same error you would have got without it.
To keep it away from a project (a test that must fail with its own error, a repository whose build you want to see fail as written), switch it off in nesly.toml. This turns off both the build repair and the start repair:
[build]
rescue = falseBuild machines
A build runs on a machine of its own, sized by its class. Each plan has one: Starter b2,Pro b4, Ultimate b8, Enterprise b30. A project may ask for a smaller one in nesly.toml, never a larger one:
[build]
machine = "b2"| Machine | vCPU | Memory | Disk |
|---|---|---|---|
| b2 | 2 | 8 GB | 64 GB |
| b4 | 4 | 8 GB | 64 GB |
| b8 | 8 | 16 GB | 64 GB |
| b30 | 16 | 16 GB | 64 GB |
A build that asks for a machine larger than its plan has builds on the plan's own machine and the build log says so; it is never refused for that. Builds of one account run a few at a time (Starter: one, Pro: three, Ultimate: six, Enterprise: ten) and the next waits its turn rather than failing. A build has 45 minutes on every machine.