An AI-powered search engine with a generative UI.
[!CAUTION] Morphic is built with Vercel AI SDK RSC. AI SDK RSC is experimental and has some limitations. When using it in production, it is recommended to migrate to SDK UI.
[!NOTE] Please note that there are differences between this repository and the official website morphic.sh. The official website is a fork of this repository with additional features such as authentication, which are necessary for providing the service online. The core source code of Morphic resides in this repository, and it's designed to be easily built and deployed.
Fork the repo to your Github account, then run the following command to clone the repo:
git clone git@github.com:[YOUR_GITHUB_ACCOUNT]/morphic.git
cd morphicbun install
Follow the guide below to set up Upstash Redis. Create a database and obtain UPSTASH_REDIS_REST_URL
and UPSTASH_REDIS_REST_TOKEN
. Refer to the Upstash guide for instructions on how to proceed.
If you intend to use a local Redis, you can skip this step.
cp .env.local.example .env.local
Your .env.local file should look like this:
# OpenAI API key retrieved here: https://platform.openai.com/api-keysOPENAI_API_KEY=# Tavily API Key retrieved here: https://app.tavily.com/homeTAVILY_API_KEY=# Upstash Redis URL and Token retrieved here: https://console.upstash.com/redisUPSTASH_REDIS_REST_URL=UPSTASH_REDIS_REST_TOKEN=## Redis ConfigurationThis application supports both Upstash Redis and local Redis. To use local Redis:1. Set `USE_LOCAL_REDIS=true` in your `.env.local` file.2. Optionally, set `LOCAL_REDIS_URL` if your local Redis is not running on the default `localhost:6379` or `redis://redis:6379` if you're using docker compose.To use Upstash Redis:1. Set `USE_LOCAL_REDIS=false` or leave it unset in your `.env.local` file.2. Set `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` with your Upstash credentials.# SearXNG ConfigurationSEARXNG_API_URL=http://localhost:8080 # Replace with your local SearXNG API URL or docker http://searxng:8080SEARCH_API=tavily # use searxng, tavily or exaSEARXNG_SECRET="" # generate a secret key e.g. openssl rand -base64 32SEARXNG_PORT=8080 # default portSEARXNG_BIND_ADDRESS=0.0.0.0 # default addressSEARXNG_IMAGE_PROXY=true # enable image proxySEARXNG_LIMITER=false # can be enabled to limit the number of requests per IP addressSEARXNG_DEFAULT_DEPTH=basic # Set to 'basic' or 'advanced', only affects SearXNG searchesSEARXNG_MAX_RESULTS=50 # Maximum number of results to return from SearXNG
To run the application locally using Bun, execute the following command:
bun dev
You can now visit http://localhost:3000 in your web browser.
Using DockerTo run the application using Docker, use the following command:
docker compose up -d
This will start the application in detached mode. You can access it at http://localhost:3000.
Host your own live version of Morphic with Vercel or Cloudflare Pages.
If you want to use Morphic as a search engine in your browser, follow these steps:
https://morphic.sh/search?q=%s
This will allow you to use Morphic as your default search engine in the browser.
Morphic now supports SearXNG as an alternative search backend with advanced search capabilities. To use SearXNG:
Ensure you have Docker and Docker Compose installed on your system.
In your .env.local
file, set the following variables:
Two configuration files are provided in the root directory:
searxng-settings.yml
: This file contains the main configuration for SearXNG, including engine settings and server options.searxng-limiter.toml
: This file configures the rate limiting and bot detection features of SearXNG.Run docker-compose up
to start the Morphic stack with SearXNG included.
SearXNG will be available at http://localhost:8080
and Morphic will use it as the search backend.
NEXT_PUBLIC_BASE_URL
: Set this to your local development URL (http://localhost:3000) or your production URL when deploying.SEARXNG_DEFAULT_DEPTH
: Set to 'basic' or 'advanced' to control the default search depth.SEARXNG_MAX_RESULTS
: Maximum number of results to return from SearXNG.SEARXNG_CRAWL_MULTIPLIER
: In advanced search mode, this multiplier determines how many results to crawl. For example, if SEARXNG_MAX_RESULTS=10
and SEARXNG_CRAWL_MULTIPLIER=4
, up to 40 results will be crawled before filtering and ranking.SEARXNG_ENGINES
: Comma-separated list of search engines to use.SEARXNG_TIME_RANGE
: Time range for search results (e.g., 'day', 'week', 'month', 'year', 'all').SEARXNG_SAFESEARCH
: Safe search setting (0 for off, 1 for moderate, 2 for strict).The advanced search feature includes content crawling, relevance scoring, and filtering to provide more accurate and comprehensive results.
Customizing SearXNGsearxng-settings.yml
to enable/disable specific search engines, change UI settings, or adjust server options.searxng-limiter.toml
file allows you to configure rate limiting and bot detection. This is useful if you're exposing SearXNG directly to the internet.docker-compose.yml
file or directly in the SearXNG container.searxng-settings.yml
:
engines:- name: wikidatadisabled: true
An AI-powered search engine with a generative UI.
[!CAUTION] Morphic is built with Vercel AI SDK RSC. AI SDK RSC is experimental and has some limitations. When using it in production, it is recommended to migrate to SDK UI.
[!NOTE] Please note that there are differences between this repository and the official website morphic.sh. The official website is a fork of this repository with additional features such as authentication, which are necessary for providing the service online. The core source code of Morphic resides in this repository, and it's designed to be easily built and deployed.
Fork the repo to your Github account, then run the following command to clone the repo:
git clone git@github.com:[YOUR_GITHUB_ACCOUNT]/morphic.git
cd morphicbun install
Follow the guide below to set up Upstash Redis. Create a database and obtain UPSTASH_REDIS_REST_URL
and UPSTASH_REDIS_REST_TOKEN
. Refer to the Upstash guide for instructions on how to proceed.
If you intend to use a local Redis, you can skip this step.
cp .env.local.example .env.local
Your .env.local file should look like this:
# OpenAI API key retrieved here: https://platform.openai.com/api-keysOPENAI_API_KEY=# Tavily API Key retrieved here: https://app.tavily.com/homeTAVILY_API_KEY=# Upstash Redis URL and Token retrieved here: https://console.upstash.com/redisUPSTASH_REDIS_REST_URL=UPSTASH_REDIS_REST_TOKEN=## Redis ConfigurationThis application supports both Upstash Redis and local Redis. To use local Redis:1. Set `USE_LOCAL_REDIS=true` in your `.env.local` file.2. Optionally, set `LOCAL_REDIS_URL` if your local Redis is not running on the default `localhost:6379` or `redis://redis:6379` if you're using docker compose.To use Upstash Redis:1. Set `USE_LOCAL_REDIS=false` or leave it unset in your `.env.local` file.2. Set `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN` with your Upstash credentials.# SearXNG ConfigurationSEARXNG_API_URL=http://localhost:8080 # Replace with your local SearXNG API URL or docker http://searxng:8080SEARCH_API=tavily # use searxng, tavily or exaSEARXNG_SECRET="" # generate a secret key e.g. openssl rand -base64 32SEARXNG_PORT=8080 # default portSEARXNG_BIND_ADDRESS=0.0.0.0 # default addressSEARXNG_IMAGE_PROXY=true # enable image proxySEARXNG_LIMITER=false # can be enabled to limit the number of requests per IP addressSEARXNG_DEFAULT_DEPTH=basic # Set to 'basic' or 'advanced', only affects SearXNG searchesSEARXNG_MAX_RESULTS=50 # Maximum number of results to return from SearXNG
To run the application locally using Bun, execute the following command:
bun dev
You can now visit http://localhost:3000 in your web browser.
Using DockerTo run the application using Docker, use the following command:
docker compose up -d
This will start the application in detached mode. You can access it at http://localhost:3000.
Host your own live version of Morphic with Vercel or Cloudflare Pages.
If you want to use Morphic as a search engine in your browser, follow these steps:
https://morphic.sh/search?q=%s
This will allow you to use Morphic as your default search engine in the browser.
Morphic now supports SearXNG as an alternative search backend with advanced search capabilities. To use SearXNG:
Ensure you have Docker and Docker Compose installed on your system.
In your .env.local
file, set the following variables:
Two configuration files are provided in the root directory:
searxng-settings.yml
: This file contains the main configuration for SearXNG, including engine settings and server options.searxng-limiter.toml
: This file configures the rate limiting and bot detection features of SearXNG.Run docker-compose up
to start the Morphic stack with SearXNG included.
SearXNG will be available at http://localhost:8080
and Morphic will use it as the search backend.
NEXT_PUBLIC_BASE_URL
: Set this to your local development URL (http://localhost:3000) or your production URL when deploying.SEARXNG_DEFAULT_DEPTH
: Set to 'basic' or 'advanced' to control the default search depth.SEARXNG_MAX_RESULTS
: Maximum number of results to return from SearXNG.SEARXNG_CRAWL_MULTIPLIER
: In advanced search mode, this multiplier determines how many results to crawl. For example, if SEARXNG_MAX_RESULTS=10
and SEARXNG_CRAWL_MULTIPLIER=4
, up to 40 results will be crawled before filtering and ranking.SEARXNG_ENGINES
: Comma-separated list of search engines to use.SEARXNG_TIME_RANGE
: Time range for search results (e.g., 'day', 'week', 'month', 'year', 'all').SEARXNG_SAFESEARCH
: Safe search setting (0 for off, 1 for moderate, 2 for strict).The advanced search feature includes content crawling, relevance scoring, and filtering to provide more accurate and comprehensive results.
Customizing SearXNGsearxng-settings.yml
to enable/disable specific search engines, change UI settings, or adjust server options.searxng-limiter.toml
file allows you to configure rate limiting and bot detection. This is useful if you're exposing SearXNG directly to the internet.docker-compose.yml
file or directly in the SearXNG container.searxng-settings.yml
:
engines:- name: wikidatadisabled: true