Strapi Plugin Tantivy logo

Strapi Plugin Tantivy

By Suneet Jain

Blazing-fast, Rust-powered Full-Text Search for your Strapi backend using Tantivy. Bridges Strapi and Tantivy via native Node.js bindings, providing instant search indexing via Strapi lifecycle hooks and optional Redis caching without needing external search engines like Elasticsearch or Algolia.

Latest version

v1.0.3

released August 3, 2026

npm install strapi-plugin-tantivy

🚀 Strapi Plugin Tantivy

Blazing-fast, Rust-powered Full-Text Search for your Strapi API

npm version License: MIT


Strapi Plugin Tantivy bridges the gap between Strapi and Tantivy (via node-tantivy-binding), providing an incredibly fast, highly scalable, full-text search engine natively integrated into your Strapi backend.

Forget complex external setups like Elasticsearch or Algolia—get lightning-fast search capabilities directly within your Node.js infrastructure.

✨ Features

  • ⚡️ Blazing Fast: Powered by Rust-based Tantivy, indexing and querying are orders of magnitude faster than traditional SQL wildcard searches.
  • 🔄 Auto-Sync: Automatically intercepts and indexes content creation, updates, and deletions in Strapi.
  • 🗄 Zero External Dependencies: Runs entirely within your Node.js process using native bindings. No need for a separate search server.
  • ⚙️ Configurable: Choose exactly which collections to index.
  • 🚀 Redis Cache Ready: Built-in support for caching queries in Redis for even faster subsequent reads.
  • 🛡 Admin Dashboard: Easily view and manage the indexing status directly from your Strapi Admin UI.

📦 Installation

To install this plugin, run the following command in your Strapi project:

npm install strapi-plugin-tantivy
# or
yarn add strapi-plugin-tantivy

🚀 Configuration

Enable and configure the plugin in your config/plugins.js (or config/plugins.ts) file.

module.exports = ({ env }) => ({
  // ... your other plugins
  
  'strapi-plugin-tantivy': {
    enabled: true,
    config: {
      // Enable or disable Redis caching for search queries
      redisCache: true,
      
      // List the Content-Type UIDs of the collections you want to index
      collections: [
        'api::device.device', 
        'api::vendor.vendor', 
        'api::app.app', 
        'api::product.product'
      ]
    }
  }
});

💡 How It Works

Once configured, the plugin performs the following tasks:

  1. Initialization: On Strapi startup, it verifies the Tantivy index directories.
  2. Lifecycle Hooks: It dynamically attaches to the afterCreate, afterUpdate, and afterDelete hooks of the collections specified in your configuration.
  3. Indexing: Any time a document is modified in Strapi, it is instantly synchronized into the local Tantivy index (stored in temp/ or data/).
  4. Querying: You can hit the search endpoints via the plugin's exposed controllers (e.g., /api/search) to retrieve fast, semantically ranked search results.

🛠 Usage in API

You can trigger a search via the Strapi API by leveraging the plugin's services. Assuming you expose a custom controller:

const { data } = await strapi.plugin('strapi-plugin-tantivy').service('tantivy').search(query, collectionUid);

(Note: Ensure you have built out a custom route/controller or are using the one exposed natively by the plugin!)

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

  1. Clone this repository.
  2. Run npm install.
  3. Create your feature branch (git checkout -b feature/amazing-feature).
  4. Commit your changes (git commit -m 'Add some amazing feature').
  5. Push to the branch (git push origin feature/amazing-feature).
  6. Open a Pull Request.

📝 License

This project is licensed under the MIT License.

Submit your content

Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.

Submit
Submit your content