How to build an inventory management system with Retool & Xano

This tutorial will guide you to create a simple inventory management system using Xano API for your backend and Retool for your frontend.
How to build an inventory management system with Retool & Xano

Xano is an excellent backend-as-a-service (BaaS) platform that helps developers to build and scale their APIs without the need to manage servers or write extensive backend code. Whether you're working with data for a mobile app, web app, or any other API-driven project, Xano provides a no-code/low-code interface to create scalable and robust backends quickly.

With Xano, developers can define their database schema, create business logic, and expose APIs—all within a single platform and with a straightforward, no-code interface. Ultimately, it means that technical folk can build a database structure like a developer can, but without needing to know code. 

It’s designed to integrate with frontend tools like Retool, React, Flutter, and others, making it a great choice for building application backends.

Combining Xano and Retool is a powerful alternative for developers who want to keep business logic outside of Retool and still access their database securely via an API. Unlike using Retool Database with direct SQL queries—which can expose applications to risks like SQL injection or unauthorized data manipulation—Xano allows you to format secure API calls, reducing the risk of malicious changes. This makes it especially useful for those building a SaaS on Retool.

This tutorial will guide you to create a simple inventory management system using Xano API for your backend and Retool for your frontend. Here’s a snapshot of our final app:

The frontend of an inventory management app in Retool.

Let’s go!

Set up your Xano Account and login

Visit Xano and register if you don’t already have an account. Click the “Get Started for free” button to register.

Xano homepage. The Get started for free button is highlighted.

After registration, you'll be guided to set up your Workspace. A Workspace is where you'll manage your database, APIs, and logic for your application.

To set up your Xano workspace, fill in the details in the Workspace form. Once this is done, you can click "Create workspace" to initialize your backend environment, which prepares it for customization and integration with your frontend tool.

Xano's Workspace setup form.

Once your workspace is created, you'll land on the Xano dashboard. This is the central hub where you can manage your backend. 

Set up your database tables in Xano

To start building, navigate to the Database tab on the left-hand menu to create your Database.

This will be the starting point before creating APIs or connecting external systems.

A Xano Workspace entitled Inventory Management. The Database tab in the left-hand menu is highlighted.

In the Database Tables section, you can start defining your data structure. To add a new table, click the + Add table button in the top-right corner. 

How to Add a table in the Database tables section of a Xano Workspace.

When creating a new table in Xano , you have the option to Import data or enter your data manually.

Modal box in Xano with options to import data or enter it manually when creating a new database table.

You can also choose to import data from either a CSV file or Airtable. For this tutorial, let’s select the CSV option, where you can upload your CSV file, and Xano will automatically create a table and populate it with the data from your file. You can download a sample CSV here to get started faster. 

If you're using the provided sample CSVs, simply upload them to quickly set up your tables.

When importing your CSV, give the table a usable name (e.g., "Products") and select the primary key column (e.g., id). Make sure to review the preview to ensure your data is formatted correctly, and adjust column types if necessary by clicking on the headers. 

The setup options for creating a new database table in Xano by importing CVS data.

Once satisfied, click “Upload” to create and populate your table in Xano. Your table should look something like this:

A table in the Database table section of a Xano's Workspace.

Once the CSV is imported, your data will appear as a table in Xano, like the "Products" table shown here. You can now view, edit, and manage the records directly in this interface.

 The next step is to create our API endpoints so that we can connect to these tables in Retool, navigate to the API tab in Xano and click on + Add API Endpoint in the top-right corner. 

This section allows you to create endpoints that interact with your database, such as fetching, creating, or updating records. These endpoints will be used by your frontend application to communicate with your backend. 

How to add API endpoints in the Authentication section of Xano Workspace.

Select CRUD database operations to create API endpoints for managing your database table. This will generate endpoints for creating, reading, updating, and deleting records.

A modal box in Xano asking what type of API endpoints you want to create. The option CRUD database operations is highlighted.

