> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Backend search with InstantSearch.js

> Set up search on your backend with InstantSearch.js.

<div className="not-prose algolia-flavor-switcher">
  <div className="afs-dropdown">
    <div className="afs-trigger" role="button" tabIndex="0" aria-haspopup="listbox">
      <span className="afs-current">JavaScript</span>

      <svg className="afs-chevron lucide lucide-chevron-down" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
        <path d="m6 9 6 6 6-6" />
      </svg>
    </div>

    <ul className="afs-menu" role="listbox">
      <li role="option" aria-selected="true"><a className="afs-option is-current" href="/doc/guides/building-search-ui/going-further/backend-search/js"><span className="afs-option-name">JavaScript</span><span className="afs-option-lib">InstantSearch.js</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/going-further/backend-search/react"><span className="afs-option-name">React</span><span className="afs-option-lib">React InstantSearch</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/going-further/backend-search/vue"><span className="afs-option-name">Vue</span><span className="afs-option-lib">Vue InstantSearch</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/going-further/backend-search/ios"><span className="afs-option-name">iOS</span><span className="afs-option-lib">InstantSearch iOS</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/going-further/backend-search/android"><span className="afs-option-name">Android</span><span className="afs-option-lib">InstantSearch Android</span></a></li>
    </ul>
  </div>
</div>

## Frontend versus backend search

You should use frontend search because:

* **It offers a better response speed**. Speed alone justifies the choice. Backend search requires two more trips between a user's browser and Algolia's servers. This decreases the effectiveness of Algolia's engine and infrastructure optimizations.
* **UI libraries aid development**. Algolia's UI libraries ([InstantSearch](/doc/guides/building-search-ui/getting-started/js) and [Autocomplete](/doc/ui-libraries/autocomplete/introduction/getting-started)) help build a frontend solution so that you can focus on configuring relevance and creating the best possible search experience.
* **It frees up your resources**. Algolia reduces the need for development and eliminates the requirement for additional server deployments and its associated infrastructure.

## Why backend search?

* Server-side pre-processing. Perhaps the most important reason for a backend solution is to make complex calculations or format your data before displaying the results.
* Real-time availability updates (like Airbnb)
* In some situations, SEO is easier to manage.

## How to implement backend search

You only need a few lines of code to send a query to Algolia and receive a response.
The response contains everything needed to build your UI.

You can perform backend search with either InstantSearch or one of the Algolia API clients.

### Backend InstantSearch

[Backend InstantSearch](/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-instantsearch/js) offers a good compromise. You perform the search on your servers, carry out any required pre-processing, and then send your results to InstantSearch's widgets. This enables you to control the query and response but saves you the work of building a custom frontend.

### Backend search with an Algolia API client

This option requires a server-side solution and custom frontend development. You manage all queries and responses, and you build the frontend UI.
You need to parse the API response: a JSON object.
The response includes:

* Results already formatted for display (full record content, embedded HTML, or image URLs)
* Highlighting and snippeting
* Pagination

For more information, see:

* [Backend search with an API client](/doc/guides/building-search-ui/going-further/backend-search/in-depth/backend-search-with-an-api-client/js)
* [Pagination](/doc/api-reference/api-parameters/page)
* [Highlighting](/doc/api-reference/api-parameters/attributesToHighlight)
* [Snippeting](/doc/api-reference/api-parameters/attributesToSnippet)
