Saltar al contenido
txAdmin recipes explained

txAdmin recipes explained

The anatomy of a txAdmin recipe: metadata, $engine and $onesync, context variables, every task action (download_github, unzip, move_path, query_database...) with examples.

Esta documentación está en inglés por ahora.

Last updated

A recipe is a YAML file that tells txAdmin’s deployer how to build a server: what to download, where to put it, which SQL to run and how to fill in server.cfg. Every server in the “Popular Recipes” list is just a recipe file on GitHub, and you can deploy any recipe by URL.

This page is the reference, based on txAdmin’s recipe.md. To see what the listed recipes install, read Popular recipes. To write one yourself, see Writing your own recipe.

A real recipe

This is the official FiveM Basic Server recipe from citizenfx/txAdmin-recipes, exactly as published:

default-fivem/recipe.yaml
$engine: 3
$onesync: on
name: FiveM Basic Server
description: Recipe for the base resources required to run a minimal FiveM server.

tasks: 
  # Download default resources
  - action: download_github
    src: https://github.com/citizenfx/cfx-server-data
    ref: master
    subpath: resources
    dest: ./resources

  # Remove the old chat resource
  - action: remove_path
    path: ./resources/[gameplay]/chat

  # Download default server.cfg for FiveM
  - action: download_file
    url: https://raw.githubusercontent.com/citizenfx/txAdmin-recipes/refs/heads/main/default-fivem/server.cfg
    path: ./server.cfg

Three tasks: copy the resources folder of cfx-server-data, delete its old chat resource (the artifact has a built in one, enabled with set resources_useSystemChat true), and download a server.cfg template. The template uses placeholders that the deployer fills in:

default-fivem/server.cfg (excerpt)
sv_hostname "{{serverName}} built with {{recipeName}}!"
sets sv_projectName "[{{recipeName}}] {{serverName}}"
sets sv_projectDesc "{{recipeDescription}}"

sv_enforceGameBuild 3751 #mp2025_02 - A Safehouse in the Hills
sv_licenseKey "{{svLicense}}"
sv_maxclients {{maxClients}}
{{serverEndpoints}}

add_ace group.admin command allow
add_ace group.admin command.quit deny
{{addPrincipalsMaster}}

How the deployer runs a recipe

  1. It reads the metadata and checks engine version and requirements.
  2. It asks the user for inputs (license key, database, extra variables).
  3. It runs the tasks one by one, in order. Any failure stops the whole process.
  4. Every path is jailed to the target folder: a recipe can’t write outside it (so it can’t touch your admins.json).
  5. At the end it checks that the target folder has a server.cfg and a resources folder, and replaces {{svLicense}} in server.cfg.

Metadata

Key Required Meaning
name recommended Short name, under 24 characters.
version recommended Your recipe’s version.
author recommended Short author name, under 24 characters.
description recommended Under 256 characters. YAML multiline strings work.
$engine optional Recipe engine version the recipe targets. Current recipes use 3.
$minFxVersion optional Minimum FXServer build required.
$onesync optional OneSync value to set after deploy: off, legacy or on.
$steamRequired optional true if the steam_webApiKey variable must be provided.

Context variables

The deployer keeps a shared context of variables. You use them as {{varName}} in replace_string tasks and in files processed with all_vars.

Variable Filled from
deploymentID Short recipe name plus a hex timestamp, like PlumeESX_BBC957.
serverName The name entered on the setup page.
recipeName, recipeAuthor, recipeVersion, recipeDescription Recipe metadata.
dbHost, dbPort, dbUsername, dbPassword, dbName, dbDelete, dbConnectionString The database inputs.
svLicense The license key input. Replaced in server.cfg automatically at the end.
serverEndpoints The endpoint_add_tcp/udp lines (default 0.0.0.0:30120, or from TXHOST_INTERFACE / TXHOST_FXS_PORT).
maxClients 48 by default, or TXHOST_MAX_SLOTS.
addPrincipalsMaster add_principal lines for the master admin’s identifiers (used in server.cfg templates).

Define your own under variables::

YAML
variables:
  frameworkLocale: en
  dbName: null   # null means "let txAdmin create a database"

Task actions

Every task is a list item with an action and its options. Every task accepts timeoutSeconds to raise its default timeout. Indentation matters in YAML: use spaces, not tabs.

download_github

Downloads a GitHub repository, optionally at a ref and only a subpath.

