Ferry Docs v2.4

Docs / Guides

Configuration

Ferry reads its settings from ferry.toml in your project root. Every option has a sensible default, so most projects only need two lines.

The config file

name = "my-site"
publish = "dist"

[build]
command = "npm run build"

[headers]
"/*" = { X-Frame-Options = "DENY" }

Options

OptionTypeDefaultDescription
namestringfolder nameProject name, used in preview URLs.
publishstring"."Folder to upload, relative to the config file.
build.commandstringnoneRuns before every deploy. A non-zero exit cancels it.
clean_urlsbooleantrueServe /about.html at /about.
headerstablenoneCustom response headers per path pattern.

Environments

Every project has three environments. Settings in an environment block override the top-level ones.

EnvironmentCreated byURL
previewferry deployUnique per deploy
stagingferry deploy --env stagingstaging.my-site.example.app
productionferry deploy --prodYour custom domain
[env.staging]
build.command = "npm run build:staging"

Deploy hooks

Hooks run shell commands at points in the deploy. They run in your project folder with the deploy's details in environment variables.

Before upload

Use hooks.before to run tests or checks. If the command fails, nothing is uploaded.

[hooks]
before = "npm test"

After going live

Use hooks.after to notify your team or warm caches. FERRY_URL holds the live URL.

[hooks]
after = "curl -X POST $SLACK_WEBHOOK -d \"Deployed $FERRY_URL\""
Keep secrets out of ferry.toml

Reference secrets as environment variables. The config file is usually committed to your repository.

Last updated: March 2026Edit this page