<?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>Forem: Danilo Vilhena</title>
    <description>The latest articles on Forem by Danilo Vilhena (@danilovilhena).</description>
    <link>https://forem.com/danilovilhena</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%2F590289%2Fc4b96103-f8a4-40f6-99ce-b67527010837.png</url>
      <title>Forem: Danilo Vilhena</title>
      <link>https://forem.com/danilovilhena</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/danilovilhena"/>
    <language>en</language>
    <item>
      <title>I built a blazing-fast AI-Powered SQL editor ⚡️</title>
      <dc:creator>Danilo Vilhena</dc:creator>
      <pubDate>Wed, 30 Apr 2025 00:36:51 +0000</pubDate>
      <link>https://forem.com/danilovilhena/i-built-the-cursor-of-sql-databases-415e</link>
      <guid>https://forem.com/danilovilhena/i-built-the-cursor-of-sql-databases-415e</guid>
      <description>&lt;p&gt;Hello!&lt;/p&gt;

&lt;p&gt;If you're like me, you've probably spent countless frustrating hours wrestling with &lt;strong&gt;clunky, slow SQL clients&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;I was tired of feeling frustrated every time I had to write, organize, or manage some SQL, so &lt;strong&gt;I built something better.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Meet TurboSQL: a blazing-fast, AI-powered SQL editor designed specifically with developers in mind.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Did I Build TurboSQL?
&lt;/h2&gt;

&lt;p&gt;The short answer: pain. Real, daily pain. Working with traditional SQL clients felt unnecessarily cumbersome. They were slow, bloated, and distracting, constantly interrupting my coding flow. What I wanted was something close to Cursor—fast, intuitive, and built for developers who value speed, simplicity, and efficiency.&lt;/p&gt;

&lt;p&gt;So I created TurboSQL—a SQL desktop app &lt;strong&gt;designed to get out of your way and let you focus entirely on your data and queries&lt;/strong&gt;. Here's what makes TurboSQL special:&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚡️ Lightning-Fast Performance
&lt;/h3&gt;

&lt;p&gt;TurboSQL is built on Tauri, a powerful framework that offers near-native performance. Queries run instantly, making it the fastest SQL client you've likely ever used.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⌨️ Keyboard-First Design
&lt;/h3&gt;

&lt;p&gt;Every action in TurboSQL is shortcut-ready. Designed to keep your hands on the keyboard, you'll never have to reach for the mouse and break your flow again.&lt;/p&gt;

&lt;h3&gt;
  
  
  🗂️ Smart Organization
&lt;/h3&gt;

&lt;p&gt;Organize your queries neatly into folders and files, just like real code. It’s intuitive, structured, and exactly what you expect as a developer.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✨ AI-Powered Magic
&lt;/h3&gt;

&lt;p&gt;TurboSQL isn’t just fast—it’s smart. The built-in AI assistant generates queries from plain English, explains complex SQL statements, and even autocompletes queries intelligently based on your database schema.&lt;/p&gt;

&lt;h3&gt;
  
  
  😎 Beautifully Minimal
&lt;/h3&gt;

&lt;p&gt;I also believe tools should be a pleasure to use. TurboSQL comes with a sleek, dark-mode UI that's minimalistic and clean, making working with your data genuinely enjoyable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pricing That Makes Sense
&lt;/h2&gt;

&lt;p&gt;TurboSQL offers a simple, transparent pricing structure:&lt;/p&gt;

&lt;p&gt;Community (Free): Powerful SQL editor, unlimited connections, fully secure and local-first experience.&lt;/p&gt;

&lt;p&gt;Professional ($15/month): Unlock the full AI-powered experience, priority support, and advanced productivity features.&lt;/p&gt;

&lt;p&gt;Try it risk-free with our 30-day money-back guarantee.&lt;/p&gt;




&lt;p&gt;Ready to Turbocharge Your SQL Workflow?&lt;/p&gt;

