Dark Mode

Use the unified DataStax Node.js driver to connect to your DataStax Astra DB database and begin building your own application.

DataStax recommends using the unified DataStax Node.js driver.If you have an existing Apache Cassandra or DataStax Enterprise (DSE) Node.js driver, migrate the driver to a version that is capable of connecting to Astra DB databases.

  • Download the secure connect bundle to obtain connection credentials for your Astra DB database.
  • link:https://nodejs.org/en/download/)[Download, window="_blank"] and install a current Node.js LTS version with npm .
  • Client ID_ and _Client Secret by creating your application token for your username and password.

Alternatively, have a teammate provide access to their Astra database.

  • Install the DataStax Node.js driver:
  • Create a connect-database.js file in the main directory for your Node.js project.
  • Copy the following connection code into the connect-database.js file.
  • After the Client class, add the following code to connect-database.js .This code creates a Client instance to connect to your Astra DB database, runs a CQL query, and prints the output to the console.
  • Save and close the connect-database.js file.
  • Run the connect-database.js example with the Node.js runtime:

The console output displays the cluster_name value from the system.local table.