<?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: Daniel Lima </title>
    <description>The latest articles on DEV Community by Daniel Lima  (@daniellimae).</description>
    <link>https://dev.to/daniellimae</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F972698%2F8d670758-8fff-49e8-8bb9-dea388fdd1e7.JPG</url>
      <title>DEV Community: Daniel Lima </title>
      <link>https://dev.to/daniellimae</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/daniellimae"/>
    <language>en</language>
    <item>
      <title>⛳ Avoid problems with Feature Flags</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Wed, 17 Jul 2024 15:11:23 +0000</pubDate>
      <link>https://dev.to/daniellimae/avoid-problems-with-feature-flags-5ckc</link>
      <guid>https://dev.to/daniellimae/avoid-problems-with-feature-flags-5ckc</guid>
      <description>&lt;p&gt;Imagine you have an online application, a product, with numerous users hitting your API client-side, and everything seems fine.&lt;/p&gt;

&lt;p&gt;But one day, your application encounters a severe bug in the payments section. Someone accidentally discovered a bug that allows infinite money withdrawal on your cashout, and they're withdrawing or attempting to withdraw like crazy. It's as if they're exploiting a GTA5 glitch to generate endless money.&lt;/p&gt;

&lt;p&gt;You urgently alert the entire development team about the issue. After discussing it, everyone agrees that until the problem is resolved, it's best to take down the production app to prevent anyone from exploiting the infinite withdrawal glitch.&lt;/p&gt;

&lt;p&gt;As a result, you shut down the entire application due to a single bug.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F0%2AZjYSm_q36J4KChdn" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fformat%3Awebp%2F0%2AZjYSm_q36J4KChdn" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ⛳ Feature flags
&lt;/h3&gt;

&lt;p&gt;Imagine if you had a magic button that could disable only one feature (like your cashout in this case) for everyone, allowing you and your team to work more calmly and effectively.&lt;/p&gt;

&lt;p&gt;That's exactly where we're heading.&lt;/p&gt;

&lt;p&gt;Feature Flags are essentially an if statement that helps minimize damage.&lt;/p&gt;

&lt;p&gt;You can implement it natively, creating your backend with various boolean values that are toggled through a custom admin dashboard.&lt;/p&gt;

&lt;p&gt;But I'll show you at the end one of the many tools that can make your life easier, especially for indie hackers and self-made developers who lack time and resources.&lt;/p&gt;

&lt;p&gt;This way, you can temporarily remove a feature, work on fixing it securely, and once everything is resolved, reintroduce it into the production environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  More Than Just an If
&lt;/h3&gt;

&lt;p&gt;I know, I initially described it as just an if for simplicity, but it can be more than that.&lt;/p&gt;

&lt;p&gt;For instance, you can roll out a feature to only 50% of users, monitor its performance, and then release it to the remaining users.&lt;/p&gt;

&lt;p&gt;In an application with 100k users, after fixing the issue, you can release it to 10k users, then another 20k, followed by 30k, and finally, to everyone.&lt;/p&gt;

&lt;p&gt;The possibilities are vast when it comes to rolling out features. But the core idea remains the same.&lt;/p&gt;

&lt;p&gt;If true, show it. If false, don't show it and move on.&lt;/p&gt;

&lt;h3&gt;
  
  
  User-Specific Flags
&lt;/h3&gt;

&lt;p&gt;Additionally, you can create flags that carry parameters like user id to make changes for a specific user or a group of users with common characteristics.&lt;/p&gt;

&lt;p&gt;This helps maintain your platform and gives you greater control over each user.&lt;/p&gt;

&lt;h3&gt;
  
  
  PostHog and Tools
&lt;/h3&gt;

&lt;p&gt;One way to save time is by using a ready-made tool.&lt;br&gt;
The best one I've tested so far is PostHog.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fposthog.com%2Fstatic%2Fa411c69c2cb0aa735b63f09b0182edbc%2Fc6ea6%2Ffeature-flags-1-dark.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fposthog.com%2Fstatic%2Fa411c69c2cb0aa735b63f09b0182edbc%2Fc6ea6%2Ffeature-flags-1-dark.webp" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I could teach you how to implement it step by step, but honestly, their documentation is so good that it would be redundant for me to explain.&lt;/p&gt;

&lt;p&gt;It's the only documentation I've copied and pasted that worked without needing any changes or bug fixes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://posthog.com/docs/feature-flags" rel="noopener noreferrer"&gt;https://posthog.com/docs/feature-flags&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For Next.js - &lt;a href="https://posthog.com/tutorials/nextjs-analytics" rel="noopener noreferrer"&gt;https://posthog.com/tutorials/nextjs-analytics&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Don't Just Disappear
&lt;/h3&gt;

&lt;p&gt;When deactivating a feature, especially if it's a core part of your product like cashout, you shouldn't just make the button disappear and leave your user confused. This could overwhelm your support team due to the missing button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Ffeature-flags-article%2Fff.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Ffeature-flags-article%2Fff.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For better UX, inform your users about what's happening. Ask for their patience and reward them with improvements.&lt;/p&gt;

&lt;p&gt;In a chaotic scenario, preparing this way significantly helps reduce damage.&lt;/p&gt;




&lt;p&gt;If you enjoy this kind of content and plan to launch your own SaaS someday, follow me for daily content on Twitter and weekly videos on YouTube.&lt;br&gt;
This article will also be available in video format soon on my YouTube channel:&lt;br&gt;
&lt;a href="https://youtube.com/@daniellimae" rel="noopener noreferrer"&gt;https://youtube.com/@daniellimae&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/daniellimae" rel="noopener noreferrer"&gt;https://x.com/daniellimae&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>saas</category>
      <category>react</category>
    </item>
    <item>
      <title>🏆 Best guide to SEO for devs</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Wed, 10 Jul 2024 14:50:47 +0000</pubDate>
      <link>https://dev.to/daniellimae/best-guide-to-seo-for-devs-6ma</link>
      <guid>https://dev.to/daniellimae/best-guide-to-seo-for-devs-6ma</guid>
      <description>&lt;p&gt;SEO, or Search Engine Optimization, is a set of techniques and practices you can adopt as a strategy to enhance the way users find you and your company/product online.&lt;/p&gt;

&lt;p&gt;In other words, it's a way to stake your claim and ensure that when someone searches for a problem or your name specifically, you appear as the primary solution for them.&lt;/p&gt;

&lt;p&gt;Throughout this article, I will provide some examples, but it is important that you DO NOT COPY AND PASTE THEM without first changing what is written and improving it for your context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-alert-search.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-alert-search.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But I need to leave a very important message.&lt;br&gt;
If you entered this article thinking there is a magic pill that you will put on your site and everything will be resolved overnight, you can forget about it.&lt;/p&gt;

&lt;p&gt;There is no magic pill, my friend. SEO is like going to the gym, a way to build your name and a set of good practices and tools that, over time, will help you have better contact with those whose problems your company solves.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs2-galileu.glbimg.com%2FPa5jDEWt8ji7sq9XvatoFTxmUtk%3D%2F0x0%3A1200x675%2F888x0%2Fsmart%2Ffilters%3Astrip_icc%28%29%2Fi.s3.glbimg.com%2Fv1%2FAUTH_fde5cd494fb04473a83fa5fd57ad4542%2Finternal_photos%2Fbs%2F2023%2Fe%2FX%2FiydKueQVa6BBzUrGks2Q%2Fmatrix-dialogo-destaque-22072020.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fs2-galileu.glbimg.com%2FPa5jDEWt8ji7sq9XvatoFTxmUtk%3D%2F0x0%3A1200x675%2F888x0%2Fsmart%2Ffilters%3Astrip_icc%28%29%2Fi.s3.glbimg.com%2Fv1%2FAUTH_fde5cd494fb04473a83fa5fd57ad4542%2Finternal_photos%2Fbs%2F2023%2Fe%2FX%2FiydKueQVa6BBzUrGks2Q%2Fmatrix-dialogo-destaque-22072020.jpg" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If in the gym you need to eat well and exercise every day, SEO works the same way. You need to constantly evolve and adapt to changes.&lt;/p&gt;

&lt;p&gt;Because it only takes a move from a company like Google and you lose your throne as the top spot.&lt;/p&gt;

&lt;p&gt;I mean, there is a magic pill; the anabolic steroids in this case would be paid traffic, but that's not our focus here. Everything we use will be done 100% naturally and organically 🌱.&lt;/p&gt;

&lt;p&gt;So, stay tuned and stay natty, kids.&lt;/p&gt;



&lt;p&gt;It all started when I had to do this myself for a platform I own called &lt;a href="https://alertpix.live" rel="noopener noreferrer"&gt; Alertpix &lt;/a&gt;, focused on streamers and solutions for live streamers.&lt;/p&gt;

&lt;p&gt;We felt at first that our search results were very poor. People searched for our name and only found Twitter or articles from sites talking about us in some way. But our actual site, which was good, nothing.&lt;/p&gt;

