Knative Bookstore tutorial¶
Build a larger sample application that combines Functions, Serving, and Eventing. The lessons follow reviews through an event-processing workflow and add the web application, processing services, and database around it.
If you are new to Knative, begin with the independent Get Started tracks first. Bookstore is a follow-on application exercise, not another universal introduction, a migration guide, or a production bookstore. You can reuse your learning cluster; the environment setup describes the extra application resources.

What are we building?¶

Our App is an online bookstore that sells a single book. Customers can post comments about the book anonymously, with each comment displayed alongside an emoji reflecting the sentiment of the comment. Comments with inappropriate content are automatically filtered out, discarded, and logged in the backend.
As the bookstore owner, you'll receive notifications via Slack each time if a comment containing a "bad word" is submitted.
Learning Goal¶

Follow a concrete event-driven application from its producer to its consumers:
- Send review comments to a Broker and route them using Triggers.
- Connect processing functions in a Sequence to analyze and filter reviews.
- Store processed reviews and display them in the web application.
- Explore an external notification integration in the later Slack/Camel K lesson.
Reuse a ready learning cluster or create one through the shared setup guide. The application adds its own frontend, backend, processing services, and database; the introductory tracks do not create those resources for you.
Bookstore Architecture¶

The bookstore application consists of the following components:
User Interface¶
A frontend Next.js application that interacts with these services. It is a web page where users can select a book to view its details, ratings and reviews.
Database Service¶
An in-memory PostgreSQL instance on Kubernetes, storing all user comments.
Book Reviews Service¶
A Node.js web server that will perform the event forwarding, database operation, and handling the websocket connection.
Notification Service¶
An Apache Camel K pipe that connects our event-driven architecture with a third-party webhook: Slack. It receives the CloudEvent and sends it as a message to a Slack Workspace.
ML Models Service¶
There are 2 Machine learning workflows that can conduct sentiment analysis on user's review comment and hateful word sanity check. You will be using a Knative Sequence to make sure they are executed in order.
Book Store Broker¶
It receives review events and routes them to the consumers selected by its Triggers. This learning example does not establish production durability or delivery guarantees.
Bad Word Broker¶
It acts as the bridge between the book store Broker and the Slack Sink, so we can send notification to your Slack when a comment containing "bad word" is submitted.
Tutorial Page Structure¶
We will be building the sample app in this order:
-
Environment Setup: Reuse or create a learning cluster, then deploy the frontend and backend and open the local browser connection.
-
Send comments to the Broker: Pass reviews from the frontend to event-display via the Broker. This involves learning about Broker, SinkBinding and CloudEvents event types.
-
Deploy Sentiment Analysis Service: Gain knowledge on deploying a sentiment analysis service using Knative Function.
-
Deploy Bad Word Filter Service: Implement a bad word filter service using Knative Function yourself.
-
Use a Sequence to Run the ML Workflows in order: Learn how to utilize a Knative Sequence to ensure your ML workflows executes in order.
-
Database Deployment: Understand the deployment of an in-memory PostgreSQL instance using a plain Kubernetes deployment.
-
Advanced event filtering: Integrate all components by receiving "analyzed reviews" via Broker (using a Trigger) and storing them into the database. This includes learning about Triggers and Filters.
-
Connect with External Services/API: Learn how to connect your application with external services and APIs using Knative Eventing and Apache Camel K integrations.
-
Extra Challenges: Additional challenges to test your understanding of the concepts learned in the tutorial.
How to properly learn?¶
Preview the final application¶
Watch the demo to see the application you will build.
Video not working above?
If the video is not working, you can watch it here.
Follow the application sequence¶

Unlike the independent Get Started tracks, these lessons build on one application. Follow them in order and keep the frontend's port-forward running while you use the browser UI. See Help if a step fails rather than creating another cluster or restarting from an unrelated introductory tutorial.
Accelerated Learning Path for Advanced Users¶

If you already know the components, use the diagrams to orient yourself. Before jumping to a later lesson, check that the resources created by its earlier steps already exist; the later lessons are not independent setup paths.
Help¶

Join the supportive Knative community via the Cloud Native Computing Foundation (CNCF) Slack, particularly the #knative channel. Before posting your questions, please search to see if they've already been answered. Your feedback on this tutorial is invaluable, so don't hesitate to reach out with suggestions or questions.
Next Step¶

Let's set up the environment first.