@clickhouse/client-common

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

DEPRECATED: this package is no longer used by @clickhouse/client or @clickhouse/client-web; the shared code is now bundled into each client package. Install @clickhouse/client (Node.js) or @clickhouse/client-web (Web) instead.

此软件包已被标记为弃用

Deprecated: import from @clickhouse/client or @clickhouse/client-web instead.

原始使用文档
文档目录13 节
  1. About
  2. Installation
  3. Environment requirements
  4. Node.js
  5. TypeScript
  6. Compatibility with ClickHouse
  7. Quick start
  8. Documentation
  9. Changelog
  10. AI Agent Skills
  11. Usage examples
  12. Contact us
  13. Contributing

ClickHouse JS client


NPM Version NPM Downloads

About

Official JS client for ClickHouse, written purely in TypeScript, thoroughly tested with actual ClickHouse versions.

The client has zero external dependencies and is optimized for maximum performance.

The repository consists of four packages:

  • @clickhouse/client - a version of the client designed for Node.js platform only. It is built on top of HTTP and Stream APIs; supports streaming for both selects and inserts.
  • @clickhouse/client-web - a version of the client built on top of Fetch and Web Streams APIs; supports streaming for selects. Compatible with Chrome/Firefox browsers and Cloudflare workers.
  • @clickhouse/client-common - shared common types and the base framework for building a custom client implementation.
  • @clickhouse/rowbinary - a library for reading (and soon writing) ClickHouse RowBinary format.

Installation

Node.js client:

npm i @clickhouse/client

Web client (browsers, Cloudflare workers):

npm i @clickhouse/client-web

Environment requirements

Node.js

Node.js must be available in the environment to run the Node.js client. The client is compatible with all the maintained Node.js releases.

Node.js versionSupported?
26.x✔
24.x✔
22.x✔
20.x✔

TypeScript

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"; // or '@clickhouse/client-web'

const client = createClient({
  url: process.env.CLICKHOUSE_URL ?? "http://localhost:8123",
  username: process.env.CLICKHOUSE_USER ?? "default",
  password: process.env.CLICKHOUSE_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

Each package keeps its own changelog:

History through @clickhouse/client 1.23.0 lives in the now-frozen repository-wide CHANGELOG.md.

AI Agent Skills

This repository contains agent skills for working with the client:

  • clickhouse-js-node-troubleshooting — troubleshooting playbook for the Node.js client.

Install via CLI:

# per project
npx skills add ClickHouse/clickhouse-js
# globally
npx skills add ClickHouse/clickhouse-js -g

Or ask your agent to install it for you:

install agent skills from ClickHouse/clickhouse-js

Usage examples

We have a wide range of examples, aiming to cover various scenarios of client usage. The overview is available in the examples README.

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.

Contributing

Check out our contributing guide.

If you'd like to build a client for an alternative runtime (such as Bun or Cloudflare Workers) or an alternative protocol (such as the native ClickHouse protocol or gRPC over a proxy), see Building specialized clients for alternative runtimes and protocols.

版本与发布记录

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

版本发布日期距今
1.23.0latest2026/06/304 个月前
1.23.0-head.dbc2960.1head2026/06/284 个月前
1.23.0-head.287977a.12026/06/284 个月前
1.23.0-head.fae5998.12026/06/254 个月前
1.23.0-head.b25cda1.12026/06/244 个月前
1.23.0-head.c8dc8d8.12026/06/234 个月前

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

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

@clickhouse/client-common 是什么?

DEPRECATED: this package is no longer used by @clickhouse/client or @clickhouse/client-web; the shared code is now bundled into each client package. Install @clickhouse/client (Node.js) or @clickhouse/client-web (Web) instead.注意:该包已被作者标记为弃用——Deprecated: import from @clickhouse/client or @clickhouse/client-web instead.

如何安装 @clickhouse/client-common?

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

@clickhouse/client-common 支持 TypeScript 吗?

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

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

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

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

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

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

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

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

最新版本 1.23.0 发布于 2026/06/30(4 个月前);至今共发布 113 个版本,其中过去 12 个月发布了 76 个;首次发布于 2023/07/20。作者已将其标记为弃用,新项目建议寻找替代方案。