Tutorial: Build low code apps with Bubble and Hasura APIs
Tags: lowcode, rest, guidesandtutorials
Published: 2021-09-13 13:26:15

---
title: Tutorial: Build low code apps with Bubble and Hasura APIs
published: true
date: 2021-08-17 07:25:43 UTC
tags: lowcode,REST,GuidesAndTutorials
canonical_url: https://hasura.io/blog/tutorial-using-hasura-api-with-bubble-a-low-code-tool-for-building-apps/
---

 ![Tutorial: Build low code apps with Bubble and Hasura APIs](https://hasura.io/blog/content/images/2021/08/hasura_bubble.png)

In this tutorial, we’ll be expanding on a previous tutorial we completed where we [integrated a Hasura project with another low-code tool, Draftbit](https://hasura.io/blog/a-tutorial-using-hasura-with-draftbit-a-low-code-tool-for-building-mobile-apps/). In this continuation, we’ll be building out a website presence for our application using Bubble. Bubble has an expansive community offering support and plugins for almost any use case. We will build on the REST integration we created in the previous tutorial and now include an additional endpoint that allows us to upload content to Hasura.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://hasura.io/blog/content/images/2021/08/hasura_bubble-1.png)<figcaption>Hasura + Bubble = Powerful low code apps</figcaption>

## The Hasura features we’ll use

Previously, we used Hasura’s ability to create a REST endpoint for a saved GraphQL query in the Hasura console. We’ll re-use this functionality and add the Pipedream serverless endpoint from our API to upload images and persist them to Hasura. [You can read more about that in the original tutorial](https://hasura.io/blog/hasura-design-patterns-asynchronous-content-enhancement-and-analysis/).

## The interface

We’ll continue the trend of minimum viable interfaces with this series and present just enough UI to functionally display the images, tags, and a file upload interface.

## The Tutorial

**Prerequisites:**

- [Familiarity with our base tutorial.](https://hasura.io/blog/hasura-design-patterns-asynchronous-content-enhancement-and-analysis/)
- A working, accessible Hasura project (not running on localhost) with existing data.
- A Bubble account.  
  
Scroll to the bottom of the page from the welcome screen, pass the onboarding tutorials, and click “Create a New App.”  

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/GByjsIc3FHpzzh8B5CMvvogAdgpzqUHDb1BOMPy04cTtGVB-F4ZV0uE7AdZ4fQqYxDBpW0vkMlxJFLQbD_YFtwWcXQ5Pfu0BLKSoZPW_pA6rPdSiicPP2ijli24TS3Ttiza6cAt8)

Fill in the default information for your application.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/oG7hmFvs_6gDMzV7J2E60y8RXwlvnXsPJKfOMnN0P4FYyhmTvpgA_fUk2ihHMT6NIuVmE8leoEveCOG5A7O6iUlCYXTrwUBkYWKUfwdSCY8z7Wlm__wQuzgFCMGeAZNLcXpOIn3b)

To keep our UI lean, we will choose “Start with a blank page.”

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/ii9pVOgFdhdFLvEuYJqa0I7nq2fYljmaEckAefi7zcqHGNIgzWJzOfvJtR28qA31pP6OucdNl-DVPbJuNbdaTcAXGdJuyrCziG1lp3HoBFCOlhABW5Eh3pVEwpHXF1CwHVwqYJpD)

After that, press “Let’s get started.”

You’ll be asked what you want the title of the page to be (what displays in the tab across the top), what the default language of the page will be, and what you want the favicon to be.

The next two questions are the most important, you can skip adding the payment plugin, but we’ll want to add the “API Connector” plugin in the question following that.

You’ll be presented with a marketplace where you can install the plugin you want; we’ll choose the one created by Bubble themselves.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/pR4SkdOec59YSxwh7dcZ4mgOGYFXyBtbwGSLlNjx5KLhBdsDkxcBlCH7gxILLggRkrOKPt-WPrdxjZQBZ70en8odYvyRo-swp75k2iZbNkVSgXMfRatZOhbTXA85Ma0Gllr5-4ej)

Install, then press “Done.”

From here, you can choose to take the application tour or simply close the assistant. For this tutorial, we’ll go straight to editing the application.

Once we are viewing the empty screen, we will navigate to our Plugin tab on the left sidebar of the application, choose the API plugin, and press “Add another API.”

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/P_z237otqKfhgzkw6lqIBwi5CQE50UPsj41nD6wDMCrc_WnV7S5NNhBDhzF9jhkeilCb0lRPWstW51iLFry_QbATspa5yVOGgS7G7vZvfJ38DrLdZ8SWj76T9bGAu06SMR5xJI2X)

We’ll provide the default connection parameters for the API call, including a generic x-hasura-admin-secret for now. Note: Best practice would be to incorporate a user-auth flow to protect the interactions on this page.

The individual call details are obscured behind the “expand” button pointed out in the screenshot.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/PcGB4napaipKSMVpTORlzW3tU8Nuvp5_ft4t_S0jFli2jrnFKgqVCUHewal-idEWMWg9zuJoV-359LQRkqFaeFRcyAMI5LSXgJwvGzwQ3wVlGsFQec-xEr0E-ySgtaO9SlCPG6qJ)

At this point, we can map the parameters to our saved REST endpoints. Next, we will define a Get List call, ensuring that this will be used as “data” on the page and that the response is JSON.

Initialize the call to ensure that it works.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/IoRqapVW34gBF7SVRPL7TyC67X8EnVLNCfZWsUZOE-XCMNvpjgPOXe_w-GZdV2jTBzd9pHv0pdUo_gM9JREuIomd_Z0UhBUxTMtpZy2rYtbaxgl5oMspfZnee7Zv3HSyQqvPg1Ol)

Bubble provides a helper utility to map the response types from our server to use them with appropriate components and utilities when building our interface.

Here we’ll define that our created\_at field is a date and that our image\_url is an image.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/WKz3JY1bKt1mekD-5fzfKiRxs2TZHZI9Edx35OIygHxKssfkj1HEO8-TpQ--IxmfXZxoqvLakMog2Hxv3DU-9jNWIUbLch7xfoeK8PuFRR-R2tkq7VKIl0KuxzmBKS6l0yAeHZ8g)

While in our plugin details, we’ll define the “Get Single” API call as well, this time using Bubble’s “[]” annotation to indicate where the URL parameterization should occur.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/88y4w5Ed5ETl2m2cSE57tiSGeEMWP1Ht_AYoWxdb1lS5J_s9WiqOySxhhGxEz-3R4QrgQs3NWUCKekPnBlUxxF41EQy93ZFLiwi5N5jxXUtRVw0g7wRtZABqg_lo0rcLQDRnTICQ)

And as before, we’ll map the response types for Date and Image where applicable.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/MvTHVA2rMAJ_Vt2LKgEDjX-CUZVLRyw0IXCCL5LISWOjCdoP3vkdPpmx6Puz6tcTZpgi9q9CEYIsROq7kA43epKYk37rVTV8qcSyfIDsWA-NiI43G7hV_h7thqaCJimuWGKzOv6o)

One last adaption to our API is to add a Date/Time header to our API calls which will allow us to bust Bubble’s cache proxy for requests to the server.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/8x2_QUQoj8cd0xvS-RbPeFV5YPG6IzLx0_8yvZJ2vROFD4s55zfD-_rtAwiT20PvmaVhYVGvXsoXVi8EfNvl1kHQYlFJ1oVFlasgrfNjBR2tvj0klR5MfSVFX-rvKybTsvCS_fKe)

As before, make sure to leave the “Private” option unchecked, which allows us to define this dynamically at the time of calling.

We’ll return to the Design tab with the APIs defined and add a “Repeating Group” container to the page.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/G5NPYGgrszrmkMuZWaUEfhMcn5Ftk0fb70ccLv-YJ_qsSWRQndwfsAsSFxrWEpab2XBpxi417InVPEopxz0jPCFEEQ0GnG7PwpOyLop9BuOYquM9NNwUFVQZ7r8IjzEy-69BcGyM)

We’ll need to identify the data source and the type of content the repeating blocks expect to see. We’ll start with the data source, choose “Get data from an external API,” and then choose the Hasura - Get List” API call. From the secondary menu.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/5IymO42-nK_-ArcVfv1r_nYB-wtEaEKyvaVeMD4hU_-jHUeDCVElKl9zAE7pUd0R2HVCj8vT9FJFD04j3VY5onoyhrGy_REq05d2HQRsW49P5aOGXMa4CW6fT3H6FNjthm6AMWZz)

From there, we’ll choose the “Get List upload” response type from the “Type of content” dropdown.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/5KnhKiUA7K2hGVlrSTEKEcjvKgVN38GQ-DoJSxjreLfUEh55R3rWV1pVVurSEqatgrMmpCrrIHfExQM-pI-beV_DuG1aVx1CU944NTS3RlY_vpkdvbdliC7OFN3qwGM7pjpbY87y)

Draw a Text component into the first grid of the repeating list; this will prompt the appearance panel to show. Next, click inside the “...edit me…” text area, which will show the “insert dynamic data” window.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/4Z8UcMA0usyufT_Az5Idy4p1OnQ_xYjO1zj2-MkAWkFL7CDmqjfSbi39sUaA6fNLC2NJyTTPrnAhI7Aay2RjUjPaGAOS4EBFUeAwIItyVplYH_8rUD58PF8GgecYbeUoyGzo4DLZ)

Bubble will present a unique but intuitive property accessor interface where you select a natural language parse of the values you are trying to view. For example, the resulting string will be the “Current cell’s Get List upload’s image name.”

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/Xxiw_HjZFDG0szm-TcnzpiksNVeTSZ_X8dJ3TGoU2vPDMOrAZmh4lOQj60itabI5KGNhm2vwwvopUpaZ5LJTBpc5_tWPuXIdpYEvr8yw0qNnVScE0Mis6FenRD06lSkI4ZYARd86)

Let’s preview our results.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/lhEdH6yv5tl7DGKBF8zk4o6SVe5iRuiPRgq_phVGVpo8WQWJ371ruxxnKP2AArZ_EobE2XILfW43gvWSgwTdGK85TlNDFMqwpF4e0DeZa6ksIe6oe_Tjts-pXYv_1TUe66OcpQNk)

It’s working! We are iterating content in Bubble from Hasura.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/ew1wLhHz_FtymK7cZp1KbRWsN2m2DGGZ5NGCAJBHQpxyUcLVKeFkAKRZPwIvRAN3kKG0vfyLpbW4kXPmEh7_fExpX4CpaEal8zCWT3PBZfEKFkYdVsrW5W3sZtK-HAZUGnIEv9W8)

Let’s replumb the component structure to put a top-level group in our repeating field, behaving as a click target for our next bit of UI. First, remove the text box, then add a group container to the component repeat field. With that in place, define its data source as we did previously with the text box, then add a child text box which will receive the final state of props.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/_e_fphornKy4yMaDpya3jIty8WJZ7E6YpoQrNGm51JlQytrqROhvhjpw_pBNesoih37_IpkYOaFcCmtRua7RMmFYU1PzlTqzUDer3JQX66IDhCCLsZKaFisFmKGUZ_3OiOlYuBtv)

Let’s add an image component to the page to view the URL of the clicked-on list item. I’ve added a border under Appearance to help visually track its place in the UI for now.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/wpkbxDfAewjmQrD23h3ds8LWLeTIHPBywflWxATazmvGpmbYkjNCcNePGrmHvCO8dQPI7tPGg1-kxCYDSIRqIF5hhOjAYJuxltfIVZAlm7XgBp5K0zAyehwCAHJNkmV55mQcZLec)

Now we need to create a workflow to handle click events on the group we added previously.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/p5iJokxed-uXZwvuwZ4UdUO31u6q5m77ao70YtND6DWLFFF6remqgDhYc84dxcjbi3DPz27Cd94mFQW0sA3N4gxywOwfhyZV41emzniAU56C6KX58PLL7OGaVcRfnCNQKdhkpey-)

We will tell the workflow to set the state on an element on our page.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/jmiSZ5JxgxOeAMs5oCg1wiLX9GbqPPtOlOO6D8uO3qhvOp42O0rfLmQPL-93yFsCX_8y1rZIjElGTRErWZmquc0kAw47GevCeoSd0AYlLPfm4bm2kjGc33dWRJRvfqzg4pt4jnet)

In this case, we are setting a custom state called “Image URL” on “Image A” to the value of the current cell’s image URL property.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/O2TvAuOE3PdCUFnWm3hS3AHy5lnK92F11ZoJg9PLibqnssEIYZvHzb9IINxgQklI3y_XWUjbkH9CcoBB4aI39TE-kHHDE-p5fB68qKd3PC--wAUmHwPXtYppIC371WlEIfi8UwYP)