&lt;p&gt;Stop dealing with slow, outdated SQL clients. TurboSQL is here to give you the speed, power, and developer-friendly UX you've always wanted.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.turbosql.co/?ref=devto" rel="noopener noreferrer"&gt;https://www.turbosql.co/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sql</category>
      <category>database</category>
      <category>datascience</category>
      <category>programming</category>
    </item>
    <item>
      <title>JSDoc: Improve your JS code documentation</title>
      <dc:creator>Danilo Vilhena</dc:creator>
      <pubDate>Thu, 01 Feb 2024 02:24:25 +0000</pubDate>
      <link>https://forem.com/danilovilhena/jsdoc-improve-your-js-code-documentation-2mj7</link>
      <guid>https://forem.com/danilovilhena/jsdoc-improve-your-js-code-documentation-2mj7</guid>
      <description>&lt;p&gt;In the dynamic world of JavaScript, &lt;strong&gt;good communication&lt;/strong&gt; is just as crucial as writing good code.&lt;/p&gt;

&lt;p&gt;This is where &lt;strong&gt;JSDoc&lt;/strong&gt; enters the scene, a tool that's essential for any JavaScript developer aiming to elevate the readability and maintainability of their code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSDoc&lt;/strong&gt; helps you craft a clear, navigable guide through your code for others and for your future self.&lt;/p&gt;

&lt;p&gt;Let's get started and see how JSDoc can make your projects more accessible and your development process more efficient! 🔥&lt;/p&gt;




&lt;h2&gt;
  
  
  What is JSDoc?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://jsdoc.app/?ref=blog.danilovilhena.com"&gt;JSDoc&lt;/a&gt; is an open-source documentation generator used by developers to annotate JavaScript source code.&lt;/p&gt;

&lt;p&gt;By using comment blocks specific to JSDoc, developers can provide rich, insightful descriptions of the code's functionality, parameters, return types, and more.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;This isn't just about adding comments; it's about creating a comprehensive guide to your code.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For example, in the image below, we are able to give a short description of what a function does, what are its params and what is returned.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2qmtb2n4r76ud4tkc17.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp2qmtb2n4r76ud4tkc17.png" alt="JSDoc for the function calculateCircleArea&amp;lt;br&amp;gt;
" width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Why use JSDoc?
&lt;/h2&gt;

&lt;p&gt;Using JSDoc can be good for your project for several reasons, let's go through a few of them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Improve code readability&lt;/strong&gt;: JSDoc provides a clear overview of what a function or a module does, what parameters it expects, and what it returns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Help code maintenance&lt;/strong&gt;: When code needs to be updated or debugged, JSDoc can help developers quickly grasp the purpose and functionality of the code, reducing the time needed for maintenance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support for Intellisense and Autocomplete&lt;/strong&gt;: Many code editors and IDEs (like VS Code) use JSDoc comments to provide Intellisense and autocomplete features. This helps developers write code more efficiently by giving them quick access to function signatures and parameter information.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Setting Up JSDoc
&lt;/h2&gt;

&lt;p&gt;JSDoc is available as a Node.js package, which means you can easily install it using &lt;code&gt;npm&lt;/code&gt;, the Node package manager.&lt;/p&gt;

&lt;p&gt;If you want to install it globally, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; jsdoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to install it in your project, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; jsdoc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once it finishes installing, the next step is to set up a basic configuration file. This file is the &lt;code&gt;jsdoc.json&lt;/code&gt;, and it defines the rules and settings. Here's a simple setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"source"&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;"include"&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;"src"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"includePattern"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;".+&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;.js(doc|x)?$"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"excludePattern"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"(^|&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;/|&lt;/span&gt;&lt;span class="se"&gt;\\\\&lt;/span&gt;&lt;span class="s2"&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;"opts"&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;"destination"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"docs"&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;p&gt;To generate documentation, you run JSDoc from the command line with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;jsdoc &lt;span class="nt"&gt;-c&lt;/span&gt; jsdoc.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And... boom! There will be an &lt;code&gt;index.html&lt;/code&gt; file with the docs. But if you are following along and you opened the index.html file, you'll see that it's &lt;strong&gt;EMPTY&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;And why is that? Because first, we need to write the JSDoc comments and then run this command. So let's go ahead and understand how to do this!&lt;/p&gt;

&lt;h2&gt;
  
  
  Writing JSDoc Comments
&lt;/h2&gt;

