---
title: "Integrating ClickHouse with Node.js"
description: "TypeScript-first HTTP client with streaming, abort signals, and a browser build via @clickhouse/client-web."
category: "LANGUAGE_CLIENT"
support: "CORE"
docs: "https://clickhouse.com/docs/integrations/javascript"
---

# Node.js

### Installation
```sh
npm i @clickhouse/client
```

### Examples
#### Create an instance
```js
import { createClient } from '@clickhouse/client'

const client = createClient({
  host: `https://<host>:8443`,
  password: '<password>',
})
```
#### Simple 'command' without a result:
```js
await client.exec({
  query: `
    CREATE TABLE IF NOT EXISTS clickhouse_js_example_table
    (id UInt64, name String)
    ORDER BY (id)
  `,
  clickhouse_settings: {
    wait_end_of_query: 1,
  },
})
```

#### Bulk insert
```js
await client.insert({
  table: 'clickhouse_js_example_table',
  values: [
    { id: 42, name: 'foo' },
    { id: 42, name: 'bar' },
  ],
  format: 'JSONEachRow',
})
```

#### Basic query
```js
const rows = await client.query({
  query: 'SELECT * FROM clickhouse_js_example_table',
  format: 'JSONEachRow',
})

console.log(await rows.json())
```