chwire: A New Native-Format JavaScript Client for ClickHouse
chwire is an open-source JS client for ClickHouse that speaks the Native binary format over HTTP and TCP, offering much faster encoding and decoding than JSONEachRow.
chwire is a newly introduced JavaScript client for ClickHouse that communicates using the database's columnar Native binary protocol instead of the row-based JSONEachRow format. The developer built it after finding that gzip/deflate compression in the official ClickHouse JS client became a CPU bottleneck at scale, spending a year refining it for production use at HockeyStack.
The performance claims are notable: for 1M-row payloads, encoding runs roughly 2-6x faster than JSONEachRow and decoding 2-8x faster. Once compression is added, Native format almost always wins since smaller payloads are cheaper to compress. The client supports ZSTD/LZ4 compression in browsers over HTTP, and in Node/Bun/Deno over both HTTP and TCP.
On the technical side, chwire handles all ClickHouse types including nested container types like Variant, Dynamic, JSON, Nested, and Tuple at arbitrary depth. It's continuously round-tripped in CI against ClickHouse's own generateRandom/generateRandomStructure tools, backed by a separate fuzzing setup. The parser is synchronous and internally resumable, with an async wrapper that buffers blocks and pulls more data as needed. It also supports external tables, native query parameters, ProfileEvents, and other protocol packet types like logs and progress.
The author positions the codebase as a solid reference implementation that others could study—or even feed to an LLM—to build similar clients in other languages, making it useful both as a practical tool for engineers doing high-throughput ClickHouse ingestion and as a blueprint for native binary protocol implementations.