Node.js Client Documentation

QuestDB welcomes Node.js developers with a dedicated client designed for efficient and high-performance data ingestion. Specifically crafted for insert-only operations, this pairing of QuestDB and its Node.js client paves the way for enhanced time series data handling and analytical performance.

The Node.js client has some nice benefits:

  • Flexible connection options: Customize host and port settings.
  • Asynchronous support: Leverage Node.js's asynchronous capabilities for non-blocking operations.

This quick start guide introduces the basic functionalities of the Node.js client, including setting up a connection, inserting data, and flushing data to QuestDB.

note

Please note that the Node.js client has not yet been updated to support HTTP.

As such, it relies on TCP and has limitations compared to clients which do support HTTP.

Requirements

Client installation

Install the QuestDB Node.js client via npm:

npm i -s @questdb/nodejs-client

Basic Usage

Here's a simple example to connect to QuestDB, insert some data into a table, and flush the data:

const { Sender } = require("@questdb/nodejs-client")

async function run() {
const sender = new Sender()

// Connect to QuestDB
await sender.connect({ port: 9009, host: "localhost" })

// Add rows to the sender's buffer
sender
.table("prices")
.symbol("instrument", "EURUSD")
.floatColumn("bid", 1.0195)
.floatColumn("ask", 1.0221)
.at(Date.now(), "ms")
sender
.table("prices")
.symbol("instrument", "GBPUSD")
.floatColumn("bid", 1.2076)
.floatColumn("ask", 1.2082)
.at(Date.now(), "ms")

// Flush the buffer to QuestDB
await sender.flush()
}

Next Steps

Dive deeper into the Node.js client capabilities by exploring more examples provided in the GitHub repository.

To learn The Way of QuestDB SQL, see the Query & SQL Overview.

Should you encounter any issues or have questions, the active community Slack is a vibrant platform for discussions.