Strapi

The official strapi-plugin-meilisearch keeps your Strapi content types in sync with a Meilisearch index. Point it at your CelerSearch instance and Strapi handles the indexing.

The current plugin supports Strapi 5. For Strapi 4, use the plugin's v0.12 branch and its README.

1. Install

Shell
npm install strapi-plugin-meilisearch
npm run build

2. Configure

Copy the Endpoint URL and API key from your instance's Connection details at app.celersearch.com, and add them to your Strapi environment:

.env
Shell
CELERSEARCH_URL=https://your-endpoint-url
CELERSEARCH_API_KEY=your-api-key
config/plugins.js
JavaScript
module.exports = ({ env }) => ({
  meilisearch: {
    config: {
      host: env('CELERSEARCH_URL'),
      apiKey: env('CELERSEARCH_API_KEY'),

      // Optional per-content-type options
      restaurant: {
        indexName: 'restaurants',
        settings: {
          filterableAttributes: ['categories'],
        },
      },
    },
  },
})

You can also enter the host and key on the plugin's settings tab in the admin panel. Values in config/plugins.js take precedence.

3. Index your content types

  1. In the Strapi admin, open Meilisearch under Plugins.
  2. Tick the content types you want searchable. Indexing starts right away.

From then on, the plugin updates the index as entries are created, updated, published and deleted.

4. Search from your frontend

The plugin's docs suggest searching from the browser with a public search key. On CelerSearch, the instance API key has full access and custom keys can't connect yet (see Connect Any App), so send searches through your backend instead.

For example, a Strapi custom route can search with the official SDK:

src/api/search/routes/search.js
JavaScript
module.exports = {
  routes: [
    {
      method: 'GET',
      path: '/search',
      handler: 'search.find',
      config: { auth: false },
    },
  ],
}
src/api/search/controllers/search.js
JavaScript
const { Meilisearch } = require('meilisearch')

const client = new Meilisearch({
  host: process.env.CELERSEARCH_URL,
  apiKey: process.env.CELERSEARCH_API_KEY,
})

module.exports = {
  async find(ctx) {
    const { hits } = await client.index('restaurants').search(String(ctx.query.q ?? ''), {
      limit: 20,
    })
    ctx.body = hits
  },
}

Install the SDK with npm install meilisearch. Your frontend then calls GET /api/search?q=…. If your frontend is a Next.js app, the Next.js guide shows the same idea with React InstantSearch.

Plans and limits

Each indexed entry is one document toward your plan's document limit. Searches are always unlimited. At the limit, new writes are refused until you delete documents or move to a larger plan.

Next steps