&lt;p&gt;A JSDoc comment begins with &lt;code&gt;/**&lt;/code&gt; and ends with &lt;code&gt;*/&lt;/code&gt;. Within this, you use specific annotations, each beginning with `@, to provide structured information.&lt;/p&gt;

&lt;p&gt;Let's start with a sum function, a simple one that takes 2 numbers and returns another number.&lt;/p&gt;

&lt;p&gt;We will use the &lt;code&gt;@param&lt;/code&gt; to describes a parameter passed to a function with its type and description, like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm37bn0icd00um0jp8fk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxm37bn0icd00um0jp8fk.png" alt="Example of @param" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But we are missing something. This function returns a number. So let's specify that with &lt;code&gt;@return&lt;/code&gt; or &lt;code&gt;@returns&lt;/code&gt;, like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2no0reb62dnn6kd3paf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft2no0reb62dnn6kd3paf.png" alt="Example of @return" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However your code is growing (like a real software project), and now you want to move that sum to a class. Let's define with &lt;code&gt;@class&lt;/code&gt; like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdfwd5iasczbpcb9r7uzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdfwd5iasczbpcb9r7uzj.png" alt="Example of @class&amp;lt;br&amp;gt;
" width="800" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And what if that class has a function that can throw an error, we will use JSDoc to describe it with &lt;code&gt;@throws&lt;/code&gt; like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6g8c726eh7kxe2sjfydp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6g8c726eh7kxe2sjfydp.png" alt="Example of @throws&amp;lt;br&amp;gt;
" width="800" height="705"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And last thing, what if you create a new sum function and deprecated the old one? Use &lt;code&gt;@deprecated&lt;/code&gt; like this 👇&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa528srwaposzjcrwbzp1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa528srwaposzjcrwbzp1.png" alt="Example of @deprecated&amp;lt;br&amp;gt;
" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are some of the annotations that can be used with JSDoc, to see all the available, check &lt;a href="https://jsdoc.app/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating Documentation with JSDoc
&lt;/h2&gt;

&lt;p&gt;Great, now our JSDoc comments are in place!&lt;/p&gt;

&lt;p&gt;So simply run the command &lt;code&gt;jsdoc index.js&lt;/code&gt; in your terminal, replacing `index.js with the path to your JavaScript file. JSDoc will process the comments and generate HTML documentation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 If you created your jsdoc.json in the section above, you can run with that!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Customizing the Output
&lt;/h3&gt;

&lt;p&gt;JSDoc allows customization of the output documentation through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Templates: JSDoc supports various templates to change the layout and style of the generated documentation. You can choose a template that fits your project's needs or even create a custom one. Check them &lt;a href="https://cancerberosgx.github.io/jsdoc-templates-demo/demo/?ref=blog.danilovilhena.com"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Styling: The generated documentation's CSS can be modified for further customization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Integrating JSDoc into Your Build Process
&lt;/h3&gt;

&lt;p&gt;You can integrate JSDoc into build tools like Grunt, Gulp, or Webpack. This can be done by adding a task or script in your &lt;code&gt;package.json&lt;/code&gt; file or build configuration file.&lt;/p&gt;

&lt;p&gt;And you can even integrate it in a CI/CD pipeline, set up a step that runs JSDoc to ensure up-to-date documentation is generated with every build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this guide, we've explored the essentials of JSDoc, from setting it up and writing effective comments to generating and customizing documentation.&lt;/p&gt;

&lt;p&gt;JSDoc is a powerful tool that enhances the readability and maintainability of JavaScript code, ensuring that every function, class, and module is clearly understood.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Thanks for reading! Follow to get more of this type of content. Have a great day, see you soon!&lt;/strong&gt; 👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
    </item>
    <item>
      <title>🚀 Kickstart: the fastest way to setup your JS projects!</title>
      <dc:creator>Danilo Vilhena</dc:creator>
      <pubDate>Sat, 13 Jan 2024 19:33:36 +0000</pubDate>
      <link>https://forem.com/danilovilhena/kickstart-the-fastest-way-to-setup-your-js-projects-1bli</link>
      <guid>https://forem.com/danilovilhena/kickstart-the-fastest-way-to-setup-your-js-projects-1bli</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16t0slt1ea4ksl2oh9j0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F16t0slt1ea4ksl2oh9j0.gif" alt="Kickstart demonstration" width="724" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Picture this: you just had a new project idea and you are to buzzing with ideas and ready to code. &lt;/p&gt;

&lt;p&gt;But then, before the actual good coding, you have to configure ESLint and Prettier, hook up Husky, add your testing framework, and so on.&lt;/p&gt;

