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
| Option | Type | Default | Description |
|---|---|---|---|
name | string | folder name | Project name, used in preview URLs. |
publish | string | "." | Folder to upload, relative to the config file. |
build.command | string | none | Runs before every deploy. A non-zero exit cancels it. |
clean_urls | boolean | true | Serve /about.html at /about. |
headers | table | none | Custom response headers per path pattern. |
Environments
Every project has three environments. Settings in an environment block override the top-level ones.
| Environment | Created by | URL |
|---|---|---|
| preview | ferry deploy | Unique per deploy |
| staging | ferry deploy --env staging | staging.my-site.example.app |
| production | ferry deploy --prod | Your 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