@clickhouse/client-web

中文文档
1.25.0发布于 2026/11/05Apache-2.0TypeScriptCommonJS零依赖构建来源已验证近 30 天下载 120.1万

Official JS client for ClickHouse DB - Web API implementation

原始使用文档
文档目录8 节
  1. Installation
  2. Environment requirements
  3. Compatibility with ClickHouse
  4. Quick start
  5. Documentation
  6. Changelog
  7. Contact us
  8. License

@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/client instead, 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 versionClickHouse
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.

License

Apache 2.0

版本与发布记录

@clickhouse/client-web 共发布 122 个版本,首次发布于 2023/07/27;过去 12 个月发布了 86 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.25.0latest2026/11/055 天前
1.25.0-head.a5b9c61.1head2026/11/045 天前
1.24.0-head.6a265d2.12026/10/091 个月前
1.24.02026/10/061 个月前
1.24.0-head.710aea5.12026/10/061 个月前
1.24.0-head.443b2f0.12026/07/163 个月前

其他发布通道:tracing_logging_command → 0.4.0,faster_exception_detection → 0.100.1,rc → 1.17.0,beta → 1.18.2,head → 1.25.0-head.a5b9c61.1。

关于 @clickhouse/client-web 的常见问题

@clickhouse/client-web 是什么?

Official JS client for ClickHouse DB - Web API implementation

如何安装 @clickhouse/client-web?

在项目目录运行 npm install @clickhouse/client-web,或使用 pnpm add / yarn add / bun add。

@clickhouse/client-web 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@clickhouse/client-web 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@clickhouse/client-web 可以商用吗?

@clickhouse/client-web 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@clickhouse/client-web 的下载量有多少?

根据 npm 官方下载统计,@clickhouse/client-web 在 2026/10/10 – 2026/11/08 这 30 天内被下载 1,200,507 次,日均约 40,017 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@clickhouse/client-web 还在维护吗?

最新版本 1.25.0 发布于 2026/11/05(5 天前);至今共发布 122 个版本,其中过去 12 个月发布了 86 个;首次发布于 2023/07/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。