&lt;p&gt;Hours slip by, and you're still not writing the code for the project itself. &lt;strong&gt;Sound familiar?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here comes &lt;strong&gt;🚀 Kickstart&lt;/strong&gt; - a CLI tool designed to &lt;em&gt;turn these hours into seconds!&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;In less than a minute and just answering questions, you're able to setup:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;✍️ Linters (ESLint or StandardJS), formatter (Prettier)&lt;br&gt;
🎨 CSS frameworks (Tailwind, Sass or Material UI)&lt;br&gt;
🧪 Unit testing (Jest or Jasmine)&lt;br&gt;
🖥️ E2E testing (Cypress or Playwright)&lt;br&gt;
🐶 Husky, lint-staged &lt;br&gt;
📝 README, CHANGELOG, .gitignore&lt;/p&gt;
&lt;h2&gt;
  
  
  How to use it?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;🚀 Kickstart&lt;/strong&gt; is a NPM package that you run in the CLI. So to install it just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; kickstart-it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a new folder, run the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kickstart-it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then you just have to answer the questions and your project will be quickly set up!&lt;/p&gt;

&lt;p&gt;After you run &lt;strong&gt;🚀 Kickstart&lt;/strong&gt; once, you're able to save a &lt;code&gt;config.json&lt;/code&gt; file of what you picked.&lt;/p&gt;

&lt;p&gt;That way you can skip answering questions next time, and just go straight to the setup.&lt;/p&gt;

&lt;p&gt;Please check the &lt;a href="https://github.com/danilovilhena/kickstart-it"&gt;README&lt;/a&gt; to see available flags and config options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Can I contribute to 🚀 Kickstart?
&lt;/h2&gt;

&lt;p&gt;Absolutely! It's an open source, and I greatly appreciate contributions from anyone! So report bugs, suggest new features and open pull requests to improve the current code!&lt;/p&gt;




&lt;p&gt;I hope you give &lt;strong&gt;🚀 Kickstart&lt;/strong&gt; a chance and try it out in your next project!&lt;/p&gt;

&lt;p&gt;If you do, please give me some feedback, so the tool can improve even further.&lt;/p&gt;

&lt;p&gt;Thanks for reading! Have an excellent day 👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
      <category>tooling</category>
    </item>
    <item>
      <title>5 great tools for React developers in 2022</title>
      <dc:creator>Danilo Vilhena</dc:creator>
      <pubDate>Wed, 07 Sep 2022 20:59:15 +0000</pubDate>
      <link>https://forem.com/danilovilhena/5-great-tools-for-react-developers-in-2022-1k93</link>
      <guid>https://forem.com/danilovilhena/5-great-tools-for-react-developers-in-2022-1k93</guid>
      <description>&lt;p&gt;React has become &lt;strong&gt;one of the most extensively used frameworks&lt;/strong&gt; in the world in less than a decade, and according to &lt;a href="https://www.statista.com/statistics/1124699/worldwide-developer-survey-most-used-frameworks-web/" rel="noopener noreferrer"&gt;Statista&lt;/a&gt;, it’s utilized by more than &lt;strong&gt;40% of developers&lt;/strong&gt; globally. One reason for this is its small cost, as well as its myriad perks and potential.&lt;/p&gt;

&lt;p&gt;Companies’ demand for React developers has increased as a result of the tool’s popularity. These professionals are increasingly in demand — and for high salaries.&lt;/p&gt;

