# Morphic: a self-hostable AI search engine with a generative UI

> Morphic is an Apache-2.0 Next.js application that answers questions with cited sources and renders streamed JSON into inline components. It runs from a single docker compose up, and the repository was still receiving pushes in September 2026.

**miurla/morphic** — An AI-powered search engine with a generative UI

- Repository: https://github.com/miurla/morphic
- Website: https://chat.morphic.sh
- Stars: 9,152 · Forks: 2,348
- Language: TypeScript
- License: Apache-2.0
- Published: 2026-09-10 · Updated: 2026-09-10 · Language: en
- Canonical page: https://hysenlabs.com/projects/miurla-morphic

## The problem Morphic solves, and who ends up running it

A chat model with no retrieval layer will answer from its training data and sound equally confident when it is wrong. Morphic wraps a search step around the model call and returns answers with citations, so the reader can check the source. The README describes the result as "AI-powered search with grounded, cited answers."

The second problem is presentation. Most answer interfaces stream markdown and stop there. Morphic streams a JSON specification that the front end renders into components: source-credited images, grids, headings. The README calls this a generative UI and frames it as going "beyond plain markdown." That is the part of the project with the least prior art and the most code behind it.

The audience is developers and small teams who want that interface without building retrieval, streaming, persistence and auth from scratch. Morphic is a Next.js application, not a library you import, so the realistic adoption path is running it or forking it. Teams that only want an answer API and already have a front end will find most of the repository irrelevant to them.

## How a query becomes a cited answer with rendered components

The request path is a Next.js route that calls the Vercel AI SDK, which is why the dependency list carries @ai-sdk/openai, @ai-sdk/anthropic, @ai-sdk/google, @ai-sdk/gateway and @ai-sdk/openai-compatible. Model choice is resolved at runtime by a selector that the README says performs "dynamic provider detection," so the same deployment can serve OpenAI, Anthropic, Google, Ollama or any OpenAI-compatible endpoint depending on which keys are present.

Search is a separate swappable layer. The README lists Tavily, SearXNG, Brave and Exa as providers, and the compose file selects one with the SEARCH_API variable, defaulting to searxng. That default matters: SearXNG is a metasearch engine included in the stack, so a fresh local install needs no paid search key.

The generative UI runs on @json-render/core and @json-render/react. The model emits a JSON spec during streaming and the React side maps it to components. This is the design decision that shapes everything else: because the answer is a spec rather than a string, new component types are a front-end concern, and a malformed spec is a rendering failure rather than a text glitch.

Persistence is split. PostgreSQL holds chat history through Drizzle, with migrations in the drizzle directory and a migrate script in package.json. Redis, referenced as LOCAL_REDIS_URL, handles the faster-moving state. Observability is wired through Langfuse and OpenTelemetry packages, which is unusual for a project at this stage and useful if you plan to run it for other people.

## Installing Morphic with Docker and running a first search

The README calls Docker the recommended path and gives a pull command for the published image before any cloning. Clone the repository first, since the compose file expects to sit next to it, then copy the environment template.

```bash
git clone https://github.com/miurla/morphic.git
cd morphic
cp .env.local.example .env.local
```

Open .env.local and set at least one provider key. The README's minimal example is OpenAI. Provider keys are the only mandatory configuration for a local run.

```bash
OPENAI_API_KEY=your_openai_key
```

Start the stack. According to the README, Docker Compose brings up PostgreSQL, Redis, SearXNG and Morphic together, so there is no second terminal and no separate database install.

```bash
docker compose up -d
```

The compose file maps port 3000 on the host to port 3000 in the container and overrides DATABASE_URL to point at the postgres service with SSL disabled, which is why a cloud database string in .env.local will not be used. It also sets ENABLE_AUTH to false by default, described in the file as intended for personal Docker use.

Visit http://localhost:3000 and pick a model in the model selector. If the selector is empty, the provider key was not read, and the container logs will show the failed call rather than a UI error.

For local development instead of containers, the README uses Bun: bun install, then bun dev, with TAVILY_API_KEY added alongside the provider key if you want Tavily rather than the bundled SearXNG.

## Where Morphic breaks, and when it is the wrong tool

The generative UI is the feature most likely to fail in front of a user. A streamed JSON spec has to arrive well-formed enough to render. The README does not document a fallback path for a spec the renderer cannot map, so a bad generation is a broken answer area rather than degraded text. If your users need a guaranteed readable response under every condition, a plain markdown stream is the safer interface.

Model selection is a runtime lookup, not a build-time one. The README describes dynamic provider detection, which means a missing or malformed key produces an empty or wrong selector rather than a startup failure. That is convenient for a personal instance and awkward for an operator who wants misconfiguration to be loud.

