In this developer code template, we show you how to create a database of e-commerce click data using DataStax Enterprise or Apache Cassandra. With Red Hat OpenShift and DataStax Kubernetes Operator for Apache Cassandra, you can deploy this distributed database locally or with a cloud provider of your choice with a unified OpenShift experience. If you prefer a database provider, get started quickly with IBM Cloud Databases for DataStax.


The delivered e-commerce site is built using server-side rendering (SSR) with Next.js and React components. As customers browse web pages, SSR quickly (and asynchronously) adds browsing information to the database for each rendered page. When a customer clicks the Add to Cart button, the client-side React component adds click flow data using the paths in the Next.js API. The DataStax Enterprise database is optimized for low-latency fast writes and is designed to be scalable. This makes DataStax Enterprise ideal for collecting large amounts of click data.

Once you’ve completed this code snippet, you’ll understand how to:

  • Choose a cloud, cluster, or development environment for Apache Cassandra or DataStax Enterprise
  • Provide DataStax Enterprise or Apache Cassandra DataStax distribution
  • Design and create a database for DataStax Enterprise
  • Create a database and query using CQL and cqlsh
  • Create and run a Next.js web application that tracks click data


  1. Users interact with the ecommerce site.
  2. Websites and components collect clicks.
  3. Clickstream data is stored in a fast-writing, highly scalable database.


Get detailed instructions READ file. These instructions explain how to:

  1. Enable DataStax Enterprise or Apache Cassandra
  2. Access your database with CQL and cqlsh
  3. Access your database using the DataStax Node.js client

This code template is part of Develop an intelligent inventory and sourcing strategy using artificial intelligence series.



Please enter your comment!
Please enter your name here