Select the Products table to create API endpoints for it. This will allow you to perform CRUD operations (Create, Read, Update, Delete) on the data stored in the Products table. Once selected, Xano will generate the necessary endpoints automatically.

Prompt in Xano asking you to select the table and operations for which you'd like to create API endpoints. Here a table called Products is highlighted.

Select the GET /products option to create an endpoint that retrieves all records from the Products table.

Prompt in Xano asking you to select the operation for which you'd like to create an endpoint. Here the option to get records from a table called products is highlighted.

Fill out the endpoint details and once complete, click Save to finalize the endpoint creation.

A setup prompt in Xano for adding an API Endpoint.

After creating your API endpoint, you can test it by clicking the Run button in the top-right corner. Use this to verify that the endpoint works as intended and processes data correctly.

How to test an API Endpoint in Xano.

Repeat this process for each type of endpoint you need, such as POST for creating new records, GET SINGLE for fetching a specific record, PUT or PATCH for updating records, and DELETE for removing records. Continue adding endpoints until all CRUD operations are set up for your table

A list of the API Endpoints for a table in a Xano Workspace.

Click the Copy base URL button in the top-right corner. This base URL will be used as the starting point for configuring your REST API resource in Retool.

A list of the API Endpoints for a Xano Workspace. The Copy link URL option is highlighted.

Set up your Retool Account

Retool is a platform for developers to quickly build frontends for their data using a drag-and-drop interface. It integrates seamlessly with databases like Postgres, MongoDB, Firebase, and APIs like Xano, enabling secure and scalable solutions. This rest of this tutorial will guide you through creating a CRUD app using Retool for frontend and Xano APIs for your backend.

Here’s a preview of how our final app will look like:

The frontend of an inventory management app in Retool.

Visit Retool and sign up if you don’t have an account yet. The registration process is simple—use your email or log in with your Google account to quickly get started on the Free plan.

After signing in, you’ll land on the dashboard. Here you can access your Retool applications, workflows, resources, and environment settings and get started with building. 

The Retool dashboard.

To get started in Retool, click the Create button in the top-right corner and select App from the dropdown menu. Here you can start building a new application where you’llconnect your Xano API endpoints and design the frontend interface for your project.

The Create button dropdown list in the Retool dashboard. Here the option to add an App is highlighted.

After creating your App, you’ll land on a blank canvas. Use the Components section to drag and drop elements like tables, buttons, and input fields onto the editor to start building your App, and configure them using the right-hand panel. 

Connect to Xano in Retool

To connect your data or APIs, you can click the </> icon on the left-hand side of the screen to create new queries to access your Xano data. Let’s walk through these steps.

An empty Retool canvas with the Components tree open. The code (</>) option in the left side bar has been highlighted.

Click the + icon as you can see in the diagram below to add a Resource Query.

How to add a Resource query to a Retool app.

Select REST API to connect your Xano endpoints. This allows you to fetch, send, and interact with your backend data directly in Retool, just like those endpoints we set up in Xano.

A list of Popular Resources available when adding a Resource query in Retool. Here REST API has been highlighted.

Configure your resource by pasting the copied Xano Base URL into the Base URL field under the "Configure REST API" screen. Once added, click Create resource to save and connect to your Xano API.

Configuration page for REST APIs in Retool.

Congratulations! You have successfully integrated your Xano API into your Retool App. 

Set up your ‘Get’ API call to read data

After creating your resource, select the HTTP method (e.g., GET) and specify the endpoint path (e.g., /products). Click Run to test the query, and the response will appear in the Output section. Use this query to fetch data for your application.

The General settings for a Resources query, called fetchXanoData, in Retool.

To display this data from your query, drag a Table component from the left panel onto the editor.

How to add a table to a Retool app.

Bind the table's data source to the output of your query (e.g., {{fetchXanoData.data}}). This will automatically populate the table with the fetched data from your Xano API.

