Morphic Architecture & Features
How It Works
User Query: "What are the latest advances in protein folding?"
│
├─ 1. Search Phase
│ SearXNG/Tavily searches the web
│ Returns 10-20 relevant sources
│
├─ 2. AI Synthesis
│ LLM reads all sources
│ Generates comprehensive answer
│ Adds inline citations [1][2][3]
│
├─ 3. Generative UI
│ Renders answer with rich formatting
│ Shows source cards with thumbnails
│ Suggests follow-up questions
│
└─ 4. Persistence
Saves to PostgreSQL
Shareable via unique URLMultiple Search Providers
| Provider | Type | Cost | Setup |
|---|---|---|---|
| SearXNG | Self-hosted | Free | Docker container |
| Tavily | API | Freemium | API key |
| Brave | API | Freemium | API key |
| Exa | API | Paid | API key |
SearXNG is recommended for self-hosting — free, no rate limits, 70+ search engines.
Multiple LLM Providers
Switch models on the fly with the built-in model selector:
| Provider | Models | Setup |
|---|---|---|
| OpenAI | GPT-4o, GPT-4o-mini | API key |
| Anthropic | Claude Sonnet, Claude Haiku | API key |
| Gemini Pro, Gemini Flash | API key | |
| Ollama | Llama 3, Mistral, Qwen | Local install |
| Vercel Gateway | Routes to cheapest/fastest | Vercel config |
Generative UI
Morphic renders rich, interactive answer pages:
- Cited text — Inline numbered citations linking to sources
- Source cards — Thumbnails and metadata for each referenced page
- Follow-up suggestions — AI-generated related questions
- Image results — Relevant images from search
- Code blocks — Syntax-highlighted code in answers
- Math rendering — LaTeX formulas displayed correctly
Chat History & Sharing
PostgreSQL stores:
├─ User sessions
├─ Search queries
├─ Generated answers
├─ Source citations
└─ Shareable URLs (e.g., /search/abc123)Self-Hosting with SearXNG
The most cost-effective setup — completely free:
# docker-compose.yaml (included in repo)
services:
morphic:
build: .
ports: ["3000:3000"]
environment:
- SEARXNG_API_URL=http://searxng:8080
- OPENAI_API_KEY=${OPENAI_API_KEY}
- DATABASE_URL=postgresql://postgres:password@db:5432/morphic
searxng:
image: searxng/searxng
ports: ["8080:8080"]
db:
image: postgres:16-alpine
environment:
- POSTGRES_DB=morphic
- POSTGRES_PASSWORD=password
redis:
image: redis:alpineFAQ
Q: What is Morphic? A: Morphic is an open-source AI answer engine with 8,700+ GitHub stars — a self-hostable Perplexity alternative built with Next.js, supporting multiple LLM providers and search backends with a generative UI.
Q: How much does it cost to run Morphic? A: Infrastructure is free (Docker + SearXNG). You only pay for LLM API calls (~$0.01-0.05 per query with GPT-4o-mini). Use Ollama for completely free local inference.
Q: Is Morphic free? A: Yes, open-source under Apache-2.0. Self-host for free. Only LLM API costs apply (or use Ollama for free local models).