<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Neel-Vekariya</title>
    <description>The latest articles on DEV Community by Neel-Vekariya (@neel-vekariya).</description>
    <link>https://dev.to/neel-vekariya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3968256%2Ff900b976-6eab-4295-bca9-6c8b6fd937e2.jpeg</url>
      <title>DEV Community: Neel-Vekariya</title>
      <link>https://dev.to/neel-vekariya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/neel-vekariya"/>
    <language>en</language>
    <item>
      <title>Testing Pyramid</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Tue, 15 Sep 2026 10:30:53 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/testing-pyramid-4dna</link>
      <guid>https://dev.to/neel-vekariya/testing-pyramid-4dna</guid>
      <description>&lt;p&gt;In recent my posts, I talk about the AAA model of the testing and what is the importance of testing. Now I think this time is perfect for introduce and talk about the testing Pyramid.&lt;/p&gt;

&lt;p&gt;The concept of the testing pyramid is introduced by Mike Cohn in 2004. Then in 2009 The formal and polished version of the testing pyramid is introduced in his book “Succeeding with Agile”. They introduce three levels pyramid which is UI tests, Service tests and Unit tests.&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1v5hpgdq3jctd59eoag0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1v5hpgdq3jctd59eoag0.png" alt="Three level diagram" width="481" height="277"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;The levels of pyramid divides based on their scope, speed, cost and frequency. Different levels have different scope, speed, cost and the running frequency. Based on this parameter, you can easily decide which type of tests to use, where to use them, and how much of each type you need.&lt;/p&gt;

&lt;p&gt;Generally, the ratio of this tests levels is 10:20:70. 10 percent of your tests is UI tests, 20 percent tests is service tests and rest of 70 percent tests is unit tests. This ratio is popularized by the google in 2015, in their testing blog “Just Say No to More End-to-End Tests”.&lt;/p&gt;





&lt;p&gt;Now let’s understand deeply what are those different levels. Let’s start with unit tests.&lt;/p&gt;

&lt;h2&gt;Unit Tests&lt;/h2&gt;

&lt;p&gt;Generally, Unit tests are small and independent block of tests for small feature, small function or small component. This unit tests are isolated then other tests. It tests and checks smallest part of the program.&lt;/p&gt;

&lt;p&gt;It run on isolation so that their scope is limited to that function or that component. Unit tests are extremely fast due to mocking of database query, API requests and file I/O. The mocking of those operation makes unit tests faster to execute.&lt;/p&gt;

&lt;p&gt;The frequency of the unit tests is very high. After every file change, the unit tests run automatically, testing the relevant cases and providing instant feedback.&lt;/p&gt;

&lt;p&gt;Now after every change the test cases automatically checks every component or feature then if any mistake was created it directly indicates failure and the cost of fix this mistake in development phase is very cheap.&lt;/p&gt;

&lt;p&gt;So that’s is all about unit tests now let’s understand service tests.&lt;/p&gt;





&lt;h2&gt;Service Tests&lt;/h2&gt;

&lt;p&gt;In unit tests we tests individual component, function or feature working individually in isolation or not. But that is not necessary if component works on isolation then it also works when they dependent to each other. In real application most of function is dependent on some component or some dependency in this time unit test is not reliable. So, we done service tests.&lt;/p&gt;

&lt;p&gt;In service case we test that the interaction between different parts like function or component is done reliably or not. The goal is to ensure that the complete system behaves correctly when its components are connected.&lt;/p&gt;

&lt;p&gt;In service tests, mocking is rarely used. In case where you use external API that is expensive, unreliable or unavailable then the mocking is used in service tests.&lt;/p&gt;

&lt;p&gt;In service tests the scope of the tests is from two component to multiple component due to use case of service test. The component is not isolated because they depend on other component so the speed of executing service test is slower than unit test.&lt;/p&gt;

&lt;p&gt;The frequency of service tests is lower than unit tests. Because service tests require multiple components or dependencies to work together, they take more time to execute. So we don't need to run every service test after every small file change.&lt;/p&gt;

&lt;p&gt;But when we change something that can affect the interaction between components, service tests become very important.&lt;/p&gt;

&lt;p&gt;They give us confidence that different parts of our application are working correctly when they are connected with each other.&lt;/p&gt;

&lt;p&gt;Now we understand unit tests and service tests. But there is still one level remaining in the Testing Pyramid. That is UI tests.&lt;/p&gt;





&lt;h2&gt;UI Tests&lt;/h2&gt;

&lt;p&gt;UI tests are tests where we test the application from the user interface. Instead of directly testing a function or connecting different components, here we test the application from the point where the real user interacts with it.&lt;/p&gt;

&lt;p&gt;The test can open the application, find the email input, enter the email, enter the password, click on the login button and check whether the user successfully reaches the dashboard.&lt;/p&gt;

&lt;p&gt;So, UI tests test the complete user interaction with the application.&lt;/p&gt;

&lt;p&gt;The scope of UI tests is much bigger than unit tests and service tests because it can cover the complete application flow. It can involve UI components, frontend logic, backend services, database and other dependencies.&lt;/p&gt;

&lt;p&gt;Because of this large scope, UI tests are much slower than unit tests and service tests. The test needs to start and interact with the application and sometimes it also needs to communicate with the backend and database.&lt;/p&gt;

&lt;p&gt;The cost of UI tests is also higher. Writing and maintaining these tests takes more time because even a small change in UI can break the test. For example, if we change the button structure or change some text or element, the UI test may need to be updated.&lt;/p&gt;

&lt;p&gt;The frequency of UI tests is also lower. We don't want to run every UI test after every small change because they take more time and resources.&lt;/p&gt;





&lt;p&gt;So if we compare all three levels, unit tests have the smallest scope, highest speed, lowest cost and highest frequency.&lt;/p&gt;

&lt;p&gt;Service tests have a bigger scope than unit tests, slower speed, higher cost and lower frequency.&lt;/p&gt;

&lt;p&gt;UI tests have the biggest scope, lowest speed, highest cost and lowest frequency.&lt;/p&gt;

&lt;p&gt;This is the basic idea behind the Testing Pyramid.&lt;/p&gt;





&lt;p&gt;There is one more thing that is important to understand.&lt;/p&gt;

&lt;p&gt;The terminology around the Testing Pyramid has changed over time.&lt;/p&gt;

&lt;p&gt;The original Testing Pyramid described the three levels as Unit Tests, Service Tests and UI Tests.&lt;/p&gt;

&lt;p&gt;But as software development practices evolved, different teams and organizations started using different terminology for these levels.&lt;/p&gt;

&lt;p&gt;The term UI tests is now often discussed as End-to-End tests, or E2E tests, and service tests discussed as integration tests.&lt;/p&gt;

</description>
      <category>softwareengineering</category>
      <category>testing</category>
      <category>webdev</category>
      <category>learning</category>
    </item>
    <item>
      <title>Is Being Good at Coding Enough?</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Sat, 12 Sep 2026 05:26:05 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/is-being-good-at-coding-enough-j3i</link>
      <guid>https://dev.to/neel-vekariya/is-being-good-at-coding-enough-j3i</guid>
      <description>&lt;p&gt;Over the last six months, I’ve learned a few things that changed the way I think about building a career in software.&lt;/p&gt;

&lt;p&gt;When we think about technical careers like software engineering, frontend development, or backend development, we usually believe technical skills are enough to build a successful and stable career.&lt;/p&gt;

&lt;p&gt;so we focusing on learning new languages, explore new frameworks, new tools and try to become good in problem solving.&lt;/p&gt;

&lt;p&gt;but this is really enough?. I don't saying like this technical skills is not necessary. it is necessary but this are skills alone actually enough.&lt;/p&gt;





&lt;h2&gt;And this is where social media become interesting.&lt;/h2&gt;

&lt;p&gt;Today, social media is not just place for entertainment it also become marketplace. where every company today come and they market them and gets visibility and trust. they build their identity as brand use of social media.&lt;/p&gt;

&lt;p&gt;do you think how companies build their identity.&lt;/p&gt;

&lt;p&gt;lets understand by simple example&lt;/p&gt;





&lt;h2&gt;How Companies Build Their Identity&lt;/h2&gt;

&lt;p&gt;lets imagine a company has a good product. does it simply build the product and wait for people to discover it?&lt;/p&gt;

&lt;p&gt;usually not.&lt;/p&gt;

&lt;p&gt;After building great product company market their product, communicate with community, creates content and tells people about what they stands for. what it does, what it believes in, and what makes its product valuable.&lt;/p&gt;

&lt;p&gt;over a time people start recognize the company and associating them with some products which company sells. now company have their identity in the market.&lt;/p&gt;





&lt;h2&gt;Now Come to Our Main Question&lt;/h2&gt;

&lt;p&gt;now come to our main question Is it really enough?. now in this case the product is our skills. company may have good product but does it automatically have customers? not&lt;/p&gt;

&lt;p&gt;so what does company do?&lt;/p&gt;

&lt;p&gt;its markets its product&lt;/p&gt;

&lt;p&gt;in a same way we need to market our skills. we need to create our identity, we need to tell people what we does, what is believes in and why we are valuable.&lt;/p&gt;





&lt;h2&gt;But Think About It Again&lt;/h2&gt;

&lt;p&gt;Now, let's recall the process of how a company builds its identity.&lt;/p&gt;

&lt;p&gt;But think about it again.&lt;/p&gt;

&lt;p&gt;Is the company actually trying to build an identity?&lt;/p&gt;

&lt;p&gt;Not exactly.&lt;/p&gt;

&lt;p&gt;The company is actually building its distribution a way to get its product and services in front of more people.&lt;/p&gt;





&lt;h2&gt;Let's Understand How Distribution Actually Works&lt;/h2&gt;

&lt;p&gt;First, let's make one thing clear:&lt;/p&gt;

&lt;p&gt;The benefits of content are random and unexpected.&lt;/p&gt;

&lt;p&gt;You cannot predict exactly who will see your content, who will connect with it, or what opportunity may come from it.&lt;/p&gt;

&lt;p&gt;But through distribution, you increase your chances and expend your surface area of getting opportunities.&lt;/p&gt;

&lt;p&gt;The more people who discover your work, your skills, and your thinking, the more chances you have of getting an opportunity.&lt;/p&gt;

&lt;p&gt;And over time, this repeated exposure creates recognition and builds your professional identity.&lt;/p&gt;





&lt;h2&gt;So Is Being Good at Coding Enough?&lt;/h2&gt;

&lt;p&gt;so now give answer Is Being Good at Coding Enough? no&lt;/p&gt;

&lt;h2&gt;because "Jo dikhta he vo bikta he"&lt;/h2&gt;

</description>
      <category>softwareengineering</category>
      <category>careerdevelopment</category>
      <category>personalbranding</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Why need software testing</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Sun, 06 Sep 2026 07:06:08 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/why-need-software-testing-2257</link>
      <guid>https://dev.to/neel-vekariya/why-need-software-testing-2257</guid>
      <description>&lt;h1&gt;Why need software testing&lt;/h1&gt;

&lt;p&gt;Two days before, I posted about how my thoughts will change around testing, talked about the AAA model of testing, and how the AAA model is used for testing.&lt;/p&gt;

&lt;p&gt;Now the next question came into my mind: if testing is important is ok, but what are the actual and well-defined advantages of testing we have?&lt;/p&gt;

&lt;p&gt;I have some thoughts about those advantages, but I can’t describe them in words because I have very unclear thoughts.&lt;/p&gt;

&lt;p&gt;Then I decided, let’s make this answer clear. I searched about that and found lots of content created around testing.&lt;/p&gt;

&lt;p&gt;The content I found has different-different opinions about testing, but deeply I observed that all the content directly or indirectly indicates the same points, but people have different-different tests and experiences to explain those points.&lt;/p&gt;

&lt;p&gt;All the content I found describes the actual thinking on top of product management and software engineering, which is very important to create and maintain the product.&lt;/p&gt;

&lt;p&gt;In software engineering, to build the feature or product is not always the task. Software engineering is never about building new ordinary features and products which do not function properly, are not reliable, and do not have enough efficient use cases.&lt;/p&gt;

&lt;p&gt;It’s all about achieving maximum functionality, reliability, usability, efficiency, maintainability, and portability of the feature or product.&lt;/p&gt;

&lt;p&gt;And the thinking behind testing is to test a feature and product on top of these parameters. And at this point, I have some clear thoughts about testing, so let’s clean those thoughts more.&lt;/p&gt;





&lt;p&gt;I described many words like functionality, reliability, usability, efficiency, maintainability, and lastly portability, but what the actual meaning of these words is, let’s clear out more.&lt;/p&gt;

&lt;h2&gt;Functionality&lt;/h2&gt;

&lt;p&gt;Functionality :- Functionality means whether all the created or implemented functions do their work correctly or not.&lt;/p&gt;

&lt;p&gt;All the functions which are built to achieve some level of expected task, give the correct and well-defined output, and using all the output we achieve the expected task, output is defined by this functionality.&lt;/p&gt;

