<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Parmesh Bhatt]]></title><description><![CDATA[Practical tutorials and insights on full-stack development, Next.js, NestJS, backend engineering, APIs, databases, and building real-world software.]]></description><link>https://parmesh-bhatt.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 28 Oct 2026 22:00:24 GMT</lastBuildDate><atom:link href="https://parmesh-bhatt.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Next.js Rendering Explained: The Complete Guide to SSR, SSG, ISR, and CSR]]></title><description><![CDATA[Building high-performance web applications today means striking a balance between speed, SEO, scalability, and data freshness. The Next.js framework, built…]]></description><link>https://parmesh-bhatt.hashnode.dev/nextjs-rendering-explained-the-complete-guide-to-ssr-ssg-isr-and-csr</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/nextjs-rendering-explained-the-complete-guide-to-ssr-ssg-isr-and-csr</guid><category><![CDATA[Next.js]]></category><category><![CDATA[development]]></category><category><![CDATA[SSR and SSG]]></category><category><![CDATA[Client-side rendering]]></category><category><![CDATA[Server side rendering]]></category><category><![CDATA[Learning Journey]]></category><category><![CDATA[#learning-in-public]]></category><category><![CDATA[code]]></category><category><![CDATA[static site generation]]></category><category><![CDATA[IncrementalStaticRegeneration]]></category><category><![CDATA[Developer]]></category><category><![CDATA[Developer Tools]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Fri, 14 Nov 2025 03:17:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1763090113932/7a6de915-0344-4431-87af-d8b0b037ee85.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">🪄 Introduction</h1>
<p>Building high-performance web applications today means striking a balance between <strong>speed, SEO, scalability, and data freshness</strong>. The Next.js framework, built on top of React, provides developers with multiple rendering strategies to achieve this balance — namely:</p>
<ul>
<li><p><strong>Server-Side Rendering (SSR)</strong></p>
</li>
<li><p><strong>Static Site Generation (SSG)</strong></p>
</li>
<li><p><strong>Incremental Static Regeneration (ISR)</strong></p>
</li>
<li><p><strong>Client-Side Rendering (CSR)</strong></p>
</li>
</ul>
<p>Each of these methods determines <strong>how and when</strong> your webpage’s HTML is generated, directly impacting load time, SEO performance, and user experience.</p>
<p>In this blog, we’ll delve into each rendering method, examine how it works under the hood, discuss its pros and cons, and identify the best scenarios for using each one.</p>
<h1 id="heading-what-is-rendering-in-nextjs">🧩 What is Rendering in Next.js?</h1>
<p>Before diving into the differences, let’s understand what <strong>rendering</strong> means.</p>
<p>Rendering is the process of transforming your React components into actual HTML that the browser can display.<br />In <strong>Next.js</strong>, this rendering can happen at different stages:</p>
<ol>
<li><p><strong>Build Time</strong> – Pages are generated once during deployment.</p>
</li>
<li><p><strong>Request Time</strong> – HTML is generated for every user request.</p>
</li>
<li><p><strong>Client-Side</strong> – HTML is built dynamically inside the user’s browser after the page loads.</p>
</li>
<li><p><strong>Incremental Regeneration</strong> – Pages are re-rendered periodically in the background.</p>
</li>
</ol>
<p>Each rendering method affects <strong>SEO, performance, and scalability</strong> differently — and choosing the right one can make or break your app’s user experience.</p>
<h1 id="heading-1-server-side-rendering-ssr">⚙️ 1. Server-Side Rendering (SSR)</h1>
<h2 id="heading-what-is-ssr">🧠 What is SSR?</h2>
<p><strong>Server-Side Rendering (SSR)</strong> means that every time a user requests a page, Next.js runs the necessary code on the <strong>server</strong>, fetches data, and renders the page <strong>on demand</strong>. The server then sends a fully rendered HTML page to the browser.</p>
<p>This ensures that search engines and users receive fully populated HTML content.</p>
<h2 id="heading-how-ssr-works">⚡ How SSR Works</h2>
<ol>
<li><p>A user visits a Next.js page with <code>getServerSideProps()</code>.</p>
</li>
<li><p>The Next.js server fetches required data (e.g., from an API or database).</p>
</li>
<li><p>HTML is generated with the latest data.</p>
</li>
<li><p>The browser receives the rendered HTML, improving SEO and load perception.</p>
</li>
</ol>
<h2 id="heading-code-example">🧩 Code Example</h2>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getServerSideProps</span>(<span class="hljs-params">context</span>) </span>{
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'https://api.example.com/posts'</span>);
  <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> res.json();

  <span class="hljs-keyword">return</span> { props: { data } };
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Blog</span>(<span class="hljs-params">{ data }</span>) </span>{
  <span class="hljs-keyword">return</span> (
    &lt;div&gt;
      &lt;h1&gt;Latest Posts&lt;/h1&gt;
      {data.map(<span class="hljs-function"><span class="hljs-params">post</span> =&gt;</span> &lt;p key={post.id}&gt;{post.title}&lt;/p&gt;)}
    &lt;/div&gt;
  );
}
</code></pre>
<h3 id="heading-advantages">✅ Advantages</h3>
<ul>
<li><p><strong>Always Fresh:</strong> Data is fetched and rendered at every request.</p>
</li>
<li><p><strong>SEO Friendly:</strong> Since HTML is generated on the server, crawlers see full content.</p>
</li>
<li><p><strong>Great for Dynamic Content:</strong> Perfect for dashboards, news, or stock updates.</p>
</li>
</ul>
<h3 id="heading-disadvantages">❌ Disadvantages</h3>
<ul>
<li><p><strong>Performance Cost:</strong> Rendering on every request increases server load.</p>
</li>
<li><p><strong>Slower Initial Load:</strong> Each request requires a round-trip to the server.</p>
</li>
<li><p><strong>Higher Hosting Costs:</strong> Requires a server to handle every request.</p>
</li>
</ul>
<h3 id="heading-best-use-cases">🧭 Best Use Cases</h3>
<ul>
<li><p>Personalized pages (user dashboards, account pages)</p>
</li>
<li><p>Real-time applications (stock tickers, sports scores)</p>
</li>
<li><p>Frequently updated data (news, social feeds)</p>
</li>
</ul>
<h1 id="heading-2-static-site-generation-ssg">📦 2. Static Site Generation (SSG)</h1>
<h2 id="heading-what-is-ssg">🧠 What is SSG?</h2>
<p><strong>Static Site Generation (SSG)</strong> pre-renders HTML pages at <strong>build time</strong>. This means your content is fetched once when you build your application, and the generated HTML files are stored and served via a CDN.</p>
<p>Users receive <strong>instant-loading, cached</strong> pages — perfect for content that doesn’t change frequently.</p>
<h2 id="heading-how-ssg-works">⚡ How SSG Works</h2>
<ol>
<li><p>During build (<code>next build</code>), Next.js runs <code>getStaticProps()</code> for each page.</p>
</li>
<li><p>The fetched data is compiled into static HTML.</p>
</li>
<li><p>When users visit your site, these HTML files are served directly from the CDN.</p>
</li>
</ol>
<h2 id="heading-code-example-1">🧩 Code Example</h2>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getStaticProps</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'https://api.example.com/products'</span>);
  <span class="hljs-keyword">const</span> products = <span class="hljs-keyword">await</span> res.json();

  <span class="hljs-keyword">return</span> { props: { products } };
}
</code></pre>
<h3 id="heading-advantages-1">✅ Advantages</h3>
<ul>
<li><p><strong>Blazing Fast:</strong> Pages are pre-built and cached, loading instantly.</p>
</li>
<li><p><strong>SEO Optimized:</strong> Fully rendered HTML available to crawlers.</p>
</li>
<li><p><strong>Cost-Efficient:</strong> No runtime server needed; can be hosted on static hosting.</p>
</li>
</ul>
<h3 id="heading-disadvantages-1">❌ Disadvantages</h3>
<ul>
<li><p><strong>Stale Data:</strong> Once built, content remains the same until redeployment.</p>
</li>
<li><p><strong>Not Suitable for Frequently Changing Data.</strong></p>
</li>
</ul>
<h3 id="heading-best-use-cases-1">🧭 Best Use Cases</h3>
<ul>
<li><p>Blogs and documentation sites</p>
</li>
<li><p>Marketing or landing pages</p>
</li>
<li><p>Product or portfolio sites with rarely changing data</p>
</li>
</ul>
<h1 id="heading-3-incremental-static-regeneration-isr">🔁 3. Incremental Static Regeneration (ISR)</h1>
<h2 id="heading-what-is-isr">🧠 What is ISR?</h2>
<p><strong>Incremental Static Regeneration (ISR)</strong> is a hybrid approach that allows you to <strong>update static pages after deployment</strong>, without rebuilding your entire site.</p>
<p>ISR combines the <strong>speed of SSG</strong> with the <strong>freshness of SSR</strong>.</p>
<h2 id="heading-how-isr-works">⚡ How ISR Works</h2>
<ol>
<li><p>A page is initially generated at build time (like SSG).</p>
</li>
<li><p>You define a <code>revalidate</code> time (in seconds).</p>
</li>
<li><p>After that time passes, the next request triggers background regeneration.</p>
</li>
<li><p>The old page is served until the new one is ready — seamless and efficient.</p>
</li>
</ol>
<h2 id="heading-code-example-2">🧩 Code Example</h2>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">getStaticProps</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'https://api.example.com/news'</span>);
  <span class="hljs-keyword">const</span> news = <span class="hljs-keyword">await</span> res.json();

  <span class="hljs-keyword">return</span> { 
    props: { news },
    revalidate: <span class="hljs-number">60</span> <span class="hljs-comment">// Rebuild every 60 seconds</span>
  };
}
</code></pre>
<h3 id="heading-advantages-2">✅ Advantages</h3>
<ul>
<li><p><strong>Best of Both Worlds:</strong> Static performance + fresh content.</p>
</li>
<li><p><strong>Automatic Updates:</strong> No need to rebuild or redeploy manually.</p>
</li>
<li><p><strong>SEO Friendly:</strong> Still pre-rendered HTML.</p>
</li>
</ul>
<h3 id="heading-disadvantages-2">❌ Disadvantages</h3>
<ul>
<li><p><strong>Potentially Stale Data:</strong> Content might be slightly outdated before regeneration.</p>
</li>
<li><p><strong>Complexity:</strong> Managing caching and validation requires careful setup.</p>
</li>
</ul>
<h3 id="heading-best-use-cases-2">🧭 Best Use Cases</h3>
<ul>
<li><p>E-commerce product listings</p>
</li>
<li><p>News and article feeds</p>
</li>
<li><p>Event or course directories</p>
</li>
</ul>
<h1 id="heading-4-client-side-rendering-csr">💻 4. Client-Side Rendering (CSR)</h1>
<h2 id="heading-what-is-csr">🧠 What is CSR?</h2>
<p><strong>Client-Side Rendering (CSR)</strong> shifts rendering responsibility to the browser.<br />The server sends a bare HTML shell and JavaScript bundles, which React uses to fetch data and render content dynamically.</p>
<p>CSR is the default behavior of standard React apps created with <code>create-react-app</code>.</p>
<p>⚡ How CSR Works</p>
<ol>
<li><p>The server sends an almost-empty HTML file.</p>
</li>
<li><p>The browser downloads and executes JavaScript.</p>
</li>
<li><p>React fetches data (using <code>fetch</code> or <code>axios</code>) and updates the UI.</p>
</li>
</ol>
<h2 id="heading-code-example-3">🧩 Code Example</h2>
<pre><code class="lang-typescript"><span class="hljs-keyword">import</span> { useEffect, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Dashboard</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> [user, setUser] = useState(<span class="hljs-literal">null</span>);

  useEffect(<span class="hljs-function">() =&gt;</span> {
    fetch(<span class="hljs-string">'/api/current-user'</span>)
      .then(<span class="hljs-function"><span class="hljs-params">res</span> =&gt;</span> res.json())
      .then(setUser);
  }, []);

  <span class="hljs-keyword">if</span> (!user) <span class="hljs-keyword">return</span> &lt;p&gt;Loading...&lt;/p&gt;;
  <span class="hljs-keyword">return</span> &lt;h1&gt;Welcome, {user.name}!&lt;/h1&gt;;
}
</code></pre>
<h3 id="heading-advantages-3">✅ Advantages</h3>
<ul>
<li><p><strong>Highly Interactive:</strong> Ideal for apps needing instant state updates.</p>
</li>
<li><p><strong>Real-Time Data:</strong> Perfect for user dashboards or live data apps.</p>
</li>
<li><p><strong>Reduced Server Load:</strong> Rendering happens on the client, not the server.</p>
</li>
</ul>
<h3 id="heading-disadvantages-3">❌ Disadvantages</h3>
<ul>
<li><p><strong>Poor SEO:</strong> HTML is mostly empty initially, which can harm indexing.</p>
</li>
<li><p><strong>Slower First Load:</strong> Users wait for JavaScript and data to load.</p>
</li>
<li><p><strong>Requires JavaScript:</strong> Non-JS browsers can’t view the page content.</p>
</li>
</ul>
<h3 id="heading-best-use-cases-3">🧭 Best Use Cases</h3>
<ul>
<li><p>Single-page applications (SPAs)</p>
</li>
<li><p>User dashboards and admin panels</p>
</li>
<li><p>Authenticated content or real-time apps</p>
</li>
</ul>
<h2 id="heading-summary-table">📊 Summary Table</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Rendering Method</td><td>Where Rendered</td><td>When Rendered</td><td>SEO Friendly</td><td>Performance</td><td>Use Cases</td></tr>
</thead>
<tbody>
<tr>
<td><strong>SSR</strong></td><td>Server</td><td>Every Request</td><td>✅ Yes</td><td>⚡ Medium</td><td>Dynamic pages, dashboards</td></tr>
<tr>
<td><strong>SSG</strong></td><td>Build Time</td><td>Once at Build</td><td>✅ Yes</td><td>⚡⚡ Very Fast</td><td>Blogs, static content</td></tr>
<tr>
<td><strong>ISR</strong></td><td>Build + Background</td><td>Periodically</td><td>✅ Yes</td><td>⚡⚡ Very Fast</td><td>News, product pages</td></tr>
<tr>
<td><strong>CSR</strong></td><td>Browser</td><td>On Client</td><td>❌ No</td><td>⚡ Depends on JS</td><td>Dashboards, SPAs</td></tr>
</tbody>
</table>
</div><h1 id="heading-ia"> </h1>
<p>🏷️ Additional SEO Tips</p>
<ul>
<li><p>Use <code>next/head</code> to include meta tags for title, description, and canonical URLs.</p>
</li>
<li><p>Enable <strong>image optimization</strong> with Next.js <code>&lt;Image /&gt;</code> component.</p>
</li>
<li><p>Use <code>getStaticPaths</code> for dynamic routes with SSG or ISR.</p>
</li>
<li><p>Combine <strong>ISR + CDN caching</strong> for global scalability.</p>
</li>
</ul>
<h1 id="heading-conclusion">🎯 Conclusion</h1>
<p>Next.js offers unmatched flexibility when it comes to rendering strategies. The right approach depends entirely on your <strong>data freshness</strong>, <strong>SEO goals</strong>, and <strong>performance needs</strong>.</p>
<ul>
<li><p>🧠 <strong>Use SSR</strong> when content changes on every request (e.g., user dashboards).</p>
</li>
<li><p>⚡ <strong>Use SSG</strong> for static pages with rarely changing content.</p>
</li>
<li><p>🔄 <strong>Use ISR</strong> when you need static speed but periodic updates.</p>
</li>
<li><p>💻 <strong>Use CSR</strong> for interactive UIs or user-specific pages.</p>
</li>
</ul>
<p>By blending these strategies, you can build <strong>fast, scalable, and SEO-friendly</strong> Next.js applications that deliver a seamless user experience.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding Cookie Transmission in Cross-Origin API Requests]]></title><description><![CDATA[How to properly configure cross-site cookie transmission between frontend and backend]]></description><link>https://parmesh-bhatt.hashnode.dev/understanding-cookie-transmission-in-cross-origin-api-requests</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/understanding-cookie-transmission-in-cross-origin-api-requests</guid><category><![CDATA[CORS]]></category><category><![CDATA[cookies]]></category><category><![CDATA[debugging]]></category><category><![CDATA[development]]></category><category><![CDATA[#learning-in-public]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[backend]]></category><category><![CDATA[Frontend Development]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Sat, 04 Oct 2025 12:13:37 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759580172237/89cc8a26-43ab-4658-84a0-3ca67dd3607d.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-the-problem-that-cost-me-2-hours">The Problem That Cost Me 2 Hours</h1>
<p>Picture this: Your frontend is calling a public API endpoint. No authentication barriers, no token requirements—just a simple, open endpoint. Everything should work smoothly, right?</p>
<p>Wrong.</p>
<p>I spent over 2 hours pulling my hair out because my cookies weren't being sent with the requests. The API was public, my code looked fine, but the browser simply refused to include the cookies I needed.</p>
<p>After diving deep into browser behavior, CORS policies, and cookie attributes, I finally understood what was happening. Here's everything I learned so you don't have to waste your afternoon debugging the same issue.</p>
<hr />
<h1 id="heading-the-big-misconception-public-cookie-freedom">The Big Misconception: Public ≠ Cookie Freedom</h1>
<p>Here's the crucial insight that took me way too long to understand:</p>
<p><strong>Just because an endpoint is public doesn't mean the browser will freely send cookies to it.</strong></p>
<p>A "public API" simply means there's no authentication barrier blocking access. But whether cookies are included in requests depends on an entirely different set of rules around:</p>
<ul>
<li><p>Cookie attributes</p>
</li>
<li><p>Cross-origin request policies</p>
</li>
<li><p>CORS configuration</p>
</li>
</ul>
<p>The browser doesn't care if the endpoint is "public" or "private"—it cares about security, and it enforces strict rules to protect users from attacks like CSRF (Cross-Site Request Forgery).</p>
<hr />
<h1 id="heading-the-three-factors-that-control-cookie-transmission">The Three Factors That Control Cookie Transmission</h1>
<p>After hours of debugging and reading documentation, I identified three critical factors that determine whether cookies are sent with cross-origin requests:</p>
<h2 id="heading-1-samesite-attribute-the-gatekeeper">1. SameSite Attribute: The Gatekeeper</h2>
<p>The <code>SameSite</code> An attribute is the first line of defense. It tells the browser when a cookie should be included:</p>
<p><code>SameSite=Strict</code></p>
<ul>
<li><p>Cookie is ONLY sent on same-site requests</p>
</li>
<li><p>Cross-site requests? Forget about it—no cookies for you</p>
</li>
<li><p>Most secure, but breaks legitimate cross-site use cases</p>
</li>
</ul>
<p><code>SameSite=Lax</code> (default in modern browsers)</p>
<ul>
<li><p>Cookie sent on same-site requests</p>
</li>
<li><p>Also sent on top-level navigations (like clicking a link)</p>
</li>
<li><p>NOT sent on cross-site API calls (like <code>fetch</code> or <code>axios</code> requests)</p>
</li>
</ul>
<p><code>SameSite=None; Secure</code></p>
<ul>
<li><p>Allows cookies on cross-site requests</p>
</li>
<li><p>MUST be paired with the <code>Secure</code> flag</p>
</li>
<li><p>Required for cookies to work in cross-origin API scenarios</p>
</li>
</ul>
<h2 id="heading-key-takeaway-if-your-backend-sets-cookies-without-samesitenone-secure-they-wont-be-sent-in-cross-origin-api-calls-period"><strong>Key takeaway:</strong> If your backend sets cookies without <code>SameSite=None; Secure</code>, they won't be sent in cross-origin API calls, period.</h2>
<hr />
<h2 id="heading-2-client-side-configuration-ask-for-credentials">2. Client-Side Configuration: Ask for Credentials</h2>
<p>Even with the right cookie attributes, you need to explicitly tell the browser to include cookies in cross-origin requests.</p>
<h2 id="heading-with-fetch-api"><strong>With Fetch API:</strong></h2>
<p>javascript</p>
<pre><code class="lang-javascript">fetch(<span class="hljs-string">`{your_endpoint}`</span>, {
  <span class="hljs-attr">credentials</span>: <span class="hljs-string">'include'</span>  <span class="hljs-comment">// This is the magic line</span>
})
</code></pre>
<h2 id="heading-with-axios"><strong>With Axios:</strong></h2>
<p>javascript</p>
<pre><code class="lang-javascript">axios.get(<span class="hljs-string">`{your_endpoint}`</span>, {
  <span class="hljs-attr">withCredentials</span>: <span class="hljs-literal">true</span>  <span class="hljs-comment">// Enable cookie transmission</span>
})
</code></pre>
<p>Without these flags, the browser assumes you don't want cookies sent cross-origin, and it won't include them—even if everything else is configured correctly.</p>
<hr />
<h2 id="heading-3-server-side-cors-headers-the-final-permission">3. Server-Side CORS Headers: The Final Permission</h2>
<p>Here's where my 2-hour bug was hiding: the server must explicitly allow credentialed requests with proper CORS headers.</p>
<h2 id="heading-required-headers"><strong>Required headers:</strong></h2>
<pre><code class="lang-plaintext">Access-Control-Allow-Credentials: true
</code></pre>
<h2 id="heading-critical-rules"><strong>Critical rules:</strong></h2>
<ul>
<li><p>You CANNOT use <code>Access-Control-Allow-Origin: *</code> with credentials</p>
</li>
<li><p>The origin must be specific</p>
</li>
<li><p>Both headers must be present for cookies to be sent</p>
</li>
</ul>
<p>In my case, the frontend had <code>withCredentials: true</code>, but the backend team hadn't configured these CORS headers. The browser saw the mismatch and silently blocked the cookies.</p>
<hr />
<h1 id="heading-other-cookie-flags-worth-understanding">Other Cookie Flags Worth Understanding</h1>
<p>While debugging, I also learned about two other important cookie attributes:</p>
<p><code>HttpOnly</code></p>
<ul>
<li><p>Prevents JavaScript from accessing the cookie via <code>document.cookie</code></p>
</li>
<li><p>Does NOT prevent the browser from sending it in HTTP requests</p>
</li>
<li><p>Great for security (prevents XSS attacks from stealing session cookies)</p>
</li>
</ul>
<p><code>Secure</code></p>
<ul>
<li><p>Cookie will ONLY be sent over HTTPS connections</p>
</li>
<li><p>Essential for production environments</p>
</li>
<li><p>Required when using <code>SameSite=None</code></p>
</li>
</ul>
<hr />
<h1 id="heading-my-debugging-story-what-went-wrong">My Debugging Story: What Went Wrong</h1>
<p>Here's exactly what happened in my case:</p>
<ol>
<li><p><strong>Frontend setup:</strong> I was using <code>axios</code> with <code>withCredentials: true</code> ✅</p>
</li>
<li><p><strong>Cookie attributes:</strong> Backend was setting cookies, but without proper <code>SameSite</code> attributes ❌</p>
</li>
<li><p><strong>CORS headers:</strong> The public API team hadn't configured <code>Access-Control-Allow-Credentials</code> or a specific <code>Access-Control-Allow-Origin</code> ❌</p>
</li>
</ol>
<p>The result? The browser looked at this mismatched configuration and said, "Nope, not sending those cookies."</p>
<p>Once the backend team added:</p>
<ul>
<li><p><code>SameSite=None; Secure</code> to the cookies</p>
</li>
<li><p><code>Access-Control-Allow-Credentials: true</code></p>
</li>
</ul>
<p>Everything worked perfectly.</p>
<hr />
<h1 id="heading-the-complete-checklist-for-cross-origin-cookies">The Complete Checklist for Cross-Origin Cookies</h1>
<p>Before you waste hours debugging like I did, check these three things:</p>
<h3 id="heading-backend-cookie-configuration">✅ Backend Cookie Configuration</h3>
<ul>
<li><p>Cookies set with <code>SameSite=None; Secure</code></p>
</li>
<li><p><code>Secure</code> flag present (requires HTTPS)</p>
</li>
<li><p><code>HttpOnly</code> flag if you don't need JS access</p>
</li>
</ul>
<h3 id="heading-frontend-request-configuration">✅ Frontend Request Configuration</h3>
<ul>
<li><p><code>withCredentials: true</code> (Axios) or <code>credentials: 'include'</code> (Fetch)</p>
</li>
<li><p>Requests are going to the correct domain</p>
</li>
</ul>
<h3 id="heading-server-cors-headers">✅ Server CORS Headers</h3>
<ul>
<li><p><code>Access-Control-Allow-Credentials: true</code></p>
</li>
<li><p><code>Access-Control-Allow-Origin</code> set to a specific origin (NOT <code>*</code>)</p>
</li>
<li><p>Headers present on both preflight and actual responses</p>
</li>
</ul>
<p><strong>All three must align perfectly, or cookies won't be sent.</strong></p>
<hr />
<h1 id="heading-pro-debugging-tips">Pro Debugging Tips</h1>
<p><strong>Chrome DevTools is your friend:</strong></p>
<ol>
<li><p>Open DevTools → Network tab</p>
</li>
<li><p>Click on the failed request</p>
</li>
<li><p>Go to the "Cookies" tab</p>
</li>
<li><p>Look for blocked cookies and the reason why</p>
</li>
</ol>
<p>The browser will tell you exactly why cookies were blocked—you just need to know where to look!</p>
<hr />
<h1 id="heading-the-bigger-picture-why-browsers-are-so-strict">The Bigger Picture: Why Browsers Are So Strict</h1>
<p>You might wonder: "Why make this so complicated? Why not just send cookies everywhere?"</p>
<p>The answer is security. These restrictions exist to protect users from:</p>
<ul>
<li><p><strong>CSRF attacks:</strong> Malicious sites make requests on your behalf to legitimate sites where you're logged in</p>
</li>
<li><p><strong>Data leakage:</strong> Third-party sites accessing your cookies and session data</p>
</li>
<li><p><strong>Privacy violations:</strong> Tracking users across different websites</p>
</li>
</ul>
<p>The browser assumes cookies contain sensitive data (like session tokens), so it requires explicit permission from both the client AND server before allowing cross-origin transmission.</p>
<p>Yes, it makes development harder. But it also keeps users safe.</p>
<hr />
<h1 id="heading-key-takeaways">Key Takeaways</h1>
<p>After spending 2 hours on this bug, here's what I want you to remember:</p>
<ol>
<li><p><strong>"Public endpoint" doesn't mean "free cookie access"</strong>—browsers enforce strict security rules regardless of API accessibility</p>
</li>
<li><p><strong>Three things must align:</strong></p>
<ul>
<li><p>Cookie attributes (<code>SameSite=None; Secure</code>)</p>
</li>
<li><p>Client configuration (<code>withCredentials: true</code>)</p>
</li>
<li><p>Server CORS headers (<code>Allow-Credentials</code> + specific <code>Allow-Origin</code>)</p>
</li>
</ul>
</li>
<li><p><strong>Silent failures are the worst</strong>—browsers often block cookies without obvious error messages, so know how to use DevTools to debug</p>
</li>
<li><p><strong>This is a backend AND frontend problem</strong>—you can't fix it from just one side</p>
</li>
<li><p><strong>Security over convenience</strong>—these restrictions exist for good reasons, even if they complicate development</p>
</li>
</ol>
<hr />
<h1 id="heading-final-thoughts">Final Thoughts</h1>
<p>Cross-origin cookie handling is one of those topics that seems simple until you actually need to implement it. The combination of cookie attributes, CORS policies, and browser security rules creates a complex system that's easy to misconfigure.</p>
<p>But once you understand the rules, debugging becomes much easier. Instead of randomly trying different configurations, you can systematically check each requirement and identify exactly what's missing.</p>
<p>I hope this post saves you from the 2 hours of frustration I went through. If you're working with public APIs and need to send cookies cross-origin, bookmark this checklist—you'll thank yourself later!</p>
<hr />
<p>#WebDevelopment #CORS #Cookies #Frontend #Backend #Debugging #WebSecurity</p>
]]></content:encoded></item><item><title><![CDATA[Securing Your Spring Boot Application with Keycloak: A Comprehensive Guide]]></title><description><![CDATA[In today's rapidly evolving digital landscape, security is paramount. Protecting your applications from unauthorized access and ensuring data integrity are…]]></description><link>https://parmesh-bhatt.hashnode.dev/securing-your-spring-boot-application-with-keycloak-a-comprehensive-guide</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/securing-your-spring-boot-application-with-keycloak-a-comprehensive-guide</guid><category><![CDATA[keycloak]]></category><category><![CDATA[IAM]]></category><category><![CDATA[Springboot]]></category><category><![CDATA[Java]]></category><category><![CDATA[development]]></category><category><![CDATA[SSO]]></category><category><![CDATA[SSO - Single Sign-On]]></category><category><![CDATA[authentication]]></category><category><![CDATA[authorization]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Sun, 09 Mar 2025 05:30:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1741497963565/8368b8ef-b412-401f-a2d4-f370c72864e7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In today's rapidly evolving digital landscape, security is paramount. Protecting your applications from unauthorized access and ensuring data integrity are critical considerations. Keycloak, an open-source Identity and Access Management (IAM) solution, provides a robust and flexible framework for securing your applications, whether web applications, APIs, or mobile applications. In this blog, we'll dive deep into Keycloak, exploring its key features, creating realms, users, and clients, explaining the main endpoints and demonstrating how to integrate it seamlessly with your Spring Boot application.</p>
<h1 id="heading-what-is-keycloak"><strong>What is Keycloak?</strong></h1>
<p>Keycloak is a powerful IAM solution that allows you to add authentication and authorization to your applications with minimal effort. It centralizes authentication, eliminating the need to build custom login forms and security mechanisms within each application. Here's a breakdown of its core capabilities:</p>
<ul>
<li><p><strong>Single Sign-On (SSO):</strong> Users only need to authenticate once to access multiple applications, improving user experience and reducing password fatigue.</p>
</li>
<li><p><strong>Authentication and Authorization:</strong> Supports various authentication protocols like OpenID Connect (OIDC), OAuth 2.0, and SAML 2.0. Provides fine-grained authorization based on roles, groups, and policies.</p>
</li>
<li><p><strong>User Management:</strong> Offers a user-friendly interface for managing users, groups, and roles. Allows for self-registration, password resets, and account management.</p>
</li>
<li><p><strong>Identity Brokering:</strong> Integrates with existing identity providers (IdPs) like Google, Facebook, Twitter, and LDAP directories, allowing users to authenticate using their existing accounts.</p>
</li>
<li><p><strong>Centralized Security Management:</strong> Provides a centralized console for managing all aspects of security, including realms, clients, users, roles, and policies.</p>
</li>
<li><p><strong>Customization and Extensibility:</strong> Highly customizable through themes, event listeners, and user federation providers. Allows you to tailor Keycloak to meet your specific security needs.</p>
</li>
</ul>
<h1 id="heading-why-choose-keycloak"><strong>Why Choose Keycloak?</strong></h1>
<ul>
<li><p><strong>Open-Source and Free:</strong> Keycloak is an open-source project, meaning it's free to use and modify.</p>
</li>
<li><p><strong>Standards-Based:</strong> Adheres to industry standards like OIDC, OAuth 2.0, and SAML 2.0, ensuring interoperability with other systems.</p>
</li>
<li><p><strong>Scalable and Performant:</strong> Designed for high-performance and scalability, making it suitable for large enterprise deployments.</p>
</li>
<li><p><strong>Easy Integration:</strong> Provides libraries and adapters for various programming languages and frameworks, including Spring Boot.</p>
</li>
<li><p><strong>Community Support:</strong> Backed by a vibrant community of developers and users, offering ample support and resources.</p>
</li>
</ul>
<h1 id="heading-key-concepts-in-keycloak"><strong>Key Concepts in Keycloak:</strong></h1>
<p>Before we jump into the integration, let's understand some fundamental Keycloak concepts:</p>
<ul>
<li><p><strong>Realm:</strong> A realm represents a security domain. It's like a container for managing users, roles, clients, and identity providers. You can have multiple realms in a Keycloak instance, allowing you to isolate security for different applications or groups of users. Think of it as a tenant.</p>
</li>
<li><p><strong>Client:</strong> Represents an application or service that wants to access resources secured by Keycloak. Each client has its own configuration, including client ID, client secret, and redirect URIs.</p>
</li>
<li><p><strong>User:</strong> Represents a person or entity that can authenticate with Keycloak. Users can belong to one or more groups and have assigned roles.</p>
</li>
<li><p><strong>Role:</strong> A named permission that grants access to specific resources or functionalities. Roles can be assigned to users directly or inherited through group membership. Examples include "admin," "user," or "developer."</p>
</li>
<li><p><strong>Group:</strong> A collection of users that share common characteristics or permissions. Roles can be assigned to groups, simplifying the management of permissions for multiple users.</p>
</li>
<li><p><strong>Client Scope:</strong> Defines the information (claims) that a client can request from Keycloak during the authentication process. Examples include "profile," "email," or "address."</p>
</li>
<li><p><strong>Authenticator:</strong> Defines the authentication flow for a realm. This includes the types of factors for authentication, such as password, OTP, etc.</p>
</li>
</ul>
<h1 id="heading-keycloak-endpoints-explained"><strong>Keycloak Endpoints Explained:</strong></h1>
<p>When integrating Keycloak with a Spring Boot application using OAuth 2.0 / OIDC, certain Keycloak endpoints play a crucial role. Understanding these endpoints is key to troubleshooting and customizing your integration.</p>
<h2 id="heading-authorization-endpoint-authrealmsrealmprotocolopenid-connectauth"><strong>Authorization Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/auth</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> This is where the authentication process begins. When a user tries to access a protected resource in your Spring Boot application, they're redirected to this endpoint. This is where Keycloak presents the login page.</p>
<ul>
<li><p><strong>Parameters:</strong> This endpoint expects several parameters, including:</p>
<ul>
<li><p><code>client_id</code>: The ID of the client application (your Spring Boot app).</p>
</li>
<li><p><code>response_type</code>: Usually <code>code</code> (for the authorization code grant type).</p>
</li>
<li><p><code>redirect_uri</code>: The URI to which Keycloak will redirect the user after successful authentication.</p>
</li>
<li><p><code>scope</code>: The requested scopes (e.g., <code>openid</code>, <code>profile</code>, <code>email</code>).</p>
</li>
<li><p><code>state</code>: A random string used to prevent cross-site request forgery (CSRF). Spring Security automatically handles this.</p>
</li>
</ul>
</li>
<li><p><strong>Response:</strong></p>
<ul>
<li><p>If authentication is successful, Keycloak redirects the user back to the <code>redirect_uri</code> with an authorization code in the URL (e.g., <code>http://localhost:8081/login/oauth2/code/keycloak?code=AUTH_CODE&amp;state=STATE</code>).</p>
</li>
<li><p>If authentication fails, Keycloak might redirect with an error parameter.</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-token-endpoint-authrealmsrealmprotocolopenid-connecttoken"><strong>Token Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/token</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> This endpoint is used to exchange the authorization code obtained from the authorization endpoint for an access token and, optionally, a refresh token and an ID token.</p>
<ul>
<li><p><strong>Parameters:</strong> This is a <code>POST</code> request that requires the following parameters in the request body (using <code>application/x-www-form-urlencoded</code> content type):</p>
<ul>
<li><p><code>grant_type</code>: Must be <code>authorization_code</code> for this flow.</p>
</li>
<li><p><code>code</code>: The authorization code received from the authorization endpoint.</p>
</li>
<li><p><code>redirect_uri</code>: The same redirect URI used in the authorization request.</p>
</li>
<li><p><code>client_id</code>: The ID of the client application.</p>
</li>
<li><p><code>client_secret</code>: The secret of the client application (required for confidential clients).</p>
</li>
</ul>
</li>
<li><p><strong>Response:</strong> A JSON response containing:</p>
<ul>
<li><p><code>access_token</code>: The token used to access protected resources.</p>
</li>
<li><p><code>refresh_token</code>: A token used to obtain new access tokens without requiring the user to re-authenticate.</p>
</li>
<li><p><code>id_token</code>: A JSON Web Token (JWT) containing information about the authenticated user.</p>
</li>
<li><p><code>expires_in</code>: The lifetime of the access token in seconds.</p>
</li>
<li><p><code>refresh_expires_in</code>: The lifetime of the refresh token in seconds.</p>
</li>
<li><p><code>token_type</code>: The type of token (usually <code>bearer</code>).</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-user-info-endpoint-authrealmsrealmprotocolopenid-connectuserinfo"><strong>User Info Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/userinfo</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> This endpoint allows you to retrieve information about the authenticated user.</p>
<ul>
<li><p><strong>Authentication:</strong> Requires a valid access token (usually passed in the <code>Authorization</code> header as a <code>Bearer</code> token).</p>
</li>
<li><p><strong>Response:</strong> A JSON response containing user attributes, such as:</p>
<ul>
<li><p><code>sub</code>: The user's unique identifier (subject).</p>
</li>
<li><p><code>name</code>: The user's full name.</p>
</li>
<li><p><code>given_name</code>: The user's first name.</p>
</li>
<li><p><code>family_name</code>: The user's last name.</p>
</li>
<li><p><code>email</code>: The user's email address.</p>
</li>
<li><p><code>email_verified</code>: A boolean indicating whether the email address has been verified.</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-logout-endpoint-authrealmsrealmprotocolopenid-connectlogout"><strong>Logout Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/logout</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> This endpoint allows you to log the user out of Keycloak. This is important to ensure that the user is completely logged out of all applications using Keycloak.</p>
<ul>
<li><p><strong>Parameters:</strong></p>
<ul>
<li><p><code>client_id</code>: The ID of the client application.</p>
</li>
<li><p><code>refresh_token</code>: The refresh token. This is the preferred method for logging out.</p>
</li>
<li><p><code>id_token_hint</code>: Optional, the ID token.</p>
</li>
</ul>
</li>
<li><p><strong>Logging Out in Spring Boot:</strong> To properly log out the user, you can invalidate the Spring Security session and also redirect the user to the Keycloak logout endpoint. You can use Spring Security's logout functionality and configure a <code>logoutSuccessHandler</code> to redirect to Keycloak's logout endpoint.</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-token-introspection-endpoint-authrealmsrealmprotocolopenid-connecttokenintrospect"><strong>Token Introspection Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/token/introspect</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> Allows a resource server (e.g., your Spring Boot API) to verify the validity of an access token. This is useful when the resource server needs to independently confirm that a token is still active and has not been revoked.</p>
<ul>
<li><p><strong>Parameters:</strong> This is a <code>POST</code> request with the following parameters in the request body (using <code>application/x-www-form-urlencoded</code>):</p>
<ul>
<li><p><code>token</code>: The access token to be introspected.</p>
</li>
<li><p><code>client_id</code>: The ID of the client application (resource server).</p>
</li>
<li><p><code>client_secret</code>: The secret of the client application (resource server - if it's a confidential client).</p>
</li>
</ul>
</li>
<li><p><strong>Response:</strong> A JSON response containing:</p>
<ul>
<li><p><code>active</code>: A boolean indicating whether the token is active (<code>true</code>) or not (<code>false</code>).</p>
</li>
<li><p>If <code>active</code> is <code>true</code>, the response may also include other token metadata, such as the subject (<code>sub</code>), scopes (<code>scope</code>), expiration time (<code>exp</code>), and issuer (<code>iss</code>).</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-public-keys-endpoint-authrealmsrealmprotocolopenid-connectcerts"><strong>Public Keys Endpoint (</strong><code>/auth/realms/{realm}/protocol/openid-connect/certs</code>):</h2>
<ul>
<li><ul>
<li><p><strong>Purpose:</strong> This endpoint provides the public keys that Keycloak uses to sign JWTs (JSON Web Tokens), such as access tokens and ID tokens.</p>
<ul>
<li><p><strong>Usage:</strong> Resource servers can use these public keys to verify the signature of JWTs and ensure that they were issued by Keycloak and haven't been tampered with.</p>
</li>
<li><p><strong>Response:</strong> A JSON response containing a set of JSON Web Keys (JWKs).</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="heading-how-to-create-a-realm-user-and-client-in-keycloak"><strong>How to Create a Realm, User, and Client in Keycloak:</strong></h1>
<p>Let's go through the steps involved in creating these essential Keycloak entities. These steps are performed through the Keycloak Admin Console (accessible at <code>http://localhost:8080</code> by default).</p>
<h2 id="heading-1-creating-a-realm"><strong>1. Creating a Realm:</strong></h2>
<ul>
<li><p><strong>Login to the Admin Console:</strong> Log in to the Keycloak Admin Console using the administrator account you created during Keycloak setup.</p>
</li>
<li><p><strong>Navigate to Realms:</strong> In the top-left corner, you'll see a dropdown that likely says "Master". This represents the "master" realm.</p>
</li>
<li><p><strong>Create Realm:</strong> Click the dropdown and select "Create realm".</p>
</li>
<li><p><strong>Enter Realm Name:</strong> Enter a descriptive name for your realm (e.g., <code>my-app-realm</code>) and click "Create".</p>
</li>
<li><p><strong>Realm Settings (Optional):</strong> After creating the realm, you'll be taken to the realm settings page. You can configure various settings, such as:</p>
<ul>
<li><p><strong>Login Theme:</strong> Customize the login page appearance.</p>
</li>
<li><p><strong>Email Settings:</strong> Configure email settings for sending password reset emails.</p>
</li>
<li><p><strong>Security Defenses:</strong> Enable security features like brute-force detection.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-2-creating-a-user"><strong>2. Creating a User:</strong></h2>
<ul>
<li><p><strong>Select Your Realm:</strong> Make sure you've selected the realm you created (e.g., <code>my-app-realm</code>) in the top-left corner.</p>
</li>
<li><p><strong>Navigate to Users:</strong> In the left-hand menu, click "Users".</p>
</li>
<li><p><strong>Add User:</strong> Click the "Add user" button.</p>
</li>
<li><p><strong>Enter User Details:</strong> Enter the user's details:</p>
<ul>
<li><p><strong>Username:</strong> A unique username for the user.</p>
</li>
<li><p><strong>Email:</strong> The user's email address (optional but recommended).</p>
</li>
<li><p><strong>First Name:</strong> The user's first name (optional).</p>
</li>
<li><p><strong>Last Name:</strong> The user's last name (optional).</p>
</li>
<li><p><strong>Enabled:</strong> Make sure the user is enabled.</p>
</li>
</ul>
</li>
<li><p><strong>Click "Create".</strong></p>
</li>
<li><p><strong>Set Password:</strong> After creating the user, you'll be taken to the user's details page. Go to the "Credentials" tab.</p>
<ul>
<li><p><strong>New Password:</strong> Enter a password for the user.</p>
</li>
<li><p><strong>Password Confirmation:</strong> Confirm the password.</p>
</li>
<li><p><strong>Temporary:</strong> Set "Temporary" to "Off" if you want the user to use this password permanently. If set to "On," the user will be forced to change the password on their first login.</p>
</li>
<li><p>Click "Set Password".</p>
</li>
</ul>
</li>
<li><p><strong>Optional: Add Attributes:</strong> You can add custom attributes to the user profile in the "Attributes" tab.</p>
</li>
</ul>
<h2 id="heading-3-creating-a-client"><strong>3. Creating a Client:</strong></h2>
<ul>
<li><p><strong>Select Your Realm:</strong> Ensure you're in the correct realm (e.g., <code>my-app-realm</code>).</p>
</li>
<li><p><strong>Navigate to Clients:</strong> In the left-hand menu, click "Clients".</p>
</li>
<li><p><strong>Create Client:</strong> Click the "Create client" button.</p>
</li>
<li><p><strong>Enter Client ID:</strong> Enter a unique ID for your client application (e.g., <code>my-spring-boot-app</code>).</p>
</li>
<li><p><strong>Select Client Type:</strong> Select "Regular web application" or "Confidential" if you want client secret. Otherwise, choose "Public". Click "Save".</p>
</li>
<li><p><strong>Configure Client Settings:</strong> After creating the client, you'll be taken to the client settings page. Configure the following important settings:</p>
<ul>
<li><p><strong>Client ID:</strong> (Already set) The unique identifier for the client.</p>
</li>
<li><p><strong>Client Protocol:</strong> Usually <code>openid-connect</code>.</p>
</li>
<li><p><strong>Root URL:</strong> The base URL of your Spring Boot application (e.g., <code>http://localhost:8081</code>).</p>
</li>
<li><p><strong>Valid Redirect URIs:</strong> The URIs to which Keycloak will redirect after successful authentication. Use wildcards for development (e.g., <code>http://localhost:8081/*</code>). For production, be specific. The Spring Security default is usually <code>${baseUrl}/login/oauth2/code/{registrationId}</code> or, in your application.yml file, <code>"{baseUrl}/login/oauth2/code/{registrationId}"</code></p>
</li>
<li><p><strong>Web Origins:</strong> The origins from which your application can make cross-origin requests to Keycloak. Use wildcards for development (e.g., <code>*</code>).</p>
</li>
<li><p><strong>Access Type:</strong></p>
<ul>
<li><p><strong>Confidential:</strong> Suitable for server-side applications that can securely store a client secret. Requires a client secret for authentication.</p>
</li>
<li><p><strong>Public:</strong> Suitable for client-side applications (e.g., JavaScript applications) where the client secret cannot be securely stored.</p>
</li>
</ul>
</li>
<li><p><strong>Service Accounts Enabled:</strong> Enable if you need to use the client's credentials to access resources on behalf of the client itself (client credentials grant).</p>
</li>
</ul>
</li>
<li><p><strong>Credentials Tab (If Access Type is Confidential):</strong></p>
<ul>
<li>If you selected "Confidential" access type, go to the "Credentials" tab to obtain the client secret. You'll need this in your Spring Boot application's configuration.</li>
</ul>
</li>
<li><p><strong>Roles Tab:</strong> * Manage default client roles here. Also map the roles of users who log in into the client.</p>
</li>
</ul>
<p><strong>Integrating Keycloak with Spring Boot: Step-by-Step Guide</strong></p>
<p>Now, let's walk through the steps to integrate Keycloak with your Spring Boot application.</p>
<h1 id="heading-1-setting-up-keycloak"><strong>1. Setting up Keycloak:</strong></h1>
<ul>
<li><p><strong>Download and Install Keycloak:</strong> Download the latest version of Keycloak from the official website (https://www.keycloak.org/downloads). Extract the archive to a directory of your choice.</p>
</li>
<li><p><strong>Start Keycloak:</strong> Navigate to the <code>bin</code> directory within the Keycloak installation folder and run the appropriate script for your operating system:</p>
<ul>
<li><p><strong>Linux/macOS:</strong> <code>./kc.sh start-dev</code></p>
</li>
<li><p><strong>Windows:</strong> <code>kc.bat start-dev</code></p>
</li>
</ul>
</li>
</ul>
<p>    This starts Keycloak in developer mode, which is suitable for testing and development. For production deployments, you'll need to configure Keycloak with a database and appropriate security settings.</p>
<ul>
<li><p><strong>Access the Keycloak Admin Console:</strong> Open your web browser and navigate to <code>http://localhost:8080</code>. You'll be prompted to create an administrator account. Create a username and password.</p>
</li>
<li><p><strong>Create a Realm:</strong> Log in to the Keycloak admin console with the administrator account you just created. By default, you'll be in the "master" realm, which is used for managing Keycloak itself. It's best practice to create a separate realm for your application. Click the "Create realm" button and enter a name for your realm (e.g., "my-app-realm").</p>
</li>
<li><p><strong>Create a Client:</strong> Within your newly created realm, click on "Clients" in the left-hand menu and then click "Create client." Enter a client ID (e.g., "my-spring-boot-app"). For "Client type," select "Regular web application" or "Confidential". Click "Save".</p>
</li>
<li><p><strong>Configure the Client:</strong> On the client details page, configure the following:</p>
<ul>
<li><p><strong>Root URL:</strong> The base URL of your Spring Boot application (e.g., <code>http://localhost:8081</code>).</p>
</li>
<li><p><strong>Valid Redirect URIs:</strong> The URIs to which Keycloak will redirect after successful authentication. Include a wildcard URI for development (e.g., <code>http://localhost:8081/*</code>). For production, specify the exact redirect URIs. A common URI is <code>http://localhost:8081/login/oauth2/code/keycloak</code>.</p>
</li>
<li><p><strong>Web Origins:</strong> The origins from which your application can make cross-origin requests to Keycloak. For development, use a wildcard (e.g., <code>*</code>). For production, specify the exact origins.</p>
</li>
<li><p><strong>Access Type:</strong> "confidential" - This provides enhanced security, requiring a client secret.</p>
</li>
</ul>
</li>
<li><p><strong>Retrieve Client Credentials:</strong> If you selected "confidential" access type, you'll need the client secret. Go to the "Credentials" tab of your client configuration and copy the "Secret".</p>
</li>
<li><p><strong>Create a User (Optional):</strong> You can create a test user within your realm to test the authentication flow. Go to the "Users" menu and click "Add user." Enter the user's details and set a password.</p>
</li>
</ul>
<h1 id="heading-2-setting-up-your-spring-boot-application"><strong>2. Setting up Your Spring Boot Application:</strong></h1>
<ul>
<li><p><strong>Create a New Spring Boot Project:</strong> Use Spring Initializr (<a target="_blank" href="https://start.spring.io/">https://start.spring.io/</a>) to create a new Spring Boot project with the following dependencies:</p>
<ul>
<li><p><strong>Spring Web:</strong> For building web applications.</p>
</li>
<li><p><strong>Spring Security:</strong> For securing your application.</p>
</li>
<li><p><strong>OAuth2 Client:</strong> For OAuth2/OIDC integration.</p>
</li>
<li><p><strong>Thymeleaf (Optional):</strong> For creating dynamic web pages.</p>
</li>
<li><p><strong>Lombok (Optional):</strong> For reducing boilerplate code.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-add-keycloak-dependencies-add-the-following-dependencies-to-your-pomxml-file"><strong>Add Keycloak Dependencies:</strong> Add the following dependencies to your <code>pom.xml</code> file:</h2>
<ul>
<li><pre><code class="lang-java">  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-oauth2-client&lt;/artifactId&gt;
  &lt;/dependency&gt;

  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;
  &lt;/dependency&gt;

  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
  &lt;/dependency&gt;

  &lt;dependency&gt;
      &lt;groupId&gt;org.thymeleaf&lt;/groupId&gt;
      &lt;artifactId&gt;thymeleaf-spring5&lt;/artifactId&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
  &lt;/dependency&gt;
</code></pre>
</li>
<li><h2 id="heading-configure-applicationproperties-or-applicationyml-add-the-following-keycloak-configuration-properties-to-your-application-configuration-file"><strong>Configure</strong> <code>application.properties</code> or <code>application.yml</code>: Add the following Keycloak configuration properties to your application configuration file:</h2>
<pre><code class="lang-yaml">  <span class="hljs-attr">spring:</span>
    <span class="hljs-attr">security:</span>
      <span class="hljs-attr">oauth2:</span>
        <span class="hljs-attr">client:</span>
          <span class="hljs-attr">registration:</span>
            <span class="hljs-attr">keycloak:</span>
              <span class="hljs-attr">client-id:</span> <span class="hljs-string">my-spring-boot-app</span> <span class="hljs-comment"># Your Client ID from Keycloak</span>
              <span class="hljs-attr">client-secret:</span> <span class="hljs-string">YOUR_CLIENT_SECRET</span> <span class="hljs-comment"># Your Client Secret from Keycloak</span>
              <span class="hljs-attr">provider:</span> <span class="hljs-string">keycloak</span>
              <span class="hljs-attr">authorization-grant-type:</span> <span class="hljs-string">authorization_code</span>
              <span class="hljs-attr">redirect-uri:</span> <span class="hljs-string">"{baseUrl}/login/oauth2/code/{registrationId}"</span> <span class="hljs-comment">#Important for the redirect URI. Replace "{baseUrl}" to your application's URL. e.g. http://localhost:8081</span>
          <span class="hljs-attr">provider:</span>
            <span class="hljs-attr">keycloak:</span>
              <span class="hljs-attr">issuer-uri:</span> <span class="hljs-string">http://localhost:8080/realms/my-app-realm</span> <span class="hljs-comment">#  Your Keycloak Realm URL</span>

  <span class="hljs-attr">server:</span>
      <span class="hljs-attr">port:</span> <span class="hljs-number">8081</span>
</code></pre>
<p>  <strong>Important:</strong> Replace the placeholders (<code>my-spring-boot-app</code>, <code>YOUR_CLIENT_SECRET</code>, <code>my-app-realm</code>, and port number) with your actual Keycloak client ID, client secret, realm name, and your application's port number.</p>
</li>
<li><p><strong>Create a Security Configuration Class:</strong> Create a class that extends <code>WebSecurityConfigurerAdapter</code> to configure Spring Security.</p>
<pre><code class="lang-java">  <span class="hljs-keyword">import</span> org.springframework.context.annotation.Bean;
  <span class="hljs-keyword">import</span> org.springframework.context.annotation.Configuration;
  <span class="hljs-keyword">import</span> org.springframework.security.config.annotation.web.builders.HttpSecurity;
  <span class="hljs-keyword">import</span> org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
  <span class="hljs-keyword">import</span> org.springframework.security.web.SecurityFilterChain;

  <span class="hljs-keyword">import</span> <span class="hljs-keyword">static</span> org.springframework.security.config.Customizer.withDefaults;

  <span class="hljs-meta">@Configuration</span>
  <span class="hljs-meta">@EnableWebSecurity</span>
  <span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">SecurityConfig</span> </span>{

      <span class="hljs-meta">@Bean</span>
      <span class="hljs-function"><span class="hljs-keyword">public</span> SecurityFilterChain <span class="hljs-title">filterChain</span><span class="hljs-params">(HttpSecurity http)</span> <span class="hljs-keyword">throws</span> Exception </span>{
          http
                  .authorizeHttpRequests(authorize -&gt; authorize
                          .mvcMatchers(<span class="hljs-string">"/public/**"</span>).permitAll() <span class="hljs-comment">// Allow public access to /public/**</span>
                          .anyRequest().authenticated() <span class="hljs-comment">// Require authentication for all other requests</span>
                  )
                  .oauth2Login(withDefaults()); <span class="hljs-comment">// Enable OAuth2 login</span>

          <span class="hljs-keyword">return</span> http.build();
      }
  }
</code></pre>
<p>  <strong>Explanation:</strong></p>
<ul>
<li><p><code>@Configuration</code>: Indicates that this class is a configuration class.</p>
</li>
<li><p><code>@EnableWebSecurity</code>: Enables Spring Security.</p>
</li>
<li><p><code>SecurityFilterChain</code>: Defines a chain of filters used for security.</p>
</li>
<li><p><code>.authorizeHttpRequests()</code>: Configures authorization rules.</p>
</li>
<li><p><code>.mvcMatchers("/public/**").permitAll()</code>: Allows access to all URLs starting with <code>/public/</code> without authentication. This is useful for static resources or publicly accessible pages.</p>
</li>
<li><p><code>.anyRequest().authenticated()</code>: Requires authentication for all other requests.</p>
</li>
<li><p><code>.oauth2Login(withDefaults())</code>: Enables OAuth 2.0 login. Spring Security will automatically configure the OAuth 2.0 client based on the properties defined in <code>application.properties</code> or <code>application.yml</code>.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-create-a-controller-create-a-simple-controller-to-demonstrate-the-protected-and-public-endpoints"><strong>Create a Controller:</strong> Create a simple controller to demonstrate the protected and public endpoints.</h2>
<ul>
<li><pre><code class="lang-java">  <span class="hljs-keyword">import</span> org.springframework.security.core.Authentication;
  <span class="hljs-keyword">import</span> org.springframework.security.core.context.SecurityContextHolder;
  <span class="hljs-keyword">import</span> org.springframework.stereotype.Controller;
  <span class="hljs-keyword">import</span> org.springframework.ui.Model;
  <span class="hljs-keyword">import</span> org.springframework.web.bind.annotation.GetMapping;

  <span class="hljs-meta">@Controller</span>
  <span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyController</span> </span>{

      <span class="hljs-meta">@GetMapping("/public")</span>
      <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">publicEndpoint</span><span class="hljs-params">()</span> </span>{
          <span class="hljs-keyword">return</span> <span class="hljs-string">"public"</span>; <span class="hljs-comment">// public.html</span>
      }

      <span class="hljs-meta">@GetMapping("/secured")</span>
      <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">securedEndpoint</span><span class="hljs-params">(Model model)</span> </span>{
           Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
              <span class="hljs-keyword">if</span> (authentication != <span class="hljs-keyword">null</span> &amp;&amp; authentication.isAuthenticated()) {
                  model.addAttribute(<span class="hljs-string">"username"</span>, authentication.getName());
                  <span class="hljs-keyword">return</span> <span class="hljs-string">"secured"</span>;
              }

          <span class="hljs-keyword">return</span> <span class="hljs-string">"redirect:/oauth2/authorization/keycloak"</span>; <span class="hljs-comment">// Redirect to Keycloak login if not authenticated</span>
      }

      <span class="hljs-meta">@GetMapping("/")</span>
          <span class="hljs-function"><span class="hljs-keyword">public</span> String <span class="hljs-title">indexPage</span><span class="hljs-params">()</span> </span>{
              <span class="hljs-keyword">return</span> <span class="hljs-string">"redirect:/secured"</span>;
      }
  }
</code></pre>
</li>
</ul>
<h2 id="heading-create-thymeleaf-templates-optional-create-simple-thymeleaf-templates-for-publichtml-and-securedhtml"><strong>Create Thymeleaf Templates (Optional):</strong> Create simple Thymeleaf templates for <code>public.html</code> and <code>secured.html</code>.</h2>
<ul>
<li><p><strong>public.html:</strong></p>
<pre><code class="lang-html">  <span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">xmlns:th</span>=<span class="hljs-string">"http://www.thymeleaf.org"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Public Page<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Public Page<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This page is accessible without authentication.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">a</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/secured"</span>&gt;</span>Go to Secured Page<span class="hljs-tag">&lt;/<span class="hljs-name">a</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>  <strong>secured.html:</strong></p>
<pre><code class="lang-xml">  <span class="hljs-meta">&lt;!DOCTYPE <span class="hljs-meta-keyword">html</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">xmlns:th</span>=<span class="hljs-string">"http://www.thymeleaf.org"</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Secured Page<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Secured Page<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Welcome, <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">th:text</span>=<span class="hljs-string">"${username}"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>!<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>This page is accessible only to authenticated users.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
       <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">th:action</span>=<span class="hljs-string">"@{/logout}"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"post"</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Sign Out"</span>/&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
</li>
</ul>
<h1 id="heading-3-running-the-application"><strong>3. Running the Application:</strong></h1>
<ul>
<li><p><strong>Start Your Spring Boot Application:</strong> Run your Spring Boot application using your IDE or the command line (<code>./mvnw spring-boot:run</code>).</p>
</li>
<li><p><strong>Access the Application:</strong> Open your web browser and navigate to <code>http://localhost:8081/</code>.</p>
<ul>
<li><p>You will be redirected to the Keycloak login page.</p>
</li>
<li><p>Enter the credentials of the user you created in Keycloak (or the admin user if you haven't created a separate user).</p>
</li>
<li><p>After successful authentication, you will be redirected back to your Spring Boot application, and you should see the content of the <code>/secured</code> page, including the username.</p>
</li>
</ul>
</li>
<li><p><strong>Test Public Endpoint:</strong> Navigate to <code>http://localhost:8081/public</code>. You should be able to access this page without being redirected to the Keycloak login page.</p>
</li>
</ul>
<h2 id="heading-explanation-of-the-integration"><strong>Explanation of the Integration:</strong></h2>
<ol>
<li><p>When you access the <code>/secured</code> endpoint, Spring Security intercepts the request and checks if the user is authenticated.</p>
</li>
<li><p>If the user is not authenticated, Spring Security redirects the user to the Keycloak authorization endpoint (configured in <code>application.properties</code> or <code>application.yml</code>).</p>
</li>
<li><p>Keycloak authenticates the user based on the configured authentication methods (e.g., username/password).</p>
</li>
<li><p>After successful authentication, Keycloak redirects the user back to the <code>redirect-uri</code> of your application, along with an authorization code.</p>
</li>
<li><p>Spring Security's OAuth 2.0 client exchanges the authorization code for an access token and a refresh token from Keycloak.</p>
</li>
<li><p>The access token is used to authenticate subsequent requests to the <code>/secured</code> endpoint.</p>
</li>
<li><p>Spring Security stores the user's authentication information (including the access token) in the <code>SecurityContextHolder</code>.</p>
</li>
<li><p>The controller retrieves the authentication information from the <code>SecurityContextHolder</code> and displays the username on the <code>/secured</code> page.</p>
</li>
</ol>
<h2 id="heading-important-considerations"><strong>Important Considerations:</strong></h2>
<ul>
<li><p><strong>Security:</strong> Protect your client secrets and configure redirect URIs carefully to prevent security vulnerabilities.</p>
</li>
<li><p><strong>Scope:</strong> Use scopes to limit the information that your application can access from Keycloak.</p>
</li>
<li><p><strong>User Roles:</strong> Use Keycloak roles to implement fine-grained authorization in your Spring Boot application. Map client roles of the user to spring security roles.</p>
</li>
<li><p><strong>Logging:</strong> Enable logging in Keycloak to monitor authentication activity and troubleshoot issues.</p>
</li>
</ul>
<h2 id="heading-further-considerations-and-advanced-features"><strong>Further Considerations and Advanced Features:</strong></h2>
<ul>
<li><p><strong>Roles and Permissions:</strong> You can configure Keycloak roles and map them to Spring Security authorities to implement fine-grained authorization. You can use <code>@PreAuthorize</code> annotations in your controllers to restrict access to specific endpoints based on roles.</p>
</li>
<li><p><strong>User Federation:</strong> You can configure Keycloak to federate with existing user directories, such as LDAP or Active Directory, so you don't need to manage users in Keycloak itself.</p>
</li>
<li><p><strong>Custom Authentication Flows:</strong> Keycloak allows you to customize the authentication flow to meet your specific requirements, such as adding multi-factor authentication (MFA) or custom authentication providers.</p>
</li>
<li><p><strong>Token Introspection:</strong> If your application needs to validate the access token, you can use Keycloak's token introspection endpoint.</p>
</li>
<li><p><strong>Keycloak Admin REST API:</strong> You can programmatically interact with Keycloak using its REST API to automate tasks such as user management, client configuration, and realm management.</p>
</li>
<li><p><strong>Keycloak Client Adapters:</strong> Keycloak provides client adapters for various programming languages and frameworks, including Spring Boot, which simplify the integration process. While we used Spring Security's built-in OAuth2 client support in this example, you can also use the Keycloak Spring Boot adapter for more advanced features.</p>
</li>
<li><p><strong>Security Best Practices:</strong> Always follow security best practices when configuring Keycloak and your Spring Boot application, such as using strong passwords, enabling HTTPS, and regularly updating your dependencies.</p>
</li>
<li><p><strong>Session Management:</strong> Keycloak manages user sessions. You can configure session timeouts and other session-related settings in the Keycloak admin console. Spring Security integrates with Keycloak's session management, ensuring consistent session handling across your application and Keycloak.</p>
</li>
</ul>
<p>By understanding these Keycloak endpoints, mastering the creation of realms, users, and clients, and following the integration steps, you'll be well-equipped to integrate Keycloak with your Spring Boot applications and build secure, robust solutions. Remember to always follow security best practices to protect your applications and user data. Embrace Keycloak to build secure and scalable applications in today's dynamic world.</p>
]]></content:encoded></item><item><title><![CDATA[Guide to Creating Custom Machine Images on AWS]]></title><description><![CDATA[AWS AMI Customization: How to Build Your Own Machine Image]]></description><link>https://parmesh-bhatt.hashnode.dev/guide-to-creating-custom-machine-images-on-aws</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/guide-to-creating-custom-machine-images-on-aws</guid><category><![CDATA[AWS]]></category><category><![CDATA[AWS,EC2]]></category><category><![CDATA[ec2]]></category><category><![CDATA[Cloud Computing]]></category><category><![CDATA[development]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[learning]]></category><category><![CDATA[coding]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Amazon Web Services]]></category><category><![CDATA[Amazon EC2]]></category><category><![CDATA[amazon machine image]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Fri, 31 May 2024 14:32:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1717165292110/62196c5a-c713-41e7-a098-ffecfd6e4870.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-step-1-understanding-amazon-machine-images-ami"><strong>🚀 Step 1: Understanding Amazon Machine Images (AMI)</strong></h1>
<p><a target="_blank" href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html">Amazon Machine Images (AMI)</a> are the fundamental building blocks for creating virtual machines (EC2 instances) in the Amazon Web Services (AWS) cloud. An AMI is essentially a snapshot or template of a virtual machine that includes the operating system, software, and configurations required to launch an instance. Think of it as a pre-configured "golden image" that you can use to quickly spin up new EC2 instances, saving you time and effort.</p>
<h1 id="heading-step-2-customizing-your-ami"><strong>🛠️ Step 2: Customizing Your AMI</strong></h1>
<p>The real power of AMIs lies in their ability to be customized to your specific needs. Instead of starting from scratch each time you need to launch a new instance, you can create an AMI that includes all the necessary software, configurations, and even your own custom applications. This way, when you launch a new instance from your AMI, everything is already set up and ready to go.</p>
<h2 id="heading-example-deploying-a-react-application">Example: Deploying a React Application</h2>
<p>Let's say you have a React application that you want to deploy on AWS. You could create an AMI that includes the necessary dependencies, such as Node.js and your application code, pre-installed and configured. Then, whenever you need to launch a new instance for your application, you can use this custom AMI, and your app will be ready to run without any additional setup.</p>
<h1 id="heading-step-3-creating-your-own-ami"><strong>🛠️ Step 3: Creating Your Own AMI</strong></h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1717165631152/1ccd15c0-66c7-4d36-b143-f80605b44c1b.png" alt class="image--center mx-auto" /></p>
<p>There are a few ways to create a custom AMI, but the simplest method is to start with an existing EC2 instance, configure it to your liking, and then create an AMI from that instance. Here's how you can do it:</p>
<h2 id="heading-step-31-launch-an-ec2-instance">Step 3.1: Launch an EC2 Instance</h2>
<p>First, launch an EC2 instance using an existing base image (e.g., Amazon Linux, Ubuntu, Windows Server) that aligns with your requirements.</p>
<h2 id="heading-step-32-customize-the-instance">Step 3.2: Customize the Instance</h2>
<p>Once your instance is running, connect to it and start customizing it. Install any necessary software, configure settings, and deploy your applications. This is the step where you'll make your instance unique and tailored to your needs.</p>
<h2 id="heading-step-33-create-an-ami-from-the-instance">Step 3.3: Create an AMI from the Instance</h2>
<p>After you've finished customizing the instance, you can create an AMI from it. In the AWS Management Console, locate the instance, right-click on it, and select "Image" and then "Create Image." This will capture the current state of your instance, including all the software and configurations you've added, and save it as a new AMI.</p>
<h2 id="heading-step-4-launching-instances-from-your-custom-ami">🚀 Step 4: Launching Instances from Your Custom AMI</h2>
<p>Now that you have your custom AMI, you can use it to launch new EC2 instances whenever you need them. Simply navigate to the AMIs section in the AWS Management Console, select your custom AMI, and click "Launch Instance." All the software and configurations you've set up will be automatically applied to the new instance, saving you time and ensuring consistency across your deployments.</p>
<h1 id="heading-conclusion"><strong>🌟 Conclusion</strong></h1>
<p>Creating custom AMIs in AWS is a powerful way to streamline your infrastructure and ensure consistency across your deployments. By pre-configuring your instances with the necessary software, dependencies, and even your own applications, you can launch new resources quickly and with confidence. Embrace the flexibility and efficiency of AWS AMIs to take your cloud-based applications to the next level!</p>
<p>If you want to connect with me,</p>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119">Twitter / X</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119">GitHub</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Understanding Next.js: An Introduction to the Superpower of React]]></title><description><![CDATA[Understanding Next.js: An Introduction to the Superpower of React Next.js is an open source JavaScript framework that is built on top of React.js. It is…]]></description><link>https://parmesh-bhatt.hashnode.dev/understanding-nextjs-an-introduction-to-the-superpower-of-react</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/understanding-nextjs-an-introduction-to-the-superpower-of-react</guid><category><![CDATA[Next.js]]></category><category><![CDATA[React]]></category><category><![CDATA[software development]]></category><category><![CDATA[development]]></category><category><![CDATA[Devops]]></category><category><![CDATA[opensource]]></category><category><![CDATA[learning]]></category><category><![CDATA[nextauth.js]]></category><category><![CDATA[ReactHooks]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Sat, 23 Mar 2024 06:57:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1711175890547/a3c771c0-912a-47f1-9513-6df59a096c0b.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Understanding Next.js: An Introduction to the Superpower of React</p>
<h1 id="heading-what-is-nextjs">What is Next.js?</h1>
<p>Next.js is an open source JavaScript framework that is built on top of React.js. It is designed to make it easier to create server-side React applications with a focus on developer productivity, performance, and SEO (search engine optimization). Next.js provides a set of tools and conventions that simplify various aspects of building web applications.</p>
<h1 id="heading-why-should-you-care-about-nextjs">Why should you care about Next.js?</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711176254661/559ac69e-d21d-4c43-9557-c4d1895b36d7.jpeg" alt class="image--center mx-auto" /></p>
<p>If you have just learned React.js, you might be wondering why you should also learn Next.js. The answer is simple: Next.js is the superpower of React.js. By using Next.js, you can improve the performance of your application, optimize it for search engines, and simplify your development process.</p>
<h1 id="heading-the-key-features-of-nextjs">The Key Features of Next.js</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1711176128620/c63a4006-150a-45dd-879b-37cfa28b9cd5.jpeg" alt class="image--center mx-auto" /></p>
<p>Next.js offers several key features that make it a powerful framework for building web applications:</p>
<h3 id="heading-server-side-rendering-ssr"><strong><em>Server-Side Rendering (SSR)</em></strong></h3>
<p>Next.js allows you to render React components on the server side before sending them to the client. This can improve page load time and SEO, as search engines can easily index the content.</p>
<h3 id="heading-static-site-generation-ssg"><strong><em>Static Site Generation (SSG)</em></strong></h3>
<p>Next.js supports static site generation, where you can pre-render pages at build time. This approach is great for content-heavy websites and can offer better performance and SEO benefits.</p>
<h3 id="heading-api-routes"><strong><em>API Routes</em></strong></h3>
<p>Next.js provides a built-in API routes feature that allows you to create serverless API endpoints within your project. This makes it easier to handle backend logic.</p>
<h3 id="heading-full-stack-framework"><strong><em>Full Stack Framework</em></strong></h3>
<p>Next.js is a full stack framework that offers both frontend and backend capabilities. It provides server components and client components, which you will learn about in depth throughout this course.</p>
<h1 id="heading-getting-started-with-nextjs">Getting Started with Next.js</h1>
<p>To get started with Next.js, you will need to install it on your machine. Here are the steps: 1. Open your terminal and navigate to the desired directory where you want to create your Next.js project. 2. Run the following command: <code>npx create-next-app your-project-name</code> 3. Replace <code>your-project-name</code> with the desired name for your project. 4. Press enter and wait for the installation process to complete. 5. Once the installation is complete, navigate to the project directory by running <code>cd your-project-name</code>. 6. Run the development server by running the command <code>npm run dev</code> or <code>yarn dev</code>. 7. Open your browser and navigate to <a target="_blank" href="http://localhost:3000`"><code>http://localhost:3000</code></a> to see your Next.js application running.</p>
<h1 id="heading-creating-routes-in-nextjs">Creating Routes in Next.js</h1>
<p>In Next.js, creating routes is simple. You just need to create a folder with the desired route name and a file called <code>page.js</code> inside it. For example, if you want to create a route for the about page, create a folder called <code>about</code> and inside it, create a file called <code>page.js</code>. In this file, you can define the content for that specific route. You can also create nested routes by creating nested folders. For example, if you want a nested route for user information inside the about page, create a folder called <code>users</code> inside the <code>about</code> folder, and inside the <code>users</code> folder, create a file called <code>page.js</code>.</p>
<h1 id="heading-linking-pages-in-nextjs">Linking Pages in Next.js</h1>
<p>Next.js provides a <code>Link</code> component that allows you to create links to navigate between pages in your application. To use the <code>Link</code> component, import it from <code>next/link</code> and specify the path you want to navigate to using the <code>href</code> prop. For example, <code>About</code> will create a link to the about page.</p>
<h1 id="heading-programmatic-navigation-with-userouter-hook">Programmatic Navigation with useRouter Hook</h1>
<p>Next.js also provides a <code>useRouter</code> hook that allows you to access the router object and its properties within your component. This hook gives you programmatic control over the router and allows you to navigate to different pages or perform other routing-related actions in response to user interactions or events. To use the <code>useRouter</code> hook, import it from <code>next/router</code>. You can then create an instance of the router object and use its <code>push</code> method to navigate to a specific page. For example, <code>router.push('/about')</code> will navigate the user to the about page.</p>
<h1 id="heading-data-fetching-fundamentals">Data Fetching Fundamentals</h1>
<h3 id="heading-fetching-data-on-the-server"><strong><em>Fetching Data on the Server</em></strong></h3>
<p>Next JS allows us to fetch data on the server using server components. By doing so, we can pre-render the data and improve the performance of our web application. This is achieved by using server-side rendering (SSR) and pre-rendering.</p>
<h3 id="heading-fetching-data-in-parallel"><strong><em>Fetching Data in Parallel</em></strong></h3>
<p>To minimize loading times, it is recommended to fetch data in parallel. This means fetching multiple sets of data simultaneously, rather than waiting for one request to finish before starting another. By doing this, we can optimize the loading process and provide a better user experience.</p>
<h3 id="heading-fetching-data-where-its-used"><strong><em>Fetching Data Where It's Used</em></strong></h3>
<p>Next JS allows us to fetch data where it's used, which means we can request data on a specific page or component. This helps to reduce unnecessary requests and improve performance. Next JS automatically deduplicates requests, so even if the same data is requested multiple times, it will only be fetched once.</p>
<h1 id="heading-using-loading-ui-and-error-boundaries">Using Loading UI and Error Boundaries</h1>
<p>To enhance the user experience, it is recommended to use loading UI and error boundaries. Loading UI provides visual feedback to the user while data is being fetched, ensuring that they know the application is working. Error boundaries help to handle and display errors gracefully, preventing the application from crashing and providing the user with options to recover or try again.</p>
<h1 id="heading-styling-in-nextjs">Styling in Next.js</h1>
<p>Styling is an important aspect of any web application, and Next.js provides several options for styling your application. In this chapter, we'll cover how to add global CSS styles, as well as how to use CSS modules and Tailwind CSS in Next.js.</p>
<p>To add global CSS styles, you can create a file called "Global CSS" in the app/ui folder and import it in your layout component. This file can contain CSS rules that will be applied to all routes in your application. Additionally, you can use CSS modules to scope CSS to specific components, and Tailwind CSS for utility-based styling.</p>
<h1 id="heading-optimizing-fonts-and-images-in-nextjs">Optimizing Fonts and Images in Next.js</h1>
<p>Fonts and images play a crucial role in the design and performance of a website. In this chapter, we'll explore how to optimize fonts and images in Next.js to improve performance and user experience.</p>
<p>Next.js provides an automatic font optimization feature through the Next Font module. This module downloads font files at build time and serves them as static assets, reducing the need for additional network requests. To add custom fonts to your application, you can import them in the app/ui/fonts.js file and apply them to the body element in your layout component.</p>
<p>Next.js also offers the Next Image component, which optimizes images by resizing them based on the device viewport, lazy loading images outside the viewport, and serving images in modern formats like WebP and AVIF. To add images to your application, you can use the Next Image component and specify the image source, width, height, and other attributes.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>Next.js is a powerful framework that extends the functionality of React.js and makes it easier to build server-side React applications. With features like server-side rendering, static site generation, and built-in API routes, Next.js offers developers a productive and efficient way to create high-performance web applications. Whether you are a beginner or an experienced React developer, learning Next.js can take your skills to the next level. So why wait? Start exploring Next.js today and unlock the full potential of React.js!</p>
]]></content:encoded></item><item><title><![CDATA[Navigating the Testing Cosmos in React: A Journey through Automation, Jest, RTL, and Beyond]]></title><description><![CDATA[Unraveling the World of Jest, RTL, and Best Practices for Robust React Applications]]></description><link>https://parmesh-bhatt.hashnode.dev/navigating-the-testing-cosmos-in-react-a-journey-through-automation-jest-rtl-and-beyond</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/navigating-the-testing-cosmos-in-react-a-journey-through-automation-jest-rtl-and-beyond</guid><category><![CDATA[React]]></category><category><![CDATA[Testing]]></category><category><![CDATA[Jest]]></category><category><![CDATA[react testing library]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Wed, 24 Jan 2024 10:26:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1705090167314/5aa6fdcf-a4c7-42a3-85a0-98b9b480e16b.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>As a developer, our primary goal is to build the software that works.</p>
<p>To ensure the software is working perfectly, we tests it using different softwares. In testing we check whether the software is working perfectly or not using different test cases.</p>
<h1 id="heading-what-is-testing-actually">What is testing actually?</h1>
<p>Testing is the process of evaluating a system or component to identify any discrepancies between expected and actual behavior. In software development, testing is crucial for ensuring the reliability, correctness, and performance of the software. Testing helps identify bugs, errors, and potential issues in the code, allowing developers to fix them before the software is deployed to production.</p>
<h1 id="heading-why-we-need-it">Why we need it?</h1>
<p>Testing is essential in the MERN stack to ensure the functionality, reliability, and security of the software. It helps identify and rectify bugs, defects, and performance issues, ensuring that the application behaves as expected. Through systematic testing, developers can validate business logic, secure sensitive data, and maintain the integrity of the codebase. Testing also supports ongoing development by facilitating regression testing, safeguarding existing features as new functionalities are added. Ultimately, testing builds confidence in the application's quality, contributing to a positive user experience and overall success of the MERN stack project.</p>
<h1 id="heading-manual-testing">Manual Testing</h1>
<p>An individual will open the website, interact with the website and ensure everything works as intended. If a new features is released, you repeat the same stpes. You may need to test the whole software when the new features is added.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1706075180377/358abf6b-d2cc-4091-a784-7fd24c4099cb.jpeg" alt class="image--center mx-auto" /></p>
<p>There are some drawbacks of manual testing.</p>
<h1 id="heading-drawbacks-of-manual-testing">Drawbacks of Manual Testing</h1>
<ol>
<li><p>Time consuming.</p>
</li>
<li><p>complex repetitive tasks has a risk of human errors.</p>
</li>
<li><p>You may not get a chance to test the entire application every time due to not having the sufficient time.</p>
</li>
</ol>
<p>The solution is automated testing.</p>
<h1 id="heading-automated-testing">Automated testing</h1>
<p>Automated testing is a software testing technique where the execution of test cases is performed automatically by using specialized testing tools and scripts. Instead of manually executing each test scenario, automated testing relies on automation scripts to carry out pre-defined actions, check expected results, and report outcomes. The primary goal of automated testing is to enhance the efficiency, repeatability, and accuracy of the testing process, particularly in complex or large-scale software projects.</p>
<ul>
<li><p>Automated tests are programs that automate the task of testing your software</p>
</li>
<li><p>write code to test the software code</p>
</li>
<li><p>additional effort required when you develop a feature</p>
</li>
</ul>
<h1 id="heading-advantages-of-automated-testing">Advantages of automated testing</h1>
<ol>
<li><p>Not time consuming</p>
</li>
<li><p>Reliable, consistent and not error prone</p>
</li>
<li><p>easy to identify and fix the features that break the test</p>
</li>
<li><p>gives confidence when shipping software</p>
</li>
</ol>
<h1 id="heading-types-of-testing">Types of testing</h1>
<ol>
<li><p>Units Test</p>
</li>
<li><p>integration Test</p>
</li>
<li><p>E2E test</p>
</li>
</ol>
<h3 id="heading-unit-testing">Unit Testing</h3>
<p>Focus is on testing the individual building blocks of an applications such as a class or a function or a component. Each unit or building block is tested in isolation, independent of other units Dependencies are mocked Run in a short amount of time and make it very easy to pinpoint failure. Relatively easier to write and maintain.</p>
<h3 id="heading-integration-testing">Integration Testing</h3>
<p>Focus is on testing a combination of units and ensuring they work together. Take longer than unit tests</p>
<h3 id="heading-e2e-test-end-to-end-testing">E2E test - End to End testing</h3>
<p>Focus is on testing the entire application flow and ensuring it works as designed from start to finish involves in a real UI, a real backend and real databases are connected and real services etc. Take the longest time to complete because it cover the all most all amount of code Have a cost implication as you interact with the real UI, APIs that may charge based on the number of requests.</p>
<h1 id="heading-testing-pyramid">Testing pyramid</h1>
<p><img src="https://www.lambdatest.com/resources/images/test-pyramid.png" alt class="image--center mx-auto" /></p>
<ul>
<li><p>E2E test - more time, more code, less test</p>
</li>
<li><p>Integration test - medium test, medium length of code, medium amount of test</p>
</li>
<li><p>Unit test - less time, less code, more code</p>
</li>
</ul>
<h1 id="heading-jest-and-rtl">Jest and RTL</h1>
<h3 id="heading-jest">Jest</h3>
<p><img src="https://images.ctfassets.net/vrc8wif0t20g/5LvLUoeqtdGMlXHvOi5gLC/7064584ca78ecf6e877e5bea6092557c/Blog_-_Getting_Started_with_Jest.png" alt class="image--center mx-auto" /></p>
<p>Jest is a JavaScript testing framework created by Facebook, known for its simplicity and speed. It requires minimal configuration, offers built-in mocking and assertions, and is commonly used for testing JavaScript and React applications. Jest provides features like snapshot testing, parallel test execution, and code coverage reporting to enhance the efficiency of the testing process.</p>
<p>Jest is a open-source JavaScript testing framework that find tests, runs the tests, determines whether the tests passed or fails and reports it back in the human readable manner.</p>
<h3 id="heading-rtl-react-testing-library">RTL - React Testing Library</h3>
<p><img src="https://thinksys.com/wp-content/uploads/2023/07/react-testing-library.jpg" alt class="image--center mx-auto" /></p>
<p>RTL, or React Testing Library, is a lightweight testing library for React. It emphasizes testing components based on user interactions and behavior rather than internal implementation details. RTL provides simple utilities for querying and interacting with rendered components, making it a popular choice for user-centric testing in React applications.</p>
<p>RTL is a JavaScript testing utility that provides virtual DOM for testing react components.</p>
<p>React Testing library provides a virtual DOM which we can use to interact with and verify the behaviour of a react component. Testing library is infact a family of packages which helps to test the UI components. The core library is called DOM testing library and RTL is simply a wrapper around this core library to test react applications in an easier way.</p>
<h1 id="heading-the-rtl-philosophy">The RTL Philosophy</h1>
<blockquote>
<p>"The more your tests resemble the way your software is used, the more confidence they can give you."</p>
</blockquote>
<ul>
<li><p>Tests we are going to learn to write in this series strike a balance between unit tests in the sense they are at a component level and easy to write and maintain and E2E tests in the sense they resemble the way a user would interact with the component.</p>
</li>
<li><p>With RTL, we are not concerned about the implementation details of a component.</p>
</li>
<li><p>Like how it is handing click event, or how it is updating the text.</p>
</li>
<li><p>instead we are testing how the components behaves when a user interacts with it.</p>
</li>
<li><p>Refactoring will not affect your test as long as the end result is the same.</p>
</li>
</ul>
<h1 id="heading-code-with-jest-and-rtl">Code with Jest and RTL</h1>
<ol>
<li><strong>Create new project with React</strong></li>
</ol>
<pre><code class="lang-javascript">npx create-react-app my-jest-rtl-app
cd my-jest-rtl-app
</code></pre>
<ol>
<li><strong>Install Jest and RTL</strong></li>
</ol>
<pre><code class="lang-javascript">npm install --save-dev jest @testing-library/react @testing-library/jest-dom
</code></pre>
<ol>
<li><strong>Create Jest Configuration</strong></li>
</ol>
<p>Create a basic Jest configuration file in the project's root folder. Add a <code>jest.config.js</code> file:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// jest.config.js</span>
<span class="hljs-built_in">module</span>.exports = {
  <span class="hljs-attr">setupFilesAfterEnv</span>: [<span class="hljs-string">"@testing-library/react/cleanup-after-each"</span>],
};
</code></pre>
<ol>
<li><strong>Update Scripts in</strong><code>package.json</code></li>
</ol>
<pre><code class="lang-javascript"><span class="hljs-comment">// package.json</span>
{
  <span class="hljs-string">"scripts"</span>: {
    <span class="hljs-string">"test"</span>: <span class="hljs-string">"jest"</span>
  }
}
</code></pre>
<p>or</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// package.json</span>
{
  <span class="hljs-string">"scripts"</span>: {
    <span class="hljs-string">"test"</span>: <span class="hljs-string">"react-scripts test"</span>
  }
}
</code></pre>
<ol>
<li><strong>Create a Simple Componen</strong></li>
</ol>
<pre><code class="lang-javascript"><span class="hljs-comment">// TextComponent.jsx</span>
<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> TextComponent = <span class="hljs-function">(<span class="hljs-params">{ text }</span>) =&gt;</span> {
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>{text}<span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>;
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> TextComponent;
</code></pre>
<ol>
<li><strong>Write a Simple Test</strong></li>
</ol>
<p>create the TextComponent.test.js file right after creating the TextComponent.jsx file.</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// TextComponent.test.js</span>
<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { render, screen } <span class="hljs-keyword">from</span> <span class="hljs-string">"@testing-library/react"</span>;
<span class="hljs-keyword">import</span> TextComponent <span class="hljs-keyword">from</span> <span class="hljs-string">"./TextComponent"</span>;

test(<span class="hljs-string">"renders text component with given text"</span>, <span class="hljs-function">() =&gt;</span> {
  render(<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">TextComponent</span> <span class="hljs-attr">text</span>=<span class="hljs-string">"Hello, Jest and RTL!"</span> /&gt;</span></span>);
  <span class="hljs-keyword">const</span> textElement = screen.getByText(<span class="hljs-regexp">/hello, jest and rtl/i</span>);
  expect(textElement).toBeInTheDocument();
});
</code></pre>
<ol>
<li>Run the test</li>
</ol>
<pre><code class="lang-javascript">npm test
</code></pre>
<p>or</p>
<pre><code class="lang-javascript">jest
</code></pre>
<p>This should execute the test for the <code>TextComponent</code>, checking if it renders the text "Hello, Jest and RTL!" correctly.</p>
<p>This is a basic setup to get you started with Jest and RTL in a Create React App project. As your project evolves, you can explore more advanced testing scenarios and features provided by <a target="_blank" href="https://jestjs.io/">Jest</a> and <a target="_blank" href="https://testing-library.com/">React Testing Library</a>.</p>
<h1 id="heading-test-function-in-jest"><strong><mark>Test</mark> function in Jest</strong></h1>
<p>By default, the test function has three parameters</p>
<ol>
<li><p>name - the name of the test that user want to give</p>
</li>
<li><p>function - which contains actual logic or the actual output that user want to test.</p>
</li>
</ol>
<p>time_duration - After how many second user want to terminate the test If it will not giving the output.</p>
<h3 id="heading-syntax-of-test-function">Syntax of test function</h3>
<pre><code class="lang-javascript">test(<span class="hljs-string">"name"</span>, <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-comment">//logic</span>
}, time_duration)
</code></pre>
<h1 id="heading-the-watch-mode-in-jest">The Watch mode in Jest</h1>
<p>Watch mode is an option that we can pass to jest asking to watch files that have changed since the last commit and execute tests related only to those changed files.</p>
<p>An optimization designed to make your tests run fast regardless of how many tests you have.</p>
<p>It will first see the which file is changed then it will just test those files which is changed.</p>
<p>This will help when we have a thousands of lines of code and just we have to test those files which has been changed recently.</p>
<p>So, we have to make sure which file has been changed since last edit.</p>
<p>If you want to test with Jest's watch mode then write this in terminal:</p>
<pre><code class="lang-javascript">jest --watch <span class="hljs-comment">//runs jest -o by default</span>
jest --watchAll <span class="hljs-comment">//runs all tests</span>
</code></pre>
<h1 id="heading-testonly-method">test.only method</h1>
<p>test.only method will help if we want to test only that part of logic in application. It will help when we have a multiple test function in one file.</p>
<h1 id="heading-testskip-method">test.skip method</h1>
<p>It will skip that test and other logic will be tested. This is helpful when we know that some of the test will automatically passed.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>In conclusion, delving into the testing cosmos of React unveils the efficiency of automation, the simplicity of Jest, and the user-centric approach of React Testing Library (RTL). Together, these tools empower developers to build more resilient applications with comprehensive test coverage. As we journey beyond Jest and RTL, the broader React testing ecosystem awaits exploration, offering endless possibilities for fortifying code and ensuring high-quality software in a dynamic testing landscape.</p>
<p>If you want to connect with me,</p>
<ul>
<li><p><a target="_blank" href="https://github.com/Parmesh119">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://linkedin.com/in/parmesh-bhatt">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119">Twitter / X</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Efficiency in Motion: Leveraging Redux Toolkit for Robust State Control]]></title><description><![CDATA[Unlocking the Power of Redux Toolkit: A Deep Dive into State Management Efficiency]]></description><link>https://parmesh-bhatt.hashnode.dev/efficiency-in-motion-leveraging-redux-toolkit-for-robust-state-control</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/efficiency-in-motion-leveraging-redux-toolkit-for-robust-state-control</guid><category><![CDATA[React]]></category><category><![CDATA[redux-toolkit]]></category><category><![CDATA[Redux]]></category><category><![CDATA[Developer]]></category><category><![CDATA[software development]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[development]]></category><category><![CDATA[Developer Tools]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[ReactHooks]]></category><category><![CDATA[State Management ]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Cloud]]></category><category><![CDATA[Cloud Computing]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Fri, 08 Dec 2023 19:14:27 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1702059935835/e10f51bc-b5e6-4c17-939f-895967797e6a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-what-is-redux"><strong>What is Redux?</strong></h1>
<p>Redux is a state management library for JavaScript applications, commonly employed with frameworks like React. It centralizes the application state in a single store, accessible through actions dispatched by components. Actions that describe state changes are processed by pure functions called reducers that update the state. The store, acting as a container for the state, ensures a predictable flow, and middleware can be employed for additional functionalities like handling asynchronous operations. With the principles of immutability and unidirectional data flow, Redux provides a structured and scalable approach to managing the complex state of web applications, enhancing maintainability and development efficiency.</p>
<h1 id="heading-what-is-the-redux-toolkit"><strong>What is the Redux Toolkit?</strong></h1>
<p>Redux Toolkit is an official package that simplifies the process of working with Redux by providing a set of conventions and utility functions. It includes utilities like <code>createSlice</code> for defining reducers and actions more concisely, <code>configureStore</code> for setting up the Redux store with sensible defaults, and <code>createAsyncThunk</code> for handling asynchronous logic. The toolkit aims to streamline common Redux patterns, reduce boilerplate code, and enhance developer productivity, making it easier for developers to adopt and maintain Redux in their applications.</p>
<h1 id="heading-why-redux-toolkit-is-needed-if-there-is-multiple-hooks-are-available-in-react">Why redux toolkit is needed, If there is multiple hooks are available in React?</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702061411440/50523314-1c80-49f3-a6fb-22eb0b469f3d.png" alt class="image--center mx-auto" /></p>
<p>Redux Toolkit was introduced to streamline and simplify the process of managing state in React applications using Redux. While React's built-in <code>useState</code> and <code>useReducer</code> hooks provide a local state management solution, they are primarily designed for managing component-level states. Redux, on the other hand, is geared towards managing global state and can be particularly useful in larger applications with complex state interactions.</p>
<p>Redux Toolkit aims to address some of the boilerplate and setup complexities traditionally associated with Redux. It provides convenient functions like <code>createSlice</code> for defining reducers and actions more concisely, <code>configureStore</code> for setting up the Redux store with sensible defaults, and <code>createAsyncThunk</code> for handling asynchronous logic.</p>
<p>The decision to use Redux Toolkit versus <code>useState</code> or <code>useReducer</code> often depends on the scale and complexity of the application. For smaller projects, the built-in React hooks might be sufficient. However, as an application grows, Redux Toolkit can offer a more organized and maintainable approach to handling global states, providing a standardized structure that can be beneficial for large and complex React applications.</p>
<h1 id="heading-setting-up-the-redux-toolkit">Setting up the Redux Toolkit</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1702062575607/d90c083c-d8b8-435b-a76b-b432338d76cc.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-installing-redux-and-redux-toolkit"><strong>Installing Redux and Redux Toolkit</strong></h3>
<p>Open your terminal and run the following command to install Redux and Redux Toolkit using npm:</p>
<pre><code class="lang-yaml"><span class="hljs-string">npm</span> <span class="hljs-string">install</span> <span class="hljs-string">@reduxjs/toolkit</span> <span class="hljs-string">react-redux</span>
</code></pre>
<h3 id="heading-setting-up-the-redux-store"><strong>Setting up the Redux Store</strong></h3>
<p>In your React application, create a new file named <code>store.js</code> to configure the Redux store. Use the <code>configureStore</code> function from the Redux Toolkit:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// store.js</span>
<span class="hljs-keyword">import</span> { configureStore } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;

<span class="hljs-keyword">const</span> store = configureStore({
  <span class="hljs-attr">reducer</span>: {
    <span class="hljs-comment">// Add your reducers here</span>
  }
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> store;
</code></pre>
<h3 id="heading-configuring-redux-toolkit">C<strong>onfiguring Redux Toolkit</strong></h3>
<p><em>Adding Middleware</em></p>
<p>Middleware enhances the functionality of Redux. You can add middleware during the store configuration. For example, adding the <code>redux-logger</code> middleware for logging:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// store.js</span>
<span class="hljs-keyword">import</span> { configureStore, getDefaultMiddleware } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;
<span class="hljs-keyword">import</span> logger <span class="hljs-keyword">from</span> <span class="hljs-string">'redux-logger'</span>;

<span class="hljs-keyword">const</span> store = configureStore({
  <span class="hljs-attr">reducer</span>: {
    <span class="hljs-comment">// your reducers go here</span>
  },
  <span class="hljs-attr">middleware</span>: [...getDefaultMiddleware(), logger],
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> store;
</code></pre>
<h3 id="heading-enabling-redux-devtools-extension"><strong>Enabling Redux DevTools Extension</strong></h3>
<p>To enable the Redux DevTools Extension, modify the store configuration:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// store.js</span>
<span class="hljs-keyword">import</span> { configureStore, getDefaultMiddleware } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;
<span class="hljs-keyword">import</span> logger <span class="hljs-keyword">from</span> <span class="hljs-string">'redux-logger'</span>;

<span class="hljs-keyword">const</span> store = configureStore({
  <span class="hljs-attr">reducer</span>: {
    <span class="hljs-comment">// your reducers go here</span>
  },
  <span class="hljs-attr">middleware</span>: [...getDefaultMiddleware(), logger],
  <span class="hljs-attr">devTools</span>: process.env.NODE_ENV !== <span class="hljs-string">'production'</span>,
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> store;
</code></pre>
<p>This configuration ensures that the DevTools Extension is only enabled in development.</p>
<h1 id="heading-creating-redux-slices"><strong>Creating Redux Slices</strong></h1>
<p>In the Redux Toolkit, a slice is a portion of the Redux store that is managed by a reducer and its actions. Let's create a simple counter slice:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// counterSlice.js</span>
<span class="hljs-keyword">import</span> { createSlice } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;

<span class="hljs-keyword">const</span> counterSlice = createSlice({
  <span class="hljs-attr">name</span>: <span class="hljs-string">'counter'</span>,
  <span class="hljs-attr">initialState</span>: <span class="hljs-number">0</span>,
  <span class="hljs-attr">reducers</span>: {
    <span class="hljs-attr">increment</span>: <span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> state + <span class="hljs-number">1</span>,
    <span class="hljs-attr">decrement</span>: <span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> state - <span class="hljs-number">1</span>,
  },
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> { increment, decrement } = counterSlice.actions;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> counterSlice.reducer;
</code></pre>
<p>Now, include this slice in your store configuration:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// store.js</span>
<span class="hljs-keyword">import</span> { configureStore, getDefaultMiddleware } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;
<span class="hljs-keyword">import</span> logger <span class="hljs-keyword">from</span> <span class="hljs-string">'redux-logger'</span>;
<span class="hljs-keyword">import</span> counterReducer <span class="hljs-keyword">from</span> <span class="hljs-string">'./counterSlice'</span>;

<span class="hljs-keyword">const</span> store = configureStore({
  <span class="hljs-attr">reducer</span>: {
    <span class="hljs-attr">counter</span>: counterReducer,
  },
  <span class="hljs-attr">middleware</span>: [...getDefaultMiddleware(), logger],
  <span class="hljs-attr">devTools</span>: process.env.NODE_ENV !== <span class="hljs-string">'production'</span>,
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> store;
</code></pre>
<h1 id="heading-integrating-redux-with-react"><strong>Integrating Redux with React</strong></h1>
<h3 id="heading-connecting-the-redux-store-to-react"><strong>Connecting the Redux Store to React</strong></h3>
<p>Wrap your main application component with the <code>Provider</code> from <code>react-redux</code> to make the Redux store available to all components:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// index.js</span>
<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">'react-dom'</span>;
<span class="hljs-keyword">import</span> { Provider } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-redux'</span>;
<span class="hljs-keyword">import</span> store <span class="hljs-keyword">from</span> <span class="hljs-string">'./store'</span>;
<span class="hljs-keyword">import</span> App <span class="hljs-keyword">from</span> <span class="hljs-string">'./App'</span>;

ReactDOM.render(
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">Provider</span> <span class="hljs-attr">store</span>=<span class="hljs-string">{store}</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">App</span> /&gt;</span>
  <span class="hljs-tag">&lt;/<span class="hljs-name">Provider</span>&gt;</span></span>,
  <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'root'</span>)
);
</code></pre>
<h3 id="heading-accessing-state-and-dispatching-actions"><strong>Accessing State and Dispatching Actions</strong></h3>
<p>Now, in your React components, you can use the <code>useSelector</code> hook to access the state and the <code>useDispatch</code> hook to dispatch actions:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// CounterComponent.js</span>
<span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { useSelector, useDispatch } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-redux'</span>;
<span class="hljs-keyword">import</span> { increment, decrement } <span class="hljs-keyword">from</span> <span class="hljs-string">'./counterSlice'</span>;

<span class="hljs-keyword">const</span> CounterComponent = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> counter = useSelector(<span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> state.counter);
  <span class="hljs-keyword">const</span> dispatch = useDispatch();

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Counter: {counter}<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> dispatch(increment())}&gt;Increment<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> dispatch(decrement())}&gt;Decrement<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> CounterComponent;
</code></pre>
<h1 id="heading-advanced-concepts"><strong>Advanced Concepts</strong></h1>
<h3 id="heading-handling-asynchronous-actions-with-redux-thunk"><strong>Handling Asynchronous Actions with Redux Thunk</strong></h3>
<p>Redux Toolkit provides middleware for handling asynchronous actions. Let's extend our counter slice to include an asynchronous action:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// counterSlice.js</span>
<span class="hljs-keyword">import</span> { createSlice, createAsyncThunk } <span class="hljs-keyword">from</span> <span class="hljs-string">'@reduxjs/toolkit'</span>;

<span class="hljs-keyword">const</span> fakeApiCall = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> {
    <span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">() =&gt;</span> {
      resolve(<span class="hljs-number">42</span>);
    }, <span class="hljs-number">1000</span>);
  });
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> fetchAsyncData = createAsyncThunk(<span class="hljs-string">'counter/fetchAsyncData'</span>, <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> fakeApiCall();
  <span class="hljs-keyword">return</span> data;
});

<span class="hljs-keyword">const</span> counterSlice = createSlice({
  <span class="hljs-attr">name</span>: <span class="hljs-string">'counter'</span>,
  <span class="hljs-attr">initialState</span>: { <span class="hljs-attr">value</span>: <span class="hljs-number">0</span>, <span class="hljs-attr">status</span>: <span class="hljs-string">'idle'</span> },
  <span class="hljs-attr">reducers</span>: {
    <span class="hljs-attr">increment</span>: <span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> {
      state.value += <span class="hljs-number">1</span>;
    },
    <span class="hljs-attr">decrement</span>: <span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> {
      state.value -= <span class="hljs-number">1</span>;
    },
  },
  <span class="hljs-attr">extraReducers</span>: <span class="hljs-function">(<span class="hljs-params">builder</span>) =&gt;</span> {
    builder
      .addCase(fetchAsyncData.pending, <span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> {
        state.status = <span class="hljs-string">'loading'</span>;
      })
      .addCase(fetchAsyncData.fulfilled, <span class="hljs-function">(<span class="hljs-params">state, action</span>) =&gt;</span> {
        state.status = <span class="hljs-string">'succeeded'</span>;
        state.value += action.payload;
      });
  },
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> { increment, decrement } = counterSlice.actions;
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> counterSlice.reducer;
</code></pre>
<p>In this example, we've added an asynchronous action <code>fetchAsyncData</code> that simulates fetching data from an API. The <code>extraReducers</code> field in the slice handles the different states of the asynchronous action.</p>
<p>Now, you can use this asynchronous action in your components:</p>
<pre><code class="lang-javascript"><span class="hljs-comment">// CounterComponent.js</span>
<span class="hljs-keyword">import</span> React, { useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> { useSelector, useDispatch } <span class="hljs-keyword">from</span> <span class="hljs-string">'react-redux'</span>;
<span class="hljs-keyword">import</span> { increment, decrement, fetchAsyncData } <span class="hljs-keyword">from</span> <span class="hljs-string">'./counterSlice'</span>;

<span class="hljs-keyword">const</span> CounterComponent = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> counter = useSelector(<span class="hljs-function">(<span class="hljs-params">state</span>) =&gt;</span> state.counter);
  <span class="hljs-keyword">const</span> dispatch = useDispatch();

  useEffect(<span class="hljs-function">() =&gt;</span> {
    dispatch(fetchAsyncData());
  }, [dispatch]);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Counter: {counter.value}<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Status: {counter.status}<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> dispatch(increment())}&gt;Increment<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">onClick</span>=<span class="hljs-string">{()</span> =&gt;</span> dispatch(decrement())}&gt;Decrement<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> CounterComponent;
</code></pre>
<h1 id="heading-benefits-of-redux">Benefits of Redux</h1>
<p>There are several benefits to using Redux in your applications:</p>
<ol>
<li>Synchronized Data</li>
</ol>
<p>With Redux, you can keep different parts of the UI in sync by storing all the application states in a central repository. This eliminates the need for individual components to manage their state and ensures that all parts of the UI have access to the same data.</p>
<ol>
<li>Transparent Data Flow</li>
</ol>
<p>Redux makes it easy to understand how data changes in your application. If something goes wrong, you can quickly see how the data changed, why it changed, and where it came from. This makes debugging and troubleshooting much easier.</p>
<ol>
<li>Debugging Tools</li>
</ol>
<p>Redux provides powerful debugging tools that allow you to track and inspect the state of your application in real-time. You can easily go back to previous actions and restore the UI to a specific state. This makes it much easier to reproduce and fix bugs.</p>
<ol>
<li>Cacheable State</li>
</ol>
<p>With Redux, you can easily cache or preserve the state of your application. This allows you to optimize performance by avoiding unnecessary data fetching and rendering. It also enables features like undo and redo.</p>
<ol>
<li>Integration with Other Libraries</li>
</ol>
<p>Redux works seamlessly with a wide range of libraries for building user interfaces. Whether you're using React, Angular, Ember, or even plain JavaScript, Redux can be easily integrated into your project. There is also a large and growing ecosystem of add-ons and plugins available for Redux.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>Redux toolkit is a powerful tool for managing the state in your React applications. It provides a simplified API and includes useful packages by default, making it easier and faster to set up Redux. With the Redux toolkit, you can create a store, add reducers, and dispatch actions with ease. Incorporating the Redux toolkit into your project will help you write cleaner and more maintainable code.</p>
<p>In this blog post, we've covered the installation, configuration, and implementation of Redux and Redux Toolkit in a React application. From setting up the store to creating slices and handling asynchronous actions, you now have a comprehensive understanding of how to efficiently manage state in your React projects. Remember to explore the official documentation for Redux and Redux Toolkit for further details and advanced features.</p>
<h1 id="heading-references">References</h1>
<ul>
<li><p><a target="_blank" href="https://redux-toolkit.js.org/">Redux Toolkit Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://react-redux.js.org/">React Redux Documentation</a></p>
</li>
</ul>
<h3 id="heading-if-you-want-to-connect-with-me">If you want to connect with me...</h3>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119">GitHub</a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119">Twitter / X</a></p>
</li>
</ul>
<h2 id="heading-happy-coding">Happy Coding...🧑‍💻🫡</h2>
]]></content:encoded></item><item><title><![CDATA[From Bugs to Features: How Issue Tracking Drives Software Development]]></title><description><![CDATA[The software industry faces significant challenges with rising bug counts due to increasing system complexity, rapid development cycles, inadequate testing…]]></description><link>https://parmesh-bhatt.hashnode.dev/from-bugs-to-features-how-issue-tracking-drives-software-development</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/from-bugs-to-features-how-issue-tracking-drives-software-development</guid><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Developer]]></category><category><![CDATA[Open Source]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Tue, 17 Oct 2023 10:39:06 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1697517303211/93a1de09-00ea-40d0-b568-baa7661b9b2a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-solving-problems-faster-the-power-of-issue-tracking-systems">Solving Problems Faster: The Power of Issue Tracking Systems</h3>
<h1 id="heading-behind-the-scenes-issues-that-complicate-software-bug-resolution">Behind the Scenes: Issues That Complicate Software Bug Resolution</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697518300427/4099967c-d1cd-4959-af61-64f4ecddeab7.jpeg" alt class="image--center mx-auto" /></p>
<p>The software industry faces significant challenges with rising bug counts due to increasing system complexity, rapid development cycles, inadequate testing practices, ineffective bug tracking, communication gaps, insufficient training, overreliance on manual testing, limited use of static code analysis tools, inadequate user feedback mechanisms, and an underestimation of bug impact. Addressing these issues requires robust testing, effective bug tracking, open communication, training, automation, and active user feedback to reduce bug prevalence and deliver high-quality software.</p>
<p>In the software industry, addressing and managing software bugs and issues is an ongoing challenge. Some current problems and challenges in this area include:</p>
<ol>
<li><p><strong>Complex Software Ecosystems</strong>: Modern software often relies on complex ecosystems with numerous dependencies. When an issue arises, it can be challenging to identify the root cause among multiple interconnected components.</p>
</li>
<li><p><strong>Testing Across Multiple Platforms and Devices</strong>: Ensuring that software works correctly on various platforms, devices, and browsers presents a significant testing challenge. It's crucial to detect and fix issues specific to different environments.</p>
</li>
<li><p><strong>Security Vulnerabilities</strong>: Cybersecurity threats are constantly evolving. Developers must identify and fix security vulnerabilities promptly to protect users' data and privacy.</p>
</li>
<li><p><strong>Scalability and Performance</strong>: As software systems scale, performance bottlenecks and scalability issues may emerge. Addressing these concerns requires careful monitoring and optimization.</p>
</li>
<li><p><strong>Real-Time and Concurrent Systems</strong>: Real-time systems and applications that handle concurrent processes can be prone to complex issues like deadlocks, race conditions, and timing problems.</p>
</li>
</ol>
<p>There are many more challenges. Addressing these challenges requires a multi-faceted approach that involves implementing robust testing practices, adopting effective bug-tracking systems, fostering open communication between teams, investing in training and automation tools, and actively seeking user feedback.</p>
<p>The cost is also increasing day by day to find and then solve those bugs. Just see the graph...</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697522799296/52d1f0f3-847b-4a48-a8c4-c6b4e5c4915d.jpeg" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697523021172/8fc57b8f-4558-4b99-801b-ce9d9c0c3008.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-comprehensive-introduction-to-bug-tracking">Comprehensive Introduction to Bug Tracking</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697521596450/6f4b5edf-59c7-4f3b-a433-43ca1597a8ea.jpeg" alt class="image--center mx-auto" /></p>
<p>A bug tracking system (BTS), also known as an issue tracking system (ITS) or a defect tracking system (DTS), is a software tool or platform that is used in software development and quality assurance to track, manage, and resolve issues, bugs, or defects in a software project.</p>
<p>These systems play a crucial role in the software development and testing process by providing a structured way to identify, report, prioritize, assign, and monitor issues that can affect the quality and functionality of the software.</p>
<p>Key characteristics and functions of a bug-tracking system include:</p>
<ol>
<li><p><strong>Issue Reporting</strong>: Users, testers, or developers can report issues they encounter in the software, including bugs, errors, crashes, and feature requests.</p>
</li>
<li><p><strong>Issue Tracking</strong>: Each reported issue is assigned a unique identifier and is logged into the system, allowing for easy tracking and reference.</p>
</li>
<li><p><strong>Assignment</strong>: Issues are assigned to responsible team members, such as developers or quality assurance testers, for resolution.</p>
</li>
<li><p><strong>Prioritization</strong>: Issues are categorized and prioritized based on their severity and impact on the software's functionality and quality.</p>
</li>
<li><p><strong>Workflow Management</strong>: Bug tracking systems often support customizable workflows, enabling teams to define how issues progress from creation to resolution.</p>
</li>
</ol>
<p>Bug tracking systems are widely used in various software development methodologies, including Agile, Scrum, and DevOps. They help teams maintain software quality, improve collaboration, and ensure that issues are addressed in a systematic and timely manner. Common bug-tracking system tools include Jira, Bugzilla, Mantis, and Redmine, among others.</p>
<h1 id="heading-features-and-importance">Features and Importance</h1>
<p>Bug Tracking Systems (BTS) typically offer a set of common features and functionalities that help development teams identify, track, manage, and resolve issues in their software projects. These features include:</p>
<ol>
<li><p><strong>Issue Creation</strong>: Users, whether they are team members, testers, or customers, can create new issues in the system. This includes bug reports, feature requests, and other types of issues.</p>
</li>
<li><p><strong>Issue Tracking</strong>: Each issue is assigned a unique identifier and is logged in the system. This identifier is used for easy reference and tracking.</p>
</li>
<li><p><strong>Assignment</strong>: Issues can be assigned to specific team members or developers responsible for resolving them. This feature ensures that issues are not overlooked.</p>
</li>
<li><p><strong>Prioritization</strong>: Issues can be categorized and prioritized based on their severity, impact, and urgency. This helps in deciding which issues should be addressed first.</p>
</li>
<li><p><strong>Status Tracking</strong>: BTS allows tracking the status of each issue, from its creation to resolution. Common statuses include "New," "In Progress," "Resolved," and "Closed."</p>
</li>
<li><p><strong>Workflow Management</strong>: BTS often supports customizable workflows. Teams can define how issues progress from one status to another, ensuring that the process aligns with their development methodology.</p>
</li>
<li><p><strong>Comments and Updates</strong>: Users and team members can add comments, attachments, and updates to issues. This feature facilitates communication, collaboration, and the sharing of additional information.</p>
</li>
<li><p><strong>Attachments</strong>: Users can attach screenshots, log files, or other relevant documents to provide additional context for the reported issues.</p>
</li>
<li><p><strong>Version Control Integration</strong>: Integration with version control systems and code repositories allows for associating issues with specific code changes. This helps in identifying when an issue was introduced or resolved.</p>
</li>
<li><p><strong>Search and Filtering</strong>: Users can search for specific issues using keywords, filters, or advanced search criteria. This simplifies issue retrieval and analysis.</p>
</li>
<li><p><strong>Notifications</strong>: Automated email notifications keep relevant team members informed about issue updates, assignments, and status changes.</p>
</li>
</ol>
<p>There are many more features and importance of a bug tracking system.</p>
<h1 id="heading-types-of-bugs">Types of bugs</h1>
<p>In software development, various types of bugs or defects can occur, each with its characteristics and impact on the software's functionality and quality. Here are some common types of bugs:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697528726145/bb47a2af-0451-4693-a249-de143893931d.jpeg" alt class="image--center mx-auto" /></p>
<ol>
<li><p><strong>Syntax Errors</strong>: These are the simplest types of bugs and occur when the code violates the programming language's syntax rules. Syntax errors prevent the code from being compiled or executed.</p>
</li>
<li><p><strong>Logic Errors</strong>: Logic errors, also known as bugs in the algorithm, occur when the code functions as intended but produces incorrect results due to a flaw in the logical flow or calculations.</p>
</li>
<li><p><strong>Runtime Errors</strong>: Runtime errors, also called exceptions, happen during program execution. They can include division by zero, null pointer references, or out-of-bounds array access.</p>
</li>
<li><p><strong>Interface Errors</strong>: Interface bugs occur when different software components or systems fail to communicate properly, leading to data exchange problems or integration issues.</p>
</li>
<li><p><strong>Performance Issues</strong>: These bugs affect the software's speed and efficiency. Common examples include slow response times, high resource consumption, and memory leaks.</p>
</li>
<li><p><strong>Security Vulnerabilities</strong>: Security bugs can lead to vulnerabilities that could be exploited by attackers. These include issues like SQL injection, cross-site scripting (XSS), and authentication weaknesses.</p>
</li>
<li><p><strong>Concurrency Bugs</strong>: Concurrency issues, such as race conditions and deadlocks, occur in multi-threaded or parallel applications when multiple threads access shared resources simultaneously.</p>
</li>
</ol>
<h1 id="heading-difference-between-bug-and-error">Difference between bug and error</h1>
<p>In software development, errors are mistakes made during development, while bugs are manifestations of those errors in the functioning of the software.</p>
<ul>
<li><p><strong>Error</strong></p>
<p>  A mistake was made by the developer while writing the code. Errors can be more conceptual or logical.</p>
</li>
<li><p><strong>Bug</strong></p>
<p>  A defect in the code that causes the software to produce an incorrect or unexpected result. Bugs can be temporary or permanent.</p>
</li>
<li><p><strong>Differences</strong></p>
<ul>
<li><p>Nature: Errors are temporary, while bugs can be permanent.</p>
</li>
<li><p>Cause: Errors are caused by incorrect input, while bugs are caused by the software.</p>
</li>
<li><p>Impact: Errors can cause compilation and execution to fail, while bugs can cause minor inconveniences or more severe issues like data loss, security breaches, or functional limitations.</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-bug-lifecycle">Bug Lifecycle</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697531171430/c31d9002-c5c1-49cc-8508-4b689f7e6f9e.jpeg" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697537340308/b62617ee-12e4-4f9f-90ab-73a0dcc6c4f9.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-how-the-bug-tracking-system-works">How the bug tracking system works</h1>
<p>A software bug occurs when an application or program doesn’t work the way it is designed to function. Most errors are faults or mistakes made by system architects, designers, or developers. Testing teams use bug tracking to monitor and report on errors that occur as an application is developed and tested.</p>
<p>“A major component of a bug tracking system is a database that records facts about known bugs,” says Wikipedia. “Facts may include the time a bug was reported, its severity, the erroneous program behavior, and details on how to reproduce the bug, as well as the identity of the person who reported it and any programmers who may be fixing it.” <a target="_blank" href="https://www.ibm.com/topics/bug-tracking#citation2"><sup>2</sup></a></p>
<p>During its lifetime, a single defect may go through several stages or states. They include:</p>
<ul>
<li><p>Active: Investigation is underway</p>
</li>
<li><p>Test: Fixed and ready for testing</p>
</li>
<li><p>Verified: Retested and verified by quality assurance (QA)</p>
</li>
<li><p>Closed: Can be closed after QA retesting or if it is not considered to be a defect</p>
</li>
<li><p>Reopened: Not fixed and reactivated <a target="_blank" href="https://www.ibm.com/topics/bug-tracking#citation3"><sup>3</sup></a></p>
</li>
</ul>
<p>Bugs are managed based on priority and severity. Severity levels help to identify the relative impact of a problem on a product release. These classifications may vary in number, but they generally include some form of the following:</p>
<ul>
<li><p>Catastrophic: causes total failure of the software or unrecoverable data loss. There is no workaround, and the product can’t be released.</p>
</li>
<li><p>Impaired functionality: A workaround may exist, but it is unsatisfactory. The software can’t be released.</p>
</li>
<li><p>Failure of non-critical systems: A reasonably satisfactory workaround exists. The product may be released if the bug is documented.</p>
</li>
<li><p>Very minor: There is a workaround, or the issue can be ignored. It does not impact a product release.</p>
</li>
</ul>
<p>In most cases, states and severity levels are monitored in a bug-tracking database. A good tracking platform also ties into larger software development and management systems, making it easier to assess error status and the potential impact on overall production and timelines.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697537585934/6497e13c-9403-4c49-9eef-c74db3114e87.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-issues-with-the-bug-tracking-system">Issues with the bug-tracking system</h1>
<p>While bug tracking systems (BTS) offer numerous benefits, they are not without their challenges and issues. Some of the common issues associated with bug tracking systems available on the market include:</p>
<ol>
<li><p><strong>Complexity and Overhead</strong>: Some bug tracking systems can be overly complex, especially for small teams or projects. They may introduce unnecessary overhead in terms of setup and maintenance.</p>
</li>
<li><p><strong>Learning Curve</strong>: BTS tools can have a steep learning curve, making it challenging for new team members to use the system effectively.</p>
</li>
<li><p><strong>Customization Challenges</strong>: Configuring and customizing the BTS to match the specific needs and workflows of a team can be time-consuming and require technical expertise.</p>
</li>
<li><p><strong>Over-Reliance on Technology</strong>: Teams may become overly reliant on the BTS, neglecting other essential aspects of communication and issue management.</p>
</li>
<li><p><strong>Information Overload</strong>: A high volume of issues, especially in larger projects, can lead to information overload, making it difficult to prioritize and address issues effectively.</p>
</li>
<li><p><strong>Lack of Integration</strong>: Some BTS tools do not integrate well with other development tools, leading to a disconnected development environment.</p>
</li>
<li><p><strong>Poor Reporting and Analytics</strong>: Inadequate reporting and analytics features can limit a team's ability to track project progress, identify trends, and make data-driven decisions.</p>
</li>
</ol>
<h1 id="heading-popular-bug-tracking-tools-in-the-market">Popular bug-tracking tools in the market</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697538052008/6fb17e7f-586c-4437-99e8-f564c4906371.jpeg" alt class="image--center mx-auto" /></p>
<p>There are several popular and widely used bug-tracking tools available in the market. The popularity of these tools may vary based on user requirements and specific use cases. Here are some of the top bug-tracking tools:</p>
<ol>
<li><p><strong>Jira</strong>: Jira, developed by Atlassian, is one of the most widely used bug-tracking and project management tools. It offers extensive customization and integration and supports agile methodologies.</p>
</li>
<li><p><strong>Bugzilla</strong>: Bugzilla is an open-source bug-tracking tool developed by Mozilla. It is known for its simplicity and robust bug-tracking capabilities.</p>
</li>
<li><p><strong>MantisBT</strong>: Mantis Bug Tracker (MantisBT) is an open-source tool that is easy to use and offers features for bug tracking, issue management, and project collaboration.</p>
</li>
<li><p><strong>Redmine</strong>: Redmine is an open-source project management and bug-tracking tool that is highly customizable. It supports issue tracking, time tracking, and source code management.</p>
</li>
<li><p><strong>Trello</strong>: Trello is a visual project management tool that can be adapted for bug tracking and issue management. It is known for its user-friendly interface.</p>
</li>
</ol>
<h1 id="heading-bug-tracking-in-agile-and-devops">Bug tracking in Agile and DevOps</h1>
<p>Bug tracking in Agile and DevOps methodologies is an integral part of the software development and delivery process. In Agile, bugs are reported as work items and addressed during sprint planning and execution. Agile teams prioritize bug fixes alongside new features, aiming for a prompt resolution to maintain a working product. In DevOps, bug tracking is highly automated, with a focus on early detection through continuous testing and monitoring in production. Collaboration between development and operations teams is crucial for fast bug resolution. Both methodologies emphasize quick identification, prioritization, and collaboration to maintain software quality and deliver value to users.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697538345505/721a65f5-e3e9-4a98-be81-c0a3c56950b0.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-future-trends">Future trends</h1>
<p>The future of bug-tracking systems in the software industry holds a promising landscape. Expect to see increased integration of AI and machine learning for automated issue classification and predictive analysis, along with advanced automation throughout the bug-tracking process. Collaboration features will be enhanced to facilitate seamless communication among cross-functional teams and blockchain technology may be utilized to bolster issue data security. Tight integration with DevOps and CI/CD pipelines, real-time monitoring, and robust mobile and remote access options will become standard. Bug tracking systems will also offer improved analytics, while cloud and SaaS adoption continues to rise. Cross-platform compatibility, user-friendly interfaces, and compliance with data privacy regulations will be the norm, reflecting the evolving needs and challenges of the software industry.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>In conclusion, bug-tracking systems are indispensable tools in the software development world, ensuring the quality and reliability of software products. They streamline issue identification, tracking, resolution, and reporting. With the advent of AI and automation, bug-tracking systems are poised to become even more efficient, capable of predictive analysis and enhanced collaboration.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1697538683056/0810a7f2-79cc-497e-b887-612d6dbd90ab.jpeg" alt class="image--center mx-auto" /></p>
<p>If you want to connect with me, the links are given below...</p>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/"><strong>LinkedIn</strong></a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119"><strong>Twitter</strong></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119"><strong>GitHub</strong></a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[From V8 to Event Loop: The Inner Anatomy of Node.js]]></title><description><![CDATA[Asynchronous Magic: Demystifying the Event Loop]]></description><link>https://parmesh-bhatt.hashnode.dev/from-v8-to-event-loop-the-inner-anatomy-of-nodejs</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/from-v8-to-event-loop-the-inner-anatomy-of-nodejs</guid><category><![CDATA[Node.js]]></category><category><![CDATA[backend developments]]></category><category><![CDATA[Event Loop]]></category><category><![CDATA[React]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Sat, 26 Aug 2023 16:59:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1692547131391/0c94ea2f-ca07-473b-8573-c7420f902ef7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-what-is-node"><strong>What is Node?</strong></h1>
<p>Many people think that Node.js is a framework and other new students who are new beginners understand it as a library. But wait my friends, Node is neither a framework nor a library.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693059694643/529a7824-a602-4825-83fb-572f1b2d0d31.png" alt /></p>
<p>Node.js is a cross-platform, open-source server environment that can run on Windows, Linux, Unix, macOS, and more. Node.js is a back-end JavaScript runtime environment, that runs on the V8 JavaScript engine and executes JavaScript code outside a web browser. Node is built using programming languages like C, C++, and JavaScript.</p>
<blockquote>
<p>You can explore more about NodeJs from their <a target="_blank" href="https://nodejs.org/en/docs">official documentation</a> or <a target="_blank" href="https://en.wikipedia.org/wiki/Node.js">Wikipedia</a>.</p>
</blockquote>
<h1 id="heading-the-v8-engine-the-backbones-of-node-applications">The V8 Engine - the backbones of Node applications</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693059951715/bc0fed71-ac50-4201-bd8f-b0dd487a111d.png" alt /></p>
<p>V8 is a free and open-source JavaScript and WebAssembly engine developed by the Chromium Project for Chromium and Google Chrome web browsers. The project's creator is Lars Bak. V8 Engine is built using JavaScript, C++, ECMAScript, and Assembly languages.</p>
<p>V8 is the name of the JavaScript engine that powers Google Chrome. It's the thing that takes our JavaScript and executes it while browsing with Chrome. V8 provides the runtime environment in which JavaScript executes. V8 is written in C++, and it's continuously improved. It is portable and runs on Mac, Windows, Linux, and several other systems.</p>
<blockquote>
<p>You can explore more about the V8 Engine from <a target="_blank" href="https://v8.dev/docs">official documentation</a> or <a target="_blank" href="https://en.wikipedia.org/wiki/V8_(JavaScript_engine)">Wikipedia</a>.</p>
</blockquote>
<h1 id="heading-performance-myth-internal-working-of-nodejs">Performance Myth - Internal Working of NodeJs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693060894296/c2541504-ed4b-4ab4-8533-8824fe9df5eb.jpeg" alt /></p>
<p>Many people are still not able to understand the internal workings of NodeJs because it's doing non-blocking and asynchronous execution of programs makes it very complex to understand. Especially the internal working of NodeJs which is Event Loop.</p>
<p>Now, many people have questioned what is asynchronous programming. So, let's understand what is Synchronous and Asynchronous Programming.</p>
<h1 id="heading-what-is-synchronous-and-asynchronous-programming">What is Synchronous and Asynchronous Programming?</h1>
<p><strong>Synchronous programming</strong> means that the code runs in the sequence it is defined. When a function is called and has returned some value in a synchronous program, only then will the next line be executed.</p>
<p>In simple words, synchronous programming means the execution of a program happens line by line. If one line is taking so much time to execute then the execution of the program will not go in the next line. It waits for that line to execute and then It will go in the next line. And If one line takes so much time to execute then the UI will be frozen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693062935559/5bb3298d-aa9f-4709-a773-bd225d201874.jpeg" alt class="image--center mx-auto" /></p>
<p><strong>Asynchronous programming</strong>, on the other hand, refers to code that doesn't execute in sequence. These functions are performed not according to the sequence they are defined inside a program but only when certain conditions are met.</p>
<p>In simple words, Asynchronous means the environment doesn't wait for the specific line to execute. It will start executing that line and put it into the background and when the output of that line comes It will print it to the console. This way the UI will not be frozen only that part will be frozen whose going to fetch the data from the actual application server.</p>
<p><strong><em>Example:</em></strong></p>
<p>JavaScript</p>
<p>Plain Text</p>
<p>Plain Text</p>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Hello world!"</span>)

<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">()=&gt;</span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'set timeout function'</span>)
}, <span class="hljs-number">2000</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'I am Parmesh Bhatt.'</span>)
</code></pre>
<p><strong><em>Output:</em></strong></p>
<pre><code class="lang-plaintext">Hello world!
I am Parmesh Bhatt.
set timeout function
</code></pre>
<p>Now, let's understand about Event Loop in NodeJs.</p>
<h1 id="heading-event-loop">Event Loop</h1>
<p>An event loop is <strong>an endless loop, that waits for tasks, executes them, and then sleeps until it receives more tasks</strong>. Node handles requests using an <strong>Event loop</strong> inside the NodeJS environment.</p>
<p>NodeJs has mainly three parts in the backend <strong>Call Stack, Call Back Queue, and Node APIs</strong>. The combination of all these three is called an <strong>Event Loop</strong>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693063752395/cc06b199-652c-4fc1-8e7c-c47b2656ff2f.jpeg" alt /></p>
<h3 id="heading-lets-have-an-example-and-understand-it-simply"><strong>Let's have an example and understand it simply:</strong></h3>
<p>Suppose we have a code like below,</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">let</span> a = <span class="hljs-number">2</span>;
<span class="hljs-keyword">let</span> b = <span class="hljs-number">3</span>;
<span class="hljs-keyword">const</span> sum = a + b;
<span class="hljs-built_in">console</span>.log(sum);
</code></pre>
<p>For this, the output will be,</p>
<pre><code class="lang-plaintext">5
</code></pre>
<p>When we write a simple code like the above, the first execution will start and the main function goes into the Call stack.</p>
<blockquote>
<p><strong><em>Now you all have a question in JavaScript, we are not writing any main function as we write in C++ and Java. So, from where this main function comes in the Call stack.</em></strong></p>
<p><strong><em>My friends, JavaScript is internally built When It starts executing it will automatically put all of the code in the main function and then start its actual execution.</em></strong></p>
</blockquote>
<p>After the main function goes into the Call stack, the console.log function goes into the Call stack and the Call stack executes it, and the output prints on the screen.</p>
<blockquote>
<p><strong>Call Stack has an internal building like It follows the LIFO property. LIFO means Last In First Out. This means whichever function comes last will execute first and that's why the main function comes first and gets out of the stack at last.</strong></p>
</blockquote>
<h3 id="heading-another-example">Another example:</h3>
<pre><code class="lang-javascript"><span class="hljs-built_in">console</span>.log(<span class="hljs-string">'one'</span>);

<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">()=&gt;</span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Settimeout 1"</span>)
}, <span class="hljs-number">2000</span>)

<span class="hljs-built_in">setTimeout</span>(<span class="hljs-function">()=&gt;</span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Settimeout 2"</span>)
}, <span class="hljs-number">0</span>)

