https://github.com/miurla/morphic
An AI-powered search engine with a generative UI
https://github.com/miurla/morphic
deepseek-r1 generative-ai generative-ui nextjs ollama react redis searxng shadcn-ui tailwindcss tavily typescript upstash vercel-ai-sdk
Last synced: 28 days ago
JSON representation
An AI-powered search engine with a generative UI
- Host: GitHub
- URL: https://github.com/miurla/morphic
- Owner: miurla
- License: apache-2.0
- Created: 2024-04-05T13:55:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-01-31T06:57:14.000Z (about 1 month ago)
- Last Synced: 2026-01-31T19:39:52.604Z (about 1 month ago)
- Topics: deepseek-r1, generative-ai, generative-ui, nextjs, ollama, react, redis, searxng, shadcn-ui, tailwindcss, tavily, typescript, upstash, vercel-ai-sdk
- Language: TypeScript
- Homepage: https://morphic.sh
- Size: 7.88 MB
- Stars: 8,523
- Watchers: 60
- Forks: 2,320
- Open Issues: 53
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-llm-services - Morphic
- StarryDivineSky - miurla/morphic
- AiTreasureBox - miurla/morphic - 11-03_8315_0](https://img.shields.io/github/stars/miurla/morphic.svg)|An AI-powered answer engine with a generative UI| (Repos)
- jimsghstars - miurla/morphic - An AI-powered search engine with a generative UI (TypeScript)
- awesome - miurla/morphic - An AI-powered search engine with a generative UI (TypeScript)
- awesome - miurla/morphic - An AI-powered search engine with a generative UI (TypeScript)
- definitive-opensource - Morphic - powered search engine with a generative UI | `SelfHost` `Web (Cloud)` | **8.6k** | (Table of Contents / Search Engine)
README
# Morphic
An AI-powered search engine with a generative UI.
[](https://deepwiki.com/miurla/morphic) [](https://github.com/miurla/morphic/stargazers) [](https://github.com/miurla/morphic/network/members)

## 🗂️ Overview
- 🛠 [Features](#-features)
- 🧱 [Stack](#-stack)
- 🚀 [Quickstart](#-quickstart)
- 🌐 [Deploy](#-deploy)
- 👥 [Contributing](#-contributing)
- 📄 [License](#-license)
📝 Explore AI-generated documentation on [DeepWiki](https://deepwiki.com/miurla/morphic)
## 🛠 Features
### Core Features
- AI-powered search with GenerativeUI
- Natural language question understanding
- Multiple search providers support (Tavily, Brave, SearXNG, Exa)
- Search modes: Quick, Planning, and Adaptive
- Model type selection: Speed vs Quality
- Inspector panel for tool execution and AI processing details
### Authentication
- User authentication powered by [Supabase Auth](https://supabase.com/docs/guides/auth)
### Guest Mode
- Allow users to try the app without creating an account
- No chat history stored for guests (ephemeral sessions)
- Optional daily rate limit per IP address
- Enable with `ENABLE_GUEST_CHAT=true`
### Chat & History
- Chat history automatically stored in PostgreSQL database
- Share search results with unique URLs
- Message feedback system
- File upload support
### AI Providers
- OpenAI (Default)
- Anthropic Claude
- Google Gemini
- Vercel AI Gateway
- Ollama
Models are configured in `config/models/*.json` with profile-based settings. When using non-OpenAI providers, update the model configuration files with compatible model IDs. See [Configuration Guide](docs/CONFIGURATION.md) for details.
### Search Capabilities
- URL-specific search
- Content extraction with Tavily or Jina
- Citation tracking and display
- Self-hosted search with SearXNG support
### Additional Features
- Docker deployment ready
- Browser search engine integration
- LLM observability with Langfuse (optional)
- Todo tracking for complex tasks
## 🧱 Stack
### Core Framework
- [Next.js](https://nextjs.org/) - React framework with App Router
- [TypeScript](https://www.typescriptlang.org/) - Type-safe development
- [Vercel AI SDK](https://ai-sdk.dev) - TypeScript toolkit for building AI-powered applications
### Authentication & Authorization
- [Supabase](https://supabase.com/) - User authentication and backend services
### AI & Search
- [OpenAI](https://openai.com/) - Default AI provider (Optional: Google AI, Anthropic)
- [Tavily AI](https://tavily.com/) - AI-optimized search with context
- [Brave Search](https://brave.com/search/api/) - Traditional web search results
- Tavily alternatives:
- [SearXNG](https://docs.searxng.org/) - Self-hosted search
- [Exa](https://exa.ai/) - Meaning-based search powered by embeddings
- [Firecrawl](https://firecrawl.dev/) - Web, news, and image search with crawling, scraping, LLM-ready extraction, and [open source](https://github.com/firecrawl/firecrawl).
### Data Storage
- [PostgreSQL](https://www.postgresql.org/) - Primary database (supports Neon, Supabase, or standard PostgreSQL)
- [Drizzle ORM](https://orm.drizzle.team/) - Type-safe database ORM
- [Cloudflare R2](https://developers.cloudflare.com/r2/) - File storage (optional)
### UI & Styling
- [Tailwind CSS](https://tailwindcss.com/) - Utility-first CSS framework
- [shadcn/ui](https://ui.shadcn.com/) - Re-usable components
- [Radix UI](https://www.radix-ui.com/) - Unstyled, accessible components
- [Lucide Icons](https://lucide.dev/) - Beautiful & consistent icons
## 🚀 Quickstart
### 1. Fork and Clone repo
Fork the repo to your Github account, then run the following command to clone the repo:
```bash
git clone git@github.com:[YOUR_GITHUB_ACCOUNT]/morphic.git
```
### 2. Install dependencies
```bash
cd morphic
bun install
```
### 3. Configure environment variables
```bash
cp .env.local.example .env.local
```
Fill in the required environment variables in `.env.local`:
```bash
DATABASE_URL=your_database_url
OPENAI_API_KEY=your_openai_key
TAVILY_API_KEY=your_tavily_key
```
**Note**: Authentication is disabled by default (`ENABLE_AUTH=false`).
For optional features (alternative search providers, authentication, alternative AI providers, etc.), see [CONFIGURATION.md](./docs/CONFIGURATION.md)
### 4. Run database migrations
```bash
bun run migrate
```
This command will create the necessary database tables.
### 5. Run app locally
#### Using Bun
```bash
bun dev
```
#### Using Docker
1. Configure environment variables for Docker:
```bash
cp .env.local.example .env.local
```
Edit `.env.local` and set the required variables:
```bash
DATABASE_URL=postgresql://morphic:morphic@postgres:5432/morphic
OPENAI_API_KEY=your_openai_key
TAVILY_API_KEY=your_tavily_key
BRAVE_SEARCH_API_KEY=your_brave_key
```
**Note**: Authentication is disabled by default (`ENABLE_AUTH=false` in `.env.local.example`).
**Optional**: Customize PostgreSQL credentials by setting environment variables in `.env.local`:
```bash
POSTGRES_USER=morphic # Default: morphic
POSTGRES_PASSWORD=morphic # Default: morphic
POSTGRES_DB=morphic # Default: morphic
POSTGRES_PORT=5432 # Default: 5432
```
2. Start the Docker containers:
```bash
docker compose up -d
```
The application will:
- Start PostgreSQL 17 with health checks
- Start Redis for SearXNG search caching
- Wait for the database to be ready
- Run database migrations automatically
- Start the Morphic application
- Start SearXNG (optional search provider)
3. Visit http://localhost:3000 in your browser.
**Note**: Database data is persisted in a Docker volume. To reset the database, run:
```bash
docker compose down -v # This will delete all data
```
## 🌐 Deploy
Host your own live version of Morphic with Vercel or Docker.
### Vercel
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmiurla%2Fmorphic&env=DATABASE_URL,OPENAI_API_KEY,TAVILY_API_KEY,BRAVE_SEARCH_API_KEY)
**Note**: For Vercel deployments, set `ENABLE_AUTH=true` and configure Supabase authentication to secure your deployment.
### Docker
#### Using Prebuilt Image
Prebuilt Docker images are automatically built and published to GitHub Container Registry:
```bash
docker pull ghcr.io/miurla/morphic:latest
```
You can use it with docker-compose by setting the image in your `docker-compose.yaml`:
```yaml
services:
morphic:
image: ghcr.io/miurla/morphic:latest
env_file: .env.local
environment:
DATABASE_URL: postgresql://morphic:morphic@postgres:5432/morphic
DATABASE_SSL_DISABLED: 'true'
ENABLE_AUTH: 'false'
ports:
- '3000:3000'
depends_on:
- postgres
- redis
```
**Note**: The prebuilt image runs in **anonymous mode only** (`ENABLE_AUTH=false`). Supabase authentication cannot be enabled because `NEXT_PUBLIC_*` environment variables are embedded at build time by Next.js. To enable authentication or customize model configurations, you need to build from source — see [CONFIGURATION.md](./docs/CONFIGURATION.md) for details.
#### Building from Source
Or use Docker Compose for a complete setup with PostgreSQL, Redis, and SearXNG. See the [Using Docker](#using-docker) section under Quickstart for detailed instructions.
## 👥 Contributing
We welcome contributions to Morphic! Whether it's bug reports, feature requests, or pull requests, all contributions are appreciated.
Please see our [Contributing Guide](CONTRIBUTING.md) for details on:
- How to submit issues
- How to submit pull requests
- Commit message conventions
- Development setup
## 📄 License
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.