Ditch the Subscription: Self-Host Perplexica for Private AI Search

AI tutorial - IT technology blog
AI tutorial - IT technology blog

Why I Stopped Paying $20/Month for Search

I’ve spent over $240 on Perplexity Pro subscriptions this past year. While the tool is excellent, I grew increasingly uncomfortable with my entire search history—including sensitive project ideas and proprietary code snippets—living on a third-party server. I wanted the power of Retrieval-Augmented Generation (RAG) without the privacy trade-offs. That search led me to Perplexica.

Perplexica is a robust open-source alternative that mimics the Perplexity workflow. It uses SearXNG to crawl the live web and then feeds that data into an LLM like Claude 3.5 Sonnet or a local Llama 3 instance to generate cited answers. This setup bridges the gap between static LLMs and real-time internet data while keeping you in total control of your data footprint.

Quick Start: Up and Running in Under 5 Minutes

As long as you have Docker and Docker Compose ready, you can deploy a functional instance almost immediately. I recommend starting with the default configuration first. This ensures your network can reach search providers before you start experimenting with local LLM integrations.

1. Clone the Repository

git clone https://github.com/ItS0hyam/perplexica.git
cd perplexica

2. Configure the Environment

Perplexica relies on a sample.config.toml file for its backend logic. Copy this to create your active configuration:

cp sample.config.toml config.toml

You don’t need to perform heavy edits yet. However, it is worth a quick look to confirm the default PORT and SEARCH_ENGINE settings align with your environment.

3. Launch with Docker Compose

Execute the following command to pull the necessary images and spin up the containers:

docker compose up -d

Once the process completes, the UI is accessible at http://localhost:3000, while the backend handles requests on http://localhost:3001. If the search bar appears, you are ready to go.

Under the Hood: The Architecture

To optimize Perplexica for your specific workflow, you need to understand its three-pillar structure: the Next.js Frontend, the Node.js Backend, and the SearXNG engine.

The Role of SearXNG

SearXNG acts as a privacy-respecting metasearch engine. Instead of querying Google directly, Perplexica sends requests to SearXNG, which aggregates results from Google, Bing, and DuckDuckGo. If your searches return empty results, the culprit is usually a port conflict or a blocked IP within the SearXNG container.

Choosing Your LLM Provider

Your config.toml acts as the brain of the operation. You have two primary paths for processing your search data:

  • Cloud APIs: Use Groq for sub-second responses, or Anthropic’s Claude 3.5 Sonnet for high-reasoning tasks.
  • Local Hosting: Ollama is the preferred choice for those prioritizing 100% data sovereignty.

If you choose Groq—which I recommend for its incredible speed and generous free tier—your configuration should look like this:

[API_KEYS]
GROQ = "your_groq_api_key_here"

[GENERAL]
LLM_PROVIDER = "groq"
DYNAMIC_LLM_MODEL = "llama3-70b-8192"

Going Local: Connecting Ollama

The real power of self-hosting is keeping the entire stack on your own hardware. If you have Ollama running on your host machine, you must ensure the Docker container can communicate with it. This is where most users run into a wall.

Step 1: Network Binding

Ollama often defaults to 127.0.0.1, which is invisible to Docker containers. On Windows or Mac, set the environment variable OLLAMA_HOST=0.0.0.0. Linux users will need to edit the systemd service file to allow cross-interface communication.

Step 2: Update config.toml

Point the API URL to your machine’s Docker bridge IP rather than localhost:

[GENERAL]
LLM_PROVIDER = "ollama"
OLLAMA_BASE_URL = "http://host.docker.internal:11434"
DYNAMIC_LLM_MODEL = "llama3"

Note: host.docker.internal is a shortcut for Docker Desktop. If you are on a native Linux server, use the docker0 interface IP, which is typically 172.17.0.1.

Step 3: Refining Search Focus

Perplexica includes a “Focus Mode” to narrow down source material. Switching to “Academic” mode significantly improves the signal-to-noise ratio when researching technical documentation. It bypasses SEO-heavy blogs to prioritize whitepapers and official manuals.

Performance and Troubleshooting

After running this stack in my home lab for several months, I’ve identified a few key areas for optimization.

Managing Port Conflicts

The stack defaults to ports 3000 and 3001. If you are already running a dashboard like Portainer or a Nextcloud instance, Perplexica will crash on startup. Simply remap the ports in your docker-compose.yaml:

services:
  perplexica-frontend:
    ports:
      - "8080:3000" # Maps your local port 8080 to the container

Hardware Requirements

Running the full stack alongside a local 8B parameter model requires at least 16GB of RAM for a fluid experience. If you are limited to 8GB, I suggest hosting the UI and SearXNG locally but offloading the LLM processing to Groq or OpenAI’s API.

Keeping the Engine Updated

Development on Perplexica moves fast. To stay current without breaking your setup, use this sequence:

git pull
docker compose build
docker compose up -d

Self-hosting your search engine isn’t just a privacy flex. It’s about building a tool that isn’t throttled by subscription tiers or modified by corporate filters. Once you experience a private, cited search, it is very difficult to go back to the standard commercial options.

Share: