<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sanjeeb Lama on Medium]]></title>
        <description><![CDATA[Stories by Sanjeeb Lama on Medium]]></description>
        <link>https://medium.com/@dreamer.warrior?source=rss-d9d4a53513ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*HS1uDlrAzhd8jR2YjQOb2A.jpeg</url>
            <title>Stories by Sanjeeb Lama on Medium</title>
            <link>https://medium.com/@dreamer.warrior?source=rss-d9d4a53513ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:13:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dreamer.warrior/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Dynamic Form Field in Bubble.io: A Step-by-Step Guide]]></title>
            <link>https://articles.wesionary.team/creating-dynamic-form-field-in-bubble-io-a-step-by-step-guide-839015a4d134?source=rss-d9d4a53513ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/839015a4d134</guid>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[no-code-development]]></category>
            <category><![CDATA[bubble-io]]></category>
            <dc:creator><![CDATA[Sanjeeb Lama]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 05:11:46 GMT</pubDate>
            <atom:updated>2024-01-29T05:11:46.441Z</atom:updated>
            <content:encoded><![CDATA[<p>In my journey with Bubble.io, I’ve encountered features that are not immediately obvious but highly useful.</p><p>As I learn and build, I’m eager to share these insights. Today, let’s dive into creating dynamic form fields in Bubble — a simple yet powerful tool for your projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*H9eeG8N5Gzmgj9jD4owYfA.gif" /><figcaption>GIF: Dynamic Form Field</figcaption></figure><blockquote>[ <a href="https://prototype-56565.bubbleapps.io/version-test">Click here to see the demo</a> ]</blockquote><p><a href="https://prototype-56565.bubbleapps.io/version-test">Bubble - Visual Programming</a></p><h3>Structure of the guide:</h3><ol><li>Setting Up the Database and Enabling Auto-bind</li><li>Visual Elements Hierarchy</li><li>Attaching Data Sources and workflows</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JvgilwQsIqeowd8ikhWpTw.png" /><figcaption>fig: Cover Image for the Article</figcaption></figure><h3>1. Setting Up the Database and Enabling Auto-bind</h3><h4>1.a. Data type and its fields</h4><p>For this demonstration, we will keep things straightforward. We’ll be creating a data type called Product in Bubble.io, which will include the following custom fields:</p><ol><li><strong>ID</strong>: Unlike typical usage, the &#39;ID&#39; field serves a specific purpose here. It&#39;s not for uniqueness, as Bubble.io automatically provides unique identifiers for each row. Instead, the &#39;ID&#39; field is crucial for creating a new row in our table when the &#39;Add Component&#39; button is clicked. It acts as a trigger for adding new product entries.</li><li><strong>Name</strong>: This field will store the name of the product. It’s a text field where users can enter the product’s name.</li><li><strong>Price</strong>: This field will hold the price of the product. It should be set up as a number field to accommodate numerical values, enabling calculations or sorting based on price.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ebCR-PdqiLQ9s7kuksHsLQ.png" /><figcaption>Fig: Data type and it’s fields</figcaption></figure><h4>1.b. Setup Privacy Rule and Allow auto-bind:</h4><p>In Bubble.io, managing data privacy and enabling auto-binding are critical steps in ensuring both the security and dynamic responsiveness of your application. Let’s see how to set this up for our Product data type.</p><h4>i. Setting Up Privacy Rules</h4><p>Privacy rules are essential to control who can view or modify data in your application. For our demonstration, we’ll implement a basic rule:</p><ul><li><strong>Rule</strong>: When the current user is logged in.</li><li>This rule means that only authenticated users who are logged into your application can interact with the data. It’s a fundamental level of security that prevents unauthorized access to your data.</li></ul><h4>ii. Enabling Auto-binding</h4><p>Auto-binding allows users to modify data in the database directly from the input elements in the UI, without the need for additional workflows.</p><ul><li>For the sake of simplicity in this demo, we will allow everyone to auto-bind. This means that any user, as long as they are logged in, can directly modify or add product data through the UI.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PLHgLO9dRzPQ6fWnoli08w.png" /><figcaption>fig: Privacy Rule and Auto-bind settings</figcaption></figure><p>Remember, in a real-world application, you might want to set more specific rules based on user roles or other criteria to ensure data integrity and security.</p><p>By setting up these privacy rules and enabling auto-binding, we create a framework that balances user accessibility with data security. It’s a crucial step in making our application both functional and safe for users.</p><h3>2. Visual Elements Hierarchy:</h3><p>In this part of our guide, we will outline the hierarchy of the visual elements needed for our dynamic form fields in Bubble.io.</p><p>Although we won’t delve deeply into the step-by-step process of creating these visual elements (as it is quite straightforward even for beginners), I will provide a structure that you can follow to set up your interface effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*PJNA1vG5Z-maInHBMdJIYw.png" /><figcaption>fig: Element hierarchy</figcaption></figure><h4>2.a. Hierarchy of Elements:</h4><ul><li><em>Group A</em>: This is a container or parent group on the page.</li><li><em>Text B</em>: a title or a label.</li><li><em>Group Contents</em>: A subgroup or a container within Group A that holds content related to the products.</li><li><em>RepeatingGroup Products</em>: This repeating group dynamically displays a list of products. It serves as a container that will repeat its contents for each product entry in the list.</li><li><em>Group Product</em>: A subgroup within the repeating group, which represents a single product entry.</li><li><em>Group Product Fields</em>: A further subgroup that holds the fields associated with a single product.</li><li><em>Group Name</em>: Contains elements related to the product’s name.</li><li><em>Text Regular</em>: A static text element, serving as a label for the product name.</li><li><em>Input Product</em>: An input field where the user can enter the name of a product.</li><li><em>Group Price</em>: Contains elements related to the product’s price.</li><li><em>Text Price</em>: A static text element, a label for the product price.</li><li><em>Input Price</em>: An input field where the user can enter the price of a product.</li><li><em>Button DELETE</em>: A button that, when clicked, may be set up to delete the specific product entry within the repeating group.</li><li><em>Button Add</em>: This button is outside and probably below Group A and is used to add new product entries to the list within the RepeatingGroup Products.</li></ul><p>The hierarchy suggests that there is a system in place for displaying, adding, and deleting product entries, with specific areas for users to input and view product names and prices. <br><strong>Each product entry can be individually manipulated, with options to edit or remove as needed.</strong></p><h4>2.b. Additional Resources for Creating Visual Elements:</h4><p>For those who are new to Bubble.io or need a refresher on creating visual elements, I recommend this helpful YouTube tutorial:</p><blockquote>[<a href="https://www.youtube.com/watch?v=a01LP-zsrJA">Introducing Bubble: A Beginners Tutorial 2024</a>]</blockquote><p>It provides a comprehensive guide that can assist you in understanding and implementing the visual aspects of Bubble.io.</p><p>By setting up these visual elements in a structured and hierarchical manner, you ensure a clean, user-friendly interface that supports the dynamic functionality of your application. Remember, the key is to keep the design intuitive and straightforward, enhancing the overall user experience.</p><h3>3. Attach Data Sources and workflows</h3><p>Integrating our visual components with the database and establishing workflows is essential for our dynamic form to operate smoothly. This process links user actions to our backend logic and data.</p><h4><strong>3.a. Group Contents</strong></h4><p>Within our Group Contents, we need to create and manage two custom states:</p><ol><li><strong>ID (state of type number)</strong>: The ‘ID’ state, already introduced in the database setup, is used here as a counter for creating new rows in our table when ‘Add Component’ is clicked, preparing the UI for new product entries.</li><li><strong>List of Products (state of type Product)</strong>: This state keeps track of all Product entries, updating the display in RepeatingGroup Products as items are added or removed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ItGq363Rsbrha_lv5fzVw.png" /><figcaption>fig: Group Contents and custom states</figcaption></figure><h4><strong>3.b</strong>. RepeatingGroup Products</h4><p>The RepeatingGroup Products is configured to display a list of product entries:</p><ul><li>Type of content: Set to ‘Product’, which indicates that the repeating group will display items from the Product data type.</li><li>Data source: Connected to ‘Group Contents’s list of products’, meaning it will dynamically display a list based on the custom state that holds the product entries.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c6lPBvLwLanJQsGk2pvnAA.png" /><figcaption>fig: Visual element hierarchy and RG data source and type</figcaption></figure><h4>3.c. Data Source Configuration for Dynamic Product Entries</h4><p>Within the RepeatingGroup Products, we have several nested groups, each with a specific role and data configuration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmMN9ioi31JXJCDgjeX0Cw.png" /><figcaption>fig: Group of Elements and it’s data sources</figcaption></figure><ul><li><strong>Group Product</strong>: This group is set to display the content of the type ‘Product’, and its data source is ‘Current cell’s Product’, meaning that it will display the details of the product in the current cell of the repeating group.</li><li><strong>Group Product Fields</strong>: This is a subgroup of ‘Group Product’ and inherits its content type as ‘Product’. Its data source is ‘Parent group’s Product’, indicating that it will use the product data from its parent group, which is the individual cell of the repeating group.</li><li><strong>Group Name and Group Price</strong>: These are further nested within ‘Group Product Fields’ and are configured similarly, with their content type set to ‘Product’. They also use ‘Parent group’s Product’ as their data source, meaning they display the name and price of the product respectively from the same parent group data.</li></ul><p>This setup ensures that each cell in the repeating group displays a complete set of product information, with the name and price fields pulling data from the current product being iterated over in the repeating group.</p><h4>3.d. Configuring Input Fields for Auto-Binding in Bubble.io</h4><ul><li><strong>Input Product</strong>: This input field is configured for text entry, with auto-binding enabled to allow direct updating of the ‘Name’ field in the database for the parent element’s thing (the current product entry).</li><li><strong>Input Price:</strong> Similarly, this field is set up for numerical input, specifically integers, reflecting its use for price data. Auto-binding is also enabled here, linked to the ‘Price’ field in the database.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCP2EdcRPVdjxiAAK6SFcQ.png" /><figcaption>fig: Input Product and Price Property Editor</figcaption></figure><h4>3.e. Configuring the ‘Add’ Button Workflow in Bubble.io</h4><p>This workflow is essential for enabling users to continuously add new products to the application in a user-friendly and efficient manner.</p><ul><li><strong>Step 1: “Create a new Product”</strong> — This action creates a new entry in the Product database. The ‘id’ field is set to increment by 1 from the last entry’s ID, which is managed by the state ‘Group Contents’ id’.</li><li><strong>Step 2: “Set states list of products”</strong> — The state ‘list of products’ of the Group Contents is updated to include the new product created in Step 1. This dynamically updates the list without needing to refresh the page.</li><li><strong>Step 3: “Reset relevant inputs” </strong>— This action resets the input fields, preparing them for a new entry. It’s not fully shown in the image, but typically, this would clear the current values in the input fields so the user can enter a new product without manually deleting the old data.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M4AQZcioSoCOxZ2oE2oV_w.png" /><figcaption>fig: Workflow for Add Button</figcaption></figure><h4>3.f. Configuring the ‘DELETE’ Button Workflow in Bubble.io</h4><p>This workflow is triggered when a user clicks the ‘Delete’ button associated with a product entry, streamlining the user experience by allowing for the immediate removal of products from the list.</p><ul><li><strong>Step 1: “Delete Product”</strong> — This action is set to delete the specific product that corresponds to the ‘Parent group’s Product’. It’s the actual command that removes the product from the database.</li><li><strong>Step 2: “Set states list of products”</strong> — After deleting the product entry, this action updates the ‘list of products’ state within the ‘Group Contents’. It removes the deleted item from the list, which is reflected in the ‘RepeatingGroup Products’ on the UI. This ensures that the displayed list remains accurate without requiring a page refresh.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BcNs2P_YnY_Bx-u44fTkjg.png" /><figcaption>fig: Workflow for Delete Button</figcaption></figure><p>We’ve explored the creation of dynamic forms in Bubble.io, demonstrating how to add and delete product entries with ease. The steps provided serve as a blueprint for building data-driven components in your applications. Embrace these techniques to enhance user engagement and streamline your Bubble.io projects.</p><p>Happy building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=839015a4d134" width="1" height="1" alt=""><hr><p><a href="https://articles.wesionary.team/creating-dynamic-form-field-in-bubble-io-a-step-by-step-guide-839015a4d134">Creating Dynamic Form Field in Bubble.io: A Step-by-Step Guide</a> was originally published in <a href="https://articles.wesionary.team/">wesionaryTEAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Checkbox Fields in Bubble.io for Update Operations]]></title>
            <link>https://articles.wesionary.team/checkbox-fields-in-bubble-io-for-update-operations-4fdab0d70545?source=rss-d9d4a53513ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fdab0d70545</guid>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[bubble-io]]></category>
            <category><![CDATA[forms]]></category>
            <category><![CDATA[multiple-checkbox]]></category>
            <category><![CDATA[crud]]></category>
            <dc:creator><![CDATA[Sanjeeb Lama]]></dc:creator>
            <pubDate>Mon, 29 Jan 2024 05:11:43 GMT</pubDate>
            <atom:updated>2024-01-29T05:11:43.645Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_YxMlgMLyRCb2b38ky7tQQ.png" /><figcaption>fig: Cover for the Article</figcaption></figure><p>Forms are the backbone of user interaction in any application, and mastering CRUD (Create, Read, Update, Delete) operations is fundamental.</p><p><strong>But</strong> when it comes to updating <strong>checkboxes</strong> in Bubble.io, things get a bit <strong>complicated</strong>. Unlike text or number fields that show data clearly, checkboxes hide a complex challenge — they don’t easily reveal what a user previously selected. Solving this took time and patience, but the answer is here.</p><p>In this article, I’ll guide you through the process of displaying selected checkbox options in the updated state of a form in Bubble.io, ensuring that your users’ selections are clearly and effectively shown.</p><h3>Structure of the guide:</h3><ol><li>Configuring Option Set and Database</li><li>Visual Elements Hierarchy</li><li>Attaching Workflow to Checkbox</li><li>Attaching Workflow to the Save Button</li><li>Attaching Workflow to When Page is Loaded</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MbfeNXU9LbcHKlGXGmoHhA.png" /><figcaption>fig: Checkbox and Dataflow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*CJzQIm7raa7KJDzbKZR3LA.gif" /></figure><blockquote>[ <a href="https://checkbox-issue-85969.bubbleapps.io/version-test">Click here to see the demo</a> ]</blockquote><p><a href="https://checkbox-issue-85969.bubbleapps.io/version-test">Bubble - Visual Programming</a></p><h3>1. Configuring Option Set and Database</h3><h4>Option Sets:</h4><p>Option Sets in Bubble.io are used to define a list of static choices that can be used across your app. The following image shows an Option Set named Options which represents the different choices for a checkbox field.</p><ul><li><strong>Option Set Name:</strong> ‘Options’ is the name of the Option Set, which acts as a reference point throughout the app.</li><li><strong>Attributes</strong>: The only attribute shown is ‘Display’, which is a built-in attribute that holds the text to be displayed for each option.</li><li><strong>Options</strong>: Listed are four options (Option 1, Option 2, Option 3, Option 4), which are the values that can be selected by the user. These options can be modified, reordered, or deleted as needed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UOfjOBEL17G25-MOe3LE7w.png" /><figcaption>Fig: Option Set, its attribute and options</figcaption></figure><h4>Database:</h4><p>The second image represents a data type in the database called ‘<strong>demo</strong>’, which is used to store user selections from the checkboxes.</p><ul><li><strong>Field Type Name: ‘demo’</strong> is the data type name, which categorizes what kind of data is stored here.</li><li><strong>Fields: selected-options</strong>: A field of type ‘List of Optionses’, indicating it stores multiple selections from the defined Option Set ‘Options’.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4JjSmpv_2AI962fVJcecA.png" /><figcaption>Fig: Data type and its fields</figcaption></figure><h3>2. Visual Elements Hierarchy:</h3><p>In this part of our guide, we will outline the hierarchy of the visual elements needed for our checkbox form fields in Bubble.io.</p><p>Although we won’t delve deeply into the step-by-step process of creating these visual elements (as it is quite straightforward even for beginners), I will provide a structure that you can follow to set up your interface effectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgB0gFulGYT9xMISW6CqXA.png" /><figcaption>fig: Visual element hierarchy</figcaption></figure><ul><li><strong>Group Options Container</strong>: This is the main grouping that contains all related elements for the options. It acts as a container for organizational purposes and possibly for styling.</li><li><strong>Text List of Options</strong>: A text element that serves as a heading or label for the list of options below it.</li><li><strong>RepeatingGroup Options</strong>: This is a repeating group element, which is used in Bubble.io to iterate over a list of items — in this case, options from the Option Set. Each cell in this repeating group corresponds to an individual option that can be selected by the user.</li><li><strong>Custom State ‘selected_item’:</strong> The RepeatingGroup Options has a custom state named selected_item, which is of type &#39;Options&#39; and is a list. This custom state is used to keep track of which options have been selected by the user as they interact with the form.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4IiPvD-jA1nFQGw0bQyDQ.png" /><figcaption>fig: Data Source and States and conditions</figcaption></figure><ul><li><strong>Checkbox Current cell’s Option</strong>: Inside each cell of the RepeatingGroup, there is a checkbox element. This checkbox is linked to the current cell’s option, meaning it will display the option from the Option Set for each cell in the RepeatingGroup.</li><li><strong>Preset Status of Checkbox:</strong> The preset status of each checkbox is set to ‘Dynamic’, which allows the checked state to be determined by a condition.</li><li><strong>Dynamic Status Condition:</strong> The condition set for the dynamic status is RepeatingGroup Options&#39;s selected_item contains Current cell&#39;s Options. This means that the checkbox will be checked if the option it represents is included in the selected_item list. Essentially, when the page loads or when the repeating group&#39;s state changes, each checkbox checks whether its corresponding option is in the selected_item list and updates its checked status accordingly.</li><li><strong>Button Save</strong>: Below the RepeatingGroup, there is a ‘Save’ button which is used to save the state of the selected checkboxes when clicked. It is likely connected to a workflow that updates the user’s selections in the database.</li></ul><h3>3. Attaching Workflow to the Checkbox</h3><h4>Case 1: When This Checkbox is checked</h4><ul><li><strong>Trigger Event</strong>: The workflow is initiated when a checkbox, referred to as “Checkbox Current cell’s”, is checked. This is determined by the condition “This Checkbox is checked”.</li></ul><p><strong>Workflow Steps:</strong></p><ul><li><strong>Step 1: Set states </strong><strong>selected_itemof RepeatingGroup Options</strong>: This action sets a custom state, named selected_item, for the RepeatingGroup Options.</li><li><strong>Element</strong>: The action targets the RepeatingGroup Options.</li><li><strong>Custom state:</strong> The state being modified is selected_item, which is a list of selected options.</li><li>The Value that is being set for the selected_item state is updated to include the option from the current cell that has been checked. This is done using the expression RepeatingGroup Options&#39;s selected_item plus item Current cell&#39;s Options, which adds the newly checked option to the list of already selected items.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uHcVmybiEMx4juqAJgMmaQ.png" /><figcaption>fig: Workflow for checked</figcaption></figure><p>This workflow is designed to update a list state in real-time as checkboxes are checked, keeping track of all the selected options within the repeating group. It’s a crucial part of managing a multi-select scenario with checkboxes, ensuring that the application’s state reflects the user’s choices accurately.</p><h4>Case 2: When This Checkbox isn’t checked</h4><ul><li><strong>Trigger Event:</strong> The workflow is activated when the value of a checkbox, identified as “Checkbox Current cell’s”, changes and the checkbox becomes unchecked. This is specified by the condition “This Checkbox isn’t checked”.</li></ul><p><strong>Workflow Steps:</strong></p><ul><li><strong>Step 1: Set states selected_item… of RepeatingGroup Options:</strong> This action updates a custom state for the RepeatingGroup that contains the checkboxes.</li><li><strong>Element</strong>: The action targets the RepeatingGroup Options.</li><li><strong>Custom state:</strong> The state being modified is selected_item, which is a list of selected options.</li><li><strong>Value:</strong> The value set for selected_item is adjusted by removing the option associated with the current cell of the repeating group that has been unchecked. This is done using the expression RepeatingGroup Options&#39;s selected_item minus item Current cell&#39;s Options, which effectively removes the deselected option from the list.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7canNXRxA7xEI2sK4r54Iw.png" /><figcaption>fig: When Checkbox isn’t checked</figcaption></figure><p>This workflow ensures that when a user unchecks an option, it is removed from the list of selected items, keeping the application’s state consistent with the user’s current selections.</p><h3>4. Attaching Workflow to the Save Button:</h3><p>This workflow ensures that when a user makes selections using the checkboxes and hits ‘Save’, their choices are captured and stored in the database, allowing for the update of the ‘demo’ record with the new selections.</p><p><strong>Step 1: Make changes to the demo…:</strong> This action is set to make changes to a specific entry in the database, which is of type ‘demo’.</p><ul><li><strong>Thing to change</strong>: It’s targeting the first item found in a search for the ‘demo’ data type entries, indicating it will update a specific record.</li><li><strong>Field to change:</strong> The field being updated is ‘selected options set list’, which is likely a list field within the ‘demo’ data type designed to store multiple selected options from the checkboxes.</li><li><strong>Value to set</strong>: The value is being set to the list of selected items from the ‘RepeatingGroup Options’. This means that the workflow will collect all the selections made within the repeating group and apply them to the ‘selected options set list’ field in the ‘demo’ database entry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sV9wL4KtsFBh_5Rn3myiyQ.png" /><figcaption>fig: Workflow to add Selected Options to the Data field</figcaption></figure><blockquote>For this demonstration, the workflow is configured to update the first item in the ‘demo’ data type. However, in a live application, you would typically set this to update the current user’s data or apply other conditions to ensure that the correct entry is being updated.</blockquote><blockquote>The workflow can be tailored to match specific criteria based on your application’s requirements, such as the user’s ID, a unique form identifier, or any other relevant condition.</blockquote><h3>5. Attaching Workflow to When Page is Loaded:</h3><p>This is the final workflow for creating a dynamic form where user selections are persistent. It ensures that when a user revisits the form, their previous selections are pre-loaded and displayed accurately, providing a seamless experience for editing or reviewing information.</p><ul><li><strong>Trigger Event</strong>: The workflow starts automatically upon the loading of the page, as indicated by “When Page is loaded”.</li></ul><p><strong>Workflow Steps:</strong></p><ul><li><strong>Step 1: Set states selected_item… of RepeatingGroup Options:</strong> This step involves initializing or updating a custom state based on the data that’s already been saved.</li><li><strong>Element</strong>: The target for this action is RepeatingGroup Options, which is the element containing the checkboxes.</li><li><strong>Custom state</strong>: The custom state being set is selected_item. This state is used to keep track of which options should be displayed as checked when the page loads.</li><li><strong>Value</strong>: The value assigned to the selected_item state comes from a search query, which retrieves the first item&#39;s selected options from the database. This indicates that when the page loads, the application will automatically check the checkboxes that correspond to the saved selections in the database.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PutFGxjPd9mlEu4Vm-6ciA.png" /><figcaption>fig: Workflow to Populate the state when the page is loaded</figcaption></figure><p>Mastering checkboxes in Bubble.io forms is key to creating a dynamic and user-friendly experience. We’ve tackled the nuances of updating checkboxes, from setting up your database to ensuring that user selections persist across sessions.</p><p>As you implement these steps, you’ll find that what once seemed complex becomes second nature. Stay tuned for more Bubble-related insights and tutorials to elevate your app development journey!</p><p>Happy building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fdab0d70545" width="1" height="1" alt=""><hr><p><a href="https://articles.wesionary.team/checkbox-fields-in-bubble-io-for-update-operations-4fdab0d70545">Checkbox Fields in Bubble.io for Update Operations</a> was originally published in <a href="https://articles.wesionary.team/">wesionaryTEAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automate Lighthouse Audit for FREE: Catch performance issues early]]></title>
            <link>https://articles.wesionary.team/automate-lighthouse-audit-for-free-catch-performance-issues-early-4d0840209368?source=rss-d9d4a53513ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d0840209368</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[lighthouse]]></category>
            <category><![CDATA[core-web-vitals]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[monorepo]]></category>
            <dc:creator><![CDATA[Sanjeeb Lama]]></dc:creator>
            <pubDate>Thu, 25 May 2023 01:59:36 GMT</pubDate>
            <atom:updated>2023-05-25T01:59:36.483Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome 🎊 to this technical guide on automating Lighthouse audits. We’ll cover everything you need to know, from setting up Lighthouse CI to integrating it into your GitHub Action workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KVzvp3BLVnMNsvs7GW2mRw.jpeg" /><figcaption>Image: Lighthouse Audit Report</figcaption></figure><h3>💡Heads up: What is the structure of this Guide?</h3><ol><li><strong>Introduction to Lighthouse:</strong></li></ol><ul><li>Understand what Lighthouse is and its importance in web development.</li></ul><p>2. <strong>Adding Lighthouse CI to </strong><a href="https://nextjs.org/"><strong><em>Next.js</em></strong></a><strong><em> and </em></strong><a href="https://turbo.build/"><strong><em>TurboRepo</em></strong></a><strong><em> Locally:</em></strong></p><ul><li>Automating the audit process using a single command.</li><li>Screenshots are provided for each step to enhance clarity.</li><li><em>P.S. You do not need to </em><strong><em>FOLLOW FOR BOTH.</em></strong></li></ul><p>3. <strong>Automate Lighthouse Audit using Github Action in PR</strong></p><ul><li>Learn how to integrate Lighthouse CI with GitHub Actions.</li><li>Deploy the Next.js app to Vercel.</li><li>Automate the Lighthouse audit for every pull request (PR) and preview link provided by the VERCEL.</li><li><em>Note: This section may require acquiring keys, tokens, and IDs, but the effort will be worthwhile.</em></li></ul><p>4. <strong>Managing Lighthouse Config Files:</strong></p><ul><li>Understand how to control Lighthouse config files.</li><li>Learn how to customize and optimize the Lighthouse configuration for specific needs.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FCd9XcHdZEIcaA%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fanimation-doughnuts-lighthouse-Cd9XcHdZEIcaA&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExODRhYjM0ZTZmYTQzZmM1NWQ3YmNjMDc4YTc2MTBhY2RmOTkwMjA5YyZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FCd9XcHdZEIcaA%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/45f4c46ba5760bba78d50bd53c14969e/href">https://medium.com/media/45f4c46ba5760bba78d50bd53c14969e/href</a></iframe><h3>#1: <strong>Introduction to Lighthouse</strong></h3><p>Lighthouse is an open-source tool developed by Google to measure the performance, accessibility, and best practices of web pages. It will help you catch performance issues early on in the development process and ensure that your website is fast and optimized for your users.</p><blockquote>For more info Check this out:</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fd98CAgQNeaM%3Fstart%3D2%26feature%3Doembed%26start%3D2&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dd98CAgQNeaM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fd98CAgQNeaM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ac872f59d46c874c8f70942ba671624/href">https://medium.com/media/9ac872f59d46c874c8f70942ba671624/href</a></iframe><h3><strong>#2: Adding Lighthouse CI to </strong><a href="https://nextjs.org/"><strong><em>Next.js</em></strong></a><strong><em> and </em></strong><a href="https://turbo.build/"><strong><em>TurboRepo</em></strong></a><strong><em> Locally:</em></strong></h3><blockquote>P.S. You do not need to FOLLOW FOR BOTH. You can follow either one of them as per your requirement.</blockquote><ul><li>Make sure you’ve set up your <a href="https://nextjs.org/">Next.js</a> or <a href="https://turbo.build/">TurboRepo</a> app.</li><li>Then you can get started by installing Lighthouse CI as a development dependency in our application.</li><li>On your root folder:</li></ul><pre>// Next Js<br>yarn add --dev @lhci/cli @lhci/server <br><br>//Turbo <br>yarn workspace your-workspace-name add --dev @lhci/cli @lhci/server</pre><ul><li>Create a file called lighthouserc.js on your current working directory ( that may be your root folder or <strong><em>workspace</em>.</strong>)</li><li>lighthouserc.js is a <a href="https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/configuration.md"><strong><em>configuration file</em></strong></a> for lighthouse CI.</li><li>The structure of the config file is segmented by command.</li></ul><pre>// For running on local env <br><br>module.exports = {<br>	ci: {<br>		collect: {<br>			url: &#39;&lt;http://localhost:3000&gt;&#39;,<br>			startServerCommand: &#39;yarn run dev&#39;,<br>		},<br>		assert: {<br>		  preset: &#39;lighthouse:recommended&#39;<br>		},<br>		upload: {<br>			target: &#39;temporary-public-storage&#39;,<br>		},<br>	},<br>};</pre><pre>// For running on prod env<br><br>module.exports = {<br>	ci: {<br>		collect: {<br>			url: [`https://${process.env.PREVIEW_URL}`],<br>			startServerCommand: process.env.NODE_ENV === &#39;production&#39; ? undefined : &#39;yarn run dev&#39;,<br>		},<br>		assert: {<br>			// preset: &#39;lighthouse:recommended&#39;,<br>			preset: &#39;lighthouse:no-pwa&#39;,<br>		},<br>		upload: {<br>			target: &#39;temporary-public-storage&#39;,<br>		},<br>	},<br>};</pre><ul><li>Add following command to your current working directory package.json</li></ul><pre>&quot;test:lighthouse&quot;: &quot;yarn run build &amp;&amp; lhci autorun&quot;</pre><ul><li>Run Lighthouse audit in local env from root of your current working directory.</li></ul><pre>//Next Js<br>yarn run test:lighthouse <br><br>// Turbo<br>yarn workspace your-workspace-name run test:lighthouse</pre><h4><strong>#A: Local Output: Case Success</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBPrXqiVPL5fiFAVfW3-ZQ.jpeg" /></figure><h4>#B: Local Output: Case Failure</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gx4PaKC6zQWv7VJ6_B5s7A.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FJLFq4Jh5bSJEDHZjSB%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fstudiosoriginals-good-job-cheerleader-you-did-it-JLFq4Jh5bSJEDHZjSB&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExZWFjMmI4YmQ5ZGI1ZWYyZjczOTNmYzJhMTY3YmEwYzY4ZTU1NGNiYiZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FJLFq4Jh5bSJEDHZjSB%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/d96370dc67badee024ee7f09e2996240/href">https://medium.com/media/d96370dc67badee024ee7f09e2996240/href</a></iframe><blockquote>You have completed #2: Adding Lighthouse CI to <a href="https://nextjs.org/">Next.js</a> and <a href="https://turbo.build/">TurboRepo</a> Locally:</blockquote><h3>#3: Automate Lighthouse Audit using Github Action in PR</h3><p>You’ll need to do some configurations in order to add Lighthouse CI in your GitHub action workflow. You need to follow steps:</p><p><strong>A. Configure Lighthouse CI to your GitHub repo</strong></p><p><strong>B. Deploy your project on Vercel:</strong></p><ul><li>For Next.js apps</li><li>For Turbo Repo:</li></ul><p><strong>C. Set up the required secret keys in your GitHub repository:</strong></p><ul><li>Configure the following secret keys: <strong><em>LHCI_GITHUB_APP_TOKEN</em></strong><em>, </em><strong><em>VERCEL_PROJECT_ID</em></strong><em>, and </em><strong><em>VERCEL_TOKEN</em></strong>.<br>(Note: These keys are necessary for the integration to work.)</li></ul><p><strong>D. Add Github Action Workflow for deployment and running lighthouse Audit</strong></p><ul><li>For Next.js</li><li>For Turbo Repo</li></ul><h3>A. Configure Lighthouse CI to your GitHub repo</h3><ol><li>Go to this link <a href="https://github.com/apps/lighthouse-ci">https://github.com/apps/lighthouse-ci</a>.</li></ol><p><a href="https://github.com/apps/lighthouse-ci">Build software better, together</a></p><ul><li>Click on Configure button.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pz858aD-rh8x-DKuBx2wXQ.png" /></figure><ul><li>You’ll need to select the account. For this project I will be installing in my personal repo.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K57Z9NucZ4ImdcIH0l73qA.png" /></figure><p>You might need to confirm the access by inputing the authentication code or password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EY4oBgz4ztthMc3DH1SZPQ.png" /></figure><p>Select the Repo in which you would like to install the Lighthouse CI and click on Install and Authorize.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wiUTBouk5CIDaRQ7xsUvmQ.png" /></figure><p>c. You will see something like this. You need to copy the <strong><em>LHCI_GITHUB_APP_TOKEN</em></strong><em> </em>key. Make sure you do not lose it for a while.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JcNvaKVd4xjCquRCvcSHJQ.png" /></figure><h3>B. Deploy Project on Vercel</h3><ol><li>Go to Vercel:</li><li>Login / Signup</li><li>Add your GitHub to your Vercel account</li><li>You can either click on add a new project or go to this <a href="https://vercel.com/new"><strong>link</strong></a>. You will see the following view:</li><li>Select the repo you want to deploy</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iwuFYlOWAkrc5Nd3kuFPUQ.png" /></figure><h3>For Next Js:</h3><ol><li>Select the Next JS project you want to deploy. You will see something like below:</li><li>Click on Deploy.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wppe6eaZHhg1s2TjMdeEzw.png" /></figure><p>Wait for a while for it to deploy. and after a while. You will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBkrPQFzfoFaj1g-X2bZKQ.png" /></figure><h3>For Turbo Repo:</h3><ul><li>Since its a mono repo you’ll need to select which root directory of the app you want to deploy.</li><li>In this case I am deploying apps/docs workspace.</li><li>You might want to override the build command to build only apps/docs workspace and to not get any potential build error <br>yarn workspace docs run build</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQz30Z0_IkCck76Uowe-ig.png" /></figure><p>Hit deploy:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fUZvbG1lsUtF9LFks2leMw.png" /></figure><blockquote>🚧 Since we will add GitHub workflow to deploy and run the lighthouse audit manually. I suggest you to disable the automatic deployment of project in the Vercel. To save resources.</blockquote><p>You can do that by going on the Settings tab and on your left click on Git Tab and then click on Disconnect. No need to worry we will still be able to deploy. 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9RRCytJuglhvdzsJD0OrVA.png" /></figure><h3>C1: Acquire Secret keys: [ VERCEL_PROJECT_ID and VERCEL_TOKEN ]</h3><h4>For: VERCEL_PROJECT_ID</h4><ol><li>Go to the settings of your project and on General tab</li><li>Scroll down</li><li>You will see Project ID</li><li>Copy the keys as VERCEL_PROJECT_ID</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*araUA_gTn7rxExE7pU6eSA.png" /></figure><h4>For: VERCEL_TOKEN</h4><ol><li>Go to your dashboard and click on settings:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRdr8VB96sSuwFOx-ZwNvw.png" /></figure><ol><li>Click on Tokens on your left hand side:</li><li>You’ll need to add following:</li></ol><ul><li>Token Name</li><li>Scope</li><li>Expiration date as you like:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMQq7uIirlKfkKuPZ3lNyg.png" /></figure><ul><li>Click on Create button. You will get the following:</li><li>Copy and save it as VERCEL_TOKEN</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R1mhw4ZF188XWKQihI7Zog.png" /></figure><h3>C: Setup secret keys to your GitHub project</h3><p>Now that we have all the keys we can add these secret keys to our Github repo.</p><ol><li>Go to your repo and click on Settings tab</li><li>Click on <strong><em>Secrets and Variables</em></strong> on your left panel and then to <strong>Actions</strong> tab</li><li>Actions secret and Variables page will open.<br>- Click on New repository secret button</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8gIZQd2C7ldxoMHrqFOatQ.png" /></figure><ul><li>Add Name and Secrets one by one.</li><li>Name: LHCI_GITHUB_APP_TOKEN</li><li>Secret: Keys you copied.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tp6xHE1_9eGwlluoezh1zw.png" /></figure><p>After adding all there keys you will have something like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZHZYAdKKByyd060NwHysg.png" /></figure><blockquote>🙌🏼 You’re doing a good job</blockquote><h3>D. Add GitHub Action Workflow for deployment and running lighthouse Audit</h3><ul><li>Create a github workflow</li></ul><ol><li>Create .github/workflows folders in your root directory</li><li>Create a file named main.yml</li></ol><h3>For Next Js Project:</h3><pre>name: Lighthouse CI<br><br>on: push<br><br>jobs:<br>  build-deploy-test:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout Code<br>        uses: actions/checkout@v3<br><br>      - name: Use Node.js 16.x<br>        uses: actions/setup-node@v3<br>        with:<br>          node-version: 16.x<br><br>      - name: Install Dependencies<br>        run: yarn<br><br>      - name: Build App<br>        run: yarn run build<br><br>      - name: Deploy to Vercel<br>        uses: amondnet/vercel-action@v20<br>        with:<br>          vercel-token: ${{ secrets.VERCEL_TOKEN }}<br>          vercel-args: --yes<br><br>      - name: Wait for Deployment<br>        run: |<br>          echo &quot;Waiting for deployment to finish...&quot;<br>          preview_url=$(curl -s -H &quot;Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}&quot; &quot;&lt;https://api.vercel.com/v6/deployments?projectId=$&gt;{{ secrets.VERCEL_PROJECT_ID }}&amp;limit=1&quot; | jq -r &quot;.deployments[0].url&quot;)<br>          while [[ $(curl -sL -w &quot;%{http_code}\\\\n&quot; &quot;${preview_url}&quot; -o /dev/null) != &quot;200&quot; ]]; do sleep 10; done<br>          echo &quot;Deployment finished. Preview URL: $preview_url&quot;<br>          echo &quot;PREVIEW_URL=$preview_url&quot; &gt;&gt; $GITHUB_ENV<br><br>      - name: Run Lighthouse Tests<br>        run: |<br>          npm install -g @lhci/cli@0.11.x<br>          lhci autorun<br>        env:<br>          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}<br><br>      - name: Upload Lighthouse Reports<br>        uses: actions/upload-artifact@v2<br>        with:<br>          name: lhci-report<br>          path: &#39;./.lighthouseci&#39;</pre><h3>For Turbo Repo:</h3><pre>name: Lighthouse CI<br><br>on: push<br><br>jobs:<br>  build-deploy-test:<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout Code<br>        uses: actions/checkout@v3<br><br>      - name: Use Node.js 16.x<br>        uses: actions/setup-node@v3<br>        with:<br>          node-version: 16.x<br><br>      - name: Install Dependencies<br>        run: yarn<br><br>      - name: Build App<br>        working-directory: apps/web<br>        run: yarn run build<br><br>      - name: Deploy apps/web to Vercel<br>        uses: amondnet/vercel-action@v20<br>        with:<br>          vercel-token: ${{ secrets.VERCEL_TOKEN }}<br>          vercel-args: --yes<br>          build-dir: apps/web/.next<br><br>      - name: Wait for Deployment<br>        run: |<br>          echo &quot;Waiting for deployment to finish...&quot;<br>          preview_url=$(curl -s -H &quot;Authorization: Bearer ${{ secrets.VERCEL_TOKEN }}&quot; &quot;&lt;https://api.vercel.com/v6/deployments?projectId=$&gt;{{ secrets.VERCEL_PROJECT_ID }}&amp;limit=1&quot; | jq -r &quot;.deployments[0].url&quot;)<br>          while [[ $(curl -sL -w &quot;%{http_code}\\\\n&quot; &quot;${preview_url}&quot; -o /dev/null) != &quot;200&quot; ]]; do sleep 10; done<br>          echo &quot;Deployment finished. Preview URL: $preview_url&quot;<br>          echo &quot;PREVIEW_URL=$preview_url&quot; &gt;&gt; $GITHUB_ENV<br><br>      - name: Run Lighthouse Tests<br>        run: |<br>          cd apps/web <br>          npm install -g @lhci/cli@0.11.x<br>          lhci autorun<br>        env:<br>          LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}<br><br>      - name: Upload Lighthouse Reports<br>        uses: actions/upload-artifact@v2<br>        with:<br>          name: lhci-report<br>          path: &#39;./.lighthouseci&#39;</pre><h3>Explanation:</h3><p>The job “build-deploy-test” is defined, which specifies that the workflow should run on an Ubuntu environment. The following steps are then executed as part of the job:</p><ul><li>Checkout Code: Uses the “checkout” action to check out the code from the repository.</li><li>Use Node.js 16.x: Uses the “setup-node” action to set up Node.js 16.x as the runtime environment.</li><li>Install Dependencies: Runs the “yarn” command to install the app’s dependencies.</li><li>Build App: Runs the “yarn run build” command to build the app.</li><li>Deploy to Vercel: Uses the “vercel-action” action to deploy the app to Vercel.</li><li>Wait for Deployment: Waits for the Vercel deployment to finish and sets the preview URL as an environment variable.</li><li>Run Lighthouse Tests: Installs the Lighthouse CLI and runs the tests.</li><li>Upload Lighthouse Reports: Uses the “upload-artifact” action to upload the Lighthouse report artifacts.</li></ul><h3>Output:</h3><p><strong><em>Next Js:<br></em></strong>Checkout on here <a href="https://github.com/SanjeebLama/lighthouse-ci-test/pull/2">https://github.com/SanjeebLama/lighthouse-ci-test/pull/2</a></p><p><strong><em>Turbo<br></em></strong>Checkout on here <a href="https://github.com/SanjeebLama/frontend-skeleton/pull/19">https://github.com/SanjeebLama/frontend-skeleton/pull/19</a></p><p><strong>#A:</strong> Output demo</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWF3TMyrTGKQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWF3TMyrTGKQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWF3TMyrTGKQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1952d4e8e5a019511641b38388cc874d/href">https://medium.com/media/1952d4e8e5a019511641b38388cc874d/href</a></iframe><p><strong>#B</strong>: Output demo</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1J3WZY9SB2w%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1J3WZY9SB2w&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1J3WZY9SB2w%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/00ba9109f249c4ac33c859cb6c97da4e/href">https://medium.com/media/00ba9109f249c4ac33c859cb6c97da4e/href</a></iframe><p>If it fails for some reason, you will also get in anEMAIL.. 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fqhEDoQxNGvjoovNKhqb1A.png" /></figure><blockquote>🦉 “ A test failure is not a failure, it’s just a reminder that <strong>you’re human</strong>. And humans make mistakes. But that’s okay. Mistakes are how we learn and grow. So don’t be afraid to make mistakes. Just learn from them and <strong>keep</strong> <strong>moving forward….</strong> 🫡 “</blockquote><blockquote>- wise developer next desk</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FsyK7sJQC0yWfIiXJi9%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fyes-yesss-yesssss-syK7sJQC0yWfIiXJi9&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNmIzMTdiOTc5MTdiMmQxNjk3YTdhMzdkMjEyYmYzNjAzNzRjMDA5YSZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FsyK7sJQC0yWfIiXJi9%2Fgiphy-downsized-large.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/f2ee07bce82b20105c9ee773b17fd99e/href">https://medium.com/media/f2ee07bce82b20105c9ee773b17fd99e/href</a></iframe><blockquote>Phew.. That was long but … YESSSS! You have completed <strong>#3: Automate Lighthouse Audit using Github Action in PR</strong></blockquote><h3>#4: <strong>Managing Lighthouse Config Files:</strong></h3><ul><li>Good News, We have a lot of controls over these configurations.</li></ul><h4>Run Audit on multiple pages:</h4><p>You just need to add links in url array.</p><ol><li>For Local env put the following code in your lighthouserc.js:</li></ol><pre>module.exports = {<br> ci: {<br>  collect: {<br>   // You can add other pages in similar ways:<br>   url: [&#39;http://localhost:3000&#39;, &#39;http://localhost:3000/about&#39;],<br><br>   startServerCommand:<br>    process.env.NODE_ENV === &#39;production&#39; ? undefined : &#39;npm run start&#39;,<br>  },</pre><p>2. For <em>prod / dev</em> env put following code in your <em>lighthouserc.js</em>:</p><pre>module.exports = {<br> ci: {<br>  collect: {<br>   url: [<br>    `https://${process.env.PREVIEW_URL}`,<br>    `https://${process.env.PREVIEW_URL}/about`,<br>   ],<br>  },</pre><h4>Change Number of Runs:</h4><ul><li>By default it will run 3 times. We can change it as per our needs.</li><li>But it’s recommended to run audit more than once and then analyze.</li></ul><pre>{<br>  &quot;ci&quot;: {<br>    &quot;collect&quot;: {<br>      &quot;numberOfRuns&quot;: 5<br>    },<br>    &quot;assert&quot;: { ...</pre><h4>Bypass Basic Auth Client and Server:</h4><pre>//Client: <br><br>{<br>  &quot;ci&quot;: {<br>    &quot;upload&quot;: {<br>      &quot;basicAuth&quot;: {<br>        &quot;username&quot;: &quot;myusername&quot;,<br>        &quot;password&quot;: &quot;LighthouseRocks&quot;<br>      }<br>    }<br>  }<br>}</pre><pre>// Server:<br><br>{<br>  &quot;ci&quot;: {<br>    &quot;server&quot;: {<br>      &quot;basicAuth&quot;: {<br>        &quot;username&quot;: &quot;myusername&quot;,<br>        &quot;password&quot;: &quot;LighthouseRocks&quot;<br>      },<br>      &quot;storage&quot;: {<br>        // ...<br>      }<br>    }<br>  }<br>}</pre><h3>Reference and Resources:</h3><ul><li><a href="https://github.com/GoogleChrome/lighthouse-ci/blob/main/docs/getting-started.md">lighthouse-ci/getting-started.md at main · GoogleChrome/lighthouse-ci</a></li><li><a href="https://github.com/marketplace/actions/lighthouse-ci-action">Lighthouse CI Action - GitHub Marketplace</a></li><li><a href="https://github.com/SanjeebLama/frontend-skeleton">GitHub - SanjeebLama/frontend-skeleton: A template designed to help streamline the process of creating new frontend projects. It comes equipped with all the latest stable dependencies that we use, allowing developers to get up and running quickly.</a></li><li><a href="https://github.com/SanjeebLama/lighthouse-ci-test">GitHub - SanjeebLama/lighthouse-ci-test: Create an automated process for running Lighthouse CI in a local env as well as in the preview, dev, and production env of a Next.js application.</a></li></ul><p>AND… That’s a wrap.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FYTbZzCkRQCEJa%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fparty-excited-birthday-YTbZzCkRQCEJa&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExNjZiMzhlMGUyMjMyZGU4NWU4NGVkYTY1ZjY4MWJjNjZiMGUyZWIxNCZlcD12MV9pbnRlcm5hbF9naWZzX2dpZklkJmN0PWc%2FYTbZzCkRQCEJa%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/da0675f5b4c1f85012b73ebcbb163170/href">https://medium.com/media/da0675f5b4c1f85012b73ebcbb163170/href</a></iframe><blockquote><em>🌻 </em>Thank you for reading till the end!</blockquote><blockquote><em>I greatly appreciate your time and engagement with this article. If you have any feedback or questions, I would be delighted to address them. Feel free to reach out.🙌</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d0840209368" width="1" height="1" alt=""><hr><p><a href="https://articles.wesionary.team/automate-lighthouse-audit-for-free-catch-performance-issues-early-4d0840209368">Automate Lighthouse Audit for FREE: Catch performance issues early</a> was originally published in <a href="https://articles.wesionary.team/">wesionaryTEAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing the Power of Image Optimization: Boost Speed, Enhance UX, and Dominate Google Search]]></title>
            <link>https://articles.wesionary.team/unleashing-the-power-of-image-optimization-boost-speed-enhance-ux-and-dominate-google-search-db790dea9649?source=rss-d9d4a53513ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/db790dea9649</guid>
            <category><![CDATA[seo]]></category>
            <category><![CDATA[image-optimization]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[core-web-vitals]]></category>
            <dc:creator><![CDATA[Sanjeeb Lama]]></dc:creator>
            <pubDate>Wed, 24 May 2023 10:04:03 GMT</pubDate>
            <atom:updated>2023-05-24T10:04:03.096Z</atom:updated>
            <content:encoded><![CDATA[<p>Discover the secrets of image optimization to skyrocket your website’s speed, revolutionize user experience, and conquer the rankings in Google search. Unlock the full potential of your images with 7 techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXvhUsfdiNj2MRDmY4RgBg.jpeg" /></figure><h3>Introduction</h3><blockquote>Try to imagine Internet without the Images, it wouldn’t be that fun right?</blockquote><p>Image are most of the time the <strong>Biggest Piece of Content</strong> in your website which effects one of the core web vitals called LCP <em>Largest Contentful Paint</em>. Google uses core web vitals to rank your web site.</p><p>We all know how important Images are for crafting good Digital Experience. One image may convey 1000s of words. Brands use it to convey <em>ideas, thoughts, message</em>, and to raise certain kind of <em>emotions</em>.</p><p>So, if you’re a creator, developer, entrepreneur, web site owner want to have higher chance of discoverability in Internet / Search engines like Google. You have to optimize your images.</p><blockquote>Need more reason check this out.<br><a href="https://web.dev/renault/">Learn How Renault improved its bounce and conversion rates by measuring and optimizing Largest Contentful Paint</a></blockquote><h3>Let’s Talk about Image Optimization Techniques:</h3><p>Images are an essential part of any website, but they can also significantly slow down page load times if they are not optimized correctly.</p><h4><strong>1. Choose the Right Format:</strong></h4><p>First thing first you need to understand the different kind of image formats and choose the right format as per your need. Different image formats have different strengths and weaknesses, and choosing the wrong format can result in larger file sizes and slower load times. Here are some common image formats and when to use them:</p><ul><li><strong>JPEG</strong>: <br>Use JPEG for photographs and images with <strong><em>lots of detail and color</em></strong>. JPEG images can be compressed without losing too much quality, making them ideal for large images.</li><li><strong>PNG</strong>: <br>Use PNG for images with <strong><em>transparent backgrounds or simple graphics</em></strong> with few colors. PNG images can be compressed without losing any quality, making them ideal for smaller images.</li><li><strong>GIF</strong>: <br>Use GIF for <strong><em>simple animations</em></strong> or graphics with limited colors. GIF images can be animated and compressed without losing quality.</li><li><strong>WebP</strong>: <br>Use WebP for <strong><em>high-quality images with smaller file sizes</em></strong>. WebP is a newer image format that is designed specifically for the web and can provide significant improvements in file size compared to JPEG or PNG.</li></ul><h4><strong>2. Compress Images:</strong></h4><p>Once you have chosen the right format for your images, the next step is to compress them. Image compression involves reducing the file size of the image without losing too much quality. Some of the tools for image compression are:</p><ul><li><a href="https://tinypng.com/">TinyPNG</a>: A tool that can compress PNG and JPEG images without losing quality.</li><li><a href="https://squoosh.app/">Squoosh</a>: A web-based tool from Google that can compress images in various formats, including WebP.</li><li><a href="https://imageoptim.com/mac">ImageOptim</a>: A tool that can compress JPEG, PNG, and GIF images without losing quality.</li></ul><h4><strong>3. Resize Images:</strong></h4><p>Another trick to optimize images is to resize them to the actual size they will be displayed on the website.</p><figure><img alt="Image Source : https://unsplash.com/photos/7uoMmzPd2JA" src="https://cdn-images-1.medium.com/max/1024/1*4dQ442XcgpMAuc1i2rq66w.jpeg" /><figcaption>Image Source : <a href="https://unsplash.com/photos/7uoMmzPd2JA">https://unsplash.com/photos/7uoMmzPd2JA</a></figcaption></figure><p>You should not add the original image size (6720 * 4480) to the avatars without resizing for a few reasons:</p><ul><li><strong>File Size</strong>: <br>The original image size is likely to be significantly larger in file size compared to the avatar sizes (128 * 128, 64 * 64, 32 * 32). This means that using the original image as it is would result in unnecessarily large file sizes for the avatars, which can negatively impact website performance and load times.</li><li><strong>Bandwidth</strong>: <br>Uploading and serving the original image for each avatar would consume more bandwidth since the larger file size requires more data to be transferred. This can slow down the website, especially for users with slower internet connections or limited bandwidth.</li><li><strong>Rendering Efficiency:</strong> <br>Displaying a large image in a smaller avatar size without resizing can lead to poor rendering quality. The image may appear pixelated, blurry, or distorted, as it hasn’t been optimized for the specific dimensions of the avatars.</li></ul><p>By resizing the original image to the exact dimensions of the avatars (128 * 128, 64 * 64, 32 * 32), you can ensure that the images are optimized for their intended display size. This helps reduce file sizes, conserves bandwidth, and maintains the visual quality of the avatars.</p><h4><strong>4. Use Lazy Loading:</strong></h4><p>Lazy loading is a technique that can significantly improve page load times for websites with many images. Lazy loading involves only loading images when they are needed, rather than loading all images at once. This can reduce the number of requests the browser needs to make to load the page and improve page load times. Many content management systems and JavaScript libraries support lazy loading of images.</p><p><strong>Here are some code examples for responsive images with different formats:</strong></p><ul><li><strong>Using the Picture Element:</strong> The picture element allows you to provide multiple sources for an image, each with different characteristics such as resolution, aspect ratio, or file format. The browser will then choose the best source for the current device and screen size.</li></ul><pre>&lt;picture&gt;<br>  &lt;source srcset=&quot;image-small.webp&quot; media=&quot;(max-width: 768px)&quot; type=&quot;image/webp&quot;&gt;<br>  &lt;source srcset=&quot;image-large.webp&quot; tyjpe=&quot;image/webp&quot;&gt;<br>  &lt;source srcset=&quot;image-small.jpg&quot; media=&quot;(max-width: 768px)&quot; type=&quot;image/jpeg&quot;&gt;<br>  &lt;source srcset=&quot;image-large.jpg&quot; type=&quot;image/jpeg&quot;&gt;<br>  &lt;img src=&quot;image-small.jpg&quot; alt=&quot;Image Description&quot;&gt;<br>&lt;/picture&gt;</pre><p>In this example, we have provided two sources for both JPEG and WebP formats. The first source is for small screens with a maximum width of 768 pixels, and the second source is for larger screens. The browser will choose the best source based on the screen size and format support.</p><ul><li><strong>Using the srcset Attribute:</strong> The srcset attribute is another way to provide multiple sources for an image. It allows you to specify a comma-separated list of image sources with different sizes or resolutions.</li></ul><pre>&lt;img src=&quot;image.jpg&quot; alt=&quot;Image Description&quot; <br>srcset=&quot;image-small.jpg 400w, image-medium.jpg 800w, image-large.jpg 1200w&quot;&gt;</pre><p>In this example, we have provided three sources for the image, each with a different width. The browser will choose the best source based on the screen size and resolution.</p><ul><li><strong>Using the srcset Attribute with WebP:</strong> You can also use the srcset attribute with WebP format to provide multiple sources for the same image in different formats.</li></ul><pre>&lt;img src=&quot;image.jpg&quot; alt=&quot;Image Description&quot; <br>srcset=&quot;image-small.webp 400w, image-medium.webp 800w, image-large.webp 1200w, <br>image-small.jpg 400w, image-medium.jpg 800w, image-large.jpg 1200w&quot; <br>type=&quot;image/webp&quot;&gt;</pre><p>In this example, we have provided six sources for the image, three in WebP format and three in JPEG format. The browser will choose the best source based on the screen size and format support.</p><blockquote><em>By using these techniques to provide responsive images in different formats, you can improve page load times and provide a better user experience for your visitors.</em></blockquote><h3>5. Content Delivery Network (CDN):</h3><p>Using a Content Delivery Network (CDN) is an effective way to improve website performance. A CDN is a network of servers distributed around the world that store cached copies of website content. When a user requests a page, the CDN serves the content from the server that is closest to the user, reducing the time required to transfer data over the internet. Here are some benefits of using a CDN:</p><ol><li><strong>Reduced latency:</strong> By serving content from servers located closer to the user, a CDN can reduce latency and improve website load times.</li><li><strong>Increased reliability:</strong> CDNs are designed to handle high traffic volumes and can help ensure that content is available even during peak usage periods.</li><li><strong>Improved scalability:</strong> CDNs can help websites scale their infrastructure to handle large amounts of traffic without affecting website performance.</li><li><strong>Better security:</strong> Many CDNs offer security features such as DDoS protection, web application firewalls, and SSL/TLS encryption.</li></ol><p>Some popular CDN providers include Cloudflare, Amazon CloudFront, Akamai, and Google Cloud CDN. By using a CDN, websites can improve their performance, reduce their load times, and provide a better user experience.</p><h3>6. Optimizing for return visits using Cache-Control for Assets:</h3><ul><li>Static assets include files like images, stylesheets, JavaScript files, and other resources that do not change frequently. By setting the appropriate <strong>Cache-Control</strong> header for these assets, you can instruct the user&#39;s browser to cache and store these files locally for a certain period of time.</li><li>The <strong>Cache-Control</strong> header allows you to control how long the browser should cache the static assets before checking for updates. By specifying a longer caching duration, you can reduce the number of requests made to the server when a user revisits your website, improving the loading speed and reducing bandwidth usage.</li><li>For example, you can set the <strong>Cache-Control</strong> header to cache the assets for a month:</li></ul><pre>Cache-Control: public, max-age=2592000</pre><p>Here, <strong>public</strong> indicates that the asset can be cached by both the user&#39;s browser and intermediate caches (like CDNs), and <strong>max-age=2592000</strong> sets the caching duration to 2592000 seconds (30 days).</p><p>It’s important to note that using <strong>Cache-Control</strong> for static assets assumes that you have a mechanism in place to manage cache invalidation.</p><p>By leveraging caching with the <strong>Cache-Control</strong> header for static assets, you can improve the overall performance and user experience, particularly for return visits where the browser can retrieve the assets from the local cache rather than making unnecessary requests to the server.</p><h3>7. Image Optimization using next/image in Next JS</h3><p>You can simply use next/image component but it has a catch (I learned it a hard way).</p><pre>import Image from &#39;next/image&#39;;<br> <br>export default function ProfileImage() {<br>  return (<br>    &lt;Image<br>      src=&quot;/profile.png&quot;<br>      width={400}<br>      height={400}<br>      alt=&quot;Profile Image&quot;<br>    /&gt;<br>  );<br>}</pre><p>By using <a href="https://nextjs.org/docs/app/building-your-application/optimizing/images">next/image</a> you’ll get following benefits:</p><ul><li><strong>Size Optimization:</strong> Automatically serve correctly sized images for each device, using modern image formats like WebP and AVIF.</li><li><strong>Visual Stability:</strong> Prevent layout shift automatically when images are loading.</li><li><strong>Faster Page Loads:</strong> Images are only loaded when they enter the viewport using native browser lazy loading, with optional blur-up placeholders.</li><li><strong>Asset Flexibility:</strong> On-demand image resizing, even for images stored on remote servers</li></ul><p><strong>What’s the catch?</strong></p><ul><li>Well you’ll get upto 1000 images in hobby plan and upto 5000 images in Pro plan</li><li>Not all clients would want to pay more for image optimization if it crosses the limit.</li><li>If any chance you cross the limit you won’t be able to display images.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LFPiFj42iB7nPlKUgkmCw.png" /><figcaption>Image Source: <a href="https://vercel.com/docs/concepts/limits/overview#typical-monthly-usage-guidelines">https://vercel.com/docs/concepts/limits/overview#typical-monthly-usage-guidelines</a></figcaption></figure><p>Remember, not all users have access to high-speed internet or unlimited data. Some of your website visitors may be located in remote areas with slow internet connections or limited data packs.</p><ul><li>By prioritizing optimization for such users, you can provide a better browsing experience and help them conserve their hard-earned money.</li><li>Resize and optimize images, implement caching techniques, and minimize unnecessary data transfers.</li><li>By doing so, you create a more inclusive and accessible website for all your visitors.</li></ul><p>I hope you learned something and will use it to craft a good digital experience. ✌🏻 If you have any feedback or any questions let me know. I’ll try my best to get back to you.</p><p>Happy Learning !!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db790dea9649" width="1" height="1" alt=""><hr><p><a href="https://articles.wesionary.team/unleashing-the-power-of-image-optimization-boost-speed-enhance-ux-and-dominate-google-search-db790dea9649">Unleashing the Power of Image Optimization: Boost Speed, Enhance UX, and Dominate Google Search</a> was originally published in <a href="https://articles.wesionary.team/">wesionaryTEAM</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>