Chat
Authorization-aware human chat primitives for Bijection applications.
git clone https://github.com/bijectionhq/chat.git
cd chat
git checkout 1d1ab29c707d2fa1bf124afa2c78682941c3c6b7
cd packages/convex-chatBijection repository access is required. Request access.
Description
Authorization-aware human chat primitives for Bijection applications.
Explore the package README for API concepts, configuration, and examples. Check the Bijection source for adaptation-specific setup.
Review the source and its dependencies before adopting this package. Source availability does not establish npm publication or runtime qualification.
Getting started
- Get the source at the revision above and read its package documentation.
- Check the required Bijection SDK version, dependencies, and external service credentials.
- Follow the package setup instructions and the guide to using components.
- Exercise the component in your deployment according to your project’s verification rules.
Open source
Maintained source: bijectionhq/chat. Based on dciccale/convex-chat. License: Apache-2.0. Consult the repository for license terms, notices, and contributor attribution.
From the upstream publisher
Authorization-aware human chat primitives for Convex applications.
Explore the demo ↗Upstream package FAQ
Does convex-chat handle authentication or decide who can start a conversation?
No. convex-chat never decides whether two users are allowed to start a chat. The host application authenticates callers, enforces relationship and policy rules, and creates the conversation. convex-chat then enforces membership and chat invariants for every subsequent operation. Host table IDs cross the component boundary as opaque strings, so the component has no knowledge of your user model.
What version of convex-chat should I install?
Install convex-chat@next from npm. The latest tag currently points to a 0.0.1 name-reservation placeholder and does not include the implemented component. The project is in early alpha and its API and data model may change before the first stable release.
How do I register convex-chat in a Convex application?
Import the component config and register it in your convex/convex.config.ts file using app.use(chat), where chat is the default export from convex-chat/convex.config.js. Then expose host mutations and queries that authenticate the caller, derive their scopeId and subjectId, and delegate to the generated component API or the exposeChatApi wrappers.
Does convex-chat support message replies and edits?
Yes. convex-chat supports replies with deletion-safe quote snapshots, meaning the quoted content is captured at reply time and survives deletion of the original message. It also supports revision-safe edits and delete-for-everyone tombstones, so clients always receive a consistent view of message state.
Can convex-chat be used with Next.js?
The repository includes a runnable Next.js example application under apps/example that demonstrates direct messaging, presence, reactions, and Cloudflare R2 attachments. The example uses a deliberately insecure identity switcher for demo purposes and documents how to deploy to Vercel using a monorepo build configuration with a Convex deploy key.
Use with agents and CLI
Give your coding agent the component’s source identity and setup guidance.
Help me integrate Chat with Bijection.
Read: https://bijection.com/components/chat/SKILL.md
Check SDK compatibility and dependency availability.
Follow this project's execution and verification rules.Upstream README.md
View repository ↗Documentation from dciccale/convex-chat, recorded October 23, 2026. APIs and setup may differ in the Bijection adaptation.
convex-chat
Authorization-aware chat primitives for Convex.
convex-chat is an independent Convex component for direct and small-group
human messaging. It owns the durable chat invariants—membership, ordering,
idempotency, unread state, message lifecycle, and presence—while your
application remains responsible for authentication, relationships, and product
policy.
[!WARNING] This project is on the
0.1.0-rc.2release candidate. Its API and data model may change before the first stable release. Install the candidate from npm withconvex-chat@next; thelatesttag still points to the0.0.1name-reservation placeholder.
Features
- Direct and group conversations with application-defined external keys
- Chat-local membership checks on every actor operation
- Revision-safe projection of host-managed membership access
- Ordered, idempotent sends with per-conversation sequence numbers
- Realtime history, conversation summaries, and exact unread counts
- Replies with deletion-safe quote snapshots
- Revision-safe edits and delete-for-everyone tombstones
- Allowlisted reactions
- Online presence and typing indicators
- Provider-neutral attachment descriptors with a direct Cloudflare R2 example
- Next.js and Expo/React Native examples with a deliberately fake identity switcher
How it fits together
Your client
│
▼
Your public Convex functions ── authenticate and derive the actor
│
▼
convex-chat component ── enforce membership and chat invariants
│
└── host-managed storage for attachment bytes
The component never decides whether two people are allowed to start a chat. Your host application makes that product decision, creates the conversation, and exposes only actor-scoped functions to clients. Host table IDs cross the component boundary as opaque strings.
Workspace
| Path | Purpose |
|---|---|
packages/convex-chat | Publishable Convex component and host helpers |
packages/example-backend | Shared private Convex backend for both examples |
apps/example | Runnable Next.js browser example |
apps/example-native | Runnable Expo and React Native mobile example |
apps/web | Marketing website and Fumadocs documentation |
Run the example
You need Node.js 20 or newer, pnpm 10, and a Convex account for a development deployment.
pnpm install
pnpm --filter convex-chat build:codegen
pnpm convex:dev
Keep the Convex process running. After the first CLI setup, copy its public
CONVEX_URL value into the two ignored frontend environment files:
# apps/example/.env.local
NEXT_PUBLIC_CONVEX_URL=https://your-development-deployment.convex.cloud
# apps/example-native/.env.local
EXPO_PUBLIC_CONVEX_URL=https://your-development-deployment.convex.cloud
Then start the browser frontend in another terminal:
pnpm dev:example
Open http://localhost:3001. On first use, the Convex
CLI asks you to select or create a project and writes deployment settings to
the ignored packages/example-backend/.env.local file.
To run the native client, start Metro in another terminal and scan its QR code with Expo Go:
pnpm dev:example-native
The phone and development machine should normally share a network. If LAN
discovery is blocked, use
pnpm --filter @convex-chat/example-native start --tunnel. Select different
demo identities in the browser and phone to test realtime chat through the
same Convex deployment. Text, images, audio playback, and press-and-hold voice
recording work in Expo Go; no custom native build is required for this example.
The marketing and documentation site runs separately on http://localhost:3000:
pnpm dev:web
The example lets you switch between Alice, Bob, and Charlie in the browser.
That is intentionally insecure demo plumbing; never accept scopeId or
subjectId from an untrusted client in a real application.
Add the component to an application
Install convex-chat@next and register it in convex/convex.config.ts:
import chat from "convex-chat/convex.config.js";
import { defineApp } from "convex/server";
const app = defineApp();
app.use(chat);
export default app;
Then expose host functions that authenticate the caller and derive their
application scope and subject IDs. exposeChatApi provides a small set of
actor-scoped wrappers; applications can also write their own wrappers around
the generated component API.
Conversation creation should stay in host-controlled mutations, after your
application has checked its own relationship and policy rules. See
packages/example-backend/convex/chat.ts
for a compact integration example and
packages/convex-chat/README.md
for package-specific setup.
Attachments
The component stores attachment descriptors, not binary data or provider
credentials. The host application authorizes uploads, resolves download URLs,
and deletes objects. The example integrates @convex-dev/r2 directly while
keeping its upload grants and conversation authorization in host functions.
See apps/web/content/docs/guides/attachments.md for the security model and R2
setup.
Presence
The component composes @convex-dev/presence for ephemeral online and typing
state. Conversation membership is checked before presence operations, and
applications may omit the host wrappers when presence is disabled by product
policy.
See apps/web/content/docs/guides/presence.md for lifecycle, API, and privacy
details.
Deploy the example
For Vercel Git integration, use apps/example as the project root and set a Convex
deploy key as CONVEX_DEPLOY_KEY. Use separate production and preview keys;
never reuse a production deploy key for previews. apps/example/vercel.json
contains the workspace-aware build command.
Project status
The 0.1.0-rc.2 candidate covers the features listed above. The maintained roadmap
distinguishes supported behavior from modeled groundwork and future work.
The original v0.1 design proposal and roadmap is in
apps/web/content/docs/reference/convex-chat-v0.1-prd.md. Changes since the
last release are tracked in CHANGELOG.md.
The current feature boundary and prioritized roadmap are documented in
apps/web/content/docs/reference/roadmap.mdx.
The release-candidate evidence and criteria for publishing 0.1.0 are tracked in the
release-readiness checklist.
Upgrade and schema rollout practices are documented in
UPGRADING.md.
The frozen 0.1 behavior and package boundary are documented in the
supported contract.
Development
pnpm install
pnpm format:check
pnpm test
pnpm typecheck
pnpm build
pnpm --filter convex-chat pack --pack-destination /tmp
Contributions are welcome. Please read CONTRIBUTING.md and
our CODE_OF_CONDUCT.md before opening a pull request.
Report security issues privately as described in SECURITY.md.
Maintainer releases follow RELEASING.md.
License
Licensed under the Apache License 2.0.