Connect a website to Directus with AI
Use the official JavaScript SDK to fetch the right fields, expand related records and choose credentials appropriate to the server or browser.
To connect a website to Directus with AI, give the agent a page with a specific data problem. A catalogue that needs a product title, an image and a category name illustrates the difference between asking for identifiers and expanding a relation. The directus-sdk skill guides the request in the context of your installed package.
It also checks where the client runs. A public collection may already allow the required read, while a server-rendered account page needs credentials limited to the person making the request. The chosen approach affects which records reach the screen.
What it does
- Compose the SDK client with the features your request needs.
- Fetch selected fields from a collection and expand related records.
- Count filtered results using an aggregate request.
- Keep static tokens out of code sent to a visitor’s browser.
- Use the appropriate commands for files and users in core collections.
Install and use
- Install the skill in a compatible agent alongside a JavaScript or TypeScript project using the official Directus SDK. Private collections require an authorised connection to the instance.
- Ask, “Show the ten most recent published guides, each with an author name. Use our existing schema types and keep the token on the server.”
- Check the returned fields, sort order and access on the actual page. Verify that counts use the same filters.
FAQ
Source
Made by Directus (Monospace Inc.). Original skill: directus-sdk, published on GitHub under the MIT licence.
View on GitHub