A Directus v9 Interface for generating a human-readable ID for a text or string field in a collection.
The ID takes the form of {adjective}-{color}-{animal}
, such as spicy-blue-eagle
or mean-pink-starfish
.
The different components of the ID can be manually selected from all of the possible values or a custom value can be entered.
This extension is inspired by the IDs generated by coolaj86/human-readable-ids.
The idea is that this provides a realtively large set of random combinations that can be used as easily-remembered codes or IDs.
This repository contains a custom Directus interface that must be built and then installed into your Directus instance.
Install the node dependencies:
npm install
The available options for each component (adjective, color, animal) can be customized by modifying the files in the src/assets/
directory before building the extension.
Build the extension (using rollup via directus-extension):
npm run build
The dist/index.js
file must be moved to the directus /extensions/interfaces
directory. First, set the DIRECTUS_EXTENSIONS_PATH environment
variable to the path of the Directus extensions directory (either directly or by setting it in a .env file in the repository root directory).
Then, use the included deploy script to copy the appropriate files:
DIRECTUS_EXTENSIONS_PATH=/directus/extensions npm run deploy
To use the interface, create a standard text or string field and select "Human Readable ID" as the interface for the field.
1. Create a new Standard Field in a Collection
2. Set the type as either String
or Text
3. Select Human Readable ID as the Interface