xlanex6 / nuxt-meilisearch

🔎 Meilisearch module for Nuxt 3
https://nuxt-meilisearch.vercel.app
MIT License
119 stars 16 forks source link
meilisearch meilisearch-nuxt nuxt nuxt-module nuxt3 nuxtjs

xlanex6/nuxt-meilisearch

[![Latest Stable Version](https://img.shields.io/npm/v/nuxt-meilisearch.svg?style=for-the-badge)](https://www.npmjs.com/package/nuxt-meilisearch) [![License](https://img.shields.io/npm/l/nuxt-meilisearch.svg?style=for-the-badge)](https://www.npmjs.com/package/nuxt-meilisearch) [![Twitter Follow](https://img.shields.io/twitter/follow/xlanex6?color=1DA1F2&logo=twitter&style=for-the-badge)](https://twitter.com/xlanex6)

Nuxt Meilisearch

Integrate Meilisearch fast and hyper-relevant search engine in your Nuxt application.

Read Nuxt Meilisearch documentation.

Features

Installation

Add nuxt-meilisearch using the Nuxt CLI to your project

npx nuxi@latest module add nuxt-meilisearch

or add nuxt-meilisearch using your dependency manager

# with npm
npm install nuxt-meilisearch

# with yarn
yarn add nuxt-meilisearch

# with pnpm
pnpm add nuxt-meilisearch

and then to the modules section of nuxt.config.ts:

// nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-meilisearch'
  ],
  meilisearch: {
    hostUrl:  '<your_meilisearch_host>', //required
    searchApiKey: '<public_search_api_key>', // required
    adminApiKey: '<admin_api_key>', // optional
    serverSideUsage: true // default: false
})

That's it! 🎉

Usage

This example performs a search in the books index:

<script setup>
const { search, result } = useMeiliSearch('books')

onMounted(async () => {
  await search('harry');
})
</script>

<template>
  <div>
    {{ result }}
  </div>
</template>

Learn more in the Nuxt Meilisearch documentation.

Contributing

Issues and pull requests are welcome. 🫶

Local development

Licence

MIT Licence