fastfn.json Reference¶
Verified status as of March 28, 2026. Runtime note: FastFN resolves dependencies and build steps per function: Python uses
requirements.txt, Node usespackage.json, PHP installs fromcomposer.jsonwhen present, and Rust handlers are built withcargo. Host runtimes and tools are required infastfn dev --native, whilefastfn devdepends on a running Docker daemon.
fastfn.json is the default CLI config file. FastFN reads it from the current directory unless you pass --config.
Quick View¶
- Complexity: Reference
- Typical time: 10-20 minutes
- Use this when: you want one place to define default directories, routing behavior, runtime daemon counts, or host binaries
- Outcome: reproducible local and CI behavior without long command lines
Supported keys¶
| Key | Type | What it controls |
|---|---|---|
functions-dir |
string |
Default functions root when no directory is passed to CLI commands. |
public-base-url |
string |
Canonical public URL used in generated OpenAPI servers[0].url. |
openapi-include-internal |
boolean |
Whether internal /_fn/* endpoints appear in OpenAPI and Swagger. |
force-url |
boolean |
Global opt-in that allows config-based routes to replace an already mapped URL. |
domains |
array |
Domain checks used by fastfn doctor domains. |
runtime-daemons |
object or string |
How many daemon instances to launch per external runtime. |
runtime-binaries |
object or string |
Which host executable FastFN should use for each runtime or tool. |
hot-reload |
boolean |
Enable/disable hot reload for dev and run commands. Default: true. |
Notes:
- Preferred keys use kebab-case.
- Compatibility aliases are still accepted for older projects.
domainsonly affectsfastfn doctor domains; it does not block inbound hosts by itself.runtime-daemonsapplies to external runtimes (node,python,php,rust,go).luaruns in-process, so a daemon count forluais ignored.
Example 1: Default functions directory¶
fastfn.json
Run:
Expected behavior:
- FastFN uses
functions/automatically.
Example 2: Scale runtime daemons¶
fastfn.json
{
"functions-dir": "functions",
"runtime-daemons": {
"node": 3,
"python": 3,
"php": 2,
"rust": 2
}
}
Run:
Validate:
What to expect:
node,python,php, andrustshow aroutingmode.- When a runtime has more than one socket,
routingisround_robin. socketslists each daemon instance separately.
String form is also supported:
Example 3: Choose host binaries¶
fastfn.json
{
"runtime-binaries": {
"python": "python3.12",
"node": "node20",
"php": "php8.3",
"composer": "composer",
"cargo": "cargo",
"openresty": "/opt/homebrew/bin/openresty"
}
}
Important detail:
- FastFN chooses one executable per key.
- All daemon instances for that runtime use the same configured executable.
- Multi-daemon routing does not mean mixed versions inside the same runtime group.
Supported binary keys:
| Key | Env override | Used for |
|---|---|---|
openresty |
FN_OPENRESTY_BIN |
OpenResty in native mode or inside the Docker container entrypoint. |
docker |
FN_DOCKER_BIN |
Docker CLI used by fastfn dev and fastfn doctor. |
python |
FN_PYTHON_BIN |
Python runtime daemon and Python-based launchers used by PHP, Rust, and Go daemons. |
node |
FN_NODE_BIN |
Node runtime daemon process. |
npm |
FN_NPM_BIN |
Node dependency installation. |
php |
FN_PHP_BIN |
PHP worker execution inside the PHP daemon. |
composer |
FN_COMPOSER_BIN |
PHP dependency installation. |
cargo |
FN_CARGO_BIN |
Rust builds. |
go |
FN_GO_BIN |
Go builds used by the Go daemon. |
If you only need a temporary override, the environment variables above work without editing fastfn.json.
Example 4: Explicit socket map (advanced override)¶
FN_RUNTIME_SOCKETS can override generated sockets completely.
Example:
export FN_RUNTIME_SOCKETS='{"node":["unix:/tmp/fastfn/node-1.sock","unix:/tmp/fastfn/node-2.sock"],"python":"unix:/tmp/fastfn/python.sock"}'
fastfn dev --native functions
Rules:
- A runtime value can be a string or an array.
- If
FN_RUNTIME_SOCKETSis set, it wins overruntime-daemonsandFN_RUNTIME_DAEMONS. - Use this only when you need full control over socket locations.
Example 5: Public base URL and internal OpenAPI¶
fastfn.json
{
"functions-dir": "functions",
"public-base-url": "https://api.example.com",
"openapi-include-internal": true
}
Validate:
curl -sS http://127.0.0.1:8080/_fn/openapi.json | jq '{server: .servers[0].url, has_health: (.paths | has("/_fn/health"))}'
Precedence¶
Config file lookup:
--config <path>./fastfn.json./fastfn.toml
Runtime daemon wiring:
FN_RUNTIME_SOCKETSFN_RUNTIME_DAEMONSruntime-daemons- Default: one daemon per external runtime
Binary selection:
FN_*_BINenvironment variable for that keyruntime-binaries- FastFN default lookup candidates (
python3thenpython,node,php,cargo, and so on)
OpenAPI base URL:
FN_PUBLIC_BASE_URLpublic-base-urlX-Forwarded-Proto+X-Forwarded-Host- Request scheme +
Host
Validation¶
Smoke test:
curl -sS http://127.0.0.1:8080/_fn/health | jq '.runtimes'
curl -sS http://127.0.0.1:8080/_fn/openapi.json | jq '.servers[0].url'
Troubleshooting¶
- If native mode says a runtime is missing, set the matching
FN_*_BINvariable orruntime-binaries. - If a runtime shows
up=false, check thesocketslist in/_fn/healthfirst. - If counts in
runtime-daemonsappear ignored, confirm you are scaling an external runtime, notlua. - If socket locations do not match the generated pattern, look for
FN_RUNTIME_SOCKETSin your environment. - If you are not sure whether a setting belongs in config or in the environment, check the environment variables reference first.
Additional environment variables¶
| Variable | Default | What it controls |
|---|---|---|
FN_STRICT_FS |
1 |
Enable filesystem sandboxing for handlers. Set to 0 for development. |
FN_MAX_FRAME_BYTES |
— | Maximum request frame size accepted by the runtime socket. |
GO_BUILD_TIMEOUT_S |
180 |
Timeout in seconds for Go handler compilation. |
FN_HOT_RELOAD |
1 |
Enable hot reload. Applies to both dev and run commands. |
Related links¶
- Function specification
- Environment variables
- Complete config reference
- HTTP API reference
- Architecture
- Performance benchmarks
- Scale runtime daemons
- Run and test