&lt;h2&gt;Reliability&lt;/h2&gt;

&lt;p&gt;Reliability :- Reliability means the downtime and failure rate of the software or service tend to be lower.&lt;/p&gt;

&lt;p&gt;The software or service must have maximum uptime and minimum failure time so the software or service does its work reliably.&lt;/p&gt;

&lt;h2&gt;Usability&lt;/h2&gt;

&lt;p&gt;Usability :- Usability means designing your software in a way where the features of the software are actually usable and have maximum and easy access to the feature.&lt;/p&gt;

&lt;p&gt;This thinking leads to improving the GUI of the product or feature.&lt;/p&gt;

&lt;h2&gt;Efficiency&lt;/h2&gt;

&lt;p&gt;Efficiency :- Efficiency means using your resources very wisely.&lt;/p&gt;

&lt;p&gt;The resources are very expensive, so design your feature or product in a way where your feature or product consumes a minimum amount of resources and gives the best output using the consumed resources.&lt;/p&gt;

&lt;h2&gt;Maintainability&lt;/h2&gt;

&lt;p&gt;Maintainability :- Maintainability means the feature or product is maintainable.&lt;/p&gt;

&lt;p&gt;If you design your feature or product in a way where maintaining the feature or product is harder or complex, then this will kill the maintainability of the product.&lt;/p&gt;

&lt;p&gt;In software engineering, we try to build a feature or product in a way where the maintainability of the feature or product is very high, so later, if we need to make changes, then we can make changes simply.&lt;/p&gt;

&lt;h2&gt;Portability&lt;/h2&gt;

&lt;p&gt;Now last is portability :- Portability is all about running your product on various operating systems.&lt;/p&gt;

&lt;p&gt;If your product or feature only runs on your operating system, then the portability of your product or feature is very low.&lt;/p&gt;





&lt;p&gt;So this is all the parameters where the quality of the software depends, and to test all the parameters, you need to test these points.&lt;/p&gt;

</description>
      <category>performance</category>
      <category>software</category>
      <category>softwareengineering</category>
      <category>testingbenefits</category>
    </item>
    <item>
      <title>New way to build the software</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Wed, 02 Sep 2026 05:56:48 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/new-way-to-build-the-software-k2g</link>
      <guid>https://dev.to/neel-vekariya/new-way-to-build-the-software-k2g</guid>
      <description>&lt;p&gt;If you read my blogs, then you definitely know I learned to build a full-stack application.&lt;/p&gt;

&lt;p&gt;But to build an application and to build an application that is efficient, robust, and performs well under any circumstances are different levels of skills and engineering.&lt;/p&gt;

&lt;p&gt;In this AI era, everyone generates code using AI and builds applications, but actual software engineering is never about writing code.&lt;/p&gt;

&lt;p&gt;The real engineering is to build software that works under any conditions, gives the correct output, and is reliable and well-tested.&lt;/p&gt;

&lt;p&gt;This one thought led me to explore things about testing.&lt;/p&gt;

&lt;p&gt;Before building my project, I never thought about testing and edge cases.&lt;/p&gt;

&lt;p&gt;I built the feature, and if it gave the correct output, then fine, my feature was ready and I moved on to build another feature.&lt;/p&gt;

&lt;p&gt;I wrote hundreds of lines of code without any real value because the feature was not reliable, not robust, and did not perform well under critical situations.&lt;/p&gt;





&lt;p&gt;Then I found out this is the difference between a senior developer and a junior developer.&lt;/p&gt;

&lt;p&gt;I learned to build software, but I didn’t learn to think about edge cases, what if my feature faced a critical situation, and what about robustness.&lt;/p&gt;

&lt;p&gt;I missed thinking about edge cases, critical situations, and robustness.&lt;/p&gt;

&lt;p&gt;This is the thinking that differentiates a junior developer from a senior developer.&lt;/p&gt;





&lt;p&gt;At this stage, I had one doubt, and the doubt was: if testing is important, then I want to learn testing deeply.&lt;/p&gt;

&lt;p&gt;If you have the same doubt, then I found the correct answer.&lt;/p&gt;

&lt;p&gt;To build reliable, robust software that works in critical situations, you don’t need to learn software testing deeply if your goal is not to become a QA engineer specifically.&lt;/p&gt;

&lt;p&gt;Why did I say this? The reason is that you only need to know how to verify your feature in the way you want to perform the task.&lt;/p&gt;

&lt;p&gt;During the development period, the cost of finding bugs and vulnerabilities in the feature is very low if the developer finds their bugs in the early development stage.&lt;/p&gt;

&lt;p&gt;To overcome the maximum damage of the feature and save your resources, testing becomes very essential in the development phase.&lt;/p&gt;





&lt;p&gt;Now I understand the real value of testing, so I need to go deep into testing and need to learn testing.&lt;/p&gt;

&lt;p&gt;And I found out that the basic thinking of testing depends on AAA (Arrange, Act, and Assert).&lt;/p&gt;

&lt;p&gt;Think like this: these are the main pillars of testing.&lt;/p&gt;

&lt;p&gt;In testing, you first arrange your configuration related to the feature, define some inputs and dependencies.&lt;/p&gt;

&lt;p&gt;This is called Arrange.&lt;/p&gt;

&lt;p&gt;Then the next step is Act.&lt;/p&gt;

&lt;p&gt;In Act, you execute the behavior of the feature using the configuration you created in Arrange.&lt;/p&gt;

&lt;p&gt;Now the next step is Assert.&lt;/p&gt;

&lt;p&gt;Assert means verifying whether the output of the feature matches your expectation or not.&lt;/p&gt;





&lt;p&gt;Let’s take one example for that.&lt;/p&gt;

&lt;p&gt;I want to test my function &lt;code&gt;greaterOfTwoNumber()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Then my flow of the testing is like that:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Arrange&lt;/span&gt;

&lt;span class="c1"&gt;// Import the Function for testing.&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Act&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;greaterOfTwoNumber&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Assert&lt;/span&gt;

&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toBe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the most basic example of AAA.&lt;/p&gt; 

&lt;p&gt;In the first step, we do all the configuration like defining inputs and importing the dependencies and functions or features for the test.&lt;/p&gt; 

&lt;p&gt;Now in the next step, we do Act.&lt;/p&gt; 

&lt;p&gt;In Act, we execute the behavior of the function or feature, and in Assert, we check whether the output is as per our need or not.&lt;/p&gt; 