<span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Two'</span>);
</code></pre>
<p>Output of the above code is:</p>
<pre><code class="lang-plaintext">one
Two
Settimeout 2
Settimeout 1
</code></pre>
<h3 id="heading-its-really-interesting-lets-understand-it"><strong>It's really interesting. Let's understand it...</strong></h3>
<p>We all know now that in NodeJs, there are three things first is the Call stack, second is Node APIs and third is the call-back queue.</p>
<p>When we start executing the above code, as usual, the main function goes into the Call stack and the console.log function will also go into the Call stack.</p>
<p>But from the setTimeout function, the setTimeout function will not go into the Call stack directly but it goes into the Node API.</p>
<p>Now you all have a question Why does it go into the node API directly Why does it not go into the Call stack?</p>
<p><strong>Let's understand it,</strong></p>
<p>The setTimeout function goes into the node API directly because the set timeout function is inherited from C++ and every function that inherits from C++ will always go into the node API directly and it will not be executed until it goes into the call stack.</p>
<blockquote>
<p>There are many more functions like setTimeout in C++. You may explore it on the Internet.</p>
</blockquote>
<p>So the setTimeout 1st function goes into the Node API first and the set timeout 2 function goes into the Node API 2nd.</p>
<p>Then the last console.log will go into the call stack and the call stack will execute it and print the output. Now the output is one and Two. After the execution of the last console, every function present in the Call stack will come out from the Call stack including the main And the Call stack is now empty.</p>
<p>When the call stack is empty, the functions that are present in the Node API will go into the Callback Queue one by one.</p>
<p>The functions that have a lower priority will go first into the callback queue. When multiple functions are present in the node API, every function will go one by one into the Callback Queue And then into the Call Stack.</p>
<p>Every function that is present in the Callback Queue will only go into the Call stack when the Call stack is empty. If the Call stack is not empty, the functions will not go into the call stack from the Callback Queue.</p>
<p>After going into the Call stack the Call stack executes the functions one by one and prints the output on the console. And that's why the output is like,</p>
<pre><code class="lang-plaintext">one
Two
Settimeout 2
Settimeout 1
</code></pre>
<p>This is how the node works internally and the combination of the call stack, Node API, and the Callback Queue is known as an Event Loop.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693067917460/b50c2db8-79dd-4fbb-9ac6-1b3501e9b586.gif" alt class="image--center mx-auto" /></p>
<h1 id="heading-nodejs-architecture">NodeJs Architecture</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693068019741/4eb3af0f-ebed-44f8-89e7-270063c914d8.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-features-of-event-loop">Features of Event Loop</h1>
<ol>
<li><p>An event loop is an endless loop, that waits for tasks, executes them, and then sleeps until it receives more tasks.</p>
</li>
<li><p>The event loop executes tasks from the event queue only when the call stack is empty i.e. there is no ongoing task.</p>
</li>
<li><p>The event loop allows us to use callbacks and promises.</p>
</li>
<li><p>The event loop executes the tasks starting from the oldest first.</p>
</li>
</ol>
<h1 id="heading-the-myth-and-facts-of-nodejs">The Myth and Facts of NodeJs</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1693068547330/dfa05a64-9d23-4549-a1fb-d313b1636d0b.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>The event loop <strong>allows Node.</strong> <strong>js to perform non-blocking I/O operations even though JavaScript is single-threaded</strong>.</p>
<p>Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background. When one of these operations completes, the kernel tells Node.js so that the appropriate callback may be added to the <strong>poll</strong> queue to eventually be executed.</p>
<p>Now you should understand why the two-second time delay function does not block the rest of the program from executing...</p>
<p><strong>So, I end my conversation here but if anybody wants to connect with me then the links are below...</strong></p>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119">Twitter or X</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119">GitHub</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[A Journey of Growth: Reflections on My Internship Experience]]></title><description><![CDATA[Internships are of utmost importance in an engineering student's life as they provide practical experience, skill development, and networking…]]></description><link>https://parmesh-bhatt.hashnode.dev/journey-of-growth-reflections-on-my-internship-experience</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/journey-of-growth-reflections-on-my-internship-experience</guid><category><![CDATA[internships]]></category><category><![CDATA[opensource]]></category><category><![CDATA[AWS]]></category><category><![CDATA[Devops]]></category><category><![CDATA[CommunityWork]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Wed, 02 Aug 2023 17:14:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1690975537976/05c91272-5d46-426d-a886-6f2a997dfcbb.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-from-intern-to-professional-a-story-of-challenges-and-triumphs"><strong>From Intern to Professional: A Story of Challenges and Triumphs</strong></h3>
<h2 id="heading-an-internship-is-a-chance-to-dive-into-the-ocean-of-possibilities-discovering-the-pearls-of-wisdom-along-the-way">"An internship is a chance to dive into the ocean of possibilities, discovering the pearls of wisdom along the way."</h2>
<h1 id="heading-significance-of-an-internship-in-the-student-life"><strong>Significance of an internship in the student life</strong></h1>
<p>Internships are of utmost importance in an engineering student's life as they provide practical experience, skill development, and networking opportunities. Through internships, students gain hands-on exposure to real-world engineering projects, enhancing their technical and soft skills. Additionally, they get insights into various industries and career paths, while also building valuable connections with professionals that can benefit their future careers. Internships bolster resumes, boost confidence, and act as a pathway to potential job opportunities. Moreover, students stay abreast of industry advancements, making them well-prepared for the transition from academia to the professional world.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690988403706/e3a13ce8-7faa-4923-85d0-1773ae7604f2.png" alt class="image--center mx-auto" /></p>
<p><strong>Howdy👋, y'all! I am Parmesh Bhatt🙏. I just completed my first 2-month internship as an AWS and web developer intern.</strong></p>
<p><strong>I had the amazing opportunity to be the FIRST intern ever on the AWS tools + I worked specifically work with the cloud team, as a AWS and web development intern.</strong></p>
<h2 id="heading-a-little-bit-about-me">A little bit about me...</h2>
<p>I am Parmesh Bhatt. I am currently pursuing my B. Tech from Charusat University with an interest in learning Web Development, Cloud Computing, and DevOps. I am currently in 3rd year and I am from Navsari, Gujarat. I am a MERN stack developer and presently learning and exploring cloud computing and DevOps.</p>
<p>Now let me tell you about my first summer internship!</p>
<h1 id="heading-the-beginning-joining-the-team-as-an-intern"><strong>The Beginning: Joining the team as an intern...</strong></h1>
<p>In my college, every 4th-semester student must go to the company as an intern and learn new technical skills and gain experience in the industry. So at the start of May 2023, I got the official internship call from 2 or 3 well-known companies and I accept that. And I am started working with the cloud team as an intern. The company offered me a hybrid model. This means that If I want to come to the office then I can also do that or else I can also work from home<strong>.</strong> And I choose to start working from home because since October 2021, I stayed in a hostel and my home is far away from my college. So, I am not able to spend that much time with my family for the last one and a half years.</p>
<h1 id="heading-learning-and-contribution-tasks-challenges-and-growth"><strong>Learning and Contribution: Tasks, Challenges, and Growth</strong></h1>
<ul>
<li><h3 id="heading-the-first-week-challenge-and-learning"><strong>The First Week - Challenge and Learning</strong></h3>
</li>
</ul>
<p>In the first week of the internship, The HR of my team introduced me to the team. And then started learning about MERN stack development and how the team works on a large project. I learn about PHP development, learn about WordPress. I learn how WordPress makes the life of a developer very easy.</p>
<p>Then I made some projects using PHP and know PHP works as a synchronous programming language which means If in the large code base, one line takes too much time to execute then PHP will not go to the next line like JavaScript. And I faced this issue when I was working on the project. Then the team suggests I start learning and making projects on React using Bootstrap.</p>
<p>Then I came to know about this👇,</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690990928759/b6d8b6f1-5553-4262-a9aa-c97dce450e4d.jpeg" alt class="image--center mx-auto" /></p>
<ul>
<li><h3 id="heading-learning-react-and-bootstrap"><strong>Learning React and Bootstrap</strong></h3>
</li>
</ul>
<p>After facing a large issue in the project because of language, I understand that being a developer is not an easy task because before this I thought that the best life of an engineer was to be just a developer.</p>
<p>Then I started learning about the Bootstrap. But in between the company told me that I have also worked with the cloud team. So, that I can learn the maximum from this internship.</p>
<p>So, After completing the 10 days of internship, I started learning about different AWS services and the basics of cloud computing, How virtualization works, and other things. But now I want to learn the MERN stack.</p>
<p>During the daytime when my official internship hours were going, I learn about AWS services and contributed to the cloud team. And in the night, I learned about the world of React and Bootstrap.</p>
<ul>
<li><h3 id="heading-world-of-react-and-bootstrap"><strong>World of React and Bootstrap</strong></h3>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690993112848/8fbd664f-5283-4527-a015-8e3c2683edb2.jpeg" alt class="image--center mx-auto" /></p>
<p>I learn about React and Bootstrap in my summer internship was going. In React, I learned about the difference between stateless and stateful components. I learned about React is the most effective JS library to build the UI using Bootstrap.</p>
<p>I also learned about the component life cycle methods in React which is only supported in the class components of React. But in the functional component, there are hooks to handle the state. Also, we can handle the routing in React and there are many more things in React that one developer can do with Bootstrap.</p>
<p>Using Bootstrap, we can also include CSS in the responsive web design in the UI. Because Responsive Web Design is one of the toughest challenges for UI/UX designers.</p>
<ul>
<li><h3 id="heading-world-of-aws"><strong>World of AWS</strong></h3>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690993220318/6046c85c-e4e4-4a06-8c40-efad246d29a8.jpeg" alt class="image--center mx-auto" /></p>
<p>Cloud Computing is one of the most important parts of software development now in days. During the internship period, I learned about the various AWS services that are most important to know.</p>
<p>Starting with the EC2 instances which is the virtual machine that provides lots of benefits over the implementation of the actual machine. There is also the EC2 instances auto-scaling which automatically increase the number of EC2 instance when the number of users increases.</p>
<p>There are also many more computing services, database services, storage services, container services, security services, and many more services are there.</p>
<blockquote>
<h3 id="heading-i-have-also-written-one-blog-on-the-aws-marketplace-during-the-internship"><strong>I have also written one blog on the AWS marketplace during the internship.</strong></h3>
<h3 id="heading-insights-of-aws-marketplacehttpshashnodecompostclifs9c2k000s0akw86wid9au"><a target="_blank" href="https://hashnode.com/post/clifs9c2k000s0akw86wid9au"><strong>Insights of AWS Marketplace</strong></a></h3>
</blockquote>
<h1 id="heading-diverse-project-experiences-tech-stack-cross-team-collaboration-and-high-scale"><strong>Diverse Project Experiences: Tech Stack, Cross-Team Collaboration, and High-Scale</strong></h1>
<p>I learned about AWS, Cloud Computing, React, and Bootstrap during the internship. Also, I have built and worked on live projects in the internship.</p>
<p>I build the chat application, and many more projects during the internship.</p>
<h1 id="heading-exploring-beyond-tech-fun-games-and-quizzing"><strong>Exploring Beyond Tech: Fun, Games, and Quizzing</strong></h1>
<p>When I was working as an AWS and web developer intern, I remember that in the last week of May-2023, the company organized one event for freshers and interns.</p>
<p>At that event, I meet my whole Cloud and another team member. In that event, I learn one time, we all are freshers and don't hesitate to ask our seniors about problem or error that is coming in our code or life. And from that event, I came to know about the importance of networking and how networking is very important in the tech industry. From that event, I also came to know that👇</p>
<blockquote>
<h2 id="heading-the-best-way-to-get-started-is-just-to-get-started">"<strong>The best way to get started is just to get started."</strong></h2>
</blockquote>
<p>In that event, all teams participated in the game. Unfortunately, our team was not able to win the game but I enjoyed the whole 2-hours event and also network myself at a very high level.</p>
<p>One thing that I also came to know about from my communities and internship is that👇</p>
<blockquote>
<h2 id="heading-dont-wait-for-the-change">"<strong>DON'T WAIT FOR THE CHANGE,</strong></h2>
<h2 id="heading-lets-b-the-change"><strong>LET'S B THE CHANGE..."😉</strong></h2>
</blockquote>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1690995855868/63432a1e-8e34-475f-9381-5987c5130e80.jpeg" alt class="image--center mx-auto" /></p>
<h1 id="heading-an-enriching-journey-accelerated-learning-and-gratitude"><strong>An Enriching Journey: Accelerated Learning and Gratitude</strong></h1>
<p>Overall, the internship journey was amazing and lots of new things learn from my seniors as well as my community juniors. I missed those days right now in the hostel life.</p>
<p>I came to know about React, Bootstrap, and the importance of Networking yourself. And also came to know about having a family and being with the family.</p>
<p>From my internship experience, I would like to advise my junior and not especially to juniors, It is for everyone that If you want to learn something from the tech industry. So, only you need to do is <em>"Be patient, and just be in the tech, be with the tech..."</em> and you will automatically learn about it.</p>
<p>So, I end up my conversation here but if anybody wants to connect with me then the links are below...</p>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/"><strong>LinkedIn</strong></a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119"><strong>Twitter</strong></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119"><strong>GitHub</strong></a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Harnessing the Power of Command Line: CMD Commands Explained]]></title><description><![CDATA[CLI-CMD]]></description><link>https://parmesh-bhatt.hashnode.dev/harnessing-the-power-of-command-line-cmd-commands-explained</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/harnessing-the-power-of-command-line-cmd-commands-explained</guid><category><![CDATA[cmd]]></category><category><![CDATA[Linux]]></category><category><![CDATA[Devops]]></category><category><![CDATA[shell scripting]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Tue, 27 Jun 2023 18:17:40 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1687874911027/ce6763d2-7b41-46c3-b773-619b22ff6ae7.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-cmd-cli"><strong><em>CMD-CLI</em></strong></h2>
<p>CMD's full form is <code>Command Prompt</code>.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1687888591555/b36f73a6-f1b6-4b27-9c8d-6bafdd9596ed.jpeg" alt class="image--center mx-auto" /></p>
<p>Command Prompt, also known as cmd.exe or cmd, is the default command-line interpreter for the OS/2, eComStation, ArcaOS, Microsoft Windows, and ReactOS operating systems. On Windows CE .NET 4.2, Windows CE 5.0, and Windows Embedded CE 6.0 it is referred to as the Command Processor Shell.</p>
<p>It provides a text-based interface for users to interact with the operating system through a series of commands. Command-line interfaces are also called command-line user interfaces, console user interfaces and character user interfaces.</p>
<p>CMD allows users to execute various commands to perform tasks such as managing files and directories, configuring system settings, running programs, and troubleshooting network issues, among other things. It operates based on a specific syntax, where commands are entered in the format of <code>command [options] [arguments]</code>.</p>
<h2 id="heading-developer"><strong><em>Developer</em></strong></h2>
<p>Microsoft Corporation and IBM.</p>
<h2 id="heading-programming-language"><strong><em>Programming Language</em></strong></h2>
<p>C++</p>
<p>Command Prompt Interface<em>,</em></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1687888510133/28b685f1-93bb-4350-af3d-768e72ffdeca.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-cmd-features"><strong><em>CMD features</em></strong></h2>
<ol>
<li><p><strong>Command History</strong></p>
</li>
<li><p><strong>Command Completion</strong></p>
</li>
<li><p><strong>Command Line Editing</strong></p>
</li>
<li><p><strong>List of Commands</strong></p>
</li>
<li><p><strong>Complete Command Syntax</strong></p>
</li>
<li><p><strong>Escape Key</strong></p>
</li>
</ol>
<blockquote>
<p>Typing a command and pressing <strong>ESC</strong> key clears the current line of text and returns to TL1 Prompt</p>
</blockquote>
<h2 id="heading-here-are-the-commands-for-cmd-cli"><strong><em>Here are the commands for CMD-CLI</em></strong></h2>
<h3 id="heading-to-make-a-new-file">-To make a new File</h3>
<pre><code class="lang-bash">MKDIR File_Name
</code></pre>
<h3 id="heading-to-make-a-new-file-with-some-text">-To make a new File with some text</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">echo</span> sentence &gt; File_Name
</code></pre>
<h3 id="heading-to-make-a-new-file-without-any-text">-To make a new File without any text</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">type</span> nul &gt; File_Name
</code></pre>
<h3 id="heading-to-delete-the-folder-that-contains-nothing">-To delete the folder that contains nothing</h3>
<pre><code class="lang-bash">RMDIR File_Name
</code></pre>
<h3 id="heading-to-delete-any-file">-To delete any File</h3>
<pre><code class="lang-bash">del File_Name
</code></pre>
<h3 id="heading-to-see-the-content-of-the-directory">-To see the content of the directory</h3>
<pre><code class="lang-bash">dir
</code></pre>
<h3 id="heading-to-copy-the-file">-To copy the File</h3>
<pre><code class="lang-bash">copy
</code></pre>
<h3 id="heading-to-move-the-file">-To move the File</h3>
<pre><code class="lang-bash">move
</code></pre>
<h3 id="heading-rename-the-file-to-newfilename-from-oldfilename">-Rename the file to new_File_Name from Old_File_Name</h3>
<pre><code class="lang-bash">ren Old_File_Name New_File_Name
</code></pre>
<h3 id="heading-to-see-the-ip-configuration">-To see the IP configuration</h3>
<pre><code class="lang-bash">ipconfig
</code></pre>
<h3 id="heading-to-go-to-the-previous-directory">-To go to the previous directory</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span>..
</code></pre>
<h3 id="heading-to-go-into-the-parent-directory">-To go into the parent directory</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span>\
</code></pre>
<h3 id="heading-to-go-to-a-particular-directory">-To go to a particular directory</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> directory_name
</code></pre>
<h3 id="heading-to-see-the-currently-running-services-that-are-open-in-the-background-on-our-pc-with-a-exe-extension">-To see the currently running services that are open in the background on our pc with a .exe extension</h3>
<pre><code class="lang-bash">tasklist
</code></pre>
<h3 id="heading-to-stop-a-particular-running-service">-To stop a particular running service</h3>
<pre><code class="lang-bash">tasklist /PID PID-ID
</code></pre>
<blockquote>
<p>Note: PID-ID=relace with particular service's PID in our pc</p>
</blockquote>
<h3 id="heading-to-show-the-running-application-behind-in-os">-To show the running application behind in OS</h3>
<pre><code class="lang-bash">net start
</code></pre>
<h3 id="heading-to-stop-the-service-that-is-running">-To stop the service that is running</h3>
<pre><code class="lang-bash">net stop service_name
</code></pre>
<h3 id="heading-to-start-the-service-that-is-stopped">-To start the service that is stopped</h3>
<pre><code class="lang-bash">net start service_name
</code></pre>
<h3 id="heading-to-show-the-installed-driver-queries-in-our-pc-with-their-properties">-To show the installed driver queries in our pc with their properties</h3>
<pre><code class="lang-bash">driverquery
</code></pre>
<h3 id="heading-to-clear-the-screen">-To clear the screen</h3>
<pre><code class="lang-bash">cls
</code></pre>
<h3 id="heading-to-see-the-version-of-the-pc">-To see the version of the pc</h3>
<pre><code class="lang-bash">ver
</code></pre>
<h3 id="heading-to-see-the-details-of-our-device-disks">-To see the details of our device disks</h3>
<pre><code class="lang-bash">diskpart
</code></pre>
<h3 id="heading-to-see-the-list-of-the-disk-in-our-pc">-To see the list of the disk in our pc</h3>
<blockquote>
<p>In diskpart type the bellow command</p>
</blockquote>
<pre><code class="lang-bash">list disk
</code></pre>
<h3 id="heading-to-select-the-disk-that-number-from-1-to-5">-To select the disk that number from 1 to 5</h3>
<pre><code class="lang-bash">select disk disk_number
</code></pre>
<h3 id="heading-to-see-the-information-about-the-selected-disk">-To see the information about the selected disk</h3>
<pre><code class="lang-bash">details disk
</code></pre>
<h3 id="heading-to-check-the-status-of-the-selected-disk">-To check the status of the selected disk</h3>
<pre><code class="lang-bash">chkdsk
</code></pre>
<h3 id="heading-give-the-mac-address-of-our-device">-Give the Mac address of our device</h3>
<pre><code class="lang-bash">getmac
</code></pre>
<h3 id="heading-give-the-all-information-about-our-system">-Give the all information about our system</h3>
<pre><code class="lang-bash">systeminfo
</code></pre>
<h3 id="heading-give-all-the-account-information-or-list-that-are-running-on-our-pc">-Give all the account information or list that are running on our pc</h3>
<pre><code class="lang-bash">net user
</code></pre>
<h3 id="heading-to-add-the-account-to-our-system">-To add the account to our system</h3>
<pre><code class="lang-bash">net user useraccount_name /add password
</code></pre>
<h3 id="heading-to-delete-the-account-in-our-system">-To delete the account in our system</h3>
<pre><code class="lang-bash">net user /del useraccount_name
</code></pre>
<h3 id="heading-to-active-the-administrator-account">-To active the administrator account</h3>
<pre><code class="lang-bash">net user administrator _/active:yes
</code></pre>
<h3 id="heading-to-not-active-the-administrator-account">-To not active the administrator account</h3>
<pre><code class="lang-bash">net user administrator _/active:no
</code></pre>
<h3 id="heading-to-hide-all-files">-To hide all files</h3>
<pre><code class="lang-bash">attrib +h +r +s
</code></pre>
<h3 id="heading-to-unhide-the-all-hide-files">-To unhide the all hide files</h3>
<pre><code class="lang-bash">attrib -h -r -s
</code></pre>
<h3 id="heading-to-encrypt-the-files">-To encrypt the files</h3>
<pre><code class="lang-bash">cipher /e
</code></pre>
<h3 id="heading-to-decrypt-the-encrypted-files">-To decrypt the encrypted files</h3>
<pre><code class="lang-bash">cipher /d
</code></pre>
<h3 id="heading-updating-the-efs-key-from-files-in-folders">-Updating the EFS key from files in folders</h3>
<pre><code class="lang-bash">cipher /rekey
</code></pre>
<h3 id="heading-display-date">-Display date</h3>
<pre><code class="lang-bash">date
</code></pre>
<h3 id="heading-display-time">-Display time</h3>
<pre><code class="lang-bash">time
</code></pre>
<h3 id="heading-show-the-subfolder-details-in-tree-format">-Show the subfolder details in tree format</h3>
<pre><code class="lang-bash">tree
</code></pre>
<h3 id="heading-give-all-the-information-about-the-network">-Give all the information about the network</h3>
<pre><code class="lang-bash">inconfig /all
</code></pre>
<h3 id="heading-the-windows-management-instrumentation-command-line-is-a-software-utility-that-allows-users-to-perform-windows-management-instrumentationwmi-operations-with-a-command-prompt">-The Windows Management Instrumentation Command-line is a software utility that allows users to perform Windows Management Instrumentation(WMI) operations with a Command Prompt.</h3>
<pre><code class="lang-bash">wmic
</code></pre>
<blockquote>
<p>What is WMI in Windows?</p>
<ul>
<li>WMI is the infrastructure for the management of data and operations on Windows-based OS.</li>
</ul>
</blockquote>
<h3 id="heading-get-the-product-details">-Get the product details</h3>
<pre><code class="lang-bash">/output:c:\destination_File_Name product get name,version
</code></pre>
<blockquote>
<p>In wmic type this command</p>
</blockquote>
<h3 id="heading-when-we-are-in-wmic-write-cpu-and-this-will-show-the-cpu-and-processor-details">-When we are in wmic write cpu and this will show the CPU and processor details</h3>
<pre><code class="lang-bash">CPU
</code></pre>
<h3 id="heading-exit-from-it">-Exit from it.</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">exit</span>
</code></pre>
<h3 id="heading-give-the-file-extension">-Give the file extension</h3>
<pre><code class="lang-bash">assoc.File_extension
</code></pre>
<h3 id="heading-generate-a-file-with-information-on-tasks-that-are-going-on-in-the-background">-Generate a file with information on tasks that are going on in the background</h3>
<pre><code class="lang-bash">tasklist &gt; file_name
</code></pre>
<h3 id="heading-create-the-file-with-some-text">-Create the file with some text</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">echo</span> text(That you want to put <span class="hljs-keyword">in</span> file) &gt; File_Name
</code></pre>
<details><summary>text(That you want to put in file)</summary><div data-type="detailsContent">Replace with the text that you want to be in the file</div></details>

<h3 id="heading-to-see-the-content-of-the-file">-To see the content of the file</h3>
<pre><code class="lang-bash"><span class="hljs-built_in">type</span> File_Name
</code></pre>
<h3 id="heading-it-will-open-the-file">-It will open the file</h3>
<pre><code class="lang-bash">File_Name
</code></pre>
<h3 id="heading-create-the-primary-partition-of-the-disk">-Create the primary partition of the disk</h3>
<pre><code class="lang-bash">create primary partition
</code></pre>
<h3 id="heading-it-will-select-the-partition-number-from-the-selected-disk">-It will select the partition number from the selected disk</h3>
<pre><code class="lang-bash">select primary partition_number
</code></pre>
<h3 id="heading-format-the-disk-that-you-selected">-Format the disk that you selected</h3>
<pre><code class="lang-bash">format fs = ntfs quick
</code></pre>
<h3 id="heading-active-the-specific-disk">-Active the specific disk</h3>
<pre><code class="lang-bash">active
</code></pre>
<h3 id="heading-assign-the-partition">-Assign the partition</h3>
<pre><code class="lang-bash">assign
</code></pre>
<h3 id="heading-a-new-name-for-the-disk-that-you-selected">-A new name for the disk that you selected</h3>
<pre><code class="lang-bash">label disk_name
</code></pre>
<h3 id="heading-show-the-executed-command-history">-Show the executed command history</h3>
<pre><code class="lang-bash">doskey/<span class="hljs-built_in">history</span>
</code></pre>
<h3 id="heading-shutdown-the-pc-immediately">-Shutdown the pc immediately</h3>
<pre><code class="lang-bash">shutdown -s
</code></pre>
<h3 id="heading-after-how-many-times-do-you-want-to-shut-downtimes-the-pc">-After how many times do you want to shut downtimes the pc</h3>
<pre><code class="lang-bash">shutdown -s -t time_after_shutdown
</code></pre>
<h3 id="heading-restart-the-pc">-Restart the pc</h3>
<pre><code class="lang-bash">shutdown -r
</code></pre>
<h3 id="heading-after-how-many-times-you-want-to-restart-the-pc">-After how many times you want to restart the pc</h3>
<pre><code class="lang-bash">shutdown -r -t time_after_shutdown
</code></pre>
<h3 id="heading-check-the-ntfsnew-technology-file-system-status">-Check the NTFS(new technology file system) status</h3>
<pre><code class="lang-bash">chkntfs disk_name
</code></pre>
<h3 id="heading-it-will-open-the-control-panel">-It will open the control panel</h3>
<pre><code class="lang-bash">control
</code></pre>
<h3 id="heading-show-all-the-tasks-that-are-scheduled-in-os">-Show all the tasks that are scheduled in OS.</h3>
<pre><code class="lang-bash">schtasks
</code></pre>
<h3 id="heading-it-will-generate-the-file-and-put-all-the-information-in-it">-It will generate the file and put all the information in it.</h3>
<pre><code class="lang-bash">schtasks &gt; file_name
</code></pre>
<h3 id="heading-show-the-shared-files-through-the-network-and-how-many-people-are-using-it">-Show the shared files through the network and how many people are using it.</h3>
<pre><code class="lang-bash">openfiles
</code></pre>
<h3 id="heading-generate-the-file-with-config-data">-Generate the file with config data</h3>
<pre><code class="lang-bash">ipconfig &gt; file_name
</code></pre>
<h3 id="heading-refresh-the-ip-address-or-resolve-the-ip-conflict">-Refresh the IP address or resolve the IP conflict</h3>
<pre><code class="lang-bash">ipconfig /renew
</code></pre>
<h3 id="heading-display-the-content-of-the-domain-name-systemdns">-Display the content of the domain name system(DNS)</h3>
<pre><code class="lang-bash">ipconfig /displaydns
</code></pre>
<h3 id="heading-it-will-flush-the-dns-cache-and-refresh-it">-It will flush the DNS cache and refresh it</h3>
<pre><code class="lang-bash">ipconfig /flushdns
</code></pre>
<h3 id="heading-show-or-ping-the-pc-with-another-pc">-Show or ping the pc with another pc</h3>
<pre><code class="lang-bash">ping ip_address
</code></pre>
<h3 id="heading-show-all-the-options-that-we-can-use-with-ping">-Show all the options that we can use with ping</h3>
<pre><code class="lang-bash">ping -?
</code></pre>
<h3 id="heading-send-the-packets-to-the-destination-pc-again-and-again">-Send the packets to the destination pc again and again</h3>
<pre><code class="lang-bash">ping -t ip_address
</code></pre>
<h3 id="heading-saw-pc-name-with-other-details">-Saw pc name with other details</h3>
<pre><code class="lang-bash">ping -a ip_address
</code></pre>
<h3 id="heading-only-send-the-number-of-packets-to-the-destination-pc">-Only send the number of packets to the destination pc</h3>
<pre><code class="lang-bash">ping -n count ip_address
</code></pre>
<h2 id="heading-why-we-should-use-cmd-in-windows-instead-of-gui"><strong><em>Why we should use cmd in Windows instead of GUI?</em></strong></h2>
<h3 id="heading-using-the-command-line-interface-cli-or-command-prompt-cmd-in-windows-instead-of-the-graphical-user-interface-gui-offers-several-advantages">Using the command-line interface (CLI) or Command Prompt (CMD) in Windows instead of the graphical user interface (GUI) offers several advantages:</h3>
<ul>
<li><p>Automation and scripting: CLI allows you to automate repetitive tasks by writing scripts. With commands and batch files, you can create powerful automation workflows, saving time and effort. This is particularly useful for system administrators and developers.</p>
</li>
<li><p>Efficiency: For certain tasks, using the CLI can be faster and more efficient than navigating through multiple GUI menus. Command-line tools often provide concise and direct ways to perform specific tasks without the need to search for options within a graphical interface.</p>
</li>
<li><p>Remote management: When managing remote computers or servers, the CLI becomes essential as it allows you to connect and control them via remote terminal sessions or SSH. This is particularly valuable for system administrators who need to manage multiple machines or work on headless systems.</p>
</li>
<li><p>Resource consumption: GUI applications tend to consume more system resources (CPU and memory) compared to their command-line counterparts. By using the CLI, you can free up system resources and allocate them to other important tasks.</p>
</li>
<li><p>Troubleshooting and diagnostics: When encountering issues or errors, CLI tools often provide more detailed error messages and logs than GUI applications. This additional information can be valuable for troubleshooting and diagnosing problems.</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1687889694292/0e697cf3-fa70-469e-943f-c69c73c4b270.jpeg" alt class="image--center mx-auto" /></p>
<blockquote>
<p>While the CLI offers numerous advantages, it's important to note that GUI interfaces are generally more user-friendly, especially for casual users or those who prefer visual interaction. The choice between CLI and GUI depends on the specific task, user expertise, and personal preference.</p>
</blockquote>
<h2 id="heading-references"><strong><em>References</em></strong></h2>
<p><a target="_blank" href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd">Microsoft Official - CMD</a></p>
<p><a target="_blank" href="https://github.com/Parmesh119/CMD-CLI">My GitHub repository of CMD commands</a></p>
<h3 id="heading-if-you-want-to-follow-me">If you want to follow me,</h3>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/">LinkedIn</a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119">Twitter</a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119">GitHub</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Insights of the AWS Marketplace]]></title><description><![CDATA[AWS Marketplace]]></description><link>https://parmesh-bhatt.hashnode.dev/insights-of-the-aws-marketplace</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/insights-of-the-aws-marketplace</guid><category><![CDATA[AWS]]></category><category><![CDATA[Cloud Computing]]></category><category><![CDATA[marketplace]]></category><category><![CDATA[aws-services]]></category><category><![CDATA[Cloud]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Sat, 03 Jun 2023 09:19:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1685779804376/19c49667-dad1-409d-9b7b-367037d275d6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-about"><em>About</em></h2>
<p><a target="_blank" href="https://aws.amazon.com/marketplace">AWS Marketplace</a> is an online store provided by <a target="_blank" href="https://aws.amazon.com/free/?trk=14a4002d-4936-4343-8211-b5a150ca592b&amp;sc_channel=ps&amp;ef_id=CjwKCAjwyeujBhA5EiwA5WD7_eQnabH5WZfHLawzYRNe1bfBzXvmBC7W6GIedtx871L7ygBxiNiGLxoCnLEQAvD_BwE:G:s&amp;s_kwcid=AL!4422!3!453325184782!e!!g!!aws!10712784856!111477279771&amp;all-free-tier.sort-by=item.additionalFields.SortRank&amp;all-free-tier.sort-order=asc&amp;awsf.Free%20Tier%20Types=*all&amp;awsf.Free%20Tier%20Categories=*all">Amazon Web Services (AWS)</a> that enables customers to find, purchase, and deploy a wide variety of software products and services. It is a platform where third-party software vendors can list and sell their products to AWS customers.</p>
<p>You can use AWS  Marketplace as a buyer (subscriber) a seller (provider), or both. Anyone with an AWS  account can use AWS Marketplace as a consumer and can register to become a seller. A seller can be an independent software vendor (ISV), value-added reseller, or individual with something that works with AWS products and services.</p>
<h2 id="heading-keywords"><strong><em>Keywords</em></strong></h2>
<p>AWS, AWS Marketplace, Cloud Computing, Software Production, and Development.</p>
<h2 id="heading-introduction"><strong><em>Introduction</em></strong></h2>
<p>You can quickly launch pre-configured software with just a few clicks, and choose software solutions in Amazon Machine Images (AMIs) and software as a service (SaaS) formats and other formats. Additionally, you can browse and subscribe to data products. Flexible pricing options include free trial, hourly, monthly, annual, multi-year, and a Bring  Your License (BYOL) model. All of these pricing options are billed from one source. AWS handles billing and payments, and charges appear on your AWS bill.</p>
<h2 id="heading-features-of-aws-marketplace"><strong><em>Features of AWS Marketplace</em></strong></h2>
<h3 id="heading-wide-range-of-software">Wide Range of Software</h3>
<p>AWS Marketplace provides a vast selection of software products and services across various categories, including machine learning, security, databases, networking, analytics, developer tools, and more. Customers can find solutions that meet their specific business and technical requirements.</p>
<h3 id="heading-one-stop-shop">One-Stop Shop</h3>
<p>AWS Marketplace serves as a centralized store where customers can discover, compare, and purchase software products directly from AWS. It eliminates the need to visit multiple websites or engage in separate procurement processes.</p>
<h3 id="heading-pre-configured-for-aws">Pre-Configured for AWS</h3>
<p>The software products listed on AWS Marketplace are pre-configured to work seamlessly with AWS infrastructure and services. This makes it easier for customers to deploy and integrate the software into their existing AWS environments.</p>
<h3 id="heading-flexible-pricing-models">Flexible Pricing Models</h3>
<p>AWS Marketplace supports various pricing models, including free trials, hourly or monthly usage-based pricing, and annual subscriptions. Customers can choose the pricing model that best suits their needs and pay for software usage directly through their AWS account.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685780511173/b4c343fe-b887-483d-9d8c-d5f05b8aa372.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-customer-reviews-and-ratings">Customer Reviews and Ratings</h3>
<p>Customers can benefit from the ratings and reviews provided by other users of the software products on AWS Marketplace. These reviews help customers make informed decisions and gain insights into the quality and performance of the products.</p>
<h3 id="heading-private-marketplace">Private Marketplace</h3>
<p>AWS Marketplace offers private marketplace capabilities for enterprise customers. This feature enables organizations to create a customized catalog of approved software products that meet their specific compliance and security requirements. It gives organizations greater control over software procurement and deployment within their environments.</p>
<h3 id="heading-consolidated-billing">Consolidated Billing</h3>
<p>AWS Marketplace supports consolidated billing, allowing customers to receive a single invoice for all their AWS usage, including purchases made through the marketplace. This simplifies the billing process and provides a unified view of costs.</p>
<p>This is how AWS billing is counted...</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685780928040/00550469-ea44-4822-90cd-65da2e3f703e.png" alt class="image--center mx-auto" /></p>
<p>These features make AWS Marketplace a valuable platform for customers to discover, procure, and deploy software products that are optimized for the AWS ecosystem. It simplifies the software procurement process and provides customers with a wide range of options to meet their business needs.</p>
<h2 id="heading-marketplace-services-and-guides"><strong><em>Marketplace Services and Guides</em></strong></h2>
<p>There are mainly five types that are provided by the AWS marketplace.</p>
<p><code>Seller Guide</code></p>
<p><code>Buyer Guide</code></p>
<p><code>AWS Marketplace Metering Service API Reference</code></p>
<p><code>AWS Marketplace Entitlement Service API Reference</code></p>
<p><code>AWS Marketplace Catalog API Reference</code></p>
<h2 id="heading-seller-guide"><strong><em>Seller Guide</em></strong></h2>
<p>The process for selling a software product in AWS Marketplace involves the following seven steps.</p>
<h3 id="heading-table-1"><strong>TABLE 1</strong></h3>
<h3 id="heading-seller-process">SELLER PROCESS</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td>Step</td><td>Action</td><td>Description</td></tr>
</thead>
<tbody>
<tr>
<td>1</td><td>Register</td><td>As a seller, you start by registering for the AWS Marketplace Management Portal. We recommend that you implement a new dedicated AWS account that can be easily linked with an existing AWS organization.</td></tr>
<tr>
<td>2</td><td>Decide product type</td><td>Decide on the type of product that you want to sell.</td></tr>
<tr>
<td>3</td><td>Prepare Product</td><td>Configure your package, set a pricing scheme, determine the relevant categories in which to list your product, and add keywords so your product appears in relevant searches.</td></tr>
<tr>
<td>4</td><td>Submit Product</td><td>Use the product submission process to make your products available in AWS Market- place. Products can be simple, for example, a single Amazon Machine Image (AMI) that has one price structure</td></tr>
<tr>
<td>5</td><td>Market Product</td><td>Contribute to the success of your product by driving awareness of AWS Marketplace and by driving traffic directly to your product pages in AWS Marketplace.</td></tr>
<tr>
<td>6</td><td>View Reports and data feeds</td><td>After you’re registered as a seller, use the AWS Marketplace Management Portal to access usage reports for your products. AWS Marketplace provides tools for collecting and analyzing information about your product sales.</td></tr>
<tr>
<td>7</td><td>Manage Products</td><td>It has mainly three things. What is Build, Market, Sell?</td></tr>
</tbody>
</table>
</div><p>As a seller, go to the AWS  Marketplace Management Portal to register. If you’re charging for the use of your product, you must also provide tax and banking information as part of your registration. When you register, you create a profile for your company or yourself that is discoverable in AWS Marketplace. You also use the AWS Marketplace Management Portal to create and manage product pages for your products.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685781548039/a14926f9-974d-430f-9203-6fe044ad9200.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-contract-structure-for-aws-marketplace"><strong><em>Contract structure for AWS Marketplace</em></strong></h2>
<p>The contract structure for AWS Marketplace can vary depending on the specific agreements between AWS (Amazon Web Services) and the sellers offering their products and services on the marketplace. However, I can provide you with a general overview of the typical elements that are included in a contract for AWS Marketplace.</p>
<h3 id="heading-terms-and-conditions">Terms and Conditions</h3>
<p>The contract will include the terms and conditions that govern the relationship between AWS, the seller, and the customers who purchase products or services through the AWS Marketplace. This section will outline the rights and obligations of each party.</p>
<h3 id="heading-product-listing-agreement">Product Listing Agreement</h3>
<p>Sellers on the AWS Marketplace typically sign a separate product listing agreement, which outlines the specific terms and conditions related to listing their products or services on the marketplace. This agreement may include information about pricing, revenue sharing, and any specific requirements or guidelines for product listings.</p>
<h3 id="heading-pricing-and-payment">Pricing and Payment</h3>
<p>The contract will specify the pricing structure for the products or services offered on the AWS Marketplace. It may include details about the seller's pricing model, such as fixed pricing, usage-based pricing, or tiered pricing. Additionally, the contract may outline the payment terms, including how and when the seller will receive payments from AWS for sales made through the marketplace.</p>
<h3 id="heading-intellectual-property-rights">Intellectual Property Rights</h3>
<p>The contract will address the ownership and protection of intellectual property rights related to the products or services offered on the AWS Marketplace. It may include provisions regarding the licensing of intellectual property and any restrictions or permissions related to the use of trademarks, copyrights, or patents.</p>
<p>Usage of the software, services, and data products sold in AWS  Marketplace is governed by agreements between buyers and sellers. AWS is not a party to these agreements.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685781755232/a10d4305-ec2b-416d-bf66-edd9ce8c044b.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-pricing-of-products-in-the-aws-marketplace"><strong><em>Pricing of products in the AWS Marketplace</em></strong></h2>
<p>In AWS Marketplace, products can be free to use or can have associated charges. The charge becomes part of the buyer's AWS bill, and after the buyer pays, AWS pays the seller. Products can take many forms. For example, a product can be an Amazon Machine Image (AMI) that is instantiated using a buyer's AWS account. Products can also be configured to use CloudFormation templates for delivery to the buyer. Products can also be SaaS offerings from an ISV, web access control lists (web ACL), sets of rules, or conditions for AWS WAF. Products can also be professional services from an ISV, channel partners, or MSP.</p>
<h2 id="heading-buying-guide"><strong><em>Buying Guide</em></strong></h2>
<h3 id="heading-steps"><strong>Steps</strong></h3>
<p><code>Creating an AWS account</code></p>
<p><code>Choosing your software</code></p>
<p><code>Configuring your software</code></p>
<p><code>Launching your software on Amazon EC2</code></p>
<p><code>Managing your software</code></p>
<p><code>Terminating your instance</code></p>
<h2 id="heading-software-procurement-with-aws-marketplace"><strong><em>Software Procurement with AWS Marketplace</em></strong></h2>
<h3 id="heading-discover-software">Discover Software</h3>
<p>Visit the AWS Marketplace website (<a target="_blank" href="https://aws.amazon.com/marketplace">https://aws.amazon.com/marketplace</a>) and browse through the available software products. You can search for specific categories, keywords, or vendors to find the software that meets your requirements.</p>
<h3 id="heading-product-details">Product Details</h3>
<p>Each software listing provides detailed information about the product, including pricing, usage instructions, system requirements, and customer reviews. You can evaluate the product features, pricing models (such as hourly, monthly, or annual subscriptions), and user feedback to make an informed decision.</p>
<h3 id="heading-pricing-models">Pricing Models</h3>
<p>AWS Marketplace offers various pricing models depending on the software vendor's preferences. Some products may charge on an hourly basis, while others may require a monthly or annual subscription. The pricing information is mentioned on the product listing page.</p>
<h3 id="heading-free-trials">Free Trials</h3>
<p>Many software products on AWS Marketplace offer free trials, allowing you to test the software before making a purchase. Free trials enable you to evaluate the functionality, performance, and compatibility of the software with your AWS environment and many more.</p>
<h2 id="heading-cloud-cost-management-tools-with-aws-marketplace"><strong><em>Cloud Cost Management Tools with AWS Marketplace</em></strong></h2>
<p>AWS Marketplace offers a variety of cloud cost management tools that can help you optimize and manage your AWS spending. These tools provide visibility into your cloud costs, offer cost analysis and forecasting, and help you identify opportunities to save money. Here are a few popular cost management tools available on AWS Marketplace:</p>
<h3 id="heading-cloudhealth-by-vmware">CloudHealth by VMware</h3>
<p>CloudHealth provides comprehensive cost management and optimization capabilities. It offers cost visibility, budgeting, cost allocation, and reporting. You can analyze costs, track spending, and optimize resource utilization to reduce wastage and save money.</p>
<h3 id="heading-cloudcheckr">CloudCheckr</h3>
<p>CloudCheckr offers cost optimization, billing, and invoicing features. It provides detailed insights into AWS costs, identifies unused or idle resources, and recommends cost-saving measures. It also offers security and compliance monitoring capabilities.</p>
<h3 id="heading-apptio-cloud-ability">Apptio Cloud ability</h3>
<p>Cloud ability helps you track and analyze your AWS costs. It provides visibility into spending, budgeting, and forecasting. You can allocate costs to different teams or projects, set budget alerts, and optimize resource usage to control costs.</p>
<h3 id="heading-turbonomic">Turbonomic</h3>
<p>It is an AI-powered cloud optimization tool that helps you maximize resource utilization and minimize costs. It provides real-time recommendations for resource allocation, resizing, and rightsizing to ensure efficient resource utilization and cost savings.</p>
<h3 id="heading-aws-cost-explorer">AWS Cost Explorer</h3>
<p>While not available on AWS Marketplace, AWS Cost Explorer is a native AWS service that helps you analyze and visualize your AWS costs. It provides cost breakdowns, historical data, and forecasting capabilities. You can also create custom reports and set cost alerts.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685782581646/9270d292-1031-4b03-99e3-2902ccf66cf1.jpeg" alt class="image--center mx-auto" /></p>
<h2 id="heading-software-governance-and-entitlement-with-aws-marketplace"><strong><em>Software Governance and Entitlement with AWS Marketplace</em></strong></h2>
<p>AWS Marketplace provides features for software governance and entitlement to help organizations manage software usage, licenses, and entitlements effectively. These features allow you to maintain control over software procurement, distribution, and compliance within your AWS environment. Here are some key aspects of software governance and entitlement in AWS Marketplace:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685782823727/4b645c28-f5c5-4d49-a6c3-2ae2cccec6bb.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-private-marketplace-1">Private Marketplace</h3>
<p>AWS Marketplace offers a Private Marketplace, which enables you to create a customized catalog of approved software products for your organization. With Private Marketplace, you can curate a selection of software listings that meet your organization's policies, compliance requirements, and preferred vendors.</p>
<h3 id="heading-software-subscriptions-and-licenses">Software Subscriptions and Licenses</h3>
<p>When you purchase software through AWS Marketplace, you obtain a subscription or license to use the software. These subscriptions and licenses can have different terms and entitlements, such as the number of users, instances, or features available. It's important to review and understand the specific licensing terms for each software product you procure.</p>
<h3 id="heading-software-entitlements-and-usage-tracking">Software Entitlements and Usage Tracking</h3>
<p>AWS Marketplace provides tools to help you track and manage software entitlements within your AWS account. You can monitor the consumption and usage of software subscriptions and licenses to ensure compliance with vendor agreements. This can help you avoid any unauthorized usage or overages.</p>
<h3 id="heading-aws-marketplace-management-portal-amp">AWS Marketplace Management Portal (AMP)</h3>
<p>The AWS Marketplace Management Portal (AMP) is a web-based interface that provides visibility and control over your software subscriptions and licenses acquired through AWS Marketplace. AMP allows you to view, manage, and track your software entitlements, usage, and associated costs in a centralized manner.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685782935941/33309625-5648-4701-a841-3deb48d1d2c1.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-aws-marketplace-product-categories"><strong><em>AWS Marketplace Product categories</em></strong></h2>
<p>The AWS Marketplace website is organized into primary categories, with subcategories under each. You can search and filter based on the categories and subcategories.</p>
<h3 id="heading-topics"><strong>Topics</strong></h3>
<p><code>Infrastructure Software</code></p>
<p><code>DevOps</code></p>
<p><code>Business Applications</code></p>
<p><code>Machine Learning</code></p>
<p><code>IoT</code></p>
<p><code>Professional Services</code></p>
<p><code>Desktop applications</code></p>
<p><code>Data Products</code></p>
<p><code>Industries</code></p>
<h2 id="heading-product-type"><strong><em>Product Type</em></strong></h2>
<p>AWS Marketplace includes popular open-source and commercial software, as well as free and paid data products. These products are available in different ways: as individual Amazon Machine Images (AMIs), as a cluster of AMIs deployed through an AWS CloudFormation template, as software as a service (SaaS), as professional services, and as AWS Data Exchange data products. For more details about these product types, see the following topics:</p>
<p><code>AMI-based server products</code></p>
<p><code>Container Products</code></p>
<p><code>ML Products</code></p>
<p><code>Professional Service Products</code></p>
<p><code>SaaS Products</code></p>
<h2 id="heading-key-categories-and-several-registered-services-of-the-aws-marketplace"><strong><em>Key categories and several registered services of the AWS Marketplace</em></strong></h2>
<p><code>Infrastructure Software -3188</code></p>
<p><code>DevOps- 2543</code></p>
<p><code>Business Applications- 1131</code></p>
<p><code>Machine Learning -3541</code></p>
<p><code>Data Products -1706</code></p>
<p><code>IoT -211</code></p>
<p><code>Industry -433</code></p>
<p><code>Total ---7213</code></p>
<h2 id="heading-various-delivery-methods-are"><strong><em>Various delivery methods are</em></strong></h2>
<p><code>Amazon Machine Image(8324)</code></p>
<p><code>Professional Services(4553)</code></p>
<p><code>Data Exchange(3850)</code></p>
<p><code>SaaS(2843)</code></p>
<p><code>SageMaker Model(803)</code></p>
<p><code>Container Image(515)</code></p>
<p><code>CloudFormation Template(504)</code></p>
<p><code>SageMaker Algorithm(139)</code></p>
<p><code>Helm Chart(39)</code></p>
<h2 id="heading-conclusion"><strong><em>Conclusion</em></strong></h2>
<p>AWS Marketplace is a valuable platform for both buyers and sellers in the cloud computing industry. AWS Marketplace offers a wide range of software products and services, making it a convenient one-stop shop for businesses looking to find and deploy the tools they need in their AWS environment.</p>
<p>For buyers, AWS Marketplace provides a diverse selection of third-party software solutions, allowing them to easily discover, compare, and purchase the products that best suit their needs. The platform offers a user-friendly interface, transparent pricing, and flexible deployment options, enabling customers to quickly integrate new software into their existing AWS infrastructure. AWS Marketplace is a really useful product of AWS.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1685783761598/3cadd194-fa0c-4b7f-975d-dd1ed2a04551.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-references"><strong><em>References</em></strong></h2>
<p><a target="_blank" href="https://aws.amazon.com/marketplace">https://aws.amazon.com/marketplace</a></p>
<p><a target="_blank" href="https://aws.amazon.com/mp/marketplace-service/overview/">https://aws.amazon.com/mp/marketplace-service/overview/</a></p>
<p><a target="_blank" href="https://docs.aws.amazon.com/marketplace/index.html">https://docs.aws.amazon.com/marketplace/index.html</a></p>
<p><a target="_blank" href="https://docs.aws.amazon.com/marketplace/latest/userguide/what-is-marketplace.html">https://docs.aws.amazon.com/marketplace/latest/userguide/what-is-marketplace.html</a></p>
<p><a target="_blank" href="https://docs.aws.amazon.com/marketplace/latest/buyerguide/what-is-marketplace.html">https://docs.aws.amazon.com/marketplace/latest/buyerguide/what-is-marketplace.html</a></p>
<h2 id="heading-if-you-would-like-to-contact-me"><strong><em>If you would like to contact me,</em></strong></h2>
<ul>
<li><p><a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt/"><code>LinkedIn</code></a></p>
</li>
<li><p><a target="_blank" href="https://twitter.com/Parmesh_119"><code>Twitter</code></a></p>
</li>
<li><p><a target="_blank" href="https://github.com/Parmesh119"><code>GitHub</code></a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[CityTrack: A Comprehensive Urban Monitoring Solution]]></title><description><![CDATA[CiviConnect.com]]></description><link>https://parmesh-bhatt.hashnode.dev/citytrack-a-comprehensive-urban-monitoring-solution</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/citytrack-a-comprehensive-urban-monitoring-solution</guid><category><![CDATA[HTML5]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[React]]></category><category><![CDATA[PHP]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Tue, 25 Apr 2023 19:18:35 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682448663027/8e4be0e1-ebd0-4d01-9232-07b0254a9b2d.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction"><strong><em>Introduction</em></strong></h2>
<p>Here is everything you need to know about our project. The project consists of a website divided into two sections. The first section is designed for users and the general public who wish to report any instances of mismanagement by the government.</p>
<p>The second section is where the admin comes into play. The admin will have full access to view the complaints filed by users. They can delete or update the progress of users' requests. Our project is a small component of what the actual government site has already established. This was our initial step to provide the citizens with a better way to address their daily issues, in which the government also plays a role.</p>
<p>Here is our Indian government complaint management site from which we got the idea for our project.</p>
<p><a target="_blank" href="https://pgportal.gov.in/">Government Website</a></p>
<h2 id="heading-working"><strong><em>Working</em></strong></h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682449441317/d41e5d8e-c0c4-41ef-900a-e5daf41b5ca9.png" alt class="image--center mx-auto" /></p>
<p>Our project prompts users to provide details about their complaints, such as the main issue, any sub-issues, and, if possible, an image related to their concerns. This allows government officers to easily identify the problem and assist users in resolving the issue.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682449564475/8c744d24-22d0-4edb-93eb-fe0135ffab2e.png" alt class="image--center mx-auto" /></p>
<p>On the admin side, user details will be collected, and as soon as an officer processes the user's request, the user's profile will automatically be updated with the current progress of the request they have made. Furthermore, the admin can easily identify the issue, as we have currently limited requests to cities only.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682449657128/cc5f3dd0-9ff8-4312-9c23-34eb9fcdcf52.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-main-motive"><strong><em>Main motive</em></strong></h2>
<p>Our primary objective when we undertook this project was to simplify the lives of civilians and educate those who are disconnected from the digital world, often ending up going from one government office to another to address their everyday issues in their neighborhoods, communities, or homes. Additionally, working on such a project boosts our confidence, as it aids the government in reducing the problems faced by the very people who elected them.</p>
<h2 id="heading-future-improvements"><strong><em>Future improvements</em></strong></h2>
<p>Currently, our project is limited to cities, but we plan to expand its reach to cover every corner of the country, including towns and villages. In the future, we aim to acquire the necessary knowledge to make life easier for our country's people who face issues for which the government is responsible. Furthermore, with proper guidance and maintenance, this project will flourish in the coming years. We believe that this project will assist the government as we initially anticipated.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682449797221/72705122-2e3d-496a-8581-cd99a008f1ab.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-conclusion"><strong><em>Conclusion</em></strong></h2>
<p>This entire website is designed to save time and reduce stress for our country's people. Our goal is for the government to inspect and properly maintain public places in every region of India. By doing so, we can ensure a clean and well-maintained nation, proudly showcasing India as a strong and modern country to the rest of the world.</p>
<h2 id="heading-if-you-would-like-to-contact-me">If you would like to contact me,</h2>
<ul>
<li><p><code>LinkedIn</code></p>
</li>
<li><p><code>Twitter</code></p>
</li>
<li><p><code>GitHub</code></p>
</li>
<li><p><code>Portfolio</code></p>
</li>
<li><p><a target="_blank" href="https://linktr.ee/parmesh119"><code>Linktree</code></a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How does the Medical ChatBot work?]]></title><description><![CDATA[Our whole Chatbot is working using the domain ai and we created this because our plan is to digitalize in the medical field.]]></description><link>https://parmesh-bhatt.hashnode.dev/how-does-the-medical-chatbot-work</link><guid isPermaLink="true">https://parmesh-bhatt.hashnode.dev/how-does-the-medical-chatbot-work</guid><category><![CDATA[medical]]></category><category><![CDATA[chatbot]]></category><category><![CDATA[AI]]></category><dc:creator><![CDATA[Parmesh Bhatt]]></dc:creator><pubDate>Mon, 05 Dec 2022 05:47:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713164708/oGb97GB3i.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-chatbot"><strong><em>ChatBot:-</em></strong></h3>
<p>So, a chatbot is a software that stimulates or makes a human-like conversational environment. Let me tell you that everyone in their life has interacted with chatbots whether one knows or not. As an example let us say you are doing your work on a computer some research on it, and a window pops up that says if you need help. Or while you are going to a good restaurant and ask your google assistant or Siri about which hotel will suit you. So these are scenarios in which you are having an encounter with a chatbot.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713267480/yzXyclPEg.png" alt="First Blog-1.png" class="image--center mx-auto" /></p>
<h3 id="heading-medical-chatbot"><strong><em>Medical chatbot:-</em></strong></h3>
<p>So now since chatbots are going to make our future easy there are certain fields in which chatbots are very necessary to be in. Like in the business sector and medical sector. In the medical sector, healthcare chatbots have started to slowly flourish. Healthcare chatbots offer a more personalized approach to every user in more convenient ways that can surpass human capabilities.</p>
<p>All healthcare service providers are willing to give their time to their patients but the overwhelming load doesn't always let them provide their best service. In such cases or then the chatbots come into the scene. This 21st century is of course now a modern era and has a digital future so A 21st medical practice can now rely on chatbots to ensure 24/7 assistance, and availability, answer any repetitive questions or what else can a chatbot not do in this 21st century.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713414720/83J5jwtwa.png" alt="First Blog-2.png" class="image--center mx-auto" /></p>
<h3 id="heading-examples-of-chatbot"><strong><em>Examples of Chatbot:-</em></strong></h3>
<p>Since we have been talking about medical chatbots to slowly furnish here are some of them which already have gained their attention in today's market.</p>
<p><a target="_blank" href="https://keenethics.com/project-one-remission"><strong>1)OneRemission</strong></a></p>
<p><a target="_blank" href="https://www.babylonhealth.com/en-us"><strong>2)Babylon Health</strong></a></p>
<p><a target="_blank" href="https://www.livehealthily.com/"><strong>3)Healthily</strong></a></p>
<p><a target="_blank" href="https://sensely.com/"><strong>4)Sensely</strong></a></p>
<p><a target="_blank" href="https://www.youper.ai/"><strong>5)Youper</strong></a></p>
<h3 id="heading-how-do-i-come-to-know-about-chatbot"><em>How do I come to know about Chatbot?</em></h3>
<p>It always amazes me how new technology is introduced day by day. I was always fascinated with robots and their working functionality. I always wanted to know about AI and ML fields. So I decided the same come up with an Idea that excites me the most so here is the brief info about my Chatbot.</p>
<h3 id="heading-working"><strong><em>Working:-</em></strong></h3>
<p>Basically, this chatbot works the same as any other chatbot.</p>
<p><strong>1-&gt;Firstly the user inputs the query.</strong></p>
<p><strong>2-&gt;Then the user's query is analyzed.</strong></p>
<p><strong>3-&gt;In this step there is identifying the user's query intents and entities.</strong></p>
<p><strong>4-&gt;This is the last in which the bot responds giving the proper reply to the query.</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713810402/TG6mAzZm4.png" alt="First Blog-3.png" class="image--center mx-auto" /></p>
<h3 id="heading-flowchart"><strong><em>FlowChart:-</em></strong></h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713946022/dgNpZlE6b.png" alt="First Blog-4.png" class="image--center mx-auto" /></p>
<h3 id="heading-implementation-strategy"><strong><em>Implementation Strategy:-</em></strong></h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669713985469/wSUlVOx5x.png" alt="First Blog-5.png" class="image--center mx-auto" /></p>
<p>As you can see in the above figure the bot asks a series of questions and according to the given answers, input by the user the bot comes up with the best advice.</p>
<h3 id="heading-future-scope"><strong>Future Scope:-</strong></h3>
<p>In the upcoming future, as we all know AI is going to be in each and every corner of the world, so after the successful completion of this bot, this will ease lives and will be a great help to healthcare services as well as the people who might not be able to reach to the healthcare services.</p>
<p>In the future world, these chatbots will be a great help to everyone in the world. They will even be able to solve those queries even though the doctors might not be able to. I believe that even starting to point to minor things like appointments in hospitals to scheduling appointments of doctors till solving and curing diseases and in each and every sector of the field.</p>
<h3 id="heading-conclusion"><strong><em>Conclusion:-</em></strong></h3>
<p>This whole ChatBot we created to learn and our main motive is to digitalize the medical field because India is very behind in medical technologies. The big cities have that many kinds of facilities but small village people cannot able to go to big cities and afford the cost. With the use of these ChatBots, if they have small smartphones they can easily get the solution and get the answer from their home.</p>
<p>If you want to connect with me on <a target="_blank" href="https://www.linkedin.com/in/parmesh-bhatt-277971221/">Linkedin</a> or <a target="_blank" href="https://twitter.com/Parmesh_119">Twitter</a>.</p>
]]></content:encoded></item></channel></rss>