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.6.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.6.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.

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
    • Executing a Statement
    • Full Example: Create Table and Insert Data
    • Next Steps
ScyllaDB Node.js Driver
Search Ask AI
  • v0.6.1
    • main
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • concurrent
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metadata
        • Aggregate
        • ClientState
        • ColumnMetadata
        • Index
        • KeyspaceMetadata
        • MaterializedView
        • Metadata
        • SchemaFunction
        • Strategy
        • TableMetadata
        • UdtField
        • UserDefinedType
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • speculativeExecution
          • ConstantSpeculativeExecutionPolicy
          • NoSpeculativeExecutionPolicy
          • SpeculativeExecutionPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • Long
        • ResultSet
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
        • Vector
    • Classes
      • AddressResolver
      • ByteOrderedToken
      • Client
      • ColumnInfo
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • GraphResultSet
      • HashSet
      • Host
      • HostMap
      • LineString
      • Murmur3Token
      • Path
      • Point
      • Polygon
      • Property
      • RandomToken
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
    • 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 10 Aug 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3