&lt;p&gt;So, I turned to my partner Chris and committed to learning as much as possible about how to solve this problem and appear more when people search for the problems we can solve.&lt;/p&gt;



&lt;p&gt;Well, after extensive research, I made a list of several things we could improve; this was the result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Optimize Lighthouse&lt;/li&gt;
&lt;li&gt;Better hierarchy (h1, h2, h3)&lt;/li&gt;
&lt;li&gt;Alt tags on images&lt;/li&gt;
&lt;li&gt;Metatags (meta description)&lt;/li&gt;
&lt;li&gt;O.G (Open Graph)&lt;/li&gt;
&lt;li&gt;json-ld&lt;/li&gt;
&lt;li&gt;Blog with long tail content&lt;/li&gt;
&lt;li&gt;pSEO + long tail volume&lt;/li&gt;
&lt;li&gt;Sufficient amount of keywords per page&lt;/li&gt;
&lt;li&gt;robots.txt&lt;/li&gt;
&lt;li&gt;Sitemap&lt;/li&gt;
&lt;li&gt;Google Keyword Planner, SEMrush, and Ahrefs (keywords)&lt;/li&gt;
&lt;li&gt;Canonical tag&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will address each one and give a practical example of how you can improve your site as well.&lt;/p&gt;

&lt;p&gt;I will be using Next.js here because it is a framework that already comes with many SEO-oriented features, but you can use and implement it in the framework of your choice.&lt;/p&gt;
&lt;h3&gt;
  
  
  Optimize Lighthouse
&lt;/h3&gt;

&lt;p&gt;Lighthouse is a tool that we use as a Google extension to measure how optimized our application is for the end user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flighthouse.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flighthouse.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It provides several useful metrics to keep an eye on, such as accessibility, performance, best practices, among others. But here, we will focus on SEO.&lt;/p&gt;

&lt;p&gt;The idea is always to improve according to what the tool tells you, and even if it's not 100% perfect, it's still very worthwhile to stick to what the tool delivers and make the improvements it proposes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flighthouse2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flighthouse2.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Oh, and speaking of accessibility, here is another item on our list.&lt;/p&gt;

&lt;p&gt;Alt + Hierarchy / HTML Semantics&lt;br&gt;
After all, can the accessibility of a site interfere with its SEO?&lt;/p&gt;

&lt;p&gt;What Google and other search engines can consider is whether your images have well-defined alt tags, if your HTML semantics are clear, and if your tags are well hierarchized (i.e., using h1, h2, h3, and other tags correctly).&lt;/p&gt;

&lt;p&gt;So, from that perspective, yes. Characteristics of a well-accessible site are healthy habits for good SEO.&lt;/p&gt;

&lt;p&gt;Avoid misleading titles or clickbait.&lt;br&gt;
Do not use a list of keywords as a title or a generic alt for everything.&lt;/p&gt;
&lt;h3&gt;
  
  
  Metatags
&lt;/h3&gt;

&lt;p&gt;Meta tags are HTML elements that provide information about the web page to browsers and search engines. These information are not directly displayed to page visitors, but are used for various purposes, such as search engine optimization (SEO), social media sharing, and mobile device display configuration. Some common types of meta tags include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Meta Description: Provides a short summary of the page. This text often appears in search results, helping to attract clicks.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"description"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"A brief and informative description of the page."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Meta Keywords: Lists relevant keywords for the page. Although its importance for SEO has diminished, it is still occasionally used.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"keywords"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"keyword1, keyword2, keyword3"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meta Charset: Defines the character set used on the page, helping to ensure text display.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meta Viewport: Configures the page display on mobile devices, allowing for a better user experience across different screen sizes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meta Robots: Indicates to search engines how to index or not index the page. It can be used to allow or block the page from being indexed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"robots"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"index, follow"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meta Author: Specifies the author of the page or content.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"author"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Author Name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Meta Open Graph: Used for integration with social networks like Facebook, improving the display when the page is shared.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:title"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Page Title"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:description"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Page Description"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:image"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Image URL"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:url"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Page URL"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These tags are placed within the &lt;/p&gt; section of the HTML document.

&lt;p&gt;Each meta tag has a specific purpose and can be used according to the needs of the page developer.&lt;/p&gt;

&lt;p&gt;All of this matters greatly for search tools like Google to know and make your content available.&lt;/p&gt;
&lt;h3&gt;
  
  
  O.G Open Graph
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fexamples.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fexamples.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open Graph (OG) is a protocol developed by Facebook to integrate any web page with the social network, allowing page content to be shared in a richer and more attractive way. When a web page contains Open Graph meta tags, shared links on social networks can display titles, descriptions, images, and other details in an optimized manner. This improves the appearance and functionality of links, encouraging more interactions and clicks.&lt;/p&gt;

&lt;p&gt;Here are some of the most common Open Graph meta tags and their uses:&lt;/p&gt;

&lt;p&gt;Defines the page title that will be displayed when the content is shared.&lt;/p&gt;
&lt;h4&gt;
  
  
  Defines the page title that will be displayed when the content is shared.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:title"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Título da Página"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Provides a short and attractive description of the page.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:description"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Page description."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Specifies the URL of a representative image of the page. This image will be displayed as a thumbnail when the page is shared.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:image"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"URL da Imagem"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Defines the canonical URL of the page, ensuring that the correct URL is associated with the content.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:url"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"URL da Página"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Indicates the type of content on the page, such as "website", "article", "video", etc.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:type"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"website"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Name of the site where the page is hosted.
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;property=&lt;/span&gt;&lt;span class="s"&gt;"og:site_name"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"Nome do Site"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h4&gt;
  
  
  Benefits of Using Open Graph
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Visual Attraction: Improves the appearance of shared links, displaying images and additional information.&lt;/li&gt;
&lt;li&gt;Increased Clicks: Optimized titles and descriptions can increase the click-through rate (CTR) on links.&lt;/li&gt;
&lt;li&gt;Content Control: Allows site owners to control how their content is displayed on social networks.&lt;/li&gt;
&lt;li&gt;Consistency: Ensures that shared links have a consistent appearance, regardless of where they are shared.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Implementing Open Graph meta tags is a recommended practice for any site that wants to increase its visibility and attractiveness on social media platforms.&lt;/p&gt;

&lt;p&gt;You can check if your site is okay and how it appears on different platforms using tools like this: &lt;a href="https://opengraph.dev/panel?url=https://alertpix.live" rel="noopener noreferrer"&gt;https://opengraph.dev/panel?url=https://alertpix.live&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thus, every time you share your site link, you make it more attractive and less sketchy. This gives a professional touch to your site.&lt;/p&gt;
&lt;h3&gt;
  
  
  json-ld
&lt;/h3&gt;

&lt;p&gt;JSON-LD (JavaScript Object Notation for Linked Data) is a JSON-based format used to structure data in a way that can be easily understood by machines. It is commonly used to add metadata to web pages so that search engines and other applications can process and understand this data more efficiently.&lt;/p&gt;

&lt;p&gt;JSON-LD is often used to implement structured data schemas (such as schema.org), allowing information about products, events, organizations, people, recipes, and much more to be included on a web page. These structured data can significantly improve SEO and increase the visibility of content in search results, displaying rich snippets.&lt;/p&gt;

&lt;p&gt;In other words, another tool for you to communicate directly with servers and search engines. Basically, it's a way of telling Google, "Hi, this is me, I do this, and I solve this..."&lt;/p&gt;

&lt;p&gt;An example of how we use this at AlertPix is to create a kind of FAQ with questions and answers that are commonly searched by our audience.&lt;/p&gt;

&lt;p&gt;Like this:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fjsonld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fjsonld.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But you might be wondering, what were these questions and where did I get them from?&lt;/p&gt;

&lt;p&gt;And here I'll show you a tip that I could easily charge for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You don't decide this.&lt;/li&gt;
&lt;li&gt;It's a mistake to think you know more about your business than Google.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go and ask Google, but in a different way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ads.google.com/aw/keywordplanner/home" rel="noopener noreferrer"&gt;Let me introduce you to Keyword Planner + Google ADS&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-ads.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-ads.png" alt="alt text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-ads2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Fgoogle-ads2.png" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several smart ways to discover which words are ideal for you to use on your site, but I'll tell you now, it's not from your own mind. Do some research, refine, and get the pure juice of the keywords.&lt;/p&gt;

&lt;p&gt;This is a practice that takes some time but pays off a lot.&lt;br&gt;
It's also worth researching your competitors' websites and seeing how people find them. Copy what works :)&lt;/p&gt;
&lt;h3&gt;
  
  
  Long Tail
&lt;/h3&gt;

