Algolia

Configure Algolia for @foadonis/magnify

Algolia is a closed-source, lightning-fast search engine for apps and websites. It delivers smart, instant results and offers a free plan to get started.

Getting Started

Install dependencies

First install the algoliasearch package.

npm install algoliasearch

Head over your Algolia Application and grab your Application Id and the Write API Key.

Configure environment variables

Update your environment variables schema and add them to your .env file.

import {  } from '@adonisjs/core/env'
 
export default await .(new ('../', import.meta.), {
  : ..(),
  : ..(),
})

Configure the Search Engine

Add the AlgoliaEngine to your Magnify configuration.

config/magnify.ts
import  from '#start/env'
import { ,  } from '@foadonis/magnify'
import type {  } from '@foadonis/magnify/types'
 
const  = ({
  : 'algolia',
  : {
    : .({
      : .get('ALGOLIA_APP_ID'),
      : .get('ALGOLIA_API_KEY'),
    }),
  },
})
 
export default 
 
/**
 * Inferring types for the list of engines you have configured
 * in your application.
 */
declare module '@foadonis/magnify/types' {
  export interface EnginesList extends <typeof > {}
}

Start Searching

On this page