&lt;p&gt;If you want to work as a React developer, keep reading to the end of this article to find out &lt;strong&gt;5 great tools to learn in 2022!&lt;/strong&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%2Fcdn-images-1.medium.com%2Fmax%2F9012%2F0%2AqDYRfC_9NTgZLtqG" 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%2Fcdn-images-1.medium.com%2Fmax%2F9012%2F0%2AqDYRfC_9NTgZLtqG" alt="Photo by [Lautaro Andreani](https://unsplash.com/es/@lautaroandreani?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Next.js
&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A9-dQkD3eRXBUUeTC.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2A9-dQkD3eRXBUUeTC.png" alt="Next.js logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next.js is a &lt;strong&gt;flexible&lt;/strong&gt; React framework that gives you building blocks &lt;strong&gt;to create fast web applications.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By framework, it means Next.js handles the tooling and configuration needed for React, and provides additional structure, features, and optimizations for your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Next.js
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hybrid SSG and SSR:&lt;/strong&gt; Render pages during build (Static Site Generation) or on each request (Server-side Rendering) in the same project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic Routing:&lt;/strong&gt; The URLs in Next.js are mapped based on the pages folder, thus each file in this folder automatically becomes a page, with no additional setting required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Internationalization:&lt;/strong&gt; By default Next.js already has a framework for identifying different languages, working with unique routes and translations via locale.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hot Code Reloading:&lt;/strong&gt; Any changes made to the code during development will be reflected in the local application in real time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic Code Splitting:&lt;/strong&gt; This feature allows pages to be rendered with only the packages they need. This ensures that each page has only the code required to render it, minimizing page size and boosting rendering speed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://nextjs.org/" rel="noopener noreferrer"&gt;Link to Next.js&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. GraphQL
&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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AAIP_w_Zmb0FZUvdk.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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AAIP_w_Zmb0FZUvdk.png" alt="GraphQL logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GraphQL is a server-oriented query language and execution environment for application programming interfaces (APIs), with the goal of &lt;strong&gt;providing just the data that clients request.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GraphQL is intended to make APIs more &lt;strong&gt;responsive&lt;/strong&gt;, &lt;strong&gt;adaptable&lt;/strong&gt;, and &lt;strong&gt;user-friendly for developers.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What GraphQL isn’t?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GraphQL is not a database&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GraphQL is not a replacement for SQL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GraphQL is not a server-side tool&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Advantages of GraphQL
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Requests are handled in a single round-trip transmission. Clients get exactly what they want, with no more information (overfetching). Which reduces data transfer costs, both on the server side (throughput) and on the client side (4G bandwidth)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Even on slow connections, this ensures faster response and loading times for mobile or web applications&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Allows you to change the API of an application without affecting existing queries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplicity leads to a more stable backend&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages of GraphQL
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Learning curve: you already know REST and will need to learn GraphQL&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Caching is more complex with GraphQL&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://graphql.org/" rel="noopener noreferrer"&gt;Link to GraphQL&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Chakra UI
&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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AOoAWtiSE1sVfsbBp.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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AOoAWtiSE1sVfsbBp.png" alt="Chakra UI logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Chakra UI is a React component library that makes it simple to create the user interface of an application or website. Its purpose is to provide a &lt;strong&gt;simple&lt;/strong&gt;, &lt;strong&gt;modular&lt;/strong&gt;, and &lt;strong&gt;cost-effective&lt;/strong&gt; set of &lt;em&gt;components&lt;/em&gt; that allow you to get your app up and running quickly.&lt;/p&gt;

&lt;p&gt;Chakra strives to make every component &lt;strong&gt;accessible&lt;/strong&gt;. A critical part of application development that is often overlooked.&lt;/p&gt;

&lt;p&gt;Chakra also includes a simple API that allows developers to &lt;strong&gt;become productive&lt;/strong&gt;. It allows individuals and teams to create inclusive applications without having to worry about building a bunch of components.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Chakra UI
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Development speed:&lt;/strong&gt; it includes many convenient components that can be used for common day-to-day styling jobs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Component factory:&lt;/strong&gt; it offers a versatile method of creating styled components. The components can be assembled similarly to LEGO.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Built with TypeScript:&lt;/strong&gt; as a result, the library offers complete IDE support as well as type checking.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://chakra-ui.com/" rel="noopener noreferrer"&gt;Link to Chakra UI&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Redux
&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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AnJy-6CB7rMVItafw.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%2Fcdn-images-1.medium.com%2Fmax%2F2400%2F0%2AnJy-6CB7rMVItafw.png" alt="Redux logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Redux is a Flux-based container for &lt;strong&gt;global state management&lt;/strong&gt; and control of JavaScript applications (it is intended to solve the problem of sharing state between components by making it unidirectional).&lt;/p&gt;

