Build a self-hosted Perplexity alternative with Morphic, SearXNG and Firecrawl
Self-host an AI answer engine with cited sources. Compare Morphic, Open DeepResearch and Fireplexity, and add private search with SearXNG or Whoogle.By chin · Oct 4, 2026 · 4 min read
AI answer engines like Perplexity changed how many people search. You ask a question and get a written answer with citations instead of ten blue links. Every one of these tools combines two parts: a search layer that finds fresh pages, and a language model that reads them and writes the answer.
Self-hosting lets you pick both parts. That means your own model provider and API budget, and optionally a private search engine that does not profile your queries. This guide walks through the templates for each part and how they fit together.
How an AI answer engine works
- Search. Your question is sent to a search API (Tavily, Firecrawl, SearXNG and so on), which returns relevant URLs and snippets.
- Read. The engine fetches the most promising pages and extracts their text.
- Answer. A language model writes a response grounded in that text, with links back to the sources.
The search layer is where the templates differ most, so that is the first thing to choose.
Option 1: Morphic, the polished answer engine
Morphic is an open-source, Perplexity-style app built with Next.js. It streams answers with sources, shows related questions, and keeps your history in Redis, which the template provisions for you.
The template asks for two keys:
OPENAI_API_KEY, for the model that writes answersTAVILY_API_KEY, for web search (Tavily offers a free tier that is plenty for personal use)
If you'd rather pay one bill for access to many models, the Morphic with OpenRouter variant needs a single
OPENROUTER_API_KEY. You can then switch to Claude, Gemini, Llama or others without touching the code.Morphic is the best choice if you want something you can use every day, with a clean interface, on desktop and mobile.
Option 2: Open DeepResearch, for long, multi-step questions
Some questions are not answered by one search. "Compare the pricing models of the top five vector databases" needs several rounds of searching, reading and refining. Open DeepResearch is an open-source take on "deep research" agents. It plans the research, searches with Firecrawl, reads the results, and keeps going until it can write a report.
The template is a small stack: the app, Postgres (users and chats), Redis, and an HTTP service the app uses to talk to Redis. It asks for:
FIRECRAWL_API_KEY, for search and page extractionOPENROUTER_API_KEY, for the reasoning models
Expect each deep-research run to use more tokens than a quick answer. Use it for questions worth a few minutes, not quick lookups.
Option 3: Fireplexity, the minimal starter
Fireplexity is the smallest of the three: one service, with fast streaming answers and citations, built by the Firecrawl team. It needs a
FIRECRAWL_API_KEY and a GROQ_API_KEY. Groq's fast inference makes answers appear almost instantly.Pick it if you want a starting point to customise, such as an answer engine embedded in your own product.
Adding a private search engine
Tavily and Firecrawl are paid APIs with free tiers, so your queries go to a third party. If privacy is the goal, you can run the search layer yourself.
SearXNG: a metasearch API for your apps
SearXNG is a free metasearch engine. It queries Google, Bing, DuckDuckGo, Wikipedia and dozens of other sources at once, merges the results, and does not track users. It needs no API keys, and the template keeps its settings on a volume so your changes survive redeploys.
To use it as a search backend for AI tools, enable JSON output in
settings.yml:yamlsearch:formats:- html- json
Your apps can then call
https://<your-searxng-domain>/search?q=your+query&format=json. Recent versions of Morphic can use SearXNG as their search provider (check the Morphic README for the current variable names), and many agent frameworks have a SearXNG tool built in.Keep the instance private if you can. A public SearXNG URL is quickly found and used by others, and the upstream engines may start rate-limiting it.
Whoogle: private Google results for people
Whoogle returns Google results without ads, JavaScript tracking or AMP links. It is designed for people rather than programs. Set it as your browser's default search engine and you get familiar results without the tracking.
Set
WHOOGLE_USER and WHOOGLE_PASS in the service variables to put the instance behind basic authentication, so only you can use it.Recommended setups
- Daily Perplexity replacement: Morphic (OpenRouter variant for flexibility).
- Research reports and due diligence: Open DeepResearch.
- Building your own product: Fireplexity as a base.
- Maximum privacy: self-hosted SearXNG as the search layer, plus Whoogle for everyday browsing.
Frequently asked questions
Is this cheaper than a Perplexity subscription?
For light personal use it often is: Railway resources for one small service plus pay-as-you-go model costs. Heavy use of frontier models can cost more. Set spending limits on your API keys and a usage limit in Railway.
Do these engines cite their sources?
Yes. All three show the pages each answer was based on, so you can verify claims instead of trusting the model.
Can I use a local model?
Anything that exposes an OpenAI-compatible API can usually be wired in through the provider settings. OpenRouter is the easiest way to try many models without running them yourself.
Templates in this guide
morphic [with openrouter]
Includes RedisAI-powered search, perplexity-clone, works with openrouter API
14 deploys
Deploy
Open DeepResearch [by firecrawl]
Includes Postgres + RedisAI agent that deeply researches the web, using firecrawl and Reasoning LLM
31 deploys
Deploy
fireplexity
Single serviceFast AI search engine with citations and streaming responses.
2 deploys
DeployMore guides
- How to self-host Excalidraw with real-time collaborationRun your own Excalidraw whiteboard with live, end-to-end encrypted collaboration on Railway. Covers how the two services fit together, setup, and common fixes.
- Self-hosted ChatGPT alternatives: Open WebUI vs LibreChat vs big-AGICompare three open-source ChatGPT-style interfaces you can self-host on Railway, where each one stores your chats, and which to pick for you or your team.
- Self-hosted PDF tools: Stirling-PDF vs PDFDing vs Paperless-AIEdit, organise and auto-tag PDFs without uploading them to online converters. A practical comparison of three self-hosted PDF tools you can deploy on Railway.
