Reference
Settings
Every setting of a Tifa app
Settings that hold a size (server.body_limit, ssr.vm_memory, ssr.memo_size, session.memory_limit) take a whole number with the unit B, KiB, MiB or GiB, such as 64MiB. The unit is case sensitive and has no space before it. 4MB, 4mb and 1.5MiB are refused and the program does not start. See Value formats.
| Key | Default | Flag and environment variable | What it does |
|---|---|---|---|
build.target |
es2020 |
project file only | JavaScript target of the browser bundle that Vite builds, a comma-separated list: one ECMAScript version (es2015 to es2029, esnext) plus browsers with versions, from chrome, edge, firefox, ios, opera and safari, such as es2019,chrome90,safari14. The SSR bundle always targets ES2022 |
build.public |
public |
project file only | Folder of static files copied into the program as they are and served from / |
build.public_dotfiles |
none | project file only | Comma-separated paths in the public folder whose last name starts with a dot, such as .nojekyll,docs/.assets, that are copied although files and folders that start with a dot are left out otherwise. A path is relative to the folder and written with /. A folder named here is copied with what is in it, and a dot name deeper inside still needs its own entry. .well-known needs none. A path that is not there, leaves the folder, or does not end in a name that starts with a dot fails tifa build and tifa check. tifa build lists what it leaves out, apart from .DS_Store |
build.skip_tanstack_check |
false |
project file only | true builds an app whose TanStack Router is not the version Tifa is tested with, which may leave pages blank in the browser. See Generated files and app setup |
build.debug_info |
false |
project file only | true keeps the DWARF debug info and the full source paths in the program, for debuggers such as Delve. Without it, tifa build leaves the debug info out with -ldflags=-w, which makes the example shop's program about 20% smaller, and the folders of the build machine with -trimpath. Panics still give the file and line of each frame either way. tifa dev always keeps it. See build.md |
build.i18next_cache |
true |
project file only | The server render keeps the strings i18next translates and gives them again for the same key and options, so pages that translate the same texts on every render take less time: the shop's storefront pages 0.778 of it. false turns it off. Formatters and post-processors of the app must give the same text for the same input. Turn it off when the app changes i18next's resources or options after the first render without i18next's API, or gives i18next other functions that read something of the request, or pages may show stale translations. See i18next in Tifa |
i18n.default |
none | project file only | The default language of an app with _locales/ folders, a BCP 47 tag in its usual spelling such as zh-CN or en-US. URLs in this language have no prefix (unless i18n.prefix is always), and it comes first in tifa.Languages(). An app with one language may leave it out. With several, tifa build fails without it, and when no area has a file for it. Every area must have the default language. See A site in several languages |
i18n.prefix |
off |
project file only | always puts the language in the URL of every route that has languages, the default one too: /store answers 308 to /zh-CN/store. off leaves the default language without a prefix. A route outside every area never has a prefix, in both modes |
site.url |
none | project file only | The scheme and host the site is served at, such as https://shop.example.com, with no path. The host is a name of letters, digits, hyphens and dots, an IP address or localhost: it goes into the configuration of deploy.front: nginx. A site with more than one language needs it, and tifa build fails without it. It marks the site as public: every page gets a canonical link and an og:url meta, and the program serves /sitemap.xml, a default /robots.txt, /llms.txt, /llms-full.txt and the Markdown versions of content pages. Without it there are none of these. See Search engines and language models |
server.addr |
127.0.0.1:9527 |
--server-addr, SERVER_ADDR |
Address to listen on. Use 0.0.0.0:9527 in a container. With HTTPS on it serves HTTPS and must be set, usually to :443 |
server.body_limit |
1MiB |
--server-body-limit, SERVER_BODY_LIMIT |
Largest request body. A bigger one is answered with 413. c.SetBodyLimit in OnRequest sets one for a request, see handlers.md |
server.read_timeout |
10s |
--server-read-timeout, SERVER_READ_TIMEOUT |
Time to read a whole request, its body included, from the moment the connection is taken. A body still coming after it fails to read, and a handler with an input answers 408. The request header must arrive within 5 seconds, which no setting changes. See Long requests |
server.write_timeout |
10s |
--server-write-timeout, SERVER_WRITE_TIMEOUT |
Time from the end of a request header to the end of its answer. An answer still being written after it is cut off. See Long requests |
server.shutdown_timeout |
10s |
--server-shutdown-timeout, SERVER_SHUTDOWN_TIMEOUT |
After a stop signal, the time in-flight requests get to finish, and then the time OnShutdown gets. Requests still running when it ends are canceled and get one more shutdown_timeout to return. OnShutdown runs once they have returned and is skipped if they have not. Either way the program exits with status 1 |
server.compress |
true |
--server-compress, SERVER_COMPRESS |
Sends text answers with gzip or zstd to clients that accept them (gzip unless the client ranks zstd higher or takes no gzip), and the browser bundle as the gzip files tifa build wrote, see Compression. Set it to false when a proxy in front compresses, such as nginx with brotli |
server.tls_domains |
none | --server-tls-domains, SERVER_TLS_DOMAINS |
Turns on HTTPS with certificates from Let's Encrypt for these domains, comma-separated, such as example.com,www.example.com |
server.tls_email |
none | --server-tls-email, SERVER_TLS_EMAIL |
Contact address given to Let's Encrypt with tls_domains. Optional |
server.tls_cache |
none | --server-tls-cache, SERVER_TLS_CACHE |
Folder that keeps the certificates of tls_domains across restarts. Needed with tls_domains, and must survive new deployments |
server.tls_ca |
https://acme-v02.api.letsencrypt.org/directory |
--server-tls-ca, SERVER_TLS_CA |
ACME directory that tls_domains get their certificates from. Let's Encrypt by default |
server.tls_cert |
none | --server-tls-cert, SERVER_TLS_CERT |
Turns on HTTPS with your own certificate file instead, in PEM, loaded again when it changes |
server.tls_key |
none | --server-tls-key, SERVER_TLS_KEY |
Private key file of tls_cert, in PEM |
server.http_addr |
:80 |
--server-http-addr, SERVER_HTTP_ADDR |
With HTTPS on, the plain HTTP address that answers the checks of Let's Encrypt and redirects everything else to HTTPS. off for none. Not used without HTTPS |
server.hsts |
false |
--server-hsts, SERVER_HSTS |
Adds Strict-Transport-Security: max-age=31536000 to the answers of server.addr, so browsers keep to HTTPS for a year |
server.csp |
off |
--server-csp, SERVER_CSP |
on sends server.csp_policy as the Content-Security-Policy of every answer, and of each page with the hashes of the inline scripts Tifa writes into it. report-only sends it as Content-Security-Policy-Report-Only, which only reports. See Content-Security-Policy |
server.csp_policy |
script-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors 'self' |
--server-csp-policy, SERVER_CSP_POLICY |
The policy of server.csp: directives separated by semicolons. It is checked only for what keeps it one header: printable ASCII, no comma, directive names of letters, digits and dashes |
server.trusted_origins |
none | --server-trusted-origins, SERVER_TRUSTED_ORIGINS |
Origins whose pages may send writes (POST, PUT, PATCH, DELETE) from another site, comma-separated, such as https://admin.example.com,http://localhost:3000. See Cross-site writes |
server.cross_site_paths |
none | --server-cross-site-paths, SERVER_CROSS_SITE_PATHS |
Path patterns whose writes are not checked for the site they come from, comma-separated, such as POST /auth/apple/callback. See Cross-site writes |
ssr.vms |
the CPU count (GOMAXPROCS), at most 4 |
--ssr-vms, SSR_VMS |
Prewarmed JavaScript VMs, which is how many pages render at once. In a container it follows the CPU limit. On 1, 2, 4 and 8 CPUs the default is 1, 2, 4 and 4 VMs: each VM takes memory, and a container with a memory limit and no CPU limit sees every CPU of its host. On a machine with more CPUs and the memory for them, set it, such as ssr.vms: 8 or SSR_VMS=8. A value you set is used as it is. Sizing a machine says when to change it. Measured with every P rendering (one VM per P, GOMAXPROCS=1 on 1 CPU), short requests waited about 20 ms behind the renders, because of Go's scheduler (its 10 ms monitor cycle, twice, see beastjs's A long call and the Go scheduler). With GOMAXPROCS=2 on that 1 CPU they took 0.016 ms at P50. Keep GOMAXPROCS above ssr.vms when they must stay fast, though a spare P helps only when there is CPU left for it. The default keeps them equal up to 4 CPUs and leaves GOMAXPROCS above from 5 on |
ssr.vm_memory |
128MiB |
--ssr-vm-memory, SSR_VM_MEMORY |
Memory limit of each VM. A render that runs out of memory fails, and the VM is replaced with a fresh one. Page code cannot catch it. The shapes the engine keeps for reuse count here too, up to about 6 MiB per VM at worst (2048 shapes of 32 keys of about ten characters, more with longer keys), so leave room for them when you lower it (see Memory). A VM that holds more than half of it after a collection is replaced in the background, so an app whose VMs settle above that needs a higher limit (see Memory) |
ssr.vm_stack_depth |
10000 |
--ssr-vm-stack-depth, SSR_VM_STACK_DEPTH |
How deep JavaScript calls may nest in each VM, about one level per call. Deeper calls throw RangeError: Maximum call stack size exceeded, at about the depth Node does. From 1 to 10000, see Stack depth |
ssr.timeout |
3s |
--ssr-timeout, SSR_TIMEOUT |
Time budget of one render. A render that runs longer is stopped and handled as an unexpected error, which goes to OnError. Page code cannot catch it |
ssr.queue_limit |
32 |
--ssr-queue-limit, SSR_QUEUE_LIMIT |
Renders allowed to wait for a VM, excluding renders already running. 0 rejects immediately when no VM is idle. A full queue answers 503 with Retry-After: 1 |
ssr.wait_timeout |
3s |
--ssr-wait-timeout, SSR_WAIT_TIMEOUT |
Maximum wait for a VM. Expiry answers 503 with Retry-After: 1, without starting or replacing a VM. Separate from ssr.timeout, which starts after a VM is acquired |
ssr.memo_size |
64MiB |
--ssr-memo-size, SSR_MEMO_SIZE |
Size of the render memo, counting the bytes it keeps: one form of each page and of each site file such as llms-full.txt, its gzip form with server.compress on and its HTML otherwise (see Compression). When it is full, the entries hit only once go first, so a run of addresses that come once does not push out the pages that are asked for again and again. 0 turns it off, though requests that miss the same page or file at the same time still share one render. What the render memo is and why it is safe: The render memo. A page turns the render memo off for itself with Memo = false (see SSR and cache) |
cache.s_maxage |
1m |
--cache-s-maxage, CACHE_S_MAXAGE |
The s-maxage of a page that writes const Cache = true: how long a shared cache in front of the program, such as a CDN, may keep it. See Cache for CDNs |
session.cookie |
__Host-tifa_session |
--session-cookie, SESSION_COOKIE |
Name of the session cookie. Under tifa dev the __Host- prefix is dropped, see Sessions |
session.max_age |
720h |
--session-max-age, SESSION_MAX_AGE |
How long a session lasts from the moment tifa.SetSession makes it, at least one second. It does not renew |
session.memory_limit |
64MiB |
--session-memory-limit, SESSION_MEMORY_LIMIT |
Bytes the in-memory session store may hold, used when OnStart sets no store with tifa.SetSessionStore. A full store drops the sessions that expire first |
deploy.front |
none |
project file only | What visitors come through before the server: none, cloudflare, nginx or external. With none, the app serves them itself on port 80, and with a domain in site.url on 443 with its own HTTPS. With cloudflare, tifa deploy setup puts the app behind a Cloudflare Tunnel at the host of site.url with cf, and deploy and rollback clear the CDN cache of that host name. Needs site.url without a port. With nginx, tifa deploy setup installs an nginx that it owns, which sends visitors to the app by the host of site.url, with a certificate from certbot, so several apps can share a server. With external, something of yours in front, such as a load balancer you set up at your provider, ends HTTPS and sends plain HTTP to the port of the app, which listens on every address of the server. It is the only front for several servers. See Set up with a plan, Behind nginx, Behind your load balancer and Run an app on several servers |
deploy.port |
(left out) | project file only | With deploy.front: external only, the port the app listens on, on every address of each server, from 80 to 65535. Left out, setup gives it the first port free from 9527. Another app or program on that port stops setup before it changes anything. A port below 1024 makes setup, as root, let the user tifa open ports from 80, once per server. Changing it moves the app at the next setup. See Behind your load balancer |
deploy.connect |
direct |
project file only | How deploys reach the server over ssh, from your machine and from CI: direct, cloudflare (through the Cloudflare Tunnel) or tailscale (the CI runner joins your tailnet). cloudflare needs deploy.front: cloudflare, and tailscale needs the block deploy.auto |
deploy.release_command |
none | project file only | A command of the app with its arguments, such as migrate, that each deploy runs once on the server with the program of the new release, before it starts it and while the old release serves, as tifa deploy run would. Words are split at spaces, with no quotes and no shell. A status other than 0 stops the deploy and changes nothing. A rollback never runs it. See A command before the start |
deploy.start_timeout |
30s |
project file only | How long a new release may take to start and answer /healthz, as a Go duration in whole seconds from 1s to 10m. The check of the release a failed deploy goes back to, and of a deploy rollback, gets the same time. Visitors wait on the socket while the release starts, so a longer wait is a longer stall of the site, and a release that is not up in time fails the deploy and leaves the old one running. See A slow start |
deploy.auto.branch |
the default branch of the repository | project file only | With the block deploy.auto: the branch that deploys from GitHub Actions. See Deploy from GitHub Actions |
deploy.auto.needs |
ci.yml |
project file only | With the block deploy.auto: the file in .github/workflows that must pass before a deploy, such as ci.yml, or none to wait for nothing |
The block deploy.auto turns deploys from GitHub Actions on by being there: auto: {} takes the defaults, and a key it does not know, or auto: with nothing after it, is an error. Without the block there are no deploys from GitHub Actions. tifa deploy setup sets them up.