Judah Sullivan
Work

FIG. 05 · Project

Directus Auto Gen

An extension that derives a field from the values an editor already entered. A title can become a slug, and a pair of numbers can become a total.

Directus Auto Gen field configuration
Fig. 5   Directus Auto Gen extension
01

The problem

Entering a title and then retyping its slug is small work that repeats on every item. Manual copies also drift: the title changes, the derived field stays behind.

02

My role

I authored the Auto Gen extension for Directus and documented its formula and template options. I’m a Directus Builders member.

03

The key decision

Let editors configure a readable formula next to the field. The interface shows the result as they edit. A server hook can apply the same evaluation when a configured item is written through the API.

04

The result

The package is available on npm and the examples are inspectable in the public repository. The useful result is concrete: give the field one source value, and it derives a repeatable output.

Visual evidence

One input, a derived field.

Two small examples show why the extension exists: calculate from fields an editor already has, with the rule visible beside the result.

Worked example: Field Notes becomes field-notes using the SLUG title formula.

01 / Worked example

Turn a title into a slug

A title supplies the human-readable text. The slug rule supplies a predictable URL fragment. This example uses sample content.

View full size See the formula reference
Worked example: quantity 3 multiplied by unit price 12 gives a total of 36.

02 / Worked example

Calculate an item total

The same idea works with numbers. Change the quantity or unit price and the rule calculates a new total.

View full size View the npm package