- Create a web app from scratch using Domo’s React app template
- Pull book data from a public web API (Open Library)
- Get AI-generated text using Domo’s AI Service Layer API
Step 1: Setup and installation
Before beginning, please make sure you’ve successfully installed the Domo Apps CLI and followed the basic setup and installation instructions found here. When following the article, please skip
Step 3: Create a New App. We will be creating a React app instead of a simple Javascript app.
Initialize a React project using Domo’s template by following the steps in this quickstart guide.
Once your project has been created, open it in your preferred IDE and run yarn (or npm install) to install all required dependencies.
For this app, we are also going to install two extra libraries:
- Ant Design - A popular React UI component library.
- Ryuu.js - A Domo library for sending API requests to Domo.
yarn add antd ryuu.js@4.2.0 (or npm install antd ryuu.js@4.2.0).
When you’re ready, run yarn start (or npm start) to start developing locally.
Step 2: Set up app components
Open the
public and src folders to see the files that were auto-generated for you in Step 2. For this tutorial, we will only make changes to the App.js and App.css, and manifest.json files.
-
App.jsandApp.csswill contain the code to build the app and style it how we want. -
The
manifest.jsonfile is a special Domo file that is required for building apps on the Domo App Framework. What is the manifest file?
App.js to include a container div for our main app components. Replace everything inside of App.js with the following lines of code:
App.css file with the following:
bookshelf.jpeg and chapter_divider.png files from the public folder in the project repo here.
Put both of these images in the public folder of your project.
Update your app div to use the bookshelf image as the background, and add the chapter divider image at the bottom of the heading container.

Step 3: Add Antd components for user interactivity
Now, let’s add the state variables and components that will allow the user to choose their favorite books and their preferred genre, mood, and book length. Start by adding these lines of code to the top of your component:App.css file:
options prop for each of the Select components to reference these const variables.
We’ll also go ahead and wire the value prop to our state variables, and implement the onChange event for each static Select component.

Step 4: Fetch books from Open Library API
We are going to dynamically fetch books from Open Library’s free public API so that the user can enter a few of their favorite books. This will give extra context to our AI model when we generate recommendations. When the user starts typing in the “Choose your favorite books” box, we’ll send a request to the API to fetch books that match the title given by the user. Then we’ll display the list of books for the user to select from. Let’s start implementing this by creating a function to call Open Library’s API.allBooks and matchingBooks, to keep track of our fetched books.
We’ll memoize matchingBooks and build a book option array that is formatted with the information we want to display in our Select component.
App.js file should look like this:
Step 5: Using DomoGPT to get book recommendations
Now for the most exciting part: connecting to Domo’s AI Service Layer! We want to bundle up all of the user input, send it to our AI model, and get back a list of recommended books that the user is sure to love. Let’s start by importing
domo from ryuu.js so we can send API requests to Domo. Add this line at the top of App.js:
text generation endpoint to generate our book recommendations. To learn more about the other services available with Domo’s AI Service Layer, check out our article on Domo’s AI Playground.
getBookRecommendations function and display the AI-generated results.
Add a new Button component below our form components:
antd library, the same way you import the Select component.
onSubmit function and create two new state variables: loading (so we can show a loading indicator when the button is clicked), and recommendations (to hold the AI-generated book recommendations).
App.css:
App.js file should now look something like this:

