@clickhouse/client-web
Official Web client for ClickHouse, written purely in TypeScript and thoroughly tested against actual ClickHouse versions.
It is built on top of the Fetch and Web Streams APIs and supports streaming for selects. It is compatible with Chrome/Firefox browsers and Cloudflare Workers. The client has zero external dependencies and is optimized for maximum performance.
Running on Node.js? Use
@clickhouse/clientinstead, which additionally supports streaming for inserts.
Installation
npm i @clickhouse/client-web
Environment requirements
The client targets runtimes that provide the standard Fetch and Web Streams APIs, such as modern Chrome/Firefox browsers and Cloudflare Workers.
If using TypeScript, version 4.5 or above is required to enable inline import and export syntax.
Compatibility with ClickHouse
| Client version | ClickHouse |
|---|---|
| 1.12.0+ | 24.8+ |
The client may work with older versions too; however, this is best-effort support and is not guaranteed.
Quick start
import { createClient } from "@clickhouse/client-web";
const client = createClient({
url: "http://localhost:8123",
username: "default",
password: "",
});
const resultSet = await client.query({
query: "SELECT * FROM system.tables",
format: "JSONEachRow",
});
const tables = await resultSet.json();
console.log(tables);
await client.close();
See more examples in the examples directory.
Documentation
See the ClickHouse website for the full documentation.
Changelog
See CHANGELOG.md.
Contact us
If you have any questions or need help, feel free to reach out to us in the
Community Slack (#clickhouse-js channel) or
via GitHub issues.