Option Meaning
src Repo URL or owner/repo.
ref Optional branch, tag or commit. Without it, txAdmin asks the GitHub API for the default branch.
subpath Optional folder inside the repo to copy.
dest Destination folder. Created if missing.
YAML
- action: download_github
  src: https://github.com/citizenfx/cfx-server-data
  ref: 6eaa3525a6858a83546dc9c4ce621e59eae7085c
  subpath: resources
  dest: ./resources

- action: download_github
  src: esx-framework/es_extended
  dest: ./resources/[esx]/es_extended

Note

Without ref, each download makes an extra GitHub API call. With more than ~30 downloads, users hit rate limits (401/403 errors). Set ref on every task in big recipes, ideally to a commit hash (tags can move).

download_file

YAML
- action: download_file
  url: https://github.com/overextended/ox_lib/releases/latest/download/ox_lib.zip
  path: ./tmp/ox_lib.zip

path must be a file name, not a folder.

unzip

YAML
- action: unzip
  src: ./tmp/ox_lib.zip
  dest: ./resources/[ox]

ZIP only, no .tar files.

move_path, copy_path, remove_path, ensure_dir

YAML
- action: move_path
  src: ./tmp/cfx-server-data-master/resources
  dest: ./resources
  overwrite: true        # replace dest if it exists

- action: copy_path
  src: ./tmp/configs/
  dest: ./resources/[local]/myconfig
  # copies the CONTENTS of a src folder; overwrite defaults to true
  # errorOnExist: true makes it fail instead of silently skipping when overwrite is false

- action: remove_path
  path: ./tmp            # does nothing if the path doesn't exist

- action: ensure_dir
  path: ./resources/[local]

None of these accept the root path ./ as source or target.

write_file

YAML
- action: write_file
  file: ./server.cfg
  append: true
  data: |
    ensure my_resource
    ensure another_one

- action: write_file
  file: ./resources/[local]/myres/config.json
  data: |
    { "enabled": true }

Without append, the file is overwritten and missing folders are created.

replace_string

Search and replace in one file or a list of files.

mode Behaviour
template (default) Replaces search with replace, and replace can contain {{vars}}.
all_vars Replaces every {{var}} in the file(s). search and replace are ignored.
literal Plain search and replace, no variables.
YAML
- action: replace_string
  file: ./server.cfg
  search: 'FXServer, but unconfigured'
  replace: '{{serverName}} built with {{recipeName}} by {{recipeAuthor}}!'

- action: replace_string
  mode: all_vars
  file:
    - ./server.cfg
    - ./resources/[local]/myres/config.json

connect_database and query_database

connect_database has no options. It uses the database inputs, and creates the database if dbName is null. It must run before any query_database.

YAML
- action: connect_database

- action: query_database
  file: ./tmp/qbcore/qbcore.sql

- action: query_database
  query: |
    CREATE TABLE IF NOT EXISTS `my_table` (
      `id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
      `name` VARCHAR(64) NOT NULL
    );

Use file or query, never both.

load_vars

Loads extra context variables from a JSON file (for example one shipped in a repo you downloaded):

YAML
- action: load_vars
  src: ./tmp/recipe-vars.json

waste_time

The txAdmin-recipes guidelines ask big recipes to pause with a waste_time task of 10 seconds every 25 download_github actions (50 if you set ref), so GitHub doesn’t rate limit users. It isn’t in the main recipe reference, but the official QBCore and Qbox recipes use it like this:

YAML
- action: waste_time # prevent github throttling
  seconds: 10

How big recipes are organised

Open the QBCore, Qbox or ESX recipe and you’ll see the same pattern:

  1. Database first (connect_database, then query_database with the framework SQL). It’s the step most likely to fail, so failing early saves time.
  2. Download the recipe repo itself into ./tmp, which holds server.cfg, extra .cfg files, a logo and the SQL.
  3. Move those files into place (move_path from ./tmp/... to ./server.cfg).
  4. Default Cfx resources from cfx-server-data into ./resources/[cfx-default].
  5. Libraries as release zips (download_file + unzip): oxmysql, ox_lib, ox_target, ox_inventory…
  6. Framework resources with download_github into category folders like [qb] or [qbx].
  7. remove_path on ./tmp.
  8. replace_string with all_vars on server.cfg so {{dbConnectionString}} and friends are filled in.

Where recipes come from

  • The “Popular Recipes” list comes from the index files (indexv4.json, indexv5.json…) in the txAdmin-recipes repository. Popular recipes walks through every recipe in it.
  • Any public raw URL to a .yaml works with Remote URL Template.
  • You can paste YAML directly with Custom Template.

Warning

A recipe runs downloads and SQL on your machine. Only deploy recipes from sources you trust, and read the YAML on the deployer screen before clicking Next.