Anatomy of the Patterns Catalog

The same patterns data source that powers the catalog page drives this stats overview — a different view of identical data. This is the "one source, many views" pattern: a docs site can present REST data from many angles without re-fetching, re-modelling, or duplicating the source.

Connecting...

How this page works

This page binds to the same patterns source as /patterns/ — declared once in tinkerdown.yaml and reused by any number of pages. The catalog renders a per-category listing; this page renders a tabular summary with sample patterns per category.

The pattern that matters: the source is the contract. Adding a per-status view, a "patterns added this month" view, or an embedded auto-table on the home page — all of them read from lvt-source="patterns" without re-fetching the API or re-implementing the catalog's data model. If the upstream API ever adds a new field, every page that wants to surface it picks it up by re-rendering its template.

For richer aggregation (group_by, sum, avg) the right tool is a computed source declared in tinkerdown.yaml:

sources:
  patterns:
    type: rest
    from: https://lt-patterns.fly.dev/api/index.json
    result_path: categories
  patterns_by_status:
    type: computed
    from: patterns
    group_by: status
    aggregate:
      count: count()

Computed sources move the work into Go and out of every render path — useful when the dataset is large enough that template-side aggregation gets noticeable.