npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

directus-extension-typesense

v2.2.0

Published

Typesense search engine features for directus.

Readme

directus-extension-typesense

Integrates Typesense with Directus

  • 🔒 Keeps your data secure as it adds content to the search index based on a policy (public policy by default).
  • 🌐 Supports multilingual content by adding translated fields to index collection.
  • 🪄 Adds hooks to keep your search index up-to-date (while handling bulk data imports/updates).
  • ⏯️ Adds an operation to manually trigger a rebuild of the search index in your flows.
  • 🔗 Sets the correct references on related fields to allow for Typesense JOINS

Getting started

  1. You will need a running Typesense instance.
  2. Install this extension (for now only made for use on self-hosted instances).
  3. Configure directus to use typesense by setting the TYPESENSE_URL and TYPESENSE_SECRET environment variables.

Minimal example using docker compose:

# Dockerfile
FROM directus/directus

USER root
RUN corepack enable
USER node

RUN pnpm install directus-extension-typesense
# docker-compose.yml
services:
  directus:
    platform: linux/amd64
    build:
      context: ./
    ports:
      - 127.0.0.1:8055:8055
    environment:
      ADMIN_EMAIL: [email protected]
      ADMIN_PASSWORD: d1r3ctu5
      EXTENSIONS_AUTO_RELOAD: true
      DB_FILENAME: /directus/database/db.sqlite
      TYPESENSE_URL: "http://typesense:8108"
      TYPESENSE_API_KEY: "secret"

  typesense:
    platform: linux/amd64
    image: typesense/typesense:29.0
    ports:
      - 127.0.0.1:8108:8108
    volumes:
      - ./typesense-data:/data
    environment:
      TYPESENSE_API_KEY: "secret"
      TYPESENSE_DATA_DIR: "/data"
      TYPESENSE_ENABLE_CORS: true

🔒 Policy based indexing

By default this extension will check the public policy to decide whether data will be added to the search index or not. You can change this though by setting the TYPESENSE_POLICY environment variable to the id of the policy you want it to respect.

🌐 Multilingual content

If you setup content translations this extension will fetch the translations and add them as localised fields to the documents, according to Typesense best practices for locale-specific search (https://typesense.org/docs/guide/locale.html).

// GET <typesense_url>/collections/article/documents/1
{
  "id": "1",
  "title_en": "No one is illegal",
  "title_es": "Nadie es ilegal",
  "title_ar": "لا أحد غير شرعي"
}

🪄 Hooks

This extension comes with hooks, which should keep your index up-to-date. The search index is (re-)built whenever you update any collection and/or permission or load an extension. If you create or update an element, it will be updated in the index. To prevent crashing when running lots of sequential updates, this extension will debounce updates. By default the timeout is 5 seconds, you can adjust this value though by setting the TYPESENSE_WAIT_MS environment variable, so you can change from between more "realtime" updates and more robustness for different update scenarios.

⏯️ Rebuild search index operation

You will also find a "rebuild search index" operation to use in your flows.

🔗 Relational references for Typesense JOINS

When indexing relational fields, a reference will be added. This will enable you to use Typesense JOINS in order to query by relational data:

// GET <typesense_url>/collections/posts/documents/search?q=illegal&filter_by=$posts_tags(id:=[2])&query_by=*
{
  // ...
  "hits": [
    {
      "document": {
        "id": "1",
        "posts_tags": {
          "id": "2",
          "posts_id": "2",
          "tags_id": "2"
        },
        "title_en": "No one is illegal",
        "title_es": "Nadie es ilegal",
        "title_ar": "لا أحد غير شرعي"
      },
      "highlight": {
        "title_en": {
          "matched_tokens": [
            "illegal"
          ],
          "snippet": "No one is <mark>illegal</mark>"
        }
      },
      //...
    }
  ]
}

// GET <typesense_url>/collections/posts/documents/search?q=illegal&filter_by=$posts_tags(id:=[1])&query_by=*
{
  // ...
  "hits": [],
  // ...
}