---
name: bijection-database-chat
description: "Evaluate and integrate the Database Chat component with Bijection."
---

# Database Chat

A Bijection component for adding natural language database queries to your app.

- Package: @bijectionhq/database-chat
- Category: AI & Agents
- Status: Reference
- License: MIT
- Bijection source (repository access required): https://github.com/bijectionhq/database-chat/tree/70255b5f1c89fed608dac4be344e0b1f170ad8bb
- Upstream: https://github.com/dayhaysoos/convex-database-chat/tree/627dc0cf8be0ec73ea6d85804e3f83c3c40c77aa
- Documentation: https://docs.bijection.com/components/using
- Directory: https://bijection.com/components/database-chat

## Get the source

Bijection repository access is required. Request access at https://bijection.com/contact.

```sh
git clone https://github.com/bijectionhq/database-chat.git
cd database-chat
git checkout 70255b5f1c89fed608dac4be344e0b1f170ad8bb
```

## Before using this component

Read the package README at the recorded revision for setup, dependencies, and API examples. Upstream documentation describes the original package and may differ from the Bijection adaptation. This is a source candidate for evaluation. Catalog inclusion does not establish npm availability or runtime qualification. Check compatibility with your SDK and deployment before adoption. External providers run their own compute.

## Integration workflow

1. Read the source README and package manifest at the recorded revision.
2. Confirm the required SDK, dependency availability, and runtime compatibility.
3. Follow the component's documented setup and configuration. Never invent an npm install command from a catalog package name.
4. Keep credentials in the project's existing secret store.
5. Follow the project's execution rules for verification and report what was actually checked.

## Original upstream skill

The following guidance describes @dayhaysoos/convex-database-chat. Its installation commands and APIs refer to the upstream package. Evaluate compatibility with the Bijection source separately.


> Agents: read this skill fully before writing code that uses DatabaseChat. Follow the installation and configuration steps exactly.

# DatabaseChat

## Instructions

DatabaseChat is a Convex component that lets users query your database using natural language. It provides conversation storage, efficient delta-based streaming, and tool calling capabilities that allow an LLM to execute your Convex queries based on user questions. You define query tools, implement the corresponding Convex functions, and the component handles the chat flow and streaming responses.

### Installation

```bash
npm install @dayhaysoos/convex-database-chat
```

Current npm version: `@dayhaysoos/convex-database-chat@0.5.0`

## Use cases

- **Customer support dashboards** - Let support agents ask "show me all pending orders from last week" instead of writing database queries
- **Business intelligence tools** - Enable stakeholders to explore data with questions like "what's our revenue breakdown by category this month"
- **Admin panels** - Allow non-technical team members to query user data, product inventory, or analytics without SQL knowledge
- **Data exploration interfaces** - Build internal tools where analysts can ask ad-hoc questions about your application data
- **Self-service reporting** - Create customer-facing interfaces where users can query their own account data or usage statistics

## How it works

You define tools that describe what database operations the LLM can perform, specifying parameters using JSON Schema and mapping them to Convex query functions. The component uses OpenRouter's API to process natural language requests and determine which tools to call with what arguments.

The component stores conversations in `conversations` and `messages` tables, and implements delta-based streaming for efficient real-time updates. Instead of sending full accumulated responses on each update, it streams only new content deltas and provides `useMessagesWithStreaming` and other React hooks for the client.

You integrate it by calling `components.databaseChat.chat.send` from your actions, passing the tools array and system prompt. The component handles tool execution, response generation, and stream management. You can abort streams mid-generation and the component provides queries like `getStreamState` and `getStreamDeltas` for building responsive chat UIs.

## When NOT to use

- When a simpler built-in solution exists for your specific use case
- If you are not using Convex as your backend
- When the functionality provided by DatabaseChat is not needed

## Resources

- [npm package](https://www.npmjs.com/package/%40dayhaysoos%2Fconvex-database-chat)
- [GitHub repository](https://github.com/dayhaysoos/convex-database-chat)
- [Live demo](https://convex-database-chat-production.up.railway.app/)
- [Convex Components Directory](https://www.convex.dev/components/dayhaysoos/convex-database-chat)
- [Convex documentation](https://docs.convex.dev)