&lt;p&gt;If the output is not as per our need, then the test fails; if we have the correct output, then the test passes.&lt;/p&gt; 


 

&lt;p&gt;This is the basic overview of the testing.&lt;/p&gt; 

&lt;p&gt;If I am wrong in any section, please drop your thoughts in the comments. &lt;/p&gt; 

</description>
      <category>softwareengineering</category>
      <category>testing</category>
      <category>web</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Next step to client-side storage</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Sun, 23 Aug 2026 09:44:40 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/next-step-to-client-side-storage-4g83</link>
      <guid>https://dev.to/neel-vekariya/next-step-to-client-side-storage-4g83</guid>
      <description>&lt;h2&gt;
  
  
  Next step to client-side storage
&lt;/h2&gt;

&lt;p&gt;In my past one blog, I wrote about how I improve the performance of the application using the local storage. And the problem local storage solves.&lt;/p&gt;

&lt;p&gt;But now I face another problem about the client storage. My project is simply about order management software for the rental clothing industry.&lt;/p&gt;

&lt;p&gt;In the rental clothing industry, Showrooms or small shops have a big problem. The problem starts when one order has a single or multiple items that are booked in a particular time range.&lt;/p&gt;

&lt;p&gt;Now, a second order wants the same item in between that particular time range. If, by mistake, the second order books that item, then the problem starts.&lt;/p&gt;

&lt;p&gt;The item is booked two times in that particular time range. That is called double booking of the item.&lt;/p&gt;

&lt;p&gt;This mistake is created by the use of traditional register booking. Now, when I need to store the items data, that is a small amount of data, so I simply use the local storage.&lt;/p&gt;

&lt;p&gt;But now I need another and a big storage for storing order details. I build two features: first one is for showing all the orders and second one is for showing the full order.&lt;/p&gt;

&lt;p&gt;To implement those features and to maintain the user experience, I decide to store a small amount of data about the order on the client side. First, I decide to store data in local storage.&lt;/p&gt;

&lt;p&gt;But to store data in the local storage is not a good option because the local storage is used for storing small details about the application, and storing order details in the local storage compromises the performance of the application.&lt;/p&gt;

&lt;p&gt;Now I want a new storage option for storing order details. And again I find out, and that is the IndexedDB.&lt;/p&gt;





&lt;p&gt;To integrate IndexedDB in my application, I want to learn about that storage. I search multiple videos about IndexedDB, but no one is teaching me properly.&lt;/p&gt;

&lt;p&gt;After finding hundreds of tutorials, I finally found one tutorial that is teaching properly how to integrate IndexedDB in the application. Now I want to share that learning with you.&lt;/p&gt;





&lt;p&gt;To integrate IndexedDB, we want to create first one database in IndexedDB. The &lt;code&gt;dbConnect&lt;/code&gt; is built for that and used to get the reference of the created database.&lt;/p&gt;

&lt;p&gt;To build that function, we want to create first two environment variables: &lt;code&gt;db_name&lt;/code&gt; and &lt;code&gt;version&lt;/code&gt;. Those two variables describe the name and the version of that database.&lt;/p&gt;

&lt;p&gt;If any updation happens in the version variable, then this function will execute and update the database.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dbConnect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;indexedDB&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;db_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onupgradeneeded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Access the reference of the database.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;keyPath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;autoIncrement&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="c1"&gt;// The payload is for creating a primary key.&lt;/span&gt;

    &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createObjectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Create the object that is called store in IndexedDB.&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onsuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Success&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onerror&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Failed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, in the function, we create first one database and get the reference of that database. The &lt;code&gt;req.onupgradeneeded&lt;/code&gt; is an event for updating the database when the version variable is changed, then this event is run and updates the database.&lt;/p&gt; 

&lt;p&gt;The &lt;code&gt;req&lt;/code&gt; variable sends the request to open the database, and after the request is complete, we now have access to the database connection reference. The &lt;code&gt;payload&lt;/code&gt; is the rule for how the primary key of that particular store will be generated.&lt;/p&gt; 

&lt;p&gt;To create a store, first we access the result object, and in the result object, we use the &lt;code&gt;createObjectStore&lt;/code&gt; method. &lt;code&gt;onsuccess&lt;/code&gt; and &lt;code&gt;onerror&lt;/code&gt; are events that indicate the success or failure of the connection.&lt;/p&gt; 


 

&lt;p&gt;The function &lt;code&gt;dbConnect&lt;/code&gt; is an asynchronous function, so the next step is to convert this asynchronous function to a synchronous function. To create a synchronous function, we simply wrap this function into the promise.&lt;/p&gt;

&lt;p&gt;Let's do that.&lt;/p&gt; &lt;p&gt;We do this promise in the &lt;code&gt;req.onsuccess&lt;/code&gt; or &lt;code&gt;req.onerror&lt;/code&gt; event. If the &lt;code&gt;req&lt;/code&gt; is successful, we resolve the promise; otherwise, we reject the promise.&lt;/p&gt; 

&lt;p&gt;The updated event is:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onsuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onerror&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dbConnect&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;indexedDB&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;db_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;version&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onupgradeneeded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onsuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onerror&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our function is converted into the synchronous function. Now, the next step we explore is how to store, update, read and delete the data.&lt;/p&gt; 

&lt;p&gt;In IndexedDB, all the operations are transactions. Means if any error happens, then all the started operations are undone.&lt;/p&gt; 


 

&lt;p&gt;Now the next step is to get knowledge about the permission. When we want to store or delete or update the data, the first step is to define the permission.&lt;/p&gt; &lt;p&gt;&lt;code&gt;readonly&lt;/code&gt;, &lt;code&gt;readwrite&lt;/code&gt; are the types of permission.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;storeData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;dbConnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;readwrite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Define the permission.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Neel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;neel@gmail.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="c1"&gt;// The data to store.&lt;/span&gt;

    &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;objectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;oncomplete&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Data Stored Successfully.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is all about storing the data. Now we learn about reading the data.&lt;/p&gt; &lt;p&gt;For reading the data, we use &lt;code&gt;readonly&lt;/code&gt; permission. The &lt;code&gt;getAll()&lt;/code&gt; function is used to get all the data, and &lt;code&gt;get()&lt;/code&gt; is used to get particular data.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;readData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;dbConnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;readonly&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Define the permission.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;objectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;getAll&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onsuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Data Fetched Successfully.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




 &lt;p&gt;This is all about how to read the data. Now next, we learn how to update the data.&lt;/p&gt; &lt;p&gt;To update the data, we use the &lt;code&gt;readwrite&lt;/code&gt; permission.&lt;/p&gt;