In our Image A component, we will tell the image to be the value of that new Image URL state property.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/vm6_jcrqh0AOGsQmo7uJl9oBrT5ibvSJeq3gg5Lvr0BH6mlGd4B9fvRhkSZeslhLdwykXxMzsK2JjVhCrGWlj2BhHpowRNLsAiAA23uVg2ZTB4V7N28j9Xc8X1XK_JPp4cQ2qXRX)

Let’s test this behavior.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/x8l_CzQl7i2UB95lhK-f6rwpbKnToCO_Cdo-cdViITvOTKxzAm2b029r-xBBjjavwaEEbeOArSfMMPBlNTDr_tsMuQX3N5QXIwHDkDmNH1V_tAnAxA1eR4KxsDnzjY4a7FBbrmEy)

That works!

Let’s try to show the tags associated with this image.

We will add another repeater list next to the image component. Then, we’ll add another “set state” flow to assign the ID of the selected item as “Upload ID” on the internal state of the new repeater field. The result should look like this.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/N2F59QsKVumpYMN2El0C-l7xZM-2KYDpJWRX3p1IVINvI6_pNLvQrvP9_y6wlsH01ZVGsSPLrZEiz7ioET4m-7avC3WOiawP3ePfhCMW0kLMPR60HomJs72GSLKZxm1Tsn5A_xXe)

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/w2yukTN-gvSAY78_nDBIQ3rIBsH3v8vb-zNlxkop9_iDDjOpeY2KUSP9lPtsFeeJ3zopNhFKCUoPz7cZMOt6nvKTOQSEBWCdS1auc8U-FNn4UbNxyNx3-bG-2xGh9x6lMSW5wAd4)

Adding another text box to this repeat, we can drill down to the tag name property being passed in from our API call.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/s278fGE-lYGokGnOUEDXa2UIm7DSnk55AXo7QTXU437jj8U7lzByS8NknKJ9e-CI76nZ-488PD2D2gjiBBkNASD18Z9U5zWuPJcSg3ObZLRL3H0mR6syKL7PljqXZB7i6VkoubpE)

If we preview this gain, we can see that it works, if not in need of a loading state!

To upload an image, we need to define another API call. We handle binary data through an external service that stores the file for this particular application, then calls Hasura to persist the data to our backend. You can read more about that architecture here.

We need to call a different API and define that this endpoint will receive a field parameter identified as a dynamic entry when we call the API. To allow this parameter to be called later, we need to indicate that this is not a private field.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/cxPeXpmqE6hhFiOEwuKQO3dzcv-UAIE8qUH4hFUYOWlAPsOh99obTlEJ2xboupBTP_LDp0h84le5E0sdm5iDW714JkdwTPnSqepDEtvxRGQSMHQbuNXlNoCraK09Uw8d3lBOvh15)

With that in place, we need to create a custom upload workflow trigger to handle a manual API call based on arbitrary events.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/oVD0uzZcXQkqdLSLAN5I-Z61fnyKriWXR8Y2tcSbnSptsVdHU7q9pnSYakNDrI-QHY8hbcff4xA3g9D9svicsD1CQQsXO0bAQ1rasH88mQ3kJycUiv1OzRu5nNPjEXJDylU1TxKF)

Now we need to create a trigger for this workflow from our UI. We’ll use the “Upload image” component, and I’ve opted to place mine inside of a popup. The implementation details are less critical on which UI primitive to use. Note: Ideally, you’d use a file picker and send this to our API; as it stands, the UI components from Bubble automatically persist these files to a storage bucket, so we are in effect doubling our storage. An alternative in the meantime would be to write a custom form handler using the HTML block. To show the workflow architecture, I’ve opted to stick with the default components for now.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/3UoFIEFJ36LaVdwOaLlsdOeHURBWsFS9LqfVZ28gjHVJtPjD5vN_aAyTAwlQk2W8NEAR7Wxyg4D5tyC3gc9rwYBWnNmgkEsKG2c523aw_F8YV3FLaf1eVqz7vnU5lJsrlVnMVihm)

I’ve layered an image preview and an image select. We’ll be hiding the image select and reveal the image previewer on a successful response from our API.

Back in our workflow editor, we’ll define a listener for property changes on this image upload component, which will trigger our custom API call.

This is how that looks in the editor.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/T4EZ9ZCHYrVK6V-VLoK4L3vWgTs04QQFlAC5pUCOiIJnLdiNOdfobAbug13OGH0TjGoPLbm00bz7JtxKd2BUeafuHfqJS80h_e-eoNAWdDIWc2syriIzxl8qVVlr8UPl_GQFv2Ka)

