# searxng/searxng architecture

> Architecture diagram of the GitHub repository searxng/searxng, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/searxng/searxng
- Repository: https://github.com/searxng/searxng

## Overview

SearXNG is a privacy-focused metasearch engine: users submit searches, the server parses queries and dispatches work to configured search engines, then combines results for presentation. The graph also preserves documented engine integrations, browser-side search features, and supporting state and metrics. Relationships are limited to those named in the README or SOURCE INDEX; several runtime details and frontend connections are not shown in the sampled excerpts, so they are omitted rather than inferred.

Main entry points: [`searx/search/__init__.py`](https://github.com/searxng/searxng/blob/master/searx/search/__init__.py) (Search runtime), [`client/simple/src/js/router.ts`](https://github.com/searxng/searxng/blob/master/client/simple/src/js/router.ts) (UI router), [`searx/webapp.py`](https://github.com/searxng/searxng/blob/master/searx/webapp.py) (Web request handling), [`searx/engines/__init__.py`](https://github.com/searxng/searxng/blob/master/searx/engines/__init__.py) (Engine registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webapp["Web request handling<br/>[webapp.py]"]
  node_browser["Browser search UI<br/>[search.ts]"]
  node_router["UI router<br/>[router.ts]"]
  node_keyboard["Keyboard controls<br/>[keyboard.ts]"]
  node_autocomplete["Autocomplete<br/>[autocomplete.ts]"]
  node_preferences_ui["Preferences UI<br/>[preferences.ts]"]
  node_results_ui["Results UI<br/>[results.ts]"]
  node_plugins_ui["Browser plugins<br/>[InfiniteScroll.ts]"]
end

subgraph group_search["Search orchestration"]
  node_query["Query parsing<br/>[query.py]"]
  node_search_runtime["Search runtime<br/>[__init__.py]"]
  node_processors["Engine processors<br/>[abstract.py]"]
  node_online_processor["Online processor<br/>[online.py]"]
  node_result_container["Result aggregation<br/>[results.py]"]
  node_result_types["Typed results<br/>[_base.py]"]
  node_answerers["Answer generation<br/>[_core.py]"]
end

subgraph group_engines["Engine integrations"]
  node_engine_registry["Engine registry<br/>[__init__.py]"]
  node_engine_framework["Engine framework<br/>[__init__.py]"]
  node_engine_traits["Engine traits<br/>[traits.py]"]
  node_engine_adapters["Search engine adapters"]
end

subgraph group_support["Shared services"]
  node_network["Network clients<br/>[__init__.py]"]
  node_settings["Settings loading<br/>[settings_loader.py]"]
  node_preferences["User preferences<br/>[preferences.py]"]
  node_cache[("Cache service<br/>[cache.py]")]
  node_sqlite[("SQLite storage<br/>[sqlitedb.py]")]
  node_metrics["Search metrics<br/>[__init__.py]"]
  node_plugins["Server plugins<br/>[_core.py]"]
end

node_user(("Search user"))
node_search_providers["External search providers"]

node_user -->|"submits search"| node_webapp
node_router -->|"loads search"| node_browser
node_router -->|"loads controls"| node_keyboard
node_router -->|"loads suggestions"| node_autocomplete
node_router -->|"loads preferences"| node_preferences_ui
node_router -->|"loads results"| node_results_ui
node_router -->|"loads plugin"| node_plugins_ui
node_webapp -->|"parses query"| node_query
node_webapp -->|"starts search"| node_search_runtime
node_webapp -->|"loads settings"| node_settings
node_search_runtime -->|"loads engines"| node_engine_registry
node_search_runtime -->|"initializes network"| node_network
node_search_runtime -->|"initializes metrics"| node_metrics
node_search_runtime -->|"dispatches engines"| node_processors
node_search_runtime -->|"collects results"| node_result_container
node_search_runtime -->|"runs plugins"| node_plugins
node_processors -->|"registers processor"| node_online_processor
node_processors -->|"selects engine"| node_engine_registry
node_engine_registry -->|"configures engines"| node_engine_framework
node_engine_registry -->|"uses traits"| node_engine_traits
node_engine_adapters -.->|"queries providers"| node_search_providers
node_online_processor -->|"sends requests"| node_network
node_result_container -->|"holds results"| node_result_types
node_answerers -->|"creates answers"| node_result_types
node_cache -->|"uses storage"| node_sqlite
node_webapp -->|"reads preferences"| node_preferences

click node_webapp "https://github.com/searxng/searxng/blob/master/searx/webapp.py"
click node_query "https://github.com/searxng/searxng/blob/master/searx/query.py"
click node_browser "https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/search.ts"
click node_router "https://github.com/searxng/searxng/blob/master/client/simple/src/js/router.ts"
click node_keyboard "https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/keyboard.ts"
click node_autocomplete "https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/autocomplete.ts"
click node_preferences_ui "https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/preferences.ts"
click node_results_ui "https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/results.ts"
click node_plugins_ui "https://github.com/searxng/searxng/blob/master/client/simple/src/js/plugin/InfiniteScroll.ts"
click node_search_runtime "https://github.com/searxng/searxng/blob/master/searx/search/__init__.py"
click node_processors "https://github.com/searxng/searxng/blob/master/searx/search/processors/abstract.py"
click node_online_processor "https://github.com/searxng/searxng/blob/master/searx/search/processors/online.py"
click node_result_container "https://github.com/searxng/searxng/blob/master/searx/results.py"
click node_result_types "https://github.com/searxng/searxng/blob/master/searx/result_types/_base.py"
click node_answerers "https://github.com/searxng/searxng/blob/master/searx/answerers/_core.py"
click node_engine_registry "https://github.com/searxng/searxng/blob/master/searx/engines/__init__.py"
click node_engine_framework "https://github.com/searxng/searxng/blob/master/searx/enginelib/__init__.py"
click node_engine_traits "https://github.com/searxng/searxng/blob/master/searx/enginelib/traits.py"
click node_engine_adapters "https://github.com/searxng/searxng/tree/master/searx/engines"
click node_network "https://github.com/searxng/searxng/blob/master/searx/network/__init__.py"
click node_settings "https://github.com/searxng/searxng/blob/master/searx/settings_loader.py"
click node_preferences "https://github.com/searxng/searxng/blob/master/searx/preferences.py"
click node_cache "https://github.com/searxng/searxng/blob/master/searx/cache.py"
click node_sqlite "https://github.com/searxng/searxng/blob/master/searx/sqlitedb.py"
click node_metrics "https://github.com/searxng/searxng/blob/master/searx/metrics/__init__.py"
click node_plugins "https://github.com/searxng/searxng/blob/master/searx/plugins/_core.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webapp,node_browser,node_router,node_keyboard,node_autocomplete,node_preferences_ui,node_results_ui,node_plugins_ui,node_user toneBlue
class node_query,node_search_runtime,node_processors,node_online_processor,node_result_container,node_result_types,node_answerers toneAmber
class node_engine_registry,node_engine_framework,node_engine_traits,node_engine_adapters toneMint
class node_network,node_settings,node_preferences,node_cache,node_sqlite,node_metrics,node_plugins toneRose
class node_search_providers toneIndigo
```

## Components

### Web interface

- [Web request handling](https://github.com/searxng/searxng/blob/master/searx/webapp.py): `searx/webapp.py`
- [Browser search UI](https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/search.ts): `client/simple/src/js/main/search.ts`
- [UI router](https://github.com/searxng/searxng/blob/master/client/simple/src/js/router.ts): `client/simple/src/js/router.ts`
- [Keyboard controls](https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/keyboard.ts): `client/simple/src/js/main/keyboard.ts`
- [Autocomplete](https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/autocomplete.ts): `client/simple/src/js/main/autocomplete.ts`
- [Preferences UI](https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/preferences.ts): `client/simple/src/js/main/preferences.ts`
- [Results UI](https://github.com/searxng/searxng/blob/master/client/simple/src/js/main/results.ts): `client/simple/src/js/main/results.ts`
- [Browser plugins](https://github.com/searxng/searxng/blob/master/client/simple/src/js/plugin/InfiniteScroll.ts): `client/simple/src/js/plugin/InfiniteScroll.ts`

### Search orchestration

- [Query parsing](https://github.com/searxng/searxng/blob/master/searx/query.py): `searx/query.py`
- [Search runtime](https://github.com/searxng/searxng/blob/master/searx/search/__init__.py): `searx/search/__init__.py`
- [Engine processors](https://github.com/searxng/searxng/blob/master/searx/search/processors/abstract.py): `searx/search/processors/abstract.py`
- [Online processor](https://github.com/searxng/searxng/blob/master/searx/search/processors/online.py): `searx/search/processors/online.py`
- [Result aggregation](https://github.com/searxng/searxng/blob/master/searx/results.py): `searx/results.py`
- [Typed results](https://github.com/searxng/searxng/blob/master/searx/result_types/_base.py): `searx/result_types/_base.py`
- [Answer generation](https://github.com/searxng/searxng/blob/master/searx/answerers/_core.py): `searx/answerers/_core.py`

### Engine integrations

- [Engine registry](https://github.com/searxng/searxng/blob/master/searx/engines/__init__.py): `searx/engines/__init__.py`
- [Engine framework](https://github.com/searxng/searxng/blob/master/searx/enginelib/__init__.py): `searx/enginelib/__init__.py`
- [Engine traits](https://github.com/searxng/searxng/blob/master/searx/enginelib/traits.py): `searx/enginelib/traits.py`
- [Search engine adapters](https://github.com/searxng/searxng/tree/master/searx/engines): `searx/engines`

### Shared services

- [Network clients](https://github.com/searxng/searxng/blob/master/searx/network/__init__.py): `searx/network/__init__.py`
- [Settings loading](https://github.com/searxng/searxng/blob/master/searx/settings_loader.py): `searx/settings_loader.py`
- [User preferences](https://github.com/searxng/searxng/blob/master/searx/preferences.py): `searx/preferences.py`
- [Cache service](https://github.com/searxng/searxng/blob/master/searx/cache.py): `searx/cache.py`
- [SQLite storage](https://github.com/searxng/searxng/blob/master/searx/sqlitedb.py): `searx/sqlitedb.py`
- [Search metrics](https://github.com/searxng/searxng/blob/master/searx/metrics/__init__.py): `searx/metrics/__init__.py`
- [Server plugins](https://github.com/searxng/searxng/blob/master/searx/plugins/_core.py): `searx/plugins/_core.py`

### Other components

- **Search user**
- **External search providers**

## Connections

- Search user → Web request handling: submits search
- UI router → Browser search UI: loads search (evidence: `client/simple/src/js/router.ts`)
- UI router → Keyboard controls: loads controls (evidence: `client/simple/src/js/router.ts`)
- UI router → Autocomplete: loads suggestions (evidence: `client/simple/src/js/router.ts`)
- UI router → Preferences UI: loads preferences (evidence: `client/simple/src/js/router.ts`)
- UI router → Results UI: loads results (evidence: `client/simple/src/js/router.ts`)
- UI router → Browser plugins: loads plugin (evidence: `client/simple/src/js/router.ts`)
- Web request handling → Query parsing: parses query (evidence: `searx/webapp.py`)
- Web request handling → Search runtime: starts search (evidence: `searx/webapp.py`)
- Web request handling → Settings loading: loads settings (evidence: `searx/webapp.py`)
- Search runtime → Engine registry: loads engines (evidence: `searx/search/__init__.py`)
- Search runtime → Network clients: initializes network (evidence: `searx/search/__init__.py`)
- Search runtime → Search metrics: initializes metrics (evidence: `searx/search/__init__.py`)
- Search runtime → Engine processors: dispatches engines (evidence: `searx/search/__init__.py`)
- Search runtime → Result aggregation: collects results (evidence: `searx/search/__init__.py`)
- Search runtime → Server plugins: runs plugins (evidence: `searx/search/__init__.py`)
- Engine processors → Online processor: registers processor (evidence: `searx/search/processors/__init__.py`)
- Engine processors → Engine registry: selects engine (evidence: `searx/search/processors/__init__.py`)
- Engine registry → Engine framework: configures engines (evidence: `searx/engines/__init__.py`)
- Engine registry → Engine traits: uses traits (evidence: `searx/engines/__init__.py`)
- Search engine adapters → External search providers: queries providers
- Online processor → Network clients: sends requests
- Result aggregation → Typed results: holds results
- Answer generation → Typed results: creates answers (evidence: `searx/answerers/_core.py`)
- Cache service → SQLite storage: uses storage (evidence: `searx/cache.py`)
- Web request handling → User preferences: reads preferences (evidence: `searx/webapp.py`)