&lt;br&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updateData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;dbConnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;readwrite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Define the permission.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;objectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// In this store we do not use any function; either we get the reference.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Get old data.&lt;/span&gt;

    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onsuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jay&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Jay@gmail.com&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="p"&gt;};&lt;/span&gt;

      &lt;span class="c1"&gt;// Only change name and email and other data store as it is.&lt;/span&gt;

      &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is all about how to update the data. Now next, we learn how to delete the data.&lt;/p&gt; 

&lt;p&gt;To delete the data, we use the &lt;code&gt;.delete()&lt;/code&gt; method.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;deleteData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;dbConnect&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;readwrite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Define the permission.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;objectStore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;orders&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// In this store we do not use any function; either we get the reference.&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Delete data.&lt;/span&gt;

  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;




 

&lt;p&gt;Now we successfully implemented the IndexedDB in our project.&lt;/p&gt; 

&lt;p&gt;If I made any mistake, then share my mistake in the comments.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>frontend</category>
      <category>node</category>
      <category>software</category>
    </item>
    <item>
      <title>Then My Project Needed This</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Sat, 15 Aug 2026 07:33:22 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/then-my-project-needed-this-3fep</link>
      <guid>https://dev.to/neel-vekariya/then-my-project-needed-this-3fep</guid>
      <description>&lt;h2&gt;
  
  
  Finally, I Integrated the Multiselect Autocomplete Dropdown
&lt;/h2&gt;

&lt;p&gt;In the past few months, I learned a lot of things and also made a project after many retries. The project taught me many important concepts that I didn’t know after learning languages, frameworks, or even in lectures.&lt;/p&gt;

&lt;p&gt;These were concepts that I only came across when I wanted to use them in my project or when I faced some issues. The Multiselect Autocomplete Dropdown is one of the concepts that I didn’t learn when I was actually in the learning phase, but I learned it when I was building something on top of my learnings.&lt;/p&gt;





&lt;p&gt;In my project, I wanted a feature in the frontend where a user could send me multiple-selected values of one field, and I also wanted that field to be searchable and autocomplete.&lt;/p&gt;

&lt;p&gt;Then I noticed that this type of feature is also provided in HTML with the &lt;code&gt;select&lt;/code&gt; tag, but there was an exception with this tag, and the exception was that the tag is not searchable and does not support multiple values.&lt;/p&gt;

&lt;p&gt;So, I needed a different solution, and I wanted to figure out that solution.&lt;/p&gt;





&lt;p&gt;In the age of AI, finding a solution is very easy, but the difficult part was integrating it into my project.&lt;/p&gt;

&lt;p&gt;I found the solution with the help of AI, and now the next step is to integrate it into my project.&lt;/p&gt;





&lt;p&gt;I think this type of feature is learned only for a purpose. The topic is learned when the functionality is needed.&lt;/p&gt;

&lt;p&gt;When the topic is learned only for the purpose of learning, then the topic is not available in the course we want to learn from, documentation, or some video where the topic is not fully explained.&lt;/p&gt;

&lt;p&gt;In this case, I faced the same problem.&lt;/p&gt;





&lt;p&gt;If you face the same problem, please share your experience in the comments.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Finally I access The Child Element</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Tue, 11 Aug 2026 04:21:58 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/finally-i-access-the-child-element-29al</link>
      <guid>https://dev.to/neel-vekariya/finally-i-access-the-child-element-29al</guid>
      <description>&lt;p&gt;
Recently, if you read my little weird blogs, you know I learn &lt;b&gt;React.js&lt;/b&gt; and build one project.
In the project, I made many mistakes like creating a complex component structure.
Later I removed all components and made a clear folder structure.
&lt;/p&gt;

&lt;p&gt;
I created cards that did not show data, and I don’t know why.
And so on.
But one problem came when I used the React-Hook-Forms and my custom input field.
&lt;/p&gt;





&lt;p&gt;
This problem gave me more knowledge as well as an idea about how react-hook-form works.
The problem is like this.
When I want to access the child component from the parent component to access the data entered by the user.
&lt;/p&gt;

&lt;p&gt;
That gave me &lt;b&gt;undefined instead of the value&lt;/b&gt; which was passed by the user.
I was not able to find out why that happened.
Later I found out that my parent element does not have access to the input field.
That is the problem.
&lt;/p&gt;





&lt;p&gt;
Now I don’t know why the parent element does not access the child element.
In the parent element, I did not make a mistake in using the child element.
Then why did that happen.
&lt;/p&gt;

&lt;p&gt;
Subsequently, I found out that the &lt;b&gt;register&lt;/b&gt; which is used for accessing the value from the child element sends one ref to the child element.
But I did not define that or use that.
Now I found out the method that is used to pass reference to the child component.
&lt;/p&gt;





&lt;p&gt;
React provides a higher order function named &lt;b&gt;forwardRef&lt;/b&gt; to solve the problem of passing the reference to the child component.
The forwardRef is not needed in a normal input or select field.
&lt;/p&gt;

&lt;p&gt;
The custom component built for reusability blocks the reference.
In this situation, we need a service that passes the reference from the parent to the child component.
&lt;/p&gt;

&lt;p&gt;
The service is provided by the higher order function &lt;b&gt;forwardRef&lt;/b&gt;.
To use forwardRef in the custom component, you need to import it from React.
And pass it as a secondary separate parameter ref in the function.
&lt;/p&gt;

&lt;p&gt;
Now pass this parameter as a &lt;b&gt;ref property&lt;/b&gt; in the custom input component.
And wrap your exported component in &lt;b&gt;forwardRef&lt;/b&gt;.
Now you have access to the child component in the parent.
&lt;/p&gt;

&lt;p&gt;
And also have the value which is passed in your child component.
Now this function solved my problem of passing undefined value.
&lt;/p&gt;





&lt;p&gt;
If I have done something wrong, please let me know in the comments.
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How I Prevent unauthorized user to access restricted routes</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Fri, 07 Aug 2026 04:55:29 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/how-i-prevent-unauthorized-user-to-access-restricted-routes-50pj</link>
      <guid>https://dev.to/neel-vekariya/how-i-prevent-unauthorized-user-to-access-restricted-routes-50pj</guid>
      <description>&lt;p&gt;
In my last post, I talked about how I simplified managing all my components. 
After building all the components for my backend project, I assembled them into the home page and created a flow between them to navigate from one feature to another.
&lt;/p&gt;

&lt;p&gt;
But, I didn’t run the frontend for testing. 
Consequently, I did that, and obviously, I had many errors on the screen.
&lt;/p&gt;