&lt;p&gt;Without Redux, an application is obliged to trigger events between numerous components, making them closely coupled. This makes the project difficult to maintain, as one component may rely on several others to function.&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AoIeQlgJUzRBOxGlf.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AoIeQlgJUzRBOxGlf.png" alt="Comparison of Redux and no-Redux state management"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Redux
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Centralized state management system, i.e. store:&lt;/strong&gt; Redux maintains state globally. The data is simply accessible to all components across the program. This centralizes all data and makes it extremely simple for a component to obtain the state it requires.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance optimizations:&lt;/strong&gt; Redux improves performance by avoiding needless reprocessing and guaranteeing that a given component is rendered only when its data has changed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Simple debugging and testing:&lt;/strong&gt; To better understand what’s going on in your application, you can use the &lt;a href="https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd" rel="noopener noreferrer"&gt;Redux DevTools&lt;/a&gt; or log the state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Predictable outcome:&lt;/strong&gt; Every action has a predictable result. Your state store serves as a centralized source of information.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Disadvantages of Redux
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Too complex for simples applications:&lt;/strong&gt; applications with relatively simple UI changes don’t usually require a complex pattern like Redux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Slower to code shared state:&lt;/strong&gt; but for a good reason to be manageable in the long run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increased layering complexity:&lt;/strong&gt; in writing state manipulation logic like actions and reducers, while traditional way just setState, that’s it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://redux.js.org/" rel="noopener noreferrer"&gt;Link to Redux&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Jest
&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AFTPb75gUJ0Xlefr6.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F0%2AFTPb75gUJ0Xlefr6.png" alt="Jest logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Jest is a JavaScript testing framework that ensures the accuracy of JavaScript code. It enables you to develop tests using an easy-to-use, familiar, and feature-rich API that returns results rapidly.&lt;/p&gt;

&lt;p&gt;Jest is fully documented, takes little configuration, and can be customized to meet your needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advantages of Jest
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zero config:&lt;/strong&gt; Jest aims to work out of the box, config free, on most JavaScript projects&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Snapshots:&lt;/strong&gt; make tests which keep track of large objects with ease. Snapshots live either alongside your tests, or embedded inline.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Isolated:&lt;/strong&gt; tests are parallelized by running them in their own processes to maximize performance.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Link to Jest&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;There are many more excellent React tools and frameworks to explore, but in this article we met 5 of them that are in high demand by the market and are frequently utilized by many developers.&lt;/p&gt;

&lt;p&gt;Thanks for reading! Follow me and please interact if you liked the content. Have an excellent day, see you tomorrow! 👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>What are JSON Web Tokens for and how to use with Javascript?</title>
      <dc:creator>Danilo Vilhena</dc:creator>
      <pubDate>Wed, 07 Sep 2022 00:48:07 +0000</pubDate>
      <link>https://forem.com/danilovilhena/what-are-json-web-tokens-for-2goi</link>
      <guid>https://forem.com/danilovilhena/what-are-json-web-tokens-for-2goi</guid>
      <description>&lt;p&gt;Have you ever been to an event where you had to present &lt;strong&gt;ID&lt;/strong&gt; to prove that you were the person who bought the ticket? The act of asking for ID is a form of &lt;strong&gt;authentication&lt;/strong&gt; so that you receive &lt;strong&gt;authorization&lt;/strong&gt; to enter.&lt;/p&gt;

&lt;p&gt;On the web, this process works in a similar way. In order to request certain services or access specific pages, you need to identify yourself in some way, and this identification needs to be &lt;strong&gt;secure&lt;/strong&gt; and &lt;strong&gt;unique&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this article you will understand what the &lt;strong&gt;JWT&lt;/strong&gt; (acronym for “JSON Web Tokens”) standard is for authentication, which is widely used on the web.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XxE-fQvI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/12000/0%2ARHhGyqFUPzDPS8xn" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XxE-fQvI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/12000/0%2ARHhGyqFUPzDPS8xn" alt="Photo by [Silas Köhler](https://unsplash.com/@silas_crioco?utm_source=medium&amp;amp;utm_medium=referral) on [Unsplash](https://unsplash.com?utm_source=medium&amp;amp;utm_medium=referral)" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Nowadays we hear the word token a lot in connection with NFTs, metaverse, cryptocurrencies, etc. But outside this universe, a token is a &lt;strong&gt;digital signature&lt;/strong&gt;, a &lt;strong&gt;key&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;When you open an account at a bank, you need to set up a password and your personal data. This data is converted into a digital signature that will &lt;strong&gt;uniquely&lt;/strong&gt; identify you to that bank, and every time you access your bank and enter your password and personal data, the bank will understand and confirm that you are that logged in user, similar to how we enter the event when we present our identity document.&lt;/p&gt;

