Entrypoints
The functions block turns files into Functions and sets what each one gets, from runtime and memory to its duration ceiling and packaged files.
Every key in the functions block is a file pattern, and every file it matches becomes its own Function. The value is the settings that Function runs with.
Declaring a Function
version: 4
functions:
api/index.js:
runtime: node-22
memory: 512
max_duration: 60The key is the file path relative to the project root, with no leading slash. A route's destination repeats that string exactly, which is how Routes point traffic at it. A Function nothing routes to is still packaged and deployed, but no request reaches it.
Patterns
A key is tried as a glob first. If it is not the name of a file that exists, it is tried again as a regular expression anchored at both ends, so api/.*\.js and api/** both work. A pattern that matches nothing is not an error: it produces no Function and the build carries on.
functions:
api/**:
runtime: node-22
memory: 256
api/report.js:
memory: 1024Each file under api/ becomes a separate Function at 256 MB. api/report.js gets 1024 MB and still inherits runtime: node-22, because settings merge across every pattern that matches a file, with later blocks winning. Naming the file exactly also decides which block owns it, and two settings depend on that.
Settings
| Key | Type | Accepted | Default |
|---|---|---|---|
runtime | string | One of eight identifiers | node-20 |
memory | number, MB | 128 to 3009 | 128 |
max_duration | number, seconds | 1 to 28800 | 30 |
includeFiles | string or list of strings | Glob patterns | none |
excludeFiles | string or list of strings | Glob patterns | none |
symlinks | map | 1 to 100 entries, each side 256 characters at most | none |
schedule | string | A rate or cron expression | none |
Runtimes lists the eight identifiers and what each one expects from your code. Memory and CPU covers what the platform does with a memory figure, and Max duration covers what the duration ceiling bounds. A Function that runs on a timer instead of a request is described in Cron jobs.
Which files get packaged
A Node or Bun Function is packaged from its dependency graph, traced from the entry file. That misses files your code opens at runtime through a path it computes, which is what includeFiles is for: those globs are added after tracing. excludeFiles removes files from the traced set, and it also removes them from the pattern match itself, so it can stop a file from becoming a Function at all.
functions:
api/report.js:
runtime: node-22
includeFiles:
- templates/**
- data/rates.json
excludeFiles: '**/*.test.js'Symlinks
symlinks creates links in the project directory at build time, before the Function is packaged, for code that insists on finding a directory at a fixed path. The key is where the link is created, relative to the project root. The value is what it points at, resolved relative to the link's own directory.
functions:
public/index.php:
runtime: php-84
symlinks:
public/storage: ../storage/app/publicBoth ends have to resolve inside the project root. An absolute target such as /tmp/cache never does: that entry is skipped, the deployment log records Symlink target /tmp/cache for source public/storage is not valid, and the deployment carries on without the link. Anything already sitting at the key path is removed first.
symlinks does not inherit across patterns
Settings merge across every pattern that matches a file, with later blocks winning. symlinks and schedule are the
exception: both are read from the block that produced the file, so a schedule on api/** disappears the moment you
also name api/cron.js to give it more memory. Declare them on the block that owns the file. Nothing warns you when
they are dropped.
Settings you do not write
Framework detection produces entrypoints carrying more settings than gigadrive.yaml accepts, so that an adapter can describe output it already knows the shape of. The settings table is the whole set of keys you can write yourself. Anything else in a functions block passes validation and is then discarded, with no warning.
