Part 1 - Setup and Initialize KurrentDB
Part 1: Setup and Initialize KurrentDB
In this part, you will start a GitHub Codespaces session in your browser.
Info
GitHub Codespaces provides an instant and preconfigured development environment all within your browser. This environment contains all the tools and code to complete this tutorial. To learn more about Github Codespaces, click here.
You will then initialize KurrentDB by appending sample events that mimic an e-commerce application. The events are appended using a data generator program.
Step 1: Set up Your Codespaces
Click the button below to initiate Codespaces and ensure following values are selected:
Configuration Option Selection Branch main
Dev container configuration Mix-and-Match Database
Region Any value Machine type Any value Log in to GitHub if required.
Wait for your Codespace to build. This can take up to a few minutes.
Tips
For this quickstart, you can safely ignore and close any Codespaces notifications that appear on the bottom right of the page.
Step 2: Start and Initialize KurrentDB with Sample Events
Once your Codespace is loaded, run the following command in the terminal to append sample events to KurrentDB:
./scripts/1-init-data.sh
This is a custom script for this quickstart to help start KurrentDB in Docker.
You will see the following message printed in the terminal:
🚀 KurrentDB Server has started!! 🚀 URL to the KurrentDB Admin UI 👉: https://XXXXXXXXX.XXX Appended sample data to KurrentDB
Copy the URL printed in the terminal from the last step.
Open a new browser tab.
In the address bar of the new tab, paste the URL and navigate to it.
This will display the KurrentDB Admin UI.
KurrentDB Admin UI Dashboard
Step 3: Browse Sample Events in KurrentDB's Admin UI
Click the
Stream Browser
link from the top navigation bar.Under
Recently Changed Streams
, click the$ce-cart
link.Understanding Category System Projection
The
$ce-cart
stream contains events from all the carts in KurrentDB. This uses the category system projection stream feature. For more information, see System Projections.You should see an ordered list of the appended events associated with two distinct, virtual shopping carts.
Introducing shopping cart events
In KurrentDB, events for each shopping cart are appended to a stream like
cart-2fbe05d1dcf043d782ea24923298ae3a
, where2fbeone05d1dcf043d782ea24923298ae3a
is the cart's unique ID.The cart will contain events like these:
Event Description VisitorStartedShopping
When a visitor starts shopping and a cart is created. CustomerStartedShopping
When a known customer starts shopping and a cart is associated with their ID. CartShopperGotIdentified
When a customer's identity is linked to a cart (e.g., a visitor logged in) ItemGotAdded
When an item is added to the cart, including details like quantity, price, and tax. ItemGotRemoved
When an item is removed from the cart, including the quantity removed. CartGotCheckedOut
When a cart is checked out and converted into an order. CartGotAbandoned
When a cart is abandoned after being idle for a specified duration. Quick Quiz
What were the quantities of each product in the shopping carts?