&lt;p&gt;There are several algorithms and standards that transform your information into a token, that is, a unique authentication key that makes sense for the service or application you are currently trying to access. One such standard is JWT, which is secure in that it allows authentication between two parties via a &lt;strong&gt;signed token.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is JWT?
&lt;/h2&gt;

&lt;p&gt;A JWT is a standard for authentication and information exchange defined by &lt;a href="https://datatracker.ietf.org/doc/html/rfc7519"&gt;RFC7519&lt;/a&gt;. Inside it, it’s possible to securely and compactly store JSON objects. This token is a Base64 code and can be signed using a secret or private/public key pair.&lt;/p&gt;

&lt;p&gt;Signed tokens can verify the integrity of the information contained in them, unlike encrypted tokens that hide this information. If a JWT is signed by a public/private key pair, the signature certifies that the party that has the private key is the one who actually signed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How was JWT created?
&lt;/h2&gt;

&lt;p&gt;It is part of a family of specifications: the &lt;strong&gt;JOSE&lt;/strong&gt; family.&lt;/p&gt;

&lt;p&gt;JOSE stands for &lt;strong&gt;JSON Object Signing and Encryption.&lt;/strong&gt; JWT is part of this family of specifications and represents the token. Below you can see other specifications from this family:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;JWT (JSON Web Tokens): represents the token itself&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JWS (JSON Web Signature): represents the signature of the token&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JWE (JSON Web Encryption): represents the signature for encryption of the token&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JWK (JSON Web Keys): represents the keys for the signature&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JWA (JSON Web Algorithms): represents the algorithms for signing the token&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that you know what a JWT is, what it’s for, and when to use it, let’s take a deeper look at how it works and what the components of a JWT are.&lt;/p&gt;

&lt;h2&gt;
  
  
  Basic components of a JSON Web Token
&lt;/h2&gt;

&lt;p&gt;A JWT has a basic structure consisting of the &lt;em&gt;header&lt;/em&gt;, the &lt;em&gt;payload&lt;/em&gt; and the &lt;em&gt;signature&lt;/em&gt;. These three parts are separated by dots. So it would look something like this: header.payload.signature. Let’s get a better understanding of each of these parts!&lt;/p&gt;

&lt;h3&gt;
  
  
  Header
&lt;/h3&gt;

&lt;p&gt;The header of the token is where we pass basically two pieces of information: the alg that tells which algorithm is used to create the signature and the typ that indicates what type of token.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "alg": "HS256",
  "typ": "JWT"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Payload
&lt;/h3&gt;

&lt;p&gt;The payload is the component where we can find authentication data like password and email, for example.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "email": "name@example.com",
  "password": "agEastvIders"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  Signature
&lt;/h3&gt;

&lt;p&gt;The token signature is made by encoding the header and payload plus a secret key and is generated by the algorithm specified in the header.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HS256SHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret_key)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The result is three dot-separated strings that can easily be used in HTML environments and HTTP protocols.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.
eyJlbWFpbCI6Im5hbWVAZXhhbXBsZS5jb20iLCJwYXNzd29yZCI6ImFnRWFzdHZJZGVycyJ9.
stLcZmJGIeGXw_HY9c8A28E9n-B-GLsXYZABCuNA0XA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Creating a JWT token
&lt;/h2&gt;

&lt;p&gt;To get started, let’s create a folder called jwt in the directory you want. Create a javascript file with the name of your choice, I'm using index.js.&lt;/p&gt;

&lt;p&gt;Then, install the jwt lib of your choice. There are several libs that help you generate JWTs. I’ll use &lt;a href="https://www.npmjs.com/package/jsonwebtoken"&gt;jsonwebtoken&lt;/a&gt; which is one of the most popular, but you can feel free to explore other options.&lt;/p&gt;

