JS
Embed & Developer

JavaScript SDK

Framework-agnostic SDK for any JavaScript environment

What is JavaScript SDK?

The @beforequery/sdk package is the core BeforeQuery client library. It works in any JavaScript environment: browser, Node.js, React Native, Deno, and edge runtimes. The React package is built on top of this SDK. Use it directly when you need maximum control or when your stack is not React-based.

Integration

How BeforeQuery works with JavaScript SDK

Everything you can do once the integration is connected.

Universal environment support

Works in browser, Node.js, React Native, and edge runtimes (Cloudflare Workers, Deno Deploy, Vercel Edge). One package, all environments.

Search and Chat APIs

The SDK wraps BeforeQuery's search (hybrid vector + full-text) and chat (SSE streaming RAG) endpoints with a clean, typed API.

Public and server-side auth

Use public client keys (bq_pk_...) for browser-side code and client ID + secret (bq_ci_... / bq_cs_...) for server-side integrations.

Streaming response support

The SDK handles SSE stream parsing and provides an async iterator for streaming chat responses in any JavaScript environment.

Setup

How to set it up

1

Install: npm install @beforequery/sdk

2

Initialize the client with your client key: const bq = new BeforeQueryClient({ clientKey: 'bq_pk_...' })

3

Call bq.chat() for streaming RAG answers or bq.search() for hybrid search results.

Ready to connect JavaScript SDK?

Start free. No credit card required. Connect your first integration in under 5 minutes.