In this developer code pattern, we will show how to create a database of ecommerce clickstream data with DataStax Enterprise or Apache Cassandra. Using Red Hat OpenShift and the DataStax Kubernetes Operator for Apache Cassandra, you can deploy this distributed database on-premises or on your cloud provider of choice with a unified OpenShift experience. If you prefer a database-as-a-service provider, get up and running quickly with IBM Cloud Databases for DataStax.


The provided ecommerce website is built using server-side rendering (SSR) with Next.js and React components. As customers browse the web pages, SSR quickly (and asynchronously) inserts browsing data in the database for each page rendered. When the customer clicks the “Add to cart” button, the client-side React component uses Next.js API routes to add that clickstream data. The DataStax Enterprise database is optimized for low-latency fast writes and is designed to be highly scalable. This make DataStax Enterprise a great fit for collecting high-volume clickstream data.

When you have completed this code pattern, you will understand how to:

Select a cloud, cluster, or development platform for Apache Cassandra or DataStax Enterprise
Provision DataStax Enterprise or a DataStax distribution of Apache Cassandra
Design and create a database for DataStax Enterprise
Use CQL and cqlsh to create and query your database
Build and run the Next.js web app, which tracks clickstream data


Users interact with ecommerce website.
Web pages and components capture clicks.
Clickstream data is stored in a fast-write highly scalable database.


Get detailed instructions from the README file. Those instructions explain how to:

Related work from others:  Latest from Google AI - The world’s first braiding of non-Abelian anyons

Deploy DataStax Enterprise or Apache Cassandra
Interact with your database using CQL and cqlsh
Interact with your database using the DataStax Node.js client

This code pattern is part of the Develop an intelligent inventory and procurement strategy using AI series.

Similar Posts