&lt;p&gt;The first step is import the lib in our file:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const jwt = require('jsonwebtoken');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now we create our secret key. The idea is that only you know your secret key and that it is difficult for malicious attacks. But it can be literally any string of your choice. This is how mine looks like:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const secretKey = 'Oa1tz8arFmnXURkg4aJQ';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let’s create our token using the sign method. This method accepts as parameters the payload, the secret key and the header, in that order.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myToken = jwt.sign(
  {
    email: "name@example.com",
    password: "agEastvIders",
  },
  secretKey,
  {
    expiresIn: "1y",
    subject: "1",
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For this JWT, I’m entering an email and password in the payload; my secret key; and in the header I am entering a subject, which in the library in this example works like an id. In addition I’m saying that our token expires in 1 year. By default the encryption algorithm is HS256.&lt;/p&gt;

&lt;p&gt;Now if we log this token to the terminal, we should see the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5hbWVAZXhhbXBsZS5jb20iLCJwYXNzd29yZCI6ImFnRWFzdHZJZGVycyIsImlhdCI6MTY2MTU0ODMwNCwiZXhwIjoxNjkzMTA1OTA0LCJzdWIiOiIxIn0.bYWpwadW8xgstrSydwpnGnQExYuFxLMBh3JQRvtEPmw
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Verifying our JWT token
&lt;/h2&gt;

&lt;p&gt;To verify our token we can use a method in the jsonwebtoken library itself called decode passing the generated token.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const generatedToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im5hbWVAZXhhbXBsZS5jb20iLCJwYXNzd29yZCI6ImFnRWFzdHZJZGVycyIsImlhdCI6MTY2MTU0ODMwNCwiZXhwIjoxNjkzMTA1OTA0LCJzdWIiOiIxIn0.bYWpwadW8xgstrSydwpnGnQExYuFxLMBh3JQRvtEPmw';

console.log(jwt.decode(generatedToken))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The output of the code is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  email:"name@example.com",
  password:"agEastvIders",
  iat:1661548304,
  exp:1693105904,
  sub:"1"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Where the parameters iat, exp and sub are respectively the creation and expiration dates, in UTC format, when the token was created and when it will expire, and the subject that we passed in our code with a value of 1.&lt;/p&gt;

&lt;p&gt;Now, you might be asking yourself, “Now that I know what a JSON Web Token is and how it works, how do I use it in my front-end applications?”&lt;/p&gt;

&lt;h2&gt;
  
  
  Authenticating with tokens
&lt;/h2&gt;

&lt;p&gt;Imagine you are a developer and you are creating the front-end of an application for a bank. On the login page you take the users’ data and send it to an API using fetch, for example.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(`${baseUrl}/auth/login`, {
  method: "POST",
  headers: {
    "Content Type": "application/json",
  },
  body: user,
})
.then((res) =&amp;gt; {
  ...
})
.catch((err) =&amp;gt; {
  ...
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The server will take this data and will return a token that will identify that user. Now, every time this user logs into the platform, he will go through &lt;strong&gt;authentication&lt;/strong&gt; and, if everything is right with the data, he will be authorized to access certain areas of the application, such as viewing the balance. Usually this encryption and token generation is done by the back-end, but you will need to ensure that this logged-in user can continue to access other areas of the application.&lt;/p&gt;

&lt;p&gt;You can also save the token in &lt;em&gt;session storage&lt;/em&gt; or *local storage *in your browser to ensure that as long as the token does not expire, the user remains logged into the application. In addition, it is important that when logging in, the user is redirected to a home page where he can see other features of the application.&lt;/p&gt;

&lt;p&gt;When this user tries to access the page that shows his balance, for example, you can make a request, using fetch passing in the headers an “Authorization” field with the generated token. This will cause the server to check whether or not the user is allowed to access that specific page.&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fetch(&lt;code&gt;${baseUrl}/balance&lt;/code&gt;, {&lt;br&gt;
  headers: {&lt;br&gt;
    "Authorization": Token,&lt;br&gt;
  }&lt;br&gt;
})&lt;br&gt;
.then((res) =&amp;gt; {&lt;br&gt;
  ...&lt;br&gt;
})&lt;br&gt;
.catch((err) =&amp;gt; {&lt;br&gt;
  ...&lt;br&gt;
});&lt;br&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h2&gt;

&lt;p&gt;In this article, you saw what JSON Web Tokens are, what they are used for, what their components are, and how to use them in your applications. You also saw how to use tokens in a front-end application for user authentication.&lt;/p&gt;

&lt;p&gt;Thanks for reading! Follow me and please interact if you liked the content. Have a great day, see you soon! 👋&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>json</category>
      <category>jwt</category>
      <category>authentication</category>
    </item>
  </channel>
</rss>
