Skip to content
Edit this page

Use data sources

Data sources expose structured TOML, JSON, or YAML under data.<name>. Use them for lookup tables and externally maintained information rather than asking people to copy values by hand.

Choose where data comes from

Source Choose it when Reference
Template Data should version together with the template. Template/local data
Local Data belongs to the destination project. Local data
Remote A service publishes structured data over HTTP. Remote data
Git A file is maintained in another Git repository. Git data

For a template-owned lookup table:

[data.licenses]
source = "data/licenses.toml"

Read it from an expression such as {{ data.licenses }} or use it to derive question choices. See the source declaration reference for kind inference and formats.

Authorize network access

Inspect declared remote inputs before granting trust. For a single render, pass --trust on commands supporting it. For templates you routinely use, add their source patterns to the personal trust list.

Trust authorizes a capability; it does not pin the returned contents. Sources are acquired only when expressions actually access them.

Make results repeatable

Keep data in the template when it must change in lockstep with its files. For external inputs, use content digests or immutable Git commits rather than moving branches or tags. Follow the reproducibility guide for examples and provenance.

For disconnected work, use --offline after the required inputs have been cached. An absent cache entry fails rather than silently fetching. See cache for location, freshness, and maintenance.