&lt;p&gt;
Firstly, I solved all the errors I had and checked whether all the components were working properly or not. 
After checking all components, suddenly I found one security issue in my application.
&lt;/p&gt;

&lt;p&gt;
When I wanted to switch from one feature to another feature, I tried some kind of shortcut in the URL, and it worked. 
How, I don’t know.
&lt;/p&gt;

&lt;p&gt;
As a result, it rendered my component that was restricted for the user I logged in. 
This was a problem for me due to data security and the exposure of protected routes.
&lt;/p&gt;





&lt;p&gt;
I needed a solution. 
As a result, I searched about the problem and found out this is not only my problem but also a problem that all developers face.
&lt;/p&gt;

&lt;p&gt;
They have a centralized solution for that, in addition to using a &lt;b&gt;Protected component&lt;/b&gt;. 
The main idea of the protected component is to check given conditions.
&lt;/p&gt;

&lt;p&gt;
If the conditions are true, then render the protected component, else navigate them to the login or register page. 
The component is also used to boost user experience.
&lt;/p&gt;

&lt;p&gt;
Due to redirecting the user to the login or register page, this creates a smooth path for the user to use your application.
&lt;/p&gt;





&lt;p&gt;
Now let’s understand the working of the protected component. 
The component generally takes two parameters.
&lt;/p&gt;

&lt;p&gt;
The first one is children, which is the component we want to protect from unauthorized users. 
The second one is whether the user is logged in or not.
&lt;/p&gt;

&lt;p&gt;
Now in the component, we need access to the state that shows whether the user is logged in or not. 
Now we have two variables that decide whether the user is authenticated or not.
&lt;/p&gt;

&lt;p&gt;
Now one question may come to your mind: why do we give the second parameter when we already have access to the state that represents whether the user is logged in or not?
&lt;/p&gt;

&lt;p&gt;
The reason is that if you want optional control over the controller, as a result, you have special control over this component. 
Now we check the condition.
&lt;/p&gt;

&lt;p&gt;
For checking conditions, we use &lt;b&gt;useEffect&lt;/b&gt; to track all variable or state changes. 
Now if the condition is fulfilled, then render the protected component, else navigate.
&lt;/p&gt;





&lt;p&gt;
In the code section, I have done the same thing I mentioned.
&lt;/p&gt;



&lt;pre&gt;&lt;code&gt;
export default function Protected({ children, authenticated = true }) {
  const navigate = useNavigate();
  const authstatus = useSelector((state) =&amp;gt; state.auth.authstatus);

  useEffect(() =&amp;gt; {
    if (authenticated &amp;amp;&amp;amp; authstatus !== authenticated) {
      navigate("/login");
    } else if (!authenticated &amp;amp;&amp;amp; authstatus !== authenticated) {
      navigate("/home");
    }
  }, [authenticated, navigate, authstatus]);

  return children ? children : &amp;lt;h1&amp;gt;Loading...&amp;lt;/h1&amp;gt;;
}
&lt;/code&gt;
&lt;/pre&gt;



&lt;p&gt;
I am still learning frontend development, so if you find anything wrong or have suggestions, feel free to share your thoughts in the comments.
&lt;/p&gt;

&lt;p&gt;
Thanks for reading!
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>How I Simplified My React Project Using Feature-Based Component Structure</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Tue, 04 Aug 2026 04:44:50 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/how-i-simplified-my-react-project-using-feature-based-component-structure-1dcp</link>
      <guid>https://dev.to/neel-vekariya/how-i-simplified-my-react-project-using-feature-based-component-structure-1dcp</guid>
      <description>&lt;p&gt;
Recently, I learned React.js, including how frontend development works, how to make the frontend responsive, and how to make reusable components. The only part that was missing to become a full-stack developer is now fulfilled.
&lt;/p&gt;

&lt;p&gt;
Now, I am officially a full-stack developer.
&lt;/p&gt;



&lt;p&gt;
In the journey of becoming a full-stack developer, I picked one project and improved it. First, I learned Node.js, Express.js, and MongoDB and developed one project using these technologies.
&lt;/p&gt;

&lt;p&gt;
The project I developed had many issues, so I built the same project again from scratch using the same technologies. At this point, I learned how to make a backend, but I wanted to learn Fastify and PostgreSQL, so I learned both of them.
&lt;/p&gt;

&lt;p&gt;
After learning Fastify and PostgreSQL, I built the same project using these technologies, and this helped me understand the backend deeply. Now, I have learned how to make backend APIs and databases.
&lt;/p&gt;

&lt;p&gt;
But one part was missing to develop a full product, and that is the frontend. I only knew how to make backend APIs and design databases.
&lt;/p&gt;



&lt;p&gt;
A month ago, I started learning how the frontend works, learned React.js, and other things like routers, hook-forms, localStorage, stores, etc. After learning the frontend, I made a React app for my backend project.
&lt;/p&gt;

&lt;p&gt;
But I didn’t know how to manage components, so I created components in a way that made my project complex to manage. I simply created one parent folder named "components", and in the parent folder, I created multiple subfolders like Button for the Button component, Login for the login page, Input for input fields, Register for the register page, Select for the dropdown component, Footer for the footer component, and so on.
&lt;/p&gt;

&lt;p&gt;
This means that I made one subfolder for each component, and now I realize this structure made it complex to manage all components.
&lt;/p&gt;





&lt;h2&gt;Why I Chose Feature-Wise Component Structure&lt;/h2&gt;

&lt;p&gt;
At this point, I decided to learn component structure next. I found many structures for managing components, but feature-wise component management is best for me.
&lt;/p&gt;

&lt;p&gt;
Why is it best for me? The answer is the backend project I built. In the project, I built role-wise login, logout, and features.
&lt;/p&gt;

&lt;p&gt;
Due to my backend project, I needed login, logout, register pages, and components for both roles. The feature-wise structure is best for me.
&lt;/p&gt;





&lt;h2&gt;How Feature-Wise Structure Works&lt;/h2&gt;

&lt;p&gt;
In a feature-wise structure, we build two main folders — the first one is "components" and the second one is "features". Now, we build role-wise subfolders in the "features" folder.
&lt;/p&gt;

&lt;p&gt;
In the "components" folder, we build components that are reusable for other components like Input, Button, and Select components. This is the main concept of the feature-wise component structure.
&lt;/p&gt;

&lt;p&gt;
The pages or components used for a specific feature that refers to a specific role are created in the role-wise folder. This structure removes complexity, which was a problem for me.
&lt;/p&gt;

&lt;p&gt;
Now, I add more components or features, and I manage all of this in a simple way. You get an idea from the reference image that I attached.
&lt;/p&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxa83msfxfjal65r6j93h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxa83msfxfjal65r6j93h.png" alt="Feature-wise component structure" width="800" height="1000"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;
I am still learning frontend development, so if you find anything wrong or have suggestions, feel free to share your thoughts in the comments.
&lt;/p&gt;

&lt;p&gt;
Thanks for reading!
&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>webdev</category>
      <category>react</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>How Local Storage improves the Frontend performance</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Sat, 01 Aug 2026 07:19:58 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/how-local-storage-improves-the-frontend-performance-2h2i</link>
      <guid>https://dev.to/neel-vekariya/how-local-storage-improves-the-frontend-performance-2h2i</guid>
      <description>&lt;h1&gt;How Local Storage improves the performance&lt;/h1&gt;

&lt;p&gt;In the past many days, I learned about how frontend actually works and I learned lots of things. React is one of them. I learned how to manage state, how hooks work, how to make frontend faster and reliable, and the most important thing is how client-side data is actually stored using the local storage object.&lt;/p&gt;

&lt;p&gt;If you don’t know, the local storage object is provided by all web platforms by default.&lt;/p&gt;

&lt;h2&gt;How Local Storage Works&lt;/h2&gt;

&lt;p&gt;Now that we know where local storage actually lives, the next question is how local storage actually works. Let’s imagine you open one website, you change the theme, you select your preference, and you refresh the page.&lt;/p&gt;

&lt;p&gt;Now all your selected things or preferences get reset. And this is the problem. If your selected preferences or theme get reset, this creates a lack of user experience. To solve this problem, we actually use local storage.&lt;/p&gt;

&lt;p&gt;Now you know about which problem we face and how it can be solved by local storage. So the next question may come: how does it work?&lt;/p&gt;

&lt;p&gt;The working mechanism is when a user selects the preference or theme or any other things which boost user experience, then it is stored in client-side storage using local storage.&lt;/p&gt;

&lt;p&gt;The data is stored in object format. All browsers provide around 5MB of local storage for one domain. When you first time access the local storage data, it is read from the disk and loaded into the RAM, and the browser keeps that data in cache for faster access in the future. Now the second time you need data, we don’t carry data from the disk, we already have it in cache. That improves the user experience.&lt;/p&gt;

&lt;h2&gt;Implementation of Local Storage&lt;/h2&gt;

&lt;p&gt;Now you know how local storage actually works under the hood. The next question might come: how do we implement local storage?&lt;/p&gt;

&lt;p&gt;The answer is using the &lt;code&gt;setItem&lt;/code&gt; and &lt;code&gt;getItem&lt;/code&gt; methods of local storage. First we know about how to store created items or data in &lt;code&gt;localStorage&lt;/code&gt;, after that we talk about how the API data is stored.&lt;/p&gt;





&lt;h3&gt;1) Store Created Data in Local Storage&lt;/h3&gt;

&lt;p&gt;To store data into local storage, we need two types of data. First is created data or data which is extracted from the response, and second is already stored data in localStorage.&lt;/p&gt;

&lt;p&gt;Before combining, we need to convert stored data into an object. Now we combine both data and create one object. But we can’t store it directly into localStorage. To store data, first we need to convert that object into JSON format or string format. After converting into JSON or string format, we store it in localStorage using the setItem method.&lt;/p&gt;

&lt;p&gt;This is the code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
const res = await axios.post("https://example.com/users");   
const newData = response.data.data; 

const existingData = JSON.parse(localStorage.getItem("user")) || {};     // Get old data   

const mergedData = {     
  ...existingData,     
  ...newData   
};    // Merge    

localStorage.setItem("user", JSON.stringify(mergedData)); // Save again
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the code, “user” is the object where data is stored.&lt;/p&gt;

&lt;h3&gt;2) Store API Data with Deduplication&lt;/h3&gt;

&lt;p&gt;Now talk about the data which comes from the API. In this case, we again need two types of data. First is response data and second is the stored data which we need to convert into an object. After that, we combine both data, but we need to implement a filter for the data which is present in response and also in stored data, so we remove duplicate data. Now we merge into the object, convert into string, and store it into &lt;code&gt;localStorage&lt;/code&gt;. This is the code:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
const localData = JSON.parse(localStorage.getItem("bookings")) || []; // Get old data 

const res = await axios.get("/api/shop/orders"); 
const apiData = res.data;  // New data

const merged = [ 
  ...localData, 
  ...apiData.filter((api) =&amp;gt; !localData.some((local) =&amp;gt; local.id === api.id)), // Filter the data which is already present
];  // Combine the data

localStorage.setItem('bookings', JSON.stringify(merged)); // Store the data
&lt;/code&gt;&lt;/pre&gt;





&lt;p&gt;I am still learning frontend development, so if you find anything wrong or have suggestions, feel free to share your thoughts in the comments.&lt;/p&gt;

&lt;p&gt;Thanks for reading!&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to Prevent Hanging Network Calls — What I Found After Investigating a Real Performance Issue</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Mon, 13 Jul 2026 03:26:53 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/how-to-prevent-hanging-network-calls-what-i-found-after-investigating-a-real-performance-issue-1mfd</link>
      <guid>https://dev.to/neel-vekariya/how-to-prevent-hanging-network-calls-what-i-found-after-investigating-a-real-performance-issue-1mfd</guid>
      <description>&lt;p&gt;
In the past two months I explored a lot of things Express, Fastify, MongoDB, PostgreSQL, Node.js. I built around three to four projects in this time.
&lt;/p&gt;

&lt;p&gt;
All of them focused on backend because I haven't learned React yet. But the next one will be full stack.
&lt;/p&gt;

&lt;p&gt;
While building these projects, I noticed one issue that kept repeatedly coming back.
&lt;/p&gt;

&lt;p&gt;
Every time I called a database or an external service something that depends on a network call things would get weird.
&lt;/p&gt;

&lt;p&gt;
Sometimes the response never came. Sometimes it took way longer than it should. And this was creating a performance issue in my application that I couldn't ignore.
&lt;/p&gt;

&lt;p&gt;
So I investigated it properly. And I found that this is actually a common problem a lot of developers face this. And there's a standard solution for it.
&lt;/p&gt;





&lt;h2&gt;The Solution is a Timeout Wrapper&lt;/h2&gt;

&lt;p&gt;
The idea is simple. When you make a network call, instead of just calling it directly, you pass it through a timeout wrapper.
&lt;/p&gt;

