# Self-Hosted Web Search with SearXNG

Deploy SearXNG as a Docker container for unlimited, private web search. No API key needed, no rate limits.

## Deployment

### docker-compose.yml

```yaml
services:
  searxng:
    image: searxng/searxng:latest
    container_name: searxng
    restart: always
    ports:
      - "127.0.0.1:8888:8080"  # localhost only
    volumes:
      - ./searxng-data:/etc/searxng:rw
    environment:
      - SEARXNG_BASE_URL=http://localhost:8080
      - SEARXNG_SECRET_KEY=${SEARXNG_SECRET_KEY}
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - SETGID
      - SETUID
      - DAC_OVERRIDE
```

### settings.yml (enable JSON API)

```yaml
use_default_settings: true
server:
  secret_key: "..."
  image_proxy: true
search:
  formats:
    - html
    - json
limits:
  default:
    requests: 120
    time_range: 3600
```

## Usage

```bash
curl -s "http://127.0.0.1:8888/search?q=query+here&format=json" | python3 -c "
import sys, json
d = json.load(sys.stdin)
for r in d['results'][:5]:
    print(f'  {r[\"title\"]} - {r[\"url\"]}')
"
```

## How it fits with Firecrawl

| Tool | Role | Cost |
|------|------|------|
| **SearXNG** | Search (finds links) | Free, unlimited |
| **Firecrawl** | Extraction (clean content) | API key, 500 free pages/mo |
