# What Search Backend Does Vane Use? SearXNG Integration Explained

> Discover Vane's search backend integration with SearXNG. Learn how Vane fetches web results through a flexible HTTP endpoint for enhanced search experiences.

- Repository: [Kushagra Srivastava/Vane](https://github.com/ItzCrazyKns/Vane)
- Tags: internals
- Published: 2026-03-11

---

**Vane uses SearXNG as its meta-search backend, fetching web results via a configurable HTTP endpoint exposed at `<searxngURL>/search?format=json`.**

The open-source Vane project (ItzCrazyKns/Vane) relies on SearXNG to power its web search capabilities rather than implementing a crawler directly. By leveraging SearXNG's aggregated search results, Vane provides users with privacy-focused, configurable web search while maintaining complete control over the data source through environment variables or JSON configuration.

## How Vane Integrates with SearXNG

Vane's search architecture delegates all web queries to a user-configured SearXNG instance. The integration follows a clean separation between the search client, configuration management, and server registry.

### The Search Client Implementation

The core search logic resides in **[`src/lib/searxng.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/searxng.ts)**, which exports the `searchSearxng` function. This helper constructs and executes HTTP requests to the SearXNG API, appending `?format=json` to ensure machine-readable responses. When invoked, it contacts the configured instance at `<searxngURL>/search?format=json` and returns parsed results including suggestions and result items.

### Configuration Management

The SearXNG endpoint URL is defined in **[`src/lib/config/index.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/config/index.ts)** under the `search` UI configuration section, specifically within the `searxngURL` key. At runtime, the server registry in **[`src/lib/config/serverRegistry.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/config/serverRegistry.ts)** exposes `getSearxngURL()`, which retrieves the current configuration value for use by the search client.

## Configuring the SearXNG Backend

Vane supports two methods for specifying the SearXNG instance: environment variables or static JSON configuration.

### Environment Variable Method

Set the `SEARXNG_API_URL` variable before starting the server:

```bash
export SEARXNG_API_URL="http://localhost:4000"

```

When the `ConfigManager` initializes, it reads this value and exposes it through `getSearxngURL()`.

### JSON Configuration Method

Alternatively, specify the URL in [`data/config.json`](https://github.com/ItzCrazyKns/Vane/blob/main/data/config.json):

```json
{
  "search": {
    "searxngURL": "http://my-searxng-instance.example.com"
  }
}

```

## Using the Search API

The backend exposes web search functionality through the `/api/search` route. When the request includes `"sources": ["web"]`, the handler routes the query to `searchSearxng`.

### Example API Request

A sample POST request body:

```json
{
  "chatModel": { "providerId": "openai", "key": "gpt-4o-mini" },
  "embeddingModel": { "providerId": "openai", "key": "text-embedding-3-large" },
  "sources": ["web"],
  "query": "What is Vane?"
}

```

The system forwards the query to the configured SearXNG instance and returns aggregated web results alongside AI-generated responses.

### Performing Searches Programmatically

Once configured, the `searchSearxng` function accepts query strings and optional parameters:

```typescript
import { searchSearxng } from '@/lib/searxng';

// Simple query
const { results, suggestions } = await searchSearxng('latest AI research');

// Advanced options
const { results } = await searchSearxng('open-source LLMs', {
  categories: ['general'],
  engines: ['google', 'bing'],
  language: 'en',
  pageno: 2,
});

```

Available options include `categories` for result types, `engines` for specific search providers, `language` for localization, and `pageno` for pagination.

## Architecture Overview

According to the project's **[`docs/architecture/README.md`](https://github.com/ItzCrazyKns/Vane/blob/main/docs/architecture/README.md)**, Vane employs "A meta search backend... to fetch relevant web results." This refers specifically to the SearXNG integration, which acts as a privacy-respecting intermediary between Vane and various search providers. The architecture allows operators to self-host SearXNG or connect to any reachable instance, ensuring data sovereignty and customization flexibility.

## Summary

- **Vane uses SearXNG** as its exclusive web search backend, implemented through the `searchSearxng` helper in [`src/lib/searxng.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/searxng.ts).
- **Configuration** occurs via the `SEARXNG_API_URL` environment variable or the `search.searxngURL` JSON config key, retrieved at runtime by `getSearxngURL()`.
- **API requests** target `<searxngURL>/search?format=json` and support filtering by categories, engines, language, and pagination.
- **Architecture documentation** explicitly identifies SearXNG as the meta-search backend powering web queries.

## Frequently Asked Questions

### Does Vane implement its own web crawler?

No. According to the source code in [`src/lib/searxng.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/searxng.ts), Vane delegates all web search operations to a configured SearXNG instance. SearXNG acts as the meta-search engine that aggregates results from multiple providers, while Vane handles the presentation and AI-enhanced processing of those results.

### How do I change the SearXNG instance Vane connects to?

Modify the `SEARXNG_API_URL` environment variable or update the `search.searxngURL` value in your [`data/config.json`](https://github.com/ItzCrazyKns/Vane/blob/main/data/config.json) file. The `ConfigManager` loads this value at startup, making it available through `getSearxngURL()` in [`src/lib/config/serverRegistry.ts`](https://github.com/ItzCrazyKns/Vane/blob/main/src/lib/config/serverRegistry.ts). Restart the server after making changes.

### What parameters can I pass to the `searchSearxng` function?

The function accepts a query string and an options object supporting `categories` (array of strings), `engines` (array of provider names), `language` (ISO code), and `pageno` (number). These map directly to SearXNG's API parameters, allowing fine-grained control over result sources and pagination.

### Can I use Vane without hosting my own SearXNG instance?

Yes. While self-hosting SearXNG is recommended for privacy, you can configure Vane to use any publicly accessible SearXNG instance by setting the `searxngURL` configuration value to the instance's base URL. The application will route all web searches through that endpoint.