A Retool workspace containing a table. Table settings are open in the right sidebar.

Congratulations! Your table is now populated with data from your Xano API.  

Now, in Retool, you can pretty easily customize how each column in the table is displayed. For example, you can format your inventory column as a Markdown to show Quantity and Reorder level in a more readable way.

A Retool workspace with a table and the settings for the Inventory column of the table highlighted on the right side.

For additional visual feedback, you can also set up a status indicator and color for your Inventory column to track reorder levels.

A Retool table column, called Inventory, with a color-coded status indicator. The settings for the status indicator are open on the right side.

To add a search feature for your table, drag a text input component (e.g., searchProduct) onto the editor and customize its placeholder (e.g., "Search product").

A Retool workspace containing a table and a text input component, called searchProduct, which is highlighted.

In the table settings, bind the Search term to the value of the text input, e.g., {{searchProduct.value}}.

A Retool workspace containing a table with the table settings open in the right sidebar. The Search term value box is highlighted.

Set up your delete action

Now let’s set up our delete query. Create a new query named deleteXanoData. Set the method to DELETE and specify the endpoint, e.g., /products/{{xanoDataTable.selectedRow.id}}. Once that is done, save the query.

The General settings for a Resources query, called deleteXanoData, in Retool.

In the xanoDataTable where you’re displaying your data, add a new column with the ID "delete." Set its format to Button, and add an event handler. Link the button to the deleteXanoData query under the Interaction tab. Set the action to Control Query and trigger the deleteXanoData query you just set up when the button is clicked. 

A Retool table with a column called delete highlighted and the settings for the column in the right sidebar.

Set up your ‘create’ and ‘edit’ actions

For the create and edit actions, we’re going to use one modal frame that will double as both our create and edit forms. This makes maintenance easier so that when we make any edits to our data and forms, we only need to make them in one place. 

To set up our Create form, the next step is to add an "Add new product" button to the interface. Pull in a button component from the component menu in the left panel. 

A Retool workspace containing a button, called addNewProduct. The settings for the button are in the right sidebar.

Now let’s set up the variable that will determine whether the Create or Edit form will open. Click the + button and select Variable from the dropdown.

Adding a Variable in the code section of a Retool workspace.

Variable also allows you to control application-wide or page-specific states, such as different states for this modal.

The code section of a Retool Workspace containing two queries (fetchXanoData and deleteXanodata) and a variable (modalState).

Configure your Add new product button  to Set variable in the click handler, Assign the value "Add". This ensures that when the Add New Product button is clicked, the variable modalState is updated to "Add", signaling that the modal should open in "add mode.

A Retool workspace with the settings for a button, called addNewProduct, open in the right sidebar. The settings for a Set variable event handler are highlighted.

Now, add a modal component to your editor. We’ll use this to house our create and edit forms. Set the button to show this modal using a click event handler, as in the image below.

A Retool workspace with the settings for a button, called addNewProduct, open in the right sidebar. The settings for a Control component event handler are highlighted.

To make sure it’s clear what action the user is performing, we’ll set the title of the modal based on the value of the {{modalState.value}} variable.

How to change the title on a modal component in Retool. Here the title of the modal is based on the value of a variable using Markdown.

Now, pull in a form component to your modal. Retool’s "Generate from table" feature helps to quickly create a form based on the structure of your existing data table. Click on  “Generate from table” and select the columns you would like to include or exclude from your form. After your form is successfully generated, configure each components as per your needs on the right-hand panel.

A Retool workspace with a modal component containing a form component. The settings for one of the form fields (Category) are open in the right sidebar.

To make sure we add this new data to our Xano database, let’s create a new query, createXanoProduct with the POST method. We’ll use the form data to populate this query.

Specify the endpoint /products and map the query to our productForm:

  • name: {{ productForm.data.name }}
  • category: {{ productForm.data.category }}
  • quantity: {{ productForm.data.quantity }}
  • reorder_level: {{ productForm.data.reorder_level }}
  • created_at: {{ moment().format("YYYY-MM-DD") }}
  • updated_at: {{ moment().format("YYYY-MM-DD") }}
