Skip to content

Nuxt TypesenseFast & Type-Safe Search

A powerful Nuxt module for integrating Typesense - a lightning-fast, typo-tolerant search engine

Nuxt Typesense

Quick Setup ​

Install the module:

bash
pnpm add @sfxcode/nuxt-typesense
bash
npm install @sfxcode/nuxt-typesense
bash
yarn add @sfxcode/nuxt-typesense

Add it to your nuxt.config.ts:

typescript
export default defineNuxtConfig({
  modules: ['@sfxcode/nuxt-typesense'],
  
  typesense: {
    url: process.env.TYPESENSE_URL,
    apiKey: process.env.TYPESENSE_API_KEY,
  }
})

Start using it in your components:

vue
<script setup lang="ts">
const { collectionsApi, documentsApi } = useTypesenseApi()

// Get collections
const collections = await collectionsApi.getCollections()

// Search documents
const results = await documentsApi.multiSearch({
  searches: [{
    collection: 'products',
    q: 'laptop',
    queryBy: 'name,description'
  }]
})
</script>

Resources ​

Released under the MIT License.