Skip to content

Graph templates and scaffolding

A graph template gives your application an initial definition to adapt. The catalog pairs a named, versioned package with its available graph files and a README explaining the starting point. Exporting a published template copies those resources into your working folder; you then edit the definition to describe your application’s process.

This guide uses the published wizard_onboarding_v1 package, version v1. It is a small, linear graph: one initial step, one choice and one terminal result. Its simplicity makes the changes visible without requiring an onboarding application to understand them.

The catalog groups templates into wizard, decision_tree, eligibility and funnel families. Filter it by the family and format you need:

Terminal window
vendor/bin/execkernel scaffold list --family=wizard --status=published --format=json

The relevant entries are:

Templates: 2
- wizard_onboarding_v1 (v1) [wizard] published formats=json
- wizard_product_setup_v1 (v1) [wizard] published formats=json

Each entry identifies the template code, its package version, its publication status and the formats it actually supplies. We choose wizard_onboarding_v1, v1, json. A pending package is not exportable, and selecting a format does not create a representation that the package has not declared.

The README for this template describes a base flow without conditions: the person selects its only option and receives terminal content. Start with it when that small initial structure is useful, then add the steps and decisions your application needs.

Choose a working folder for the copy:

Terminal window
vendor/bin/execkernel scaffold export --template=wizard_onboarding_v1 --version=v1 --format=json --output=./onboarding

--template and --version identify the package you selected. --format=json selects its existing JSON resource, and --output sets the destination folder. The resulting files are:

onboarding/
graph.json
README.md

graph.json contains the definition you will edit. README.md explains the template’s purpose, rules and example input and output. Both files initially contain the catalog’s data unchanged. The export does not rename the graph, translate its text or substitute application parameters.

Open graph.json. Its initial identity and language settings are:

{
"graphCode": "wizard_onboarding_v1",
"rootNodeId": 1,
"defaultLang": "es",
"allowedLangs": ["es"]
}

This is an extract, not the whole file. The template uses these camelCase field names. It defines node 1 as the initial step, node 2 as a terminal and edge 1 between them. The Spanish option label is Continuar, and the terminal content says Has completado el flujo de onboarding.

The package supplies JSON only. If you later need YAML, FlowDSL or a diagram, load the adapted graph and use the graph import and export paths.

Suppose your application will use this initial flow to introduce a workspace. Give the graph its own identity, change the heading at the initial step and replace the terminal message. These are three explicit edits to graph.json; keep its other fields and records.

First, replace the graph code:

"graphCode": "wizard_onboarding_v1",
"graphCode": "workspace_onboarding",

The graph in your working copy now has the identity workspace_onboarding; the template package retains its original code. The file remains onboarding/graph.json. Graph loaders and repositories explains how to load a definition by its file path or configure lookup by code.

In the metadata record with nodeId: 1 and lang: "es", change the title:

"title": "Onboarding inicial",
"title": "Prepara tu espacio",

That title gives your application’s initial screen its heading. The node stays 1, so the existing edge still starts at the same place.

Finally, change the content in the output record for nodeId: 2:

"content": "Has completado el flujo de onboarding.",
"content": "Tu espacio está listo para trabajar.",

When the person reaches terminal 2, your application receives that content and can display it as the result. The definition remains Spanish because defaultLang, allowedLangs and the presentation records still declare es. To offer another language, add the corresponding records as explained in Labels, metadata and languages.

The complete adapted JSON includes these edits. This adaptation changes the graph’s identity and presentation. Your application still performs any workspace setup that the completion message is intended to confirm.

Check the file that your application will actually load:

Terminal window
vendor/bin/execkernel validate onboarding/graph.json --json

For the edits above, the command exits with status 0 and returns these summary fields:

{
"nodes": 2,
"edges": 1,
"terminal_nodes": 1,
"warnings": 0
}

The changed definition remains coherent: the initial node, choice and terminal still connect, and their presentation records still refer to the correct elements. If you add or remove steps while adapting it, run validation again before putting that version into use. Graph validation and diagnostics shows how to turn a failed check into a concrete correction.

Use scaffold init when you want to author a new template package of your own. It is a separate task from using the published template above.

For example, this command creates a package named wizard_workspace_v1:

Terminal window
vendor/bin/execkernel scaffold init --template=wizard_workspace_v1 --family=wizard --version=v1 --output=./templates --dry-run=false

The template code includes its family and version; the separate --family and --version values must agree with it. init defaults to a dry run that describes the planned files. --dry-run=false writes them.

The generated package has this structure:

templates/
wizard/
wizard_workspace_v1/
v1/
json/
graph.json
meta/
manifest.json
README.md

Its JSON starts with two nodes and an unconditional transition. The manifest declares JSON support and a pending status, and the README is a starting point for the package’s instructions. Edit these resources as part of authoring the package. Writing them to ./templates does not add the package to the bundled catalog or publish it.