{"id":50970070,"url":"https://github.com/bytadaniel/clickhouse-ts","last_synced_at":"2026-06-19T01:02:23.081Z","repository":{"id":61337802,"uuid":"548658687","full_name":"bytadaniel/clickhouse-ts","owner":"bytadaniel","description":"ClickHouse TypeScript client","archived":false,"fork":false,"pushed_at":"2024-12-06T11:36:51.000Z","size":235,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-28T13:23:05.907Z","etag":null,"topics":["clickhouse","client","database","ts"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytadaniel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-10-10T01:35:04.000Z","updated_at":"2025-07-14T17:55:10.000Z","dependencies_parsed_at":"2022-10-15T08:03:34.553Z","dependency_job_id":null,"html_url":"https://github.com/bytadaniel/clickhouse-ts","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/bytadaniel/clickhouse-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytadaniel%2Fclickhouse-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytadaniel%2Fclickhouse-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytadaniel%2Fclickhouse-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytadaniel%2Fclickhouse-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytadaniel","download_url":"https://codeload.github.com/bytadaniel/clickhouse-ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytadaniel%2Fclickhouse-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34513029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clickhouse","client","database","ts"],"created_at":"2026-06-19T01:02:22.306Z","updated_at":"2026-06-19T01:02:23.047Z","avatar_url":"https://github.com/bytadaniel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/clickhouse.svg\" width=\"200px\" align=\"center\"\u003e\n\u003ch2 align=\"center\"\u003eClickHouse TypeScript client by @bytadaniel\u003c/h2\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\n![Travis (.org)](https://img.shields.io/travis/bytadaniel/clickhouse-ts)\n![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/bytadaniel/clickhouse-ts)\n![npms.io (final)](https://img.shields.io/npms-io/final-score/clickhouse-ts)\n![GitHub issues](https://img.shields.io/github/issues/bytadaniel/clickhouse-ts)\n[![Join the chat at https://gitter.im/bytadaniel/clickhouse-ts](https://badges.gitter.im/bytadaniel/clickhouse-ts.svg)](https://gitter.im/bytadaniel/clickhouse-ts?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n![GitHub followers](https://img.shields.io/github/followers/bytadaniel?style=social)\n\n## Introduction\n### 💙 Typescript\nThis package is written in TypeScript because Node.js typing development is already an industry standard.\n### 🖐 Batch insert*\nIt has been empirically verified that in-memory collecting rows is the most efficient and consistent way to insert into Clickhouse. To work with built-in caching, you just need to call the useCaching() method\n### 💪 Transparent and Stability\nclickhouse-ts doesn't use a lot of abstractions and dependencies, so it's fast and stable.\n### 🏗 Ready for production\nThe Lookforsale team has been using clickhouse-ts effectively for over a year under extreme loads!\n### 👍 Batch validation\nDouble checking data for anomalies during in-memory caching and when inserting a finished batch.\n### ✨ Flexibility\nFlexible configuration of the Clickhouse client instance and support for all features provided by Clickhouse developers.\n### 🔐 Security\nSQL Injection Protection with sqlstring\n### 🌈 Free for use\nThe package has a public license and is available for download to any developer!## Installation\n\n## *How can I insert in-memory batches?\nStarting from version `2.0.0` [the caching module](https://www.npmjs.com/package/clickcache) should be imported separately.\nThis is because clickcache package, like clickhouse-ts, is going to be part of my Clickhouse Node.js ecosystem.\nIn addition, it planned to introduce [data validation](https://www.npmjs.com/package/chvalid), as in Joi and model generation, as in mongodb/mongoose.\n\n## Installation\n```bash\nnpm i clickhouse-ts\nnpm i clickcache\n```\n\n## Roadmap\n- Implement [http/cli-queries-with-parameters](https://clickhouse.com/docs/en/interfaces/http/#cli-queries-with-parameters) feature\n- Complete in/out data validation with schemas\n- Make it works with GrahpQL or something like [cube.js](http://cube.dev)\n\n## *How to insert?\nBasically, this client supports data insertion, but you should consider collecting your data before passing it as an argument here. Use `clickcache` to prepare batches!\n\nStarting from version `2.0.0` [the caching module](https://www.npmjs.com/package/clickcache) should be imported separately.\nThis is because clickcache package, like clickhouse-ts, is going to be part of my Clickhouse Node.js ecosystem.\nIn addition, it planned to introduce [data validation](https://www.npmjs.com/package/chvalid), as in Joi and model generation, as in mongodb/mongoose.\n\n## Connection\nOnly HTTP(s) protocol is supported.\n\n```ts\nconst client = new Clickhouse(\n  {\n    url: 'url',\n    port: 8443,\n    user: 'user',\n    password: 'password',\n    database: 'database',\n    ca: fs.readFileSync('cert.crt')\n  },\n  {\n\t/* https://clickhouse.com/docs/en/interfaces/formats */  \n    defaultResponseFormat: 'JSON',\n    clickhouseOptions: {\n      /* https://clickhouse.tech/docs/en/operations/settings/settings/ */\n      send_progress_in_http_headers: '1'\n    }\n  }\n)\n```\n\n## Usage examples\n## Insert\n```ts\nconst response = await client.insert('table_strings', rows, {\n  format: 'CSVWithNames'\n})\n```\n\n## Select\n```ts\nawait clickhouseInstance.query\u003c{ t: string }\u003e('WITH now() as t SELECT t', {\n  format: 'TSV',\n  send_progress_in_http_headers: '1'\n})\n```\n\n## DDL queries\n```ts\nawait clickhouseInstance.query(`\n  CREATE TABLE strings (\n    date DateTime('UTC'),\n    string String\n  ) Engine = ReplacingMergeTree()\n  PARTITION BY toMonday(date)\n  ORDER BY (date, string)\n`, { noFormat: true })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytadaniel%2Fclickhouse-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytadaniel%2Fclickhouse-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytadaniel%2Fclickhouse-ts/lists"}