When the upload is done, we’ll trigger our follow-up request using the returned Upload ID to request our “Get Single” API endpoint, which will also return our tags once the backend processing is completed.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh6.googleusercontent.com/sarNeDIfCe3I3CWj-RzzLj-OfzXjzwz0CyVOtHwmxbuQi-_mp595cKe4N9aD6ddsjeXU5mx63HTVRDkqwCdNz5bGmIsETA-J2zwc2GJFUFwBF6lisuFOJjN1Mn0ILHV6dPn7Rmns)

The custom event is defined to set the state of our Tags list once data returns.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/cFJB8TwuafduhfYXK5S5MrxlViICzxCF_h3o8sn5y86tuOFTWdb6d0Ui5rVfZJDu61ZKsXRzoQyNA8FXMT9KdW9eAYdzPhXeCuyaC2qZGCD99N5w0EZLOnfBCHTW9nOs8nteoiTv)

The last component we need to include is a polling API call that will run at a fixed interval (5 seconds) that will only make an API request once the Upload ID is present, the total list of returned tags is 0, and the popup is open.

We introduce the third check because we need to create our tag count check in a round-about way to get around a minor bug in the platform. We will only show the tag list if the count is greater than zero, which offers predictable behavior; we then proxy this truthy condition in our API poll to check if the tag list is visible. The problem arises when the popup is dismissed and the checklist is hidden once more, returning its “hidden state” back to true. Our third conditional is the popup open, mitigates this limitation. No code often requires some edge-case thinking where convenience features may be fighting against a presupposed mental pattern.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh5.googleusercontent.com/-VUkA9OmO1MQ5bV7DBjT0MYAfw1AU9ugvH9B3ysMrFolDbgY0Qu7u92TZ6PYDLDM4Hjlu6CKI1mGoBMSHr2-P81jrXfqa7t5U3wMak33dJtAfuoYNqDBfmQyVWT2YYdmKGc3u6pR)

The steps triggered by this event will now introduce our cache-busting Date header.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh4.googleusercontent.com/Yvq9JioxNSYfjBRUgA0IJoLxyXlp-tDbJ7PEFQuGkNVd4Em30Peajb2VihpL-8Y3R-4Ur6zqmL-DndSdCgz1JHum3vFezaNL8TX-YiHt3912HDQImWNpCmMATIDgi0jVW1CGXHUy)

##   
Workflow Summary

The workflow logic can be challenging to follow; here is an outline of what is happening behind the scenes.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/afX55_NOlJZSU3keRH5cGSIjVO9Mc1OQ5OfkKH75ces27FyK67sVMHAz6u8n5HR9rrVqpBXxx1RYxoX66hNaFmYMnCE5bSjxqjLTApNG017RaAJORKzIjCqCda15fvtvMdvv3OYQ)

On page load, we fetch content from Hasura with the images. When we select one of them, we make another request for the tags of that image.

When we upload an image, we persist that image to storage, save its reference to Hasura, and return that to the client. Once that round trip is complete, we request the tags for that image and display them in the UI.

## How Hasura Cloud helps

Debugging serverless workflows like this can be difficult as we are waiting for asynchronous behaviors to execute in the background. Fortunately, Hasura Cloud has a monitoring solution that allows us to see which APIs are being called, what data was passed in, and how well they are performing.

![Tutorial: Build low code apps with Bubble and Hasura APIs](https://lh3.googleusercontent.com/gIVHiBpvhwz83_Onbk9xEVRXyeyPtpPSFbIriO62udWRbRReF-6VjhnzNXdRB8b7uRh3_Q1x3J_qxwSgEsDVlxoeQBtIqoRPc4luHEray072EkMw5FkQclP7Ox7xX6aUDSUfjNKG)

Functionality like this gives us complete observability of our low-code stack to see what’s happening in our front-end and the backing data layer.

## Closing

We’ve consumed an AI-powered image tagging service without writing any custom code, persisted our objects to storage, and navigated the content. Best of all, tools such as Bubble allow a wider range of architects to analyze the business use-case of a customer and implement a functional and effective solution without a lot of front-end specific knowledge.

Low-code will continue to be a mainstay as we see the continual offloading of business logic and corporate IP handled at an abstracted data layer and thinner and more agile front-ends simply consuming these serverless behaviors.