The compose defaults are tuned for a single user. ENABLE_AUTH defaults to false and ANONYMOUS_USER_ID defaults to docker-anonymous, so the stack as shipped has no login gate. Anyone who reaches port 3000 shares one identity. Turning auth on is a configuration change, and the README points to CONFIGURATION.md rather than describing the consequences of the switch.

Finally, the deployment assumption is Vercel. The README's deploy section is a Vercel button, and the Docker path exists but the docs do not describe what changes at scale: no horizontal scaling notes, no guidance on running the migration step across multiple instances. The Dockerfile does run an entrypoint script for migrations, which is the right instinct, but concurrent starts are not addressed in the documentation.

## Perplexity, Open WebUI and the difference in approach

Perplexity is the closest thing to a direct comparison in behaviour: ask a question, get a synthesised answer with numbered sources. The difference is ownership. Perplexity is a hosted product; Morphic is a repository you run, which means your queries go to whichever model provider you configure and your history stays in your own Postgres. That also means you own the outages, the migrations and the provider billing.

Open WebUI is the more instructive comparison, because both are self-hosted. The difference in approach is the interface model. Open WebUI presents a chat client that can be pointed at local models through Ollama. Morphic presents a search product: the search step is a first-class configurable layer with four documented providers, and the output is a rendered component tree rather than a message list. If your goal is a private chat front end, Morphic carries search infrastructure you will not use. If your goal is cited research answers, that infrastructure is the point.

A third option is building it yourself on the Vercel AI SDK, which Morphic already depends on. That is a real path for a team with one specific interface in mind, and it avoids inheriting a Next.js application's upgrade cycle. It costs you the retrieval plumbing, the persistence schema and the renderer.

## Maintenance, upgrades and the Apache-2.0 terms

The repository is not archived and the last push was on 2026-09-10. Releases are infrequent but real: v1.4.0 on 2026-05-24, v1.5.0 on 2026-06-10, v1.6.0 on 2026-08-17. The gaps between them are roughly one to three months, so an operator should expect to review changes on that rhythm rather than continuously.

The upgrade cost is dominated by the database, not the application code. Drizzle migrations live in the drizzle directory, and the Dockerfile copies drizzle, lib/db and drizzle.config.ts into the runtime image and runs docker-entrypoint.sh as the entrypoint. That means a container start can apply schema changes. The package.json migrate script runs lib/db/migrate.ts for the non-Docker path. Neither the README nor the Dockerfile describes a rollback procedure, so the practical answer is to take a Postgres backup before pulling a new image.

The version coupling is the other cost. package.json pins @aws-sdk/client-s3 and @aws-sdk/s3-request-presigner at exactly 3.859.0 while most other dependencies use caret ranges, and it lists Next.js 16 compatibility as a Dockerfile concern. Upgrading Morphic means moving the Next.js, AI SDK and Drizzle versions together; there is no documented compatibility matrix.

The licence is Apache-2.0, stated in the README and in the package.json license field. That permits commercial use and modification with the usual obligations around notices and changed files. It is not legal advice, and if you redistribute a modified Morphic you should read the LICENSE file itself rather than this summary.

## Conclusion

Adopt Morphic if you want a search-and-answer front end you can run on your own hardware, with your own model keys and SearXNG bundled so no paid search API is required. Do not adopt it if you need a supported product with a published upgrade path or a committed API surface; the README documents features and setup, not deprecation policy. Before committing, verify three things: that your chosen provider is reachable from the container network, that DATABASE_URL points at the Postgres service rather than a cloud database, and that ENABLE_AUTH matches the deployment you intend, since the compose file defaults it to false.

## FAQ

### How do I use Morphic AI?

Run the Docker Compose stack, set at least one provider API key in .env.local, then open http://localhost:3000 and choose a model from the model selector. Search works without a paid search key because SearXNG is included in the stack.

### Is Morphic an AI?

Morphic is an application, not a model. It is described as an AI-powered search engine with a generative UI, and it calls external models from OpenAI, Anthropic, Google, Ollama or any OpenAI-compatible provider that you configure.

### How much is Morphic?

The source is Apache-2.0 licensed and the README gives no pricing. Your cost is the infrastructure you run it on plus whatever the model provider you configure charges for API calls.

### What is the Morphic app?

It is a Next.js web application that answers questions with grounded, cited sources and renders the answer as generative UI components such as source-credited images, grids and headings. It stores chat history in PostgreSQL and supports sharing results at unique URLs.

## Sources

- [License: Apache-2.0](https://github.com/miurla/morphic/blob/main/LICENSE)
- [miurla/morphic on GitHub](https://github.com/miurla/morphic)
- [Project website](https://chat.morphic.sh)
- [README](https://github.com/miurla/morphic/blob/main/README.md)
- [Releases](https://github.com/miurla/morphic/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/miurla-morphic