&lt;p&gt;
If the call takes more time than it should, the wrapper skips or terminates the call and moves on.
&lt;/p&gt;

&lt;p&gt;
This keeps your application from getting stuck waiting on something that's never going to respond in time.
&lt;/p&gt;





&lt;h2&gt;Two Functions : Two Different Approaches In Timeout&lt;/h2&gt;

&lt;p&gt;
While building this, I found there are two ways to implement a timeout wrapper. Both solve the same problem but work very differently.
&lt;/p&gt;

&lt;h3&gt;1. withTimeout()&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;withTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;errorMessage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation timed out&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;reject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;errorMessage&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;race&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;promise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;
This function takes two things the promise (which is your network call) and the time limit in milliseconds.
&lt;/p&gt;

&lt;p&gt;
Inside, it creates a second promise called &lt;code&gt;timeout&lt;/code&gt;. This promise does one thing if the given time runs out, it rejects with an error message.
&lt;/p&gt;

&lt;p&gt;
Then it uses &lt;code&gt;Promise.race()&lt;/code&gt;. This function takes both promises and returns whichever one finishes first.
&lt;/p&gt;

&lt;p&gt;
If your network call responds in time, &lt;code&gt;Promise.race&lt;/code&gt; gives you that response. If the timeout fires first, you get the error.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;Simple. Clean. Works.&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
But there's a catch I found and this is the important part.
&lt;/p&gt;

&lt;p&gt;
&lt;code&gt;withTimeout()&lt;/code&gt; doesn't actually terminate the original network call. If the timeout fires and you move on, the network call is still running in the background.
&lt;/p&gt;

&lt;p&gt;
The socket is still open. Memory is still being used. CPU is still consumed. The request finishes eventually you just stopped waiting for it. The resources are still gone.
&lt;/p&gt;

&lt;p&gt;
This is where the second function solves a different problem.
&lt;/p&gt;



&lt;br&gt;
&lt;br&gt;

&lt;h3&gt;2. fetchWithTimeout()&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fetchWithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="nx"&gt;timeoutMs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;controller&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AbortController&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nx"&gt;timeoutMs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timer&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;
This function takes the URL, options for the network call, and the timeout.
&lt;/p&gt;

&lt;p&gt;
The key difference here is &lt;code&gt;AbortController&lt;/code&gt;. This is a browser and Node.js API specifically built for canceling asynchronous operations without creating memory leaks.
&lt;/p&gt;

&lt;p&gt;
You create a controller, attach its signal to the fetch call, and start a timer. If the timer runs out before the call responds &lt;code&gt;controller.abort()&lt;/code&gt; is called.
&lt;/p&gt;

&lt;p&gt;
The fetch is terminated. Not just skipped actually terminated. All the resources that were being consumed get freed.
&lt;/p&gt;

&lt;p&gt;
And the &lt;code&gt;finally()&lt;/code&gt; at the end makes sure the timer gets cleared if the call does respond in time. No timer left hanging.
&lt;/p&gt;





&lt;h2&gt;The Real Difference Between Both&lt;/h2&gt;

&lt;p&gt;
This is the thing I want to make clear because it took me a bit to fully understand it.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;&lt;code&gt;withTimeout()&lt;/code&gt;&lt;/strong&gt; skips the wait. If the call takes too long, you move on. But the call is still running. Resources are still being consumed. You just stopped caring about the response.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;&lt;code&gt;fetchWithTimeout()&lt;/code&gt;&lt;/strong&gt; terminates the call. If it takes too long, the request is actually cancelled. Network socket freed. Memory freed. CPU freed.
&lt;/p&gt;

&lt;p&gt;
For most external API calls where you're using fetch, &lt;code&gt;fetchWithTimeout&lt;/code&gt; is the right choice because it actually cleans up after itself.
&lt;/p&gt;

&lt;p&gt;
For other types of async operations database queries, file reads, anything that returns a promise &lt;code&gt;withTimeout&lt;/code&gt; is what you'd use. Just know that the operation continues in the background even after the timeout fires.
&lt;/p&gt;





&lt;h2&gt;Why This Actually Matters&lt;/h2&gt;

&lt;p&gt;
When I was building my projects and network calls were just hanging my application was stuck. The user was waiting. The server was waiting. Nothing was happening.
&lt;/p&gt;

&lt;p&gt;
After adding timeout wrappers, if a call hangs, the application moves on. The user gets a proper error response instead of waiting forever. And with &lt;code&gt;fetchWithTimeout&lt;/code&gt;, the resources actually get freed instead of piling up in the background.
&lt;/p&gt;

&lt;p&gt;
This is the kind of thing that feels small but makes a real difference in how your application behaves under real conditions.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;One investigation. One problem. Two functions that solved it.&lt;/strong&gt;
&lt;/p&gt;







&lt;p&gt;
&lt;em&gt;If I got something wrong or anything can be improved please drop it in the comments. I'm still learning and I want to get this right.&lt;/em&gt;
&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Next Token, Not the Next Script</title>
      <dc:creator>Neel-Vekariya</dc:creator>
      <pubDate>Wed, 08 Jul 2026 05:45:51 +0000</pubDate>
      <link>https://dev.to/neel-vekariya/the-next-token-not-the-next-script-5cgm</link>
      <guid>https://dev.to/neel-vekariya/the-next-token-not-the-next-script-5cgm</guid>
      <description>&lt;p&gt;Everyone is using AI to write code now. But I think the real future of programming isn't AI generating full scripts or full products it's AI predicting the next token, and us deciding whether that token is right or not.&lt;/p&gt;

&lt;p&gt;Here's why. When you write code manually, you're already doing something similar in your head predicting the next line based on patterns you've seen before, then checking if it's correct as you write it. Every line passes through your judgment.&lt;/p&gt;

&lt;p&gt;When AI generates a full script or product, that judgment gets skipped. You review the code, sure, but not the way you'd review your own. You skim  "this line does X, this line does Y" and move on. You're checking outcomes, not making decisions. That's a completely different mental process, and it's shallower.&lt;/p&gt;

&lt;p&gt;But when AI suggests the next token, or the next line, instead of the next thousand lines, you're forced back into the same loop you'd use writing manually: is this right, or not? You stay the one making the call.&lt;/p&gt;

&lt;p&gt;That's why I think the best use of AI in programming isn't generate my whole app. It's predict what comes next, and let me decide. Smaller suggestions keep engineers in the driver's seat. Full generations quietly take the wheel.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>discuss</category>
      <category>coding</category>
    </item>
  </channel>
</rss>