The code section of a Retool workspace showing the settings for a POST Resource query, called createXanoProduct.

Finally, set the "Submit" button to Trigger the createXanoProduct query upon form submission.

Using an event handler on a button in a form in Retool to trigger a query when clicked.

Configure your edit action

Like we did with the delete action, let’s add a new column to the data table for editing actions. Add an "Edit" button in this column. Then, set up a click handler that  links it to the modalState variable. When the "Edit" button is clicked, set the modalState value to "Edit", preparing the modal to display editable data for the selected row. 

A Retool table with a column called edit highlighted and the settings for the column in the right sidebar.

Set up an additional click handler to trigger the productModal to open when the "Edit" button is clicked.

A Retool table with the settings for a column called edit open in the right sidebar. A Control component event handler has been added and it's settings are highlighted.

Finally, Create an updateXanoProduct query to edit an existing product. Configure the query to use the PUT method, targeting the endpoint products/{{ xanoDataTable.selectedRow.id }}. 

Map the fields in the body as follows:

  • name: {{ productForm.data.name }}
  • category: {{ productForm.data.category }}
  • quantity: {{ productForm.data.quantity }}
  • reorder_level: {{ productForm.data.reorder_level }}
  • created_at: {{ moment().format("YYYY-MM-DD") }}
  • updated_at: {{ moment().format("YYYY-MM-DD") }}
The code section of a Retool workspace showing the settings for a PUT Resource query, called updateXanoProduct.

Add an event handler under the Submit action, linking it to the updateXanoProduct query. Use the Trigger method, ensuring it runs only when the condition {{ modalState.value === "Edit" }} is met.

Using an event handler on a button in a form in Retool to trigger a query when clicked.

With that, you’ve set up a simple CRUD interface to create, read, update and delete data from your Xano database! Keep reading for some more ideas of how to make this dashboard even more useful.

Additional UI features

Header and sidebar navigation 

For a more complex app with multiple pages, you can add a navigation bar and optionally, a sidebar to your Retool app. With the Header and Sidebar frames, that open with a default navigation component, you can easily customize the navbar to create navigation links, such as "Home," "Users," and "CMS." 

An inventory management app created in Retool. The left and right sidebars and the navigation bar are highlighted.

Summaries of data

Additionally, you can add some dashboard data to your app with analytics elements to summarize key metrics in your Xano data. In this case we showed some summaries of our order data on the right side, and inventory information on the left.

Analytic elements from a Retool app. The right box shows a graph of orders and the left box has information about inventory levels.

To display totals, such as the number of unique products, you can use this code to count the individual products based on the dataset: {{new Set(xanoDataTable.data.map(item => item.name)).size}}

A text component in Retool with the following entered as a value: {{new Set(xanoDataTable.data.map(item => item.name)).size}}.

To display the total quantity of orders, you can use the following code to sum them: {{xanoDataTable.data.reduce((sum, item) => sum + item.quantity, 0)}}.

A text component in Retool with the following entered as a value: {{xanoDataTable.data.reduce((sum, item) => sum + item.quantity, 0)}}.

You can also use components like the chart to display how much revenue have been made over a period of time. We’ll cover components like the chart and the inventory level progress bar in future tutorials - stay tuned!

Summary

Great work! Using no code, you managed to set up a database in Xano and create API calls to perform actions on your data. In Retool, with a sprinkle of code, you created a simple dashboard with a useful table, a UI for your CRUD API actions and added some additional summary data.

About the author
Tools Team

Tools Team

The tools.dev team comprises internal tools specialists with deep expertise in the platforms used to develop and optimize these solutions.

tools.dev

Your hub for internal tools & how to build them.

Find your tool
tools.dev

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to tools.dev.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.