Gathering detailed insights and metrics for directus-extension-operation-nanoid
Gathering detailed insights and metrics for directus-extension-operation-nanoid
Generate a NanoID in your Directus flows
npm install directus-extension-operation-nanoid
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Love this project? Help keep it running β sponsor us today! π
Total Downloads
635
Last Day
1
Last Week
7
Last Month
110
Last Year
635
2 Stars
33 Commits
1 Watching
2 Branches
1 Contributors
Latest Version
1.0.7
Package Id
directus-extension-operation-nanoid@1.0.7
Unpacked Size
72.94 kB
Size
19.32 kB
File Count
5
NPM Version
10.8.3
Node Version
22.6.0
Publised On
17 Jan 2025
Cumulative downloads
Total Downloads
Last day
-85.7%
1
Compared to previous day
Last week
-91.1%
7
Compared to previous week
Last month
511.1%
110
Compared to previous month
Last year
0%
635
Compared to previous year
1
5
A Directus operation extension that generates a NanoID for your Directus flows using the official nanoid
package.
A-Za-z0-9_-
) or use your own custom alphabet.The easiest way to install this extension is through the Directus Marketplace, located inside of your Settings module.
Install the extension by using your preferred package manager (i.e. pnpm
, bun
).
1# Using pnpm 2pnpm i directus-extension-operation-nanoid 3 4# Using bun 5bun i directus-extension-operation-nanoid 6 7# Using npm 8npm i directus-extension-operation-nanoid 9 10# Using yarn 11yarn add directus-extension-operation-nanoid
Clone this repository into the /extensions
folder of your Directus project.
1git clone https://github.com/antonioso-ng/directus-extension-operation-nanoid
If you require further information on how to manually install the extension inside your self-hosted instance or Docker instance, refer to the Directus documentation.
For most flows, the recommended trigger will be an Event Hook with the items.create
scope. This trigger will be used to generate a NanoID upon the creation of an item in the selected collections.
From the initial trigger card, add a new operation and select the NanoID operation, which can be found at the bottom of the operations list. You can then customize the NanoID to suit your requirements.
The example below demonstrates how to create a Stripe-like NanoID, complete with a custom prefix and seed.
After saving the operation, you can preview the generated NanoID. The result can be accessed by using {{ $last }}
in subsequent operations.
To save the generated NanoID, create an Update Data operation. In this example, the Customer collection includes a field named identifier
, where the generated NanoID will be stored.
You will assign the trigger's item ID using {{ $trigger.key }}
and set the payload to update the identifier field with the value {{ $last }}
.
After saving and activating your flow, test it to ensure that your custom NanoID is generated and stored in the identifier
field whenever a new item is created in the assigned collection.
To contribute or customize the extension, clone the repository.
1git clone https://github.com/antonioso-ng/directus-extension-operation-nanoid
Install project dependencies using your preferred package manager.
1bun i
Run the extension on watch mode or build it.
1# Develop and watch 2bun run dev 3 4# Build extension 5bun run build
NanoID is a small, secure, and URL-friendly unique string ID generator. It's an excellent alternative to UUID for creating compact and non-sequential identifiers in your applications.
You can find more information about NanoID right here.
This extension offers a powerful and simple alternative for generating custom identifiers beyond the standard options available in Directus.
NanoIDs are highly customizable, secure, and significantly smaller than UUIDs, making them an excellent choice for any project.
If you run into any issues, first ensure you are using the latest version of Directus and that your flows are set up correctly.
If the problem persists, please open a new issue on GitHub, including detailed information about the issue youβre experiencing.
To get started, follow the steps outlined in the Developing section by forking this repository. Begin by forking this repository, creating a new branch, and implementing any changes you'd like to propose.
When you're ready, commit your changes following the Git Conventional Commits guidelines and submit a pull request. Iβll review your contributions and provide feedback or approval.
nanoid
package.Made with π and 5 cups of β
Website antonioso.ng ββ’β Buy Me a Coffee β ββ’ LinkedIn @antoniosong
This extension is released under the MIT license. See LICENSE more information.
No vulnerabilities found.
No security vulnerabilities found.