ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver Getting Started
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/getting-started/getting-started.md.

Getting Started¶

This page will guide you through installing the Node.js RS Driver and executing your first statements against ScyllaDB.

Installation¶

Install the driver using npm:

npm install @scylladb/driver

Supported architectures: Linux x86_64 and Linux ARM.

Connecting to ScyllaDB¶

Create a Client instance and connect to your ScyllaDB cluster:

const { Client } = require('@scylladb/driver');

(async () => {
  const client = new Client({
    contactPoints: ['127.0.0.1'],
    localDataCenter: 'datacenter1',
  });

  await client.connect();
  console.log('Connected to ScyllaDB');
})();

For connecting with authentication, see the Authentication page.

Driver configuration reporting¶

The control connection reports a JSON description of the configuration visible to the underlying Rust session in the DRIVER_CONFIG CQL startup option. It covers native connection, control-plane, and query-policy settings. The report’s query.defaults entries contain native Rust defaults. They may differ from the Node.js query defaults and execution-profile overrides applied to individual statements.

ScyllaDB servers with a client_options column (available since ScyllaDB 2026.1) expose the report in system.clients.client_options, alongside the SESSION_ID shared by every connection from the same Client. Earlier server versions receive these startup options but do not expose them through that table. system.clients is node-local, and only the control connection sends DRIVER_CONFIG, so inspect each node or direct the query to the node hosting the control connection to find the report.

Reporting is enabled by default. Disable it when the client configuration must not be disclosed to the cluster:

const client = new Client({
  contactPoints: ['127.0.0.1'],
  localDataCenter: 'datacenter1',
  driverConfigReportingEnabled: false,
});

Disabling configuration reporting does not disable SESSION_ID.

Executing a Statement¶

Once connected, you can execute CQL statements. It is strongly recommended to use prepared statements for repeated operations, as they improve performance and enable advanced load balancing:

// Prepared statement (recommended for repeated execution)
const result = await client.execute(
  'SELECT keyspace_name FROM system_schema.keyspaces',
  [],
  { prepare: true }
);

for (const row of result.rows) {
  console.log(row['keyspace_name']);
}

For a detailed overview of statement types and best practices, see Executing CQL statements.

Full Example: Create Table and Insert Data¶

The following example creates a keyspace and table, inserts a row, and reads it back:

const { Client, types } = require('@scylladb/driver');

async function main() {
  const client = new Client({
    contactPoints: ['127.0.0.1'],
    localDataCenter: 'datacenter1',
  });

  await client.connect();

  // Create a keyspace
  await client.execute(
    `CREATE KEYSPACE IF NOT EXISTS examples
     WITH replication = {'class': 'NetworkTopologyStrategy', 'datacenter1': 1}`
  );

  // Create a table
  await client.execute(
    `CREATE TABLE IF NOT EXISTS examples.basic (
       id uuid PRIMARY KEY,
       name text,
       value int
     )`
  );

  // Insert a row using a prepared statement
  const id = types.Uuid.random();
  await client.execute(
    'INSERT INTO examples.basic (id, name, value) VALUES (?, ?, ?)',
    [id, 'Hello, ScyllaDB!', 42],
    { prepare: true }
  );

  // Read the row back
  const result = await client.execute(
    'SELECT id, name, value FROM examples.basic WHERE id = ?',
    [id],
    { prepare: true }
  );

  const row = result.first();
  console.log(`id: ${row['id']}, name: ${row['name']}, value: ${row['value']}`);

  await client.shutdown();
}

main().catch(console.error);

Next Steps¶

  • Executing CQL statements - best practices - Learn about prepared, unprepared, and batch statements

  • Fetching large result sets - Page through large query results efficiently

  • Load balancing - Configure how the driver routes requests

  • Authentication - Connect with credentials or SSL

  • Migration guide - Migrating from the Apache cassandra-driver

  • Examples - More complete usage examples

Was this page helpful?

PREVIOUS
ScyllaDB Node.js RS Driver
NEXT
Statements
  • Create an issue
  • Edit this page

On this page

  • Getting Started
    • Installation
    • Connecting to ScyllaDB
      • Driver configuration reporting
    • Executing a Statement
    • Full Example: Create Table and Insert Data
    • Next Steps
ScyllaDB Node.js Driver
Search Ask AI
  • v0.7.1
    • main
    • v0.7.1
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Schema Metadata
  • Topology
  • Replicas
  • Query Tracing
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Client Routes (Private Networking)
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
    • Classes
      • Client
      • ColumnInfo
      • ConstantSpeculativeExecutionPolicy
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • FrameWriter
      • GraphResultSet
      • HashSet
      • LineString
      • NoSpeculativeExecutionPolicy
      • Path
      • Point
      • Polygon
      • PreparedInfo
      • Property
      • ResultColumnsCache
      • ResultSet
      • RustResult
      • RustSession
      • SpeculativeExecutionPolicy
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
      • module-metadata-LocalStrategy
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 23 Oct 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3