&lt;p&gt;The concept of "long tail" is about selling a huge variety of unique items in small quantities, rather than focusing on a few popular items in large quantities. In SEO and content marketing, this means using more specific and less competitive keywords that have fewer searches but attract people with clear buying intent and less competition.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flong-tail.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fbolodissenoura%2Fimages-dump%2Fmain%2Fseo-article%2Flong-tail.jpg" alt="alt text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, instead of using "sneakers" to sell running shoes, you can use "Women's running shoes up to $100," for example.&lt;br&gt;
It's all about niching down and being extremely specific. You can incorporate this into your site using blog posts, making YouTube videos and linking them to your site, and in other ways too.&lt;/p&gt;

&lt;p&gt;Again, it's not you who defines these ideal words. Use tools like Google Keyword Planner, Ahrefs, SEMrush, and Ubersuggest to identify long-tail keyword opportunities.&lt;/p&gt;

&lt;p&gt;And when using them, make sure to include them in titles, subtitles, and the tags I've already shown you in this article.&lt;/p&gt;

&lt;p&gt;The robots.txt file is a file that tells search engines what they can and cannot access on your site. It resides in the root of the domain and has a simple structure:&lt;/p&gt;

&lt;p&gt;Basic Structure&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User-agent: *
Disallow: /admin/
Disallow: /private/
Allow: /public/

Sitemap: https://www.exemplo.com/sitemap.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Key Elements
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;User-agent: Specifies which robots the rule applies to. * applies to all.&lt;/li&gt;
&lt;li&gt;Disallow: Blocks directories or files.&lt;/li&gt;
&lt;li&gt;Allow: Allows specific directories or files.
Benefits&lt;/li&gt;
&lt;li&gt;Indexing Control: Decides what search engines see.&lt;/li&gt;
&lt;li&gt;Security: Protects sensitive areas.&lt;/li&gt;
&lt;li&gt;Optimization: Directs robots to important parts of the site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember: Anyone can view your robots.txt, and not all robots follow the rules.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sitemaps
&lt;/h3&gt;

&lt;p&gt;A sitemap is a file that lists all the pages of your site to help search engines find, crawl, and index your content more efficiently. It can be in XML or HTML format.&lt;/p&gt;

&lt;h4&gt;
  
  
  Types of Sitemaps
&lt;/h4&gt;

&lt;p&gt;XML Sitemap: Made for search engines. Contains URLs and information like last update, change frequency, and relative importance of pages.&lt;br&gt;
HTML Sitemap: Made for users. Provides an overview of the site's content, making navigation easier.&lt;br&gt;
Basic Structure of an XML Sitemap&lt;br&gt;
Here's a basic example of an XML sitemap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;urlset&lt;/span&gt; &lt;span class="na"&gt;xmlns=&lt;/span&gt;&lt;span class="s"&gt;"http://www.sitemaps.org/schemas/sitemap/0.9"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;loc&amp;gt;&lt;/span&gt;https://www.example.com/&lt;span class="nt"&gt;&amp;lt;/loc&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;lastmod&amp;gt;&lt;/span&gt;2024-07-08&lt;span class="nt"&gt;&amp;lt;/lastmod&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;changefreq&amp;gt;&lt;/span&gt;monthly&lt;span class="nt"&gt;&amp;lt;/changefreq&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;priority&amp;gt;&lt;/span&gt;1.0&lt;span class="nt"&gt;&amp;lt;/priority&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;url&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;loc&amp;gt;&lt;/span&gt;https://www.example.com/page1&lt;span class="nt"&gt;&amp;lt;/loc&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;lastmod&amp;gt;&lt;/span&gt;2024-07-08&lt;span class="nt"&gt;&amp;lt;/lastmod&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;changefreq&amp;gt;&lt;/span&gt;weekly&lt;span class="nt"&gt;&amp;lt;/changefreq&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;priority&amp;gt;&lt;/span&gt;0.8&lt;span class="nt"&gt;&amp;lt;/priority&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/url&amp;gt;&lt;/span&gt;
   &lt;span class="c"&gt;&amp;lt;!-- Mais URLs --&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/urlset&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key Elements of an XML Sitemap&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;loc&amp;gt;&lt;/code&gt;: URL of the page.&lt;br&gt;
&lt;code&gt;&amp;lt;lastmod&amp;gt;&lt;/code&gt;: Date of last modification.&lt;br&gt;
&lt;code&gt;&amp;lt;changefreq&amp;gt;&lt;/code&gt;: Expected change frequency (daily, weekly, monthly, etc.).&lt;br&gt;
&lt;code&gt;&amp;lt;priority&amp;gt;&lt;/code&gt;: Relative importance of the page (0.0 to 1.0).&lt;/p&gt;

&lt;p&gt;Benefits of a Sitemap&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Better Crawling: Helps search engines find all pages, even deep ones.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Quick Indexing: New or updated pages are indexed faster.&lt;br&gt;
Organization: Keeps the site well-organized and improves user navigation (for HTML sitemap).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  How to Use:
&lt;/h4&gt;

&lt;p&gt;Create the Sitemap: Use tools like Yoast SEO (for WordPress), Screaming Frog, or online sitemap generators.&lt;/p&gt;

&lt;p&gt;Submit to Search Engines: Submit the sitemap through Google Search Console and Bing Webmaster Tools.&lt;/p&gt;

&lt;p&gt;Example of Inclusion in robots.txt&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Sitemap: https://www.exemplo.com/sitemap.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A sitemap is essential to ensure that search engines find and index all the important content on your site, helping to improve SEO and user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus - Use Next.js
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Next.js is a powerful framework that brings us some advantages in improving SEO.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;But I need to be honest, it's not the only one. There are others like Astro and Nuxt that also do this very well and make your life easier.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SSR, SSG, Image optimization, among other advantages make Next.js a great tool to assist you on this journey.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Well guys, that's it.&lt;br&gt;
With these practices, you'll be on the right track to increase qualified traffic and the success of your blog.&lt;br&gt;
Remember that SEO changes all the time, so always seek the best and most updated strategy for you.&lt;/p&gt;

&lt;p&gt;If you like this type of content and plan to launch your own SaaS someday, come with me and follow me. I post daily content on my Twitter and weekly on my YouTube channel.&lt;br&gt;
This article will also be available in video format very soon on my YouTube channel:&lt;br&gt;
&lt;a href="https://youtube.com/@daniellimae" rel="noopener noreferrer"&gt;https://youtube.com/@daniellimae&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/daniellimae" rel="noopener noreferrer"&gt;https://x.com/daniellimae&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>seo</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>how to get more views</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Thu, 04 Jan 2024 20:08:40 +0000</pubDate>
      <link>https://dev.to/daniellimae/how-to-get-more-views-1lah</link>
      <guid>https://dev.to/daniellimae/how-to-get-more-views-1lah</guid>
      <description>&lt;p&gt;If you write articles in english, this post is for you.&lt;br&gt;
This was a game changer for me in my articles.&lt;br&gt;
This was how I grew my audience in one simple step:&lt;/p&gt;

&lt;p&gt;Everything that I wrote I pasted at GPT and prompt "Do better"..&lt;br&gt;
To seams like a "native guy", BUT, guess what: &lt;br&gt;
I'm not a native, and the reader probably neither.&lt;/p&gt;

&lt;p&gt;The main issue was thinking that english is a tool to use with only &lt;br&gt;
u.s.a / Europe persons.&lt;br&gt;
But is a tool to communicate between the whole world.&lt;br&gt;
And the majority ✨ don't is native speaker✨. &lt;/p&gt;

&lt;p&gt;So fancy words by GPT will became boring.&lt;/p&gt;

&lt;p&gt;If you want to seams smart, and cool use fancy words. Keep going.&lt;/p&gt;

&lt;p&gt;BUT, if you really want to be understood and pass on valuable knowledge:&lt;/p&gt;

&lt;p&gt;A good teacher transform hard in easy.&lt;br&gt;
Talk easy. Write easy.✌🏽&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>productivity</category>
      <category>career</category>
      <category>writing</category>
    </item>
    <item>
      <title>Article Every Day April</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Sun, 16 Apr 2023 04:59:52 +0000</pubDate>
      <link>https://dev.to/daniellimae/article-every-day-april-4lb9</link>
      <guid>https://dev.to/daniellimae/article-every-day-april-4lb9</guid>
      <description>&lt;p&gt;1# April, I decide to be a more productivity person. &lt;br&gt;
At first, the main idea was to record videos, and --force me to learn new things every day.&lt;/p&gt;

&lt;p&gt;So I decide to start my journey building articles, and create this challenge in order to help me learn how to communicate with my public. &lt;/p&gt;

&lt;p&gt;And here are the main things that i learned until day 15.&lt;/p&gt;

&lt;h2&gt;
  
  
  Improve My English Skills
&lt;/h2&gt;

&lt;p&gt;My mother language is Portuguese ( I'm from Brazil 🇧🇷 ). &lt;/p&gt;

&lt;p&gt;Of course that write every day using english was a game change for my language skills. My communication in english just became much better. The words come into my mind much easier. &lt;/p&gt;

&lt;p&gt;Now I think and write just in English, don't need to translate every time anymore. And in case I don't know a word or if I want to say the hole think in a better way, I force myself to write that in another perspective.&lt;/p&gt;

&lt;h2&gt;
  
  
  It's more about me than pass content
&lt;/h2&gt;

&lt;p&gt;I can just lie for you and say that my main thing is to just pass information for a person who don't know about the article title. But sometimes even I din't knew every thing about the article title. Write force me to learn. Or if I learn some new, it force me to write . Is a two-way street. &lt;/p&gt;

&lt;p&gt;I guess this of course is my intention, but is not the main.&lt;/p&gt;

&lt;p&gt;My main intention writing articles is to improve my skills, make a "DUMP" of what I learned.&lt;br&gt;
If you learned something about what i wrote, good for you. I'm glad too about it!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deal with criticism, not everybody likes you
&lt;/h2&gt;

&lt;p&gt;I receive fews bad feedbacks, but at begin i was too scary about how people could criticism me like :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbleumc4ag24b2j8qir4g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbleumc4ag24b2j8qir4g.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Bro wtf, this is not real, because I'm a bad ass on this subject and you are totally wrong .&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But I just realized that if my main intention was to learn and improve my skills, even if I'm totally wrong, that is ok.&lt;br&gt;
If someone correct me or add a new issue about what I write i will be GLAD and not scary.&lt;/p&gt;

&lt;p&gt;Of course that I try my maximum to pass a real and truth information. But I make mistakes, and that is ok .&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn how to learn 🤯
&lt;/h2&gt;

&lt;p&gt;The first think you should do as a developer is learn the right way to put new content in your mind.&lt;/p&gt;

&lt;p&gt;And this is a hard task because I can not give you a to-do list or a tutorial to show the best ways to fix something. Of course I can give you ways that are good for me, but learn the "right" way to lear is a thing that only you can discover.&lt;/p&gt;

&lt;p&gt;For example, I don't like to take notations about every thing at Notion. I guess this take a huge time for me and I never come back to read. So I discover that write articles and do some content at public is the best way FOR ME.&lt;/p&gt;

&lt;h2&gt;
  
  
  GTP: use but not abuse
&lt;/h2&gt;

&lt;p&gt;To write content at begin I input every phase at GPT and ask him to "improve" or to "write this in a better way". And in my opinion this is the wrong way for me. I was insecure about my english skills and try hard to make sure that my article should have the "best english ever".&lt;/p&gt;

&lt;p&gt;But this is a mistake. The most part of my audience ( and I ) are not native english speakers. So write in a simple way, without using fancy words is the best way to learn.&lt;/p&gt;

&lt;p&gt;So now you can see several gramar errors, but my main intention is to communicate with you and dump info for me at future. &lt;/p&gt;

&lt;p&gt;## Every day was not cool for me &lt;/p&gt;

&lt;p&gt;Now I realized that the best option is one video per week with a good and more elaborate article. I guess that allows me to understand more about the hole theme.&lt;/p&gt;

&lt;p&gt;Make a unique article per day don't allow me to get deep at the subject. So for now I will reduce the occurrence, to 1 video and article/week .&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;Follow me here if you want to see more content :) &lt;br&gt;
Or at twitter &lt;a class="mentioned-user" href="https://dev.to/daniellimae"&gt;@daniellimae&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
    </item>
    <item>
      <title>🔒Security Tips for Frontend</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Fri, 14 Apr 2023 22:49:12 +0000</pubDate>
      <link>https://dev.to/daniellimae/security-tips-for-frontend-5372</link>
      <guid>https://dev.to/daniellimae/security-tips-for-frontend-5372</guid>
      <description>&lt;p&gt;Do a frontend app is more than just center a div and background color your button ( unfortunately ).&lt;/p&gt;

&lt;p&gt;As a front-end developer, it's important to prioritize security measures in your code. &lt;/p&gt;

&lt;p&gt;Despite focusing on performance, SEO, and UI/UX, security is just as crucial. Even big frameworks like React and Angular can leave your code vulnerable to cross-site scripting (XSS) attacks due to risky operations like dangerouslySetInnerHTML and bypassSecurityTrust APIs. &lt;/p&gt;

&lt;p&gt;It's essential to remember that front-end development has just as much responsibility for security as back-end or DevOps. Malicious attacks can occur from the front end, so it's important to take proactive steps to protect against them.&lt;/p&gt;

&lt;p&gt;So, today i'm going to show you how hackers can enjoy about your Frontend application gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Stored in Browser Memory
&lt;/h2&gt;

&lt;p&gt;Nowadays get vantage about cookies and Local Storage is a common and very effective way to bad folks stole your user information.&lt;/p&gt;

&lt;p&gt;So be aware at &lt;a href="https://dev.to/daniellimae/localstorage-or-cookies-whats-the-difference-25ho"&gt;store info at browser&lt;/a&gt; those data, &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Avoid storing sensitive data such as authentication tokens or passwords in browser memory. Instead, use secure HTTP-only cookies or other secure storage mechanisms.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use HTTPS to encrypt all data transmitted between the client and server. This can help prevent attackers from intercepting and accessing sensitive data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use encryption to protect sensitive data stored in local storage or cookies. This can make it more difficult for attackers to decipher any data they may obtain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Implement proper input validation and sanitation to prevent attackers from injecting malicious code into web forms or other input fields.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitor and log all client-side activity, including data stored in local storage and cookies, to detect any suspicious activity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid using input type="hidden" fields to hide sensitive data in web pages, as this data can be easily accessed and manipulated by attackers. And about that topic ...&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Inputs and Hidden information
&lt;/h2&gt;

&lt;p&gt;It's important to be cautious when using hidden fields or storing sensitive data in the browser's memory.&lt;/p&gt;

&lt;p&gt;Adding input type="hidden" or storing information in localStorage, sessionStorage, or cookies does not guarantee safety. Attackers can easily access everything stored in the browser's memory, including in-memory variables, by opening dev tools. &lt;/p&gt;

&lt;p&gt;If you've hidden an authentication page based on values stored in the browser, attackers can use inspection tools like &lt;a href="https://www.zaproxy.org/" rel="noopener noreferrer"&gt;ZapProxy&lt;/a&gt; to expose those values and use them for further attacks. &lt;/p&gt;

&lt;p&gt;Therefore, it's best to avoid using type="hidden" and store keys and authentication tokens elsewhere instead of in the browser's memory storage. &lt;/p&gt;

&lt;h4&gt;
  
  
  Inputs strict
&lt;/h4&gt;

&lt;p&gt;It's crucial to ensure that user input is strictly regulated to prevent security vulnerabilities such as SQL injection and clickjacking. To accomplish this, it's essential to validate and sanitize user input before transmitting it to the back end.&lt;/p&gt;

&lt;h2&gt;
  
  
  SQL Inject
&lt;/h2&gt;

&lt;p&gt;While SQL injection attacks are usually associated with vulnerabilities on the server-side, it's still possible for attackers to manipulate data entered on the client-side in such a way that it causes a SQL injection vulnerability.&lt;/p&gt;

&lt;p&gt;Here is a quick resume about it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use prepared statements or parameterized queries to interact with the database. This can help prevent SQL injection attacks by automatically escaping and quoting user input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid dynamically building SQL queries with user input. Instead, consider using an ORM (Object-Relational Mapping) library, which can handle SQL interactions automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use server-side validation to ensure that only expected types of input are accepted, and to limit the size of inputs. This can help prevent SQL injection attacks that use long strings to exploit vulnerabilities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid displaying SQL errors on the front end, which could give attackers insight into potential vulnerabilities. Instead, log errors on the server-side and provide a generic error message to users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consider using a web application firewall (WAF) to help prevent SQL injection attacks. A WAF can inspect incoming requests and block those that appear to be malicious.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these best practices, you can help ensure that your frontend code is less vulnerable to SQL injection attacks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2t89yo550q3xf6nylz7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk2t89yo550q3xf6nylz7.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Disable iframe Embedding
&lt;/h2&gt;

&lt;p&gt;One way to protect against clickjacking attacks is to disable iframes. To do this, you can include the "X-Frame-Options": "DENY" header in the request, which prevents the website from being rendered in a frame.&lt;/p&gt;

&lt;p&gt;Another technique is to use the frame-ancestors CSP directive. This allows you to control which parents are allowed to embed the page in an iframe, giving you more control over the context in which your website can be displayed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Always Set Referrer-Policy
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbn6fz75zeohcm5g7yk5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnbn6fz75zeohcm5g7yk5.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you include links that navigate away from your website using an anchor tag, it's important to use header policies like "Referrer-Policy": "no-referrer" or set rel="noopener" or rel="noreferrer".&lt;/p&gt;

&lt;p&gt;If you don't set these headers or attributes, the destination website can potentially obtain sensitive data such as session tokens or database IDs. By using these measures, you can help protect against data leaks and keep your users' information secure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Avoid Third-Party Services
&lt;/h2&gt;

&lt;p&gt;Didn't your mother tell you to avoid talking to strangers? The same goes for that dubious library to format phone numbers (just an example).&lt;/p&gt;

&lt;p&gt;Adding just a single line of code for third-party services such as Google Analytics, Google Tag Manager, Intercom, or Mixpanel can create a vulnerability in your web application. Imagine a scenario where one of these services gets compromised.&lt;/p&gt;

&lt;p&gt;To prevent this, it's important to have a strong Content Security Policy (CSP) in place. Most third-party services have a defined CSP directive, so make sure to add them.&lt;/p&gt;

&lt;p&gt;Additionally, whenever you add a script tag, be sure to include the integrity attribute whenever possible. This feature, known as &lt;code&gt;Subresource Integrity&lt;/code&gt;, validates the cryptographic hash of the script to ensure that it hasn't been tampered with. By taking these steps, you can help protect your web app from potential security threats.&lt;/p&gt;

&lt;p&gt;Here are some others articles about that topic : &lt;br&gt;
&lt;a href="https://betterprogramming.pub/frontend-app-security-439797f57892" rel="noopener noreferrer"&gt;https://betterprogramming.pub/frontend-app-security-439797f57892&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://securitytrails.com/blog/frontend-security-best-practices" rel="noopener noreferrer"&gt;https://securitytrails.com/blog/frontend-security-best-practices&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>beginners</category>
      <category>frontend</category>
    </item>
    <item>
      <title>👥 How to clone a website into a Chrome Extension.</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Thu, 13 Apr 2023 23:41:47 +0000</pubDate>
      <link>https://dev.to/daniellimae/how-to-clone-a-website-into-a-chrome-extension-41kg</link>
      <guid>https://dev.to/daniellimae/how-to-clone-a-website-into-a-chrome-extension-41kg</guid>
      <description>&lt;p&gt;This is a simple tutorial to how clone a website into a chrome extension . &lt;/p&gt;

&lt;p&gt;Full repo : &lt;a href="https://github.com/bolodissenoura/chrome-extension" rel="noopener noreferrer"&gt;https://github.com/bolodissenoura/chrome-extension&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Actually is not a real clone, we will reproduce the hole website if a iframe tag and show it on a google extension.&lt;/p&gt;

&lt;p&gt;There are some reasons to you do it. But today i will clone a real open-source project called Phived.&lt;/p&gt;

&lt;p&gt;Phived is a dead-simple, anti-procrastination to-do list. you can have up to 5 tasks at a time. to add more tasks, complete some of your ongoing ones. no login, no cookies, no images and no ads.&lt;/p&gt;

&lt;p&gt;Phived website: &lt;a href="https://www.phived.com/" rel="noopener noreferrer"&gt;https://www.phived.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foq02rxs7ksa5b9eu7e42.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foq02rxs7ksa5b9eu7e42.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's start
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Step 1# - Create a folder
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;mkdir my-extension&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 2# - Create a &lt;code&gt;128.png&lt;/code&gt; file as your logo
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Create a 128p by 128p logo for your app.&lt;br&gt;
In the app folder, save the file as 128.png.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Step 3# - Create a &lt;code&gt;Popup.html&lt;/code&gt; file
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;At the src you should put your website.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;http-equiv=&lt;/span&gt;&lt;span class="s"&gt;"X-UA-Compatible"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"IE=edge"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Phived&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;iframe&lt;/span&gt;
      &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://www.phived.com/"&lt;/span&gt;
      &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"
        overflow: auto;
        height: 500px;
        width: 500px;
      "&lt;/span&gt;
      &lt;span class="na"&gt;title=&lt;/span&gt;&lt;span class="s"&gt;"W3Schools Free Online Web Tutorials"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
Ï
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4# - Create a &lt;code&gt;manifest.json&lt;/code&gt; file
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"manifest_version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"phived"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"icons"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"128"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"128.png"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Anti-procrastination to-do list. you can have up to 5 tasks at a time. to add more tasks, complete some of your ongoing ones. no login, no cookies, no images and no ads."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content_scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"matches"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;all_urls&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"js"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Content.js"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"browser_action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"default_popup"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Popup.html"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"default_title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"phived"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 5# - Run and test
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Save the app or extension folder on your test device.&lt;/li&gt;
&lt;li&gt;Go to chrome://extensions/.&lt;/li&gt;
&lt;li&gt;At the top right, turn on Developer mode.&lt;/li&gt;
&lt;li&gt;Click Load unpacked.&lt;/li&gt;
&lt;li&gt;Find and select the app or extension folder.&lt;/li&gt;
&lt;li&gt;Open a new tab in Chromeand thenclick Appsand thenclick the app or extension. Make sure it loads and works correctly.
If needed, make changes in the manifest.json file, host the app folder, and retest it. Repeat until the app or extension works correctly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2rz2t1wtsoh2jf675sz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2rz2t1wtsoh2jf675sz2.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If every things runs ok, you should see your extension like that:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rpsaqjuw6cmt58qfb8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5rpsaqjuw6cmt58qfb8y.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura" rel="noopener noreferrer"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>chrome</category>
    </item>
    <item>
      <title>👨🏽‍🎨 The art of frontend freelancing - My journey</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Thu, 13 Apr 2023 00:38:41 +0000</pubDate>
      <link>https://dev.to/daniellimae/the-art-of-frontend-freelancing-my-journey-la4</link>
      <guid>https://dev.to/daniellimae/the-art-of-frontend-freelancing-my-journey-la4</guid>
      <description>&lt;h1&gt;
  
  
  If you just want to code, this article isn't for you.
&lt;/h1&gt;

&lt;p&gt;Be a freelancer is more than just go to platforms, get a job  and start to code. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;And, in my opinion, be a developer is much more than just code and chill.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article i will show a new way to get new clients and to make your career as a freelancer grow up.&lt;/p&gt;

&lt;h2&gt;
  
  
  My experience as a freelancer
&lt;/h2&gt;

&lt;p&gt;I did freelances job for 2 years. I was not just a freelancer ( i worked as a Software Developer too), but 1/3 of my money at this time came from those jobs. So at this time i learned how to get new clients and how to make then happy with the product 😄.&lt;/p&gt;

&lt;p&gt;I founded a marketing and websites agency, called &lt;strong&gt;&lt;em&gt;©Vetrin&lt;/em&gt;&lt;/strong&gt;. At begin was just me. myself and I doing everything. And at the end of my journey at this company I was with 4 people working with me at the agency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Freelances Plataform
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhfdmg35kp3dcpr4hhfc6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhfdmg35kp3dcpr4hhfc6.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's important to treat your freelance work like a real business and not just as a developer. This means taking a 'holistic' approach to your work by focusing on marketing, improving your clients' experiences, and always looking to grow and scale.&lt;/p&gt;

&lt;p&gt;While freelancing platforms like Workana can be a great way to find clients, I have never got lucky with then ( and i tried a lot ). But never succeed.&lt;/p&gt;

&lt;p&gt; Success as a freelancer takes time, effort, and dedication. But by treating your work like a real business and focusing on marketing and growth, you can create a sustainable and fulfilling career for yourself.   &lt;/p&gt;

&lt;p&gt;But if you want to just develop and don't care about "marketing" and "company stuffs", a good start is to search about freelance agencies, show some projects in a portfolio .&lt;/p&gt;

&lt;h2&gt;
  
  
  How to find clients tho ?
&lt;/h2&gt;

&lt;p&gt;All my clients were from indications and marketing adds that I launched for my service. Is good to be focused on a specific niche tho. &lt;/p&gt;

&lt;h4&gt;
  
  
  What niche ? How do i start tho ?
&lt;/h4&gt;

&lt;p&gt;I started my freelance wallet with doctors that need websites ( for example ). And a part of my job was found those potential clients and approach then with problems.&lt;/p&gt;

&lt;p&gt;After storing telling about problems I bring solutions and sell it for then.&lt;/p&gt;

&lt;p&gt;But you can approach and start for any niche. Everybody needs a website or a solution to improve the routine. You need just to learn about "how to be a good seller".&lt;/p&gt;

&lt;p&gt;Think like a company.&lt;/p&gt;

&lt;h2&gt;
  
  
  💨 Running adds, approach clients. Move !
&lt;/h2&gt;

&lt;p&gt;Have a portfolio is a duty. You need it ! &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Why should i pay for you if i don't know if you really can do it for me ?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And if you show a niche portfolio for your client he will felling a FOMO ( Fear Of Messing Out ). So you must and want induce this feeling in then.&lt;/p&gt;

&lt;p&gt;In each niche the approach technique could be different, but a general and easy way is: go at instagram profile, if the account have not a website on bio, congrats, you have a potential lead.&lt;/p&gt;

&lt;p&gt;If the lead already have a website ( and if you can do better ) you can approach tho.&lt;/p&gt;

&lt;p&gt;Running adds on TikTok and Facebook Ads for Instagram is a good ideia too ! Do it if you want, a simple video with a good Call To Action ( CTA ) should bring you a lot of leads.&lt;/p&gt;

&lt;h2&gt;
  
  
  After start and why i stopped.
&lt;/h2&gt;

&lt;p&gt;The beginning is the hardest part. After conclude some jobs and make some clients happy, they will telling about you for their friends, you could have a coupon too to stimulate that ( there are some techniques for that ).&lt;/p&gt;

&lt;p&gt;All things were looking fine, the team was growing. But, it is not scalable. Or if it is I did not found the way of scaling these kind of agency. &lt;/p&gt;

&lt;p&gt;Today with AI revolution, maybe could be easier to scaling those jobs. But have clients is a hard work, especially if you have to talk with then every single day.&lt;/p&gt;

&lt;p&gt;So I just sell my part of company and quit.&lt;/p&gt;

&lt;p&gt;In this part I felt that I needed to study more and spend more time with my hard skills. But now i understand that i'm a life long learning :) &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>career</category>
    </item>
    <item>
      <title>🎒 localStorage or 🍪 cookies : What's the difference?</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Wed, 12 Apr 2023 02:35:09 +0000</pubDate>
      <link>https://dev.to/daniellimae/localstorage-or-cookies-whats-the-difference-25ho</link>
      <guid>https://dev.to/daniellimae/localstorage-or-cookies-whats-the-difference-25ho</guid>
      <description>&lt;h2&gt;
  
  
  LocalStorage vs cookies
&lt;/h2&gt;

&lt;p&gt;The both are there for one reason: storage some information ( setItem ) and use it in other instance. &lt;/p&gt;

&lt;p&gt;But there are some differences between then that you should know to choose the best option. &lt;/p&gt;

&lt;p&gt;And you should avoid to only use one for every situation, think every time what is the best one for you in the moment. You can use both on your application for multiple screens and features.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎒 Local Storage
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;LocalStorage is a storage mechanism available in modern web browsers that allows web applications to store data in the user's browser. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It provides a simple key-value store for data that can be accessed by JavaScript running in the user's browser.&lt;/p&gt;

&lt;h4&gt;
  
  
  The data stored in LocalStorage is persistent, meaning it will remain even if the user closes their browser or turns off their computer.
&lt;/h4&gt;

&lt;p&gt;LocalStorage is typically used to store larger amounts of data that need to be accessed frequently, such as user preferences or session data.&lt;/p&gt;

&lt;h3&gt;
  
  
  🍪 Cookies
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Cookies, on the other hand, are small text files that are stored in the user's browser by websites they visit. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  Unlike LocalStorage, cookies can be set with an expiration date, meaning they will automatically be deleted after a certain amount of time.
&lt;/h4&gt;

&lt;p&gt;Cookies are typically used to store smaller amounts of data, such as a user's login credentials or their shopping cart items. &lt;/p&gt;

&lt;p&gt;Cookies are also sent back to the server with each request, which can be useful for things like tracking user behavior or maintaining a user's session.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KPRN14EN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n0klnv7r7r5uvsqristr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KPRN14EN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n0klnv7r7r5uvsqristr.png" alt="Image description" width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  About Next.js and SSR
&lt;/h3&gt;

&lt;p&gt;If you're using Next.js, it's important to be aware that LocalStorage may not work as expected with server-side rendering (SSR). This is because LocalStorage relies on the browser's window object, which is not available during SSR. As a result, any attempts to access LocalStorage during SSR will fail.&lt;/p&gt;

&lt;p&gt;To work around this limitation, you can use cookies instead. Cookies are supported during SSR, so you can use them to store data that needs to be accessed on both the client and server. There are libraries available, such as nookiesjs, that make it easy to manipulate cookies in Next.js applications.&lt;/p&gt;

&lt;p&gt;By using cookies instead of LocalStorage, you can ensure that your application works as expected during SSR, while still being able to store and access data on the client-side.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the best option for me ?
&lt;/h3&gt;

&lt;p&gt;Avoid to choose then like a soccer team, or some like this. Choose the best one for your feature and change if necessary.&lt;/p&gt;

&lt;p&gt;In summary, LocalStorage and cookies are both useful storage mechanisms for web applications, but they have distinct differences that make them suitable for different use cases. By understanding the differences between these two mechanisms, developers can choose the best approach for their specific needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U5soxAg0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04hovcgey34lm5sqw1xf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U5soxAg0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04hovcgey34lm5sqw1xf.png" alt="Image description" width="800" height="509"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>frontend</category>
    </item>
    <item>
      <title>How to refresh-token</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Mon, 10 Apr 2023 22:09:09 +0000</pubDate>
      <link>https://dev.to/daniellimae/how-to-refresh-token-170n</link>
      <guid>https://dev.to/daniellimae/how-to-refresh-token-170n</guid>
      <description>&lt;p&gt;Today i'm going to show you one way to refresh your token at front-end applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a token ?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;In the context of computer programming, a token is a sequence of characters that represents a single, meaningful unit of information. Tokens are often used in programming languages, where they serve as the basic building blocks of code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And in web applications we currently Json Web Tokens ( JWT ) to pass information and do/control authentication and authorization.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5u0yyksyyvv4fix6tvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa5u0yyksyyvv4fix6tvq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Ok, why i need to refresh it ?
&lt;/h2&gt;

&lt;p&gt;Refresh tokens add to the security of OAuth since they allow the authorization server to issue access tokens with a short lifetime and reduced scope, thus reducing the potential impact of access token leakage. Refresh tokens are a convenient and UX-friendly way to obtain new access tokens after the expiration of older access tokens.&lt;/p&gt;

&lt;p&gt;One reason for using refresh tokens is that they allow the server to revoke access, although not immediately, of users. Refresh tokens provide a nice division of responsibility and abstract out a large portion of the application in a well-documented, standard-based way. Refresh tokens also allow the same access token to be used for each request without reissuing it, which can significantly improve performance.&lt;/p&gt;

&lt;p&gt;In fact, the real "excuse" for us for using refresh tokens is to provide a better user experience. A short-lived access token improves the security of applications, but frequent re-authentication can diminish the perceived user experience of the application. Refresh tokens help balance security with usability by allowing client applications to request new access tokens after the shorter-lived access tokens expire.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can i do it ?
&lt;/h2&gt;

&lt;p&gt;We have some option to do it, but the traditional way is : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb5v0gldxay9g1pye0rc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frb5v0gldxay9g1pye0rc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do the authentication, wait for the token expires, and when your user hit a 401 error do the refresh token and refetch the original request.&lt;/p&gt;

&lt;p&gt;This is a noiseless way, your user don't will be alert about that, and will just keep using the app.&lt;/p&gt;

&lt;h4&gt;
  
  
  But, you there is another way to do it. You actually don't need to wait the 401 error, once you already know when the access_token will expires.
&lt;/h4&gt;

&lt;p&gt;So, you can avoid those requestions, and when the toke is near to expires you do the refresh token without get the 401.&lt;/p&gt;

&lt;p&gt;In that way, you will avoid several 401 errors and keep maintaining your refresh in a silent way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code example
&lt;/h2&gt;

&lt;p&gt;This is a example using javascript, axios instances to listen the 401 and intercept it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;axios&lt;/span&gt;&lt;span class="dl"&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;api&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;baseURL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://api.example.com&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="c1"&gt;// Add the interceptors&lt;/span&gt;
&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&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="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;config&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;accessToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;access_token&lt;/span&gt;&lt;span class="dl"&gt;'&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="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Authorization&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{accessToken}`&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="nx"&gt;config&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;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&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;reject&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="c1"&gt;// Add interceptor response&lt;/span&gt;
&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;interceptors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&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;response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;async &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="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;originalRequest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&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="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;401&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;originalRequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_retry&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;originalRequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_retry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&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;refreshToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;refresh_token&lt;/span&gt;&lt;span class="dl"&gt;'&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;refreshToken&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Redirecionar para a página de login&lt;/span&gt;
        &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/login&lt;/span&gt;&lt;span class="dl"&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;reject&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="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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://auth.example.com/refresh&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="na"&gt;refresh_token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;refreshToken&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;accessToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&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="nx"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;// Storage the token&lt;/span&gt;
        &lt;span class="c1"&gt;// If you are using next, use nookies library to persist those data in cookies.&lt;/span&gt;
        &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;access_token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;accessToken&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;defaults&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;common&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Authorization&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="s2"&gt;{accessToken}`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;// Send again the original request&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;api&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;originalRequest&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="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/login&lt;/span&gt;&lt;span class="dl"&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;reject&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;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;reject&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;





&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura" rel="noopener noreferrer"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>react</category>
    </item>
    <item>
      <title>Emergency fund is mandatory for all developers</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Sun, 09 Apr 2023 01:56:25 +0000</pubDate>
      <link>https://dev.to/daniellimae/emergency-fund-is-mandatory-for-all-developers-ipa</link>
      <guid>https://dev.to/daniellimae/emergency-fund-is-mandatory-for-all-developers-ipa</guid>
      <description>&lt;p&gt;Money is a fundamental part of our lives. Everyone living in a capitalist system needs money. Whether you have a simple or expensive lifestyle, you need to provide for food, housing, and other necessities.&lt;/p&gt;

&lt;p&gt;Today, I will argue why having an emergency fund is mandatory for anyone, especially for a developer.&lt;/p&gt;




&lt;p&gt;In the Stone Age, people hunted and cultivated to have food. They made stocks to survive the winter and ensure that they and their families would survive. This behavior is not exclusive to humans; bears do it, bees do it, even plants store resources in case of scarcity.&lt;/p&gt;

&lt;p&gt;And today, the main resource in a capitalist world is money. Homo sapiens sapiens need to work to buy food, a house, a car, Air Jordan 1s, and Macbooks. &lt;/p&gt;

&lt;p&gt;And today you may (or may not) be in a privileged position to have everything in abundance, but unfortunately, that can change, and you MUST be prepared for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Once up a time, Joel the developer
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EMLzABPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ghi0ae6smo6etzgoyz0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EMLzABPs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ghi0ae6smo6etzgoyz0a.png" alt="Image description" width="800" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Joel ever time felt afraid to report some problems that arose in his project for fear of losing his job.&lt;/p&gt;

&lt;p&gt;He knew the company was going through financial difficulties and his team was overloaded with several projects. As a result, Joel ended up overwhelmed and could not complete all tasks on time.&lt;/p&gt;

&lt;p&gt;Unfortunately, the situation worsened when one of the projects Joel worked on was completed with delay and errors due to work overload. As a result, the company had to lay off some employees, including Joel.&lt;/p&gt;

&lt;p&gt;If Joel had an emergency fund, he could have faced the time off work with more ease and felt safer to report problems to his superiors. This could have helped the team fix errors and improve the project's performance, thus avoiding Joel's dismissal. The lack of an emergency fund affected not only Joel's financial life but also his career.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fear of reporting and asserting oneself in a discussion for "losing the job" should not exist.
&lt;/h2&gt;

&lt;p&gt;Unfortunately, this fake story of Joel happens frequently.&lt;/p&gt;

&lt;p&gt;And you will only have no fear of lose your job if you have a solid base and money.&lt;/p&gt;

&lt;p&gt;If the company where you work is like this, you need to have complete freedom to speak your mind and assert yourself in situations without fear of losing your position. This will help you grow as a professional.&lt;/p&gt;

&lt;p&gt;Working without this "fear" is 100% crucial for a developer's life. Having a clear and fear-free mind is something that will improve your performance as a dev.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overall
&lt;/h2&gt;

&lt;p&gt;An emergency fund can have a significant impact on both your personal and professional life, especially as a developer. By having a financial cushion, you can avoid feeling anxious or fearful about unexpected events that may arise in your life. This can help you to have a more confident and assertive voice in your workplace, as you won't be weighed down by the fear of losing your job.&lt;/p&gt;

&lt;p&gt;As a developer, having an emergency fund should be a top priority. It can give you peace of mind and allow you to focus on your work without worrying about financial stressors. Additionally, having a safety net can help you to take risks and pursue new opportunities, such as learning a new skill or taking on a challenging project.&lt;/p&gt;

&lt;p&gt;An emergency fund is essential for anyone looking to maintain financial stability and achieve success in their career. &lt;/p&gt;

&lt;h3&gt;
  
  
  It can provide a sense of security and confidence that will allow you to thrive both personally and professionally.
&lt;/h3&gt;




&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🌸 A elegant way to consume API's at front-end</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Fri, 07 Apr 2023 23:00:18 +0000</pubDate>
      <link>https://dev.to/daniellimae/a-elegant-way-to-consume-apis-at-front-end-3m8m</link>
      <guid>https://dev.to/daniellimae/a-elegant-way-to-consume-apis-at-front-end-3m8m</guid>
      <description>&lt;h2&gt;
  
  
  Pros and cons / when to use the react-query library.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is react-query and what pain point does it solve?
&lt;/h3&gt;

&lt;p&gt;What is react-query and what pain point does it solve? Even though the library has changed its name (to TanStack Query), we will still refer to it as react-query here, ok?&lt;/p&gt;

&lt;p&gt;On the library's website, it is described as: "The missing data fetching library for React apps, but in more technical terms, it makes it very easy to fetch, cache, synchronize and update server state in your React apps."&lt;/p&gt;

&lt;p&gt;We can interpret this as: "I am a library that helps you fetch data more efficiently using my own hooks, store that data in cache for better performance, create a more reliable loading screen. In addition, I make the code more readable and easier to handle."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WzlYT_AO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqawc5mtrznj087gz3lw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WzlYT_AO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqawc5mtrznj087gz3lw.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What other way is there to do this?
&lt;/h3&gt;

&lt;p&gt;If you have used React in a project, you have probably come across the following syntax:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DNrI419X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9prw05xn421ffb8c9ci.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DNrI419X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9prw05xn421ffb8c9ci.png" alt="Image description" width="800" height="1057"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Explaining the code would be:
&lt;/h4&gt;

&lt;p&gt;Importing axios and creating an auxiliary state for each functionality (error, data, and loading...) :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Dg5eAIQe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyav20t5zbzfk02cop4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dg5eAIQe--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyav20t5zbzfk02cop4c.png" alt="Image description" width="767" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using useEffect to call our function to hit the API and bring this data to set in our data State every time the component (or screen) is loaded.&lt;/p&gt;

&lt;p&gt;But first, we set our two error and loading states to give the impression that it is "loading..." and that "there is no error", which is a lie because what is happening is "I haven't hit the API yet, I don't know what's going on there."&lt;/p&gt;

&lt;p&gt;This way, the first thing your function does is not to hit the API but to set the various states.&lt;/p&gt;

&lt;p&gt;I recommend reading "Why useEffect is a bad place to make API calls": &lt;a href="https://articles.wesionary.team/why-useeffect-is-a-bad-place-to-make-api-calls-98a606735c1c"&gt;https://articles.wesionary.team/why-useeffect-is-a-bad-place-to-make-api-calls-98a606735c1c&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jUY3hfg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcf0m7txl8swcv87fpgb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jUY3hfg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pcf0m7txl8swcv87fpgb.png" alt="Image description" width="786" height="399"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and finally consume this data and states in our JSX return statement:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nTr8XQX1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0680cpa69sqc9v5gm3qz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nTr8XQX1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0680cpa69sqc9v5gm3qz.png" alt="Image description" width="663" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Although it may not be entirely accurate, this logic still works! And if your app doesn't have a large number of users and requests, I believe this code will serve its purpose without major issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  What pain does React-Query solve?
&lt;/h2&gt;

&lt;p&gt;Error handling: React Query provides an integrated way to handle server request errors. This can help you easily deal with common error scenarios, such as network failures and server errors.&lt;br&gt;
With this, goodbye setIsError and its derivatives. Now, controlling error and loading states with React Query's own hooks has become much better:&lt;/p&gt;

&lt;p&gt;We can also create a folder called "hooks" and fill it with hooks for each endpoint or API request. With this, we don't necessarily need this inelegant useEffect body with a new function call in each component/screen.&lt;/p&gt;

&lt;p&gt;Simplified code: React Query can help simplify your code by reducing the amount of boilerplate code you need to write to handle server responses.&lt;/p&gt;

&lt;p&gt;👉🏽 And the key differential of the library, for me, is:&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache:
&lt;/h3&gt;

&lt;p&gt;React Query's cache layer can help improve application performance by reducing the number of network requests needed to retrieve data. This can improve the responsiveness of the application and reduce server load a lot.&lt;/p&gt;

&lt;p&gt;Optimistic updates: React Query allows you to update the cache with optimistic updates, which means you can update the user interface before waiting for the server response. This can make your application seem faster and more responsive.&lt;/p&gt;

&lt;h2&gt;
  
  
  When not to use it?
&lt;/h2&gt;

&lt;p&gt;As great as the library may be, it's important to be cautious about over-engineering.&lt;/p&gt;

&lt;h3&gt;
  
  
  Learning curve:
&lt;/h3&gt;

&lt;p&gt;React Query has its own API and it can take some time to learn how to use it effectively. It is also necessary to understand the underlying concepts of the library, such as cache, invalidation, and so on.&lt;/p&gt;

&lt;h3&gt;
  
  
  Not always necessary:
&lt;/h3&gt;

&lt;p&gt;For smaller applications, it may not be necessary to use React Query. The cache and error handling features may not be as useful in small-scale applications where performance is not a major concern.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integration with existing code:
&lt;/h3&gt;

&lt;p&gt;If you are adding React Query to an existing codebase, you may need to refactor your existing code to work with the library. This can be time-consuming and increase the overall complexity of your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Overhead:
&lt;/h3&gt;

&lt;p&gt;Like any library, React Query has overhead in terms of package size and performance. For small applications, this overhead may not be justified.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final considerations
&lt;/h1&gt;

&lt;p&gt;This article does not intend to teach you how to use react-query, but you can follow the step-by-step guide in the documentation:&lt;br&gt;
&lt;a href="https://tanstack.com/query/v4/docs/react/installation"&gt;https://tanstack.com/query/v4/docs/react/installation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or if you need a video, we have Fernanda Kipper:&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=ZI9uLACYAd0"&gt;https://www.youtube.com/watch?v=ZI9uLACYAd0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Or a more specific one about cache:&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=YmS5uo9ty2Q"&gt;https://www.youtube.com/watch?v=YmS5uo9ty2Q&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>frontend</category>
      <category>api</category>
    </item>
    <item>
      <title>Beyond Changing Technology: Scaling Your Applications Efficiently</title>
      <dc:creator>Daniel Lima </dc:creator>
      <pubDate>Fri, 07 Apr 2023 02:14:49 +0000</pubDate>
      <link>https://dev.to/daniellimae/beyond-changing-technology-scaling-your-applications-efficiently-4hok</link>
      <guid>https://dev.to/daniellimae/beyond-changing-technology-scaling-your-applications-efficiently-4hok</guid>
      <description>&lt;p&gt;Often, when facing scalability issues in our applications, the first reaction is to think about changing the language or framework. &lt;/p&gt;

&lt;p&gt;The technologies we use are indeed VERY important for how fast and scalable our application can be. However, they are not the only factors to consider.&lt;/p&gt;

&lt;p&gt;However, this decision may not be the best one, as there are several ways to make your application faster and more efficient without changing technology.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rf276HdQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piu2di7x7b9cm5nb66qr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rf276HdQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/piu2di7x7b9cm5nb66qr.png" alt="Image description" width="813" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we dive into the details of how to scale your application, it's important to understand what happens when a request reaches the server. When this happens, a web server (such as NGINX or APACHE) is responsible for processing the request and forwarding it to the corresponding application. &lt;/p&gt;

&lt;h3&gt;
  
  
  In other words, the web server is the first point of contact between your application and the user.
&lt;/h3&gt;

&lt;p&gt;But as we are talking about dynamic applications, the path taken by the request does not end at the web server. The code of your application needs to be executed in some way, either through a script (in the case of Laravel, for example) or a process managed by an application server (such as Passeger, in the case of Rails). And of course, the information manipulated by the application is stored in a database.&lt;/p&gt;

&lt;p&gt;All this to say that the scalability of an application depends on many factors beyond technology choice. To ensure that your application is scalable and does not present bottlenecks, it is necessary to take into account all these elements and optimize them in the best possible way.&lt;/p&gt;

&lt;p&gt;In your application workflow, everything &lt;strong&gt;&lt;em&gt;can be synchronous&lt;/em&gt;&lt;/strong&gt;, meaning that if your database takes one second to load, your request will be delayed by one second. In such cases, the choice of your framework won't make a difference, as the bottleneck is likely to be at the database, server, or some other point in your application.&lt;/p&gt;

&lt;p&gt;If you want a fast app, you need to be fast at every process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Identify the bottlenecks.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lg9uHovR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fauvgexa0zhi6xyoaqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lg9uHovR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4fauvgexa0zhi6xyoaqw.png" alt="Image description" width="848" height="368"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For that you can use some tools, like &lt;a href="https://newrelic.com/"&gt;New Relic&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  There are situations where everything seems to be okay.
&lt;/h2&gt;

&lt;p&gt;Your application is configured correctly, but still, everything seems a bit stiff and slow in your product. I will address 3 common scenarios:&lt;/p&gt;

&lt;h2&gt;
  
  
  1 - Slow tasks:
&lt;/h2&gt;

&lt;p&gt;Imagine that you have a feature where when the user uploads a CSV file, your application scans each line of that archive and saves it in a database.&lt;/p&gt;

&lt;p&gt;If your CSV has 15 lines, it will be quick, but if it has a million lines, it may start to get slow. In this case, there isn't much to escape 😔. &lt;/p&gt;

&lt;p&gt;It's a naturally slow process and task. But a good solution to improve your user's experience is to implement the concept of QUEUES 😎.&lt;/p&gt;

&lt;p&gt;A queue works like this: you take a process that is being executed synchronously, and you isolate it in what we call JOBS. So now we have a Job that we can call "ProcessCSV." You put this in a separate class, and when the user sends the CSV, instead of processing it at that time, you send that job to the queue, which is another process that will take the jobs sent, process them, and delete them after processing. In other words, you make your application more asynchronous.&lt;/p&gt;

&lt;p&gt;But this requires good UX; you have to make it clear to your user. Your client needs to know what is happening with the task they requested for your application. For that, I also recommend reading about &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/State_machine"&gt;State Machines&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2 - Cache is love, but not always love is good.
&lt;/h2&gt;

&lt;p&gt;Let's say you have an application that returns a common API. It makes a query and returns the data from a table. If the data doesn't have a very fast mutability, meaning if you know that in a little while, if the user doesn't make any changes, the data will be the same, you can work with a cache. When making a mutation in your application, it's possible to implement an update of your cache when the mutation is completed. If you want to add new data, you can manipulate your cache to add this new post instantly to your user, without needing a refetch every time the user changes something.&lt;/p&gt;

&lt;h4&gt;
  
  
  Do not have outdated data, be careful.
&lt;/h4&gt;

&lt;p&gt;However, this is not always good to do. Let's say your site returns the updated value of Bitcoin in relation to the dollar. For this, it's not interesting to persist this data 100% in cache, considering that in a short period of time, your user wants to know the new value of Bitcoin, given that it fluctuates a lot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=i9lREHmUCic"&gt;You can watch a comprehensive video where I explain how I implement cache writing in my frontend application&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Tools for cache and examples of using
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y-_EtH7C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2yt006lpqpsw0zcdjei6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y-_EtH7C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2yt006lpqpsw0zcdjei6.png" alt="Cats argue about cache" width="503" height="307"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Imagine that you need to build a news website. If your site is small, it's fine to make 30 requests and query your database 30 times. However, if your task is to create the primary news portal for your country, there will be millions of requests at any given time for data that typically doesn't change very often. After all, the most that will happen is a writer editing a few details or deleting the news entirely, but they won't typically make thousands of edits per day.&lt;/p&gt;

&lt;p&gt;To handle this level of traffic, you can use tools such as &lt;a href="https://varnish-cache.org/"&gt;Varnish HTTP Cache&lt;/a&gt;, which caches the information of a news article starting from the first user who accesses and makes the request. Once Varnish caches the page, subsequent users will receive a response that is saved in memory. This process allows you to avoid unnecessary synchronous requests and send a quick response to users.&lt;/p&gt;

&lt;p&gt;In other words, Varnish intercepts the request and sends a pre-cached, beautiful, and fragrant response to your users without overwhelming the server with millions of unnecessary requests. However, it's important to take some security measures, such as validating whether the news has been altered or checking if the content has changed.&lt;/p&gt;

&lt;p&gt;Using a tool like Varnish HTTP Cache is a great way to make your page faster and handle high traffic volume with ease.&lt;/p&gt;

&lt;h2&gt;
  
  
  Last but not least - IMPROVE YOUR CODE
&lt;/h2&gt;

&lt;p&gt;I will write a entire article about that, but for now: &lt;/p&gt;

&lt;p&gt;Improving your code is crucial for the success of any programming project.&lt;br&gt;
Bad code make all feature more difficult and take more time to be deployed. And time is money.&lt;/p&gt;

&lt;p&gt;If you're working in a team, it's important to have the right tools and processes in place to ensure that everything is running smoothly. While there are many ways to achieve this, here are some key tips that you can implement:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Utilize efficient debugging tools to identify and resolve errors quickly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thoroughly test your code to catch any potential issues before they cause problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use clear and descriptive variable names to improve readability and maintainability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make use of Lint tools to identify and fix common coding mistakes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;... (add additional tips as appropriate)&lt;/p&gt;

&lt;p&gt;By following these best practices and continually refining your approach, you can ensure that your code is well-organized, reliable, and easy to maintain, ultimately leading to more successful projects and happier stakeholders.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CJvgj0UV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s54d087t8eiz5ipcs6t6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CJvgj0UV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s54d087t8eiz5ipcs6t6.png" alt="Image description" width="485" height="304"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Thanks &lt;a class="mentioned-user" href="https://dev.to/sibelius"&gt;@sibelius&lt;/a&gt; for give the question.&lt;br&gt;
Thanks Fabio Akita and Mateus Guimarães for explain me some topics.&lt;/p&gt;

&lt;p&gt;Hope this post can be helpful!&lt;br&gt;
For some feedback or more content, follow me on &lt;a href="https://twitter.com/daniellimae"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/bolodissenoura"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
