<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hari Krishnan</title>
    <description>The latest articles on DEV Community by Hari Krishnan (@hariraghupathy).</description>
    <link>https://dev.to/hariraghupathy</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F484455%2F514d96bf-3f72-486d-91b0-456825affa65.png</url>
      <title>DEV Community: Hari Krishnan</title>
      <link>https://dev.to/hariraghupathy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hariraghupathy"/>
    <language>en</language>
    <item>
      <title>FSD - 1.1.4 - Setting up Docker</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Sun, 05 Jan 2025 07:40:16 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/fsd-114-setting-up-docker-5ela</link>
      <guid>https://dev.to/hariraghupathy/fsd-114-setting-up-docker-5ela</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is Docker ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker is an open-source platform that allows developers to automate the deployment of applications within lightweight, portable containers. These containers bundle the application code with all its dependencies, libraries, and configurations, ensuring it runs consistently across various environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do we need Docker ?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Portability&lt;/strong&gt;: Docker containers run the same way on any system—whether it's your laptop, a testing server, or a production cloud instance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consistency&lt;/strong&gt;: Eliminates the "works on my machine" problem by ensuring uniform environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: Containers are lightweight and use fewer resources than traditional virtual machines.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rapid Deploymen&lt;/strong&gt;t: Docker simplifies and speeds up the deployment process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Isolation&lt;/strong&gt;: Each container is isolated, reducing conflicts between dependencies and improving security.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Using Docker for Development&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Set Up a Local Development Environment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem Without Docker:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need to install the right version of Node.js, databases (like MongoDB), or other tools manually.&lt;/li&gt;
&lt;li&gt;Different versions or setups can cause "it works on my computer but not on yours" issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Docker Helps:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You use Docker images (pre-configured setups) for Node.js and any other tools you need.&lt;/li&gt;
&lt;li&gt;Your team gets the same environment on their machines with just one file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Collaborate Easily with Your Team&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem Without Docker:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;One teammate might have Node.js 18, another has Node.js 16, and things break.&lt;/li&gt;
&lt;li&gt;Setting up tools for each new project takes time.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How Docker Helps:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Share the docker-compose.yml file with your team.&lt;/li&gt;
&lt;li&gt;Everyone runs docker-compose up and gets the exact same environment, regardless of their computer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why this is helpful:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;No "works on my machine" issues.&lt;/li&gt;
&lt;li&gt;New team members can start coding immediately without setup headaches.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;3. Test Different Setups Easily&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your app works with Node.js 18, but you want to test it with Node.js 16.&lt;/li&gt;
&lt;li&gt;Instead of reinstalling Node.js, just switch the version in your Docker setup and restart&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Using Docker for Production&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;App Deployments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of Docker as a way to pack your app into a "box" (called a container) that includes everything it needs to run. This makes sure your app behaves the same, no matter where it's running.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deploy Your Node.js App with Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine you're building a Node.js app (e.g., a website or API) and want to run it on a server for users to access. Instead of setting up Node.js manually on the server, you package your app with Docker.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a Docker Image:&lt;/p&gt;

&lt;p&gt;This is like making a blueprint for your app that includes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Your app code.&lt;/li&gt;
&lt;li&gt;Node.js (the version your app needs).&lt;/li&gt;
&lt;li&gt;Any libraries your app uses.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Push the Image to a Registry:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of this as uploading your "box" to a storage area (e.g., Docker Hub or AWS).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the App on a Server:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the image to start a container on a server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You have a Node.js app that runs on port 3000. When you run the container, your app is ready to serve requests on that port.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why this is helpful:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No worries about whether the server has the right Node.js version or dependencies.&lt;/li&gt;
&lt;li&gt;If something works on your computer, it'll work on the server too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;SETTING UP DOCKER&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Setting Up Docker on Ubuntu&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Update Your System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the following commands to update your system packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt upgrade -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Install Docker&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Uninstall Old Versions (if any):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt remove docker docker-engine docker.io containerd runc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Install Docker Using the Official Repository:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Verify Docker Installation:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Allow Docker Without sudo&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add your user to the docker group:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo usermod -aG docker $USER
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Log out and log back in for the changes to take effect.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Install Docker Compose&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker Compose is a tool to manage multi-container applications.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install it with:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Make it executable
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo chmod +x /usr/local/bin/docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Verify the installation:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker-compose --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Setting Up Docker on macOS Using Colima&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Colima is a lightweight, Docker-compatible container runtime for macOS that doesn’t require Docker Desktop. It uses qemu under the hood and integrates seamlessly with the Docker CLI.&lt;/p&gt;

&lt;p&gt;We use this as Docker Desktop is not for free anymore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install Colima&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Install Colima via Homebrew:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install colima
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Verify the installation:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;colima version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Install Docker CLI&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Docker CLI tools via Homebrew:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install docker docker-compose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Verify the installation:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker --version
docker-compose --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Start Colima&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start Colima with Docker support:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;colima start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Verify Colima is running:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;colima status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Test Docker with Colima&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the hello-world Docker image to confirm everything works:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Check running containers:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, we're setting up the Docker environment, which might feel overwhelming. Don't worry—later, we'll dive into what Docker is and how it will help us during development and production as we build the app.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>FSD 1.1.3 - Setting up Version Control</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Tue, 03 Dec 2024 11:23:24 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/fsd-113-setting-up-version-control-15hd</link>
      <guid>https://dev.to/hariraghupathy/fsd-113-setting-up-version-control-15hd</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is version control ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Version Control is very important for any developer to keep track of code changes and simplify code management when we work with a team of developers.&lt;/p&gt;

&lt;p&gt;It supports&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tracking Changes&lt;/strong&gt;: Records changes to files over time, allowing you to see what changed, when, and by whom.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Collaboration&lt;/strong&gt;: Allows multiple people to work on the same project without conflicts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;History&lt;/strong&gt;: Keeps a record of changes, enabling you to revert to previous versions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Branching&lt;/strong&gt;: Lets you create separate branches for new features and merge them later.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why do we need Version Control?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Collaboration&lt;/strong&gt;: Multiple people can work on the same project without overwriting each other’s work.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Backup&lt;/strong&gt;: Safeguards your code by allowing you to revert to a previous working state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Tracking&lt;/strong&gt;: Helps monitor project progress and identify when issues were introduced.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Experimentation&lt;/strong&gt;: You can test new features safely using branches without affecting the main codebase.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In a development team, think of version control like a shared codebase where multiple developers work on different features (branches) without overwriting each other’s work. If a bug is introduced, you can track changes, revert to a previous version, and merge the new features once they’re tested and ready. It ensures smooth collaboration and helps manage project history.&lt;/p&gt;

&lt;p&gt;To implement version control in this course, we will be &lt;strong&gt;using Git&lt;/strong&gt;. Git is a distributed version control system used to track changes in code and manage source code history.&lt;/p&gt;

&lt;p&gt;Git is the foundation for platforms like GitHub, GitLab, and Bitbucket, which provide additional collaboration tools like pull requests and issue tracking.&lt;/p&gt;

&lt;p&gt;We will be using Github as the platform for application development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CREATING A GITHUB ACCOUNT&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sign up with Github and choose a free plan in this link - &lt;a href="https://github.com" rel="noopener noreferrer"&gt;https://github.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SETTINGS UP GIT on macOS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Git:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the Terminal.&lt;/li&gt;
&lt;li&gt;Check if Git is already installed by running:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If not installed, Git is often pre-installed on macOS. If it’s not, install it via &lt;strong&gt;Homebrew&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configure Git:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set your global username and email for Git (used for commits):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Verify Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify your settings:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the installation
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;SETTINGS UP GIT on Ubuntu&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Git:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open the Terminal.&lt;/li&gt;
&lt;li&gt;First, update the package list:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Install Git:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configure Git:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set your global username and email for Git (used for commits):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Verify Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify your settings:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the installation
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>FSD 1.1.2 - Setting up a code-editor</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Tue, 03 Dec 2024 11:03:30 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/fsd-112-setting-up-a-code-editor-57n9</link>
      <guid>https://dev.to/hariraghupathy/fsd-112-setting-up-a-code-editor-57n9</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is a code-editor ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A code editor is a software tool specifically designed for writing and editing code. It is mainly used for &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Syntax Highlighting&lt;/strong&gt;: It colors different parts of the code (like keywords, variables, and functions) to make it easier to read and understand.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Autocompletion&lt;/strong&gt;: It suggests code snippets, variable names, and functions as you type, helping you write code faster and with fewer errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Error Detection&lt;/strong&gt;: Code editors often highlight errors or issues in your code, such as missing semicolons or typos, to help you debug and fix problems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Integrated Tools&lt;/strong&gt;: Many editors come with built-in features like version control, debugging tools, and terminal access, streamlining the development process.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Examples of popular code editors include Visual Studio Code, Sublime Text, and Atom.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Editor Installation&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Visit the offical VS code website - &lt;a href="https://code.visualstudio.com/download" rel="noopener noreferrer"&gt;https://code.visualstudio.com/download&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;There are many other alternative editors, but it is recommended to use VS code as it is open-source, built by Microsoft and has very good community support.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>FSD 1.1.1 - Setting up Node</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Tue, 03 Dec 2024 10:51:01 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/fsd-12-setting-up-node-1olf</link>
      <guid>https://dev.to/hariraghupathy/fsd-12-setting-up-node-1olf</guid>
      <description>&lt;p&gt;&lt;strong&gt;Installing Node Js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our application development is with React and Node, so both relies on  node. In this step we will setup node in our machine&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to set up Node.js Using NVM (Node Version Manager)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We are using NVM to setup node because setting up only node from its official website allows you to setup specific versions of node, whereas when we use NVM it allows to switch between node versions locally and manage different versions of node in the system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 1 : Install NVM:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open your terminal.&lt;/li&gt;
&lt;li&gt;For macOS or Linux, run the following command to download and install NVM:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Restart your terminal&lt;/strong&gt; to apply the changes. Alternatively, you can load NVM manually by running:&lt;/p&gt;

&lt;p&gt;For bash users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.bashrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For zsh users (on macOS, it's usually zsh):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will load the NVM environment variables.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verify NVM installation&lt;/strong&gt; by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;STEP 2 : Install Node.js Version 18&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can install the latest version as well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install Node.js version 18&lt;/strong&gt; using NVM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install 18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will download and install the latest stable &lt;strong&gt;Node.js version 18.x.x.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Set Node.js version 18 as the default version (optional, but recommended):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm alias default 18
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures that Node.js 18 will be the default version used in new terminal sessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verify the Node.js version&lt;/strong&gt; by running:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should output something like v18.x.x, confirming that Node.js version 18 is installed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verify the NPM version&lt;/strong&gt; (optional):&lt;/p&gt;

&lt;p&gt;Since NPM comes bundled with Node.js, check the NPM version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This should output the version of NPM installed along with Node.js.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP 3 : Managing Node.js Versions (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;NVM allows you to easily manage and switch between multiple versions of Node.js:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To switch to a different version (e.g., version 14):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm use 21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;To list all installed Node.js versions:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm ls
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;To install a specific version (e.g., version 16):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm install 16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install NVM using the curl or wget script.&lt;/li&gt;
&lt;li&gt;Install Node.js version 18 with nvm install 18.&lt;/li&gt;
&lt;li&gt;Set Node.js version 18 as the default with nvm alias default 18.&lt;/li&gt;
&lt;li&gt;Verify the installation with node --version and npm --version.&lt;/li&gt;
&lt;li&gt;Optionally, manage multiple Node.js versions using NVM.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This process is identical for both macOS and Ubuntu.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Full Stack - 1.1 - Setting up the environment</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Mon, 02 Dec 2024 05:33:18 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/full-stack-11-setting-up-the-environment-3fn2</link>
      <guid>https://dev.to/hariraghupathy/full-stack-11-setting-up-the-environment-3fn2</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is an Environment ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An environment contains the resources required for developing an application, both at the software and hardware levels.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A personal computer with at least 8GB of RAM, an Intel i5 equivalent processor, and 256GB of storage is essential.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Linux-based operating system with basic command line tools enabled is necessary. It is advisable for software developers to use Linux, as it is lightweight, open-source, and developer-friendly.&lt;/p&gt;

&lt;p&gt;To dig deeper, here is what you need to set up on your personal computer:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;System Level Setup:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Node.js and a package manager (e.g., npm).&lt;/li&gt;
&lt;li&gt;Set up a code editor (e.g., Visual Studio Code) and version control (e.g., Git).&lt;/li&gt;
&lt;li&gt;Set up Docker.&lt;/li&gt;
&lt;li&gt;Set up Git.&lt;/li&gt;
&lt;li&gt;Setup Postgres.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>FSD 1.0 - Introduction to Full Stack Development</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Tue, 26 Nov 2024 08:07:28 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/introduction-to-full-stack-development-4694</link>
      <guid>https://dev.to/hariraghupathy/introduction-to-full-stack-development-4694</guid>
      <description>&lt;p&gt;In this course, we will be building an e-commerce application using the below tech stack&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;Node with Express JS&lt;/li&gt;
&lt;li&gt;Mongo DB&lt;/li&gt;
&lt;li&gt;Typescript&lt;/li&gt;
&lt;li&gt;AWS Cloud [Amazon Web Services]&lt;/li&gt;
&lt;li&gt;Docker &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;React&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React is a JavaScript library for building web applications, particularly for single-page applications. It is maintained by Meta (formerly Facebook) and a community of developers. React is known for its efficiency, flexibility, and component-based architecture, making it a popular choice for &lt;strong&gt;front-end&lt;/strong&gt; web development.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node.js&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Node.js is an open-source, cross-platform runtime environment that allows you to execute JavaScript code on the server side, outside of a browser. We will use node with Express JS for our backend in this course.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Express JS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Express.js&lt;/strong&gt; is a &lt;strong&gt;web application framework&lt;/strong&gt; built on top of Node.js, which simplifies and organizes backend development by providing tools and features like routing, middleware, and HTTP request handling. With Express, you can easily structure your backend code for tasks like:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Building &lt;strong&gt;RESTful APIs&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Handling &lt;strong&gt;routes&lt;/strong&gt; and defining endpoints.&lt;/li&gt;
&lt;li&gt;Managing &lt;strong&gt;middleware&lt;/strong&gt; for request processing (e.g., authentication, logging, etc.).&lt;/li&gt;
&lt;li&gt;Integrating with databases (e.g., MongoDB, MySQL).&lt;/li&gt;
&lt;li&gt;Serving static files or data to the front-end.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By combining Node.js (for its runtime environment and asynchronous handling capabilities) with Express.js (for its organized and developer-friendly API), you can efficiently write and maintain the backend logic for your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mongo DB&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MongoDB is a &lt;strong&gt;NoSQL database&lt;/strong&gt; that is designed for storing, managing, and retrieving large amounts of data in a way that is highly scalable and flexible. Unlike traditional relational databases (e.g., MySQL, PostgreSQL), which use tables and rows, MongoDB stores data in documents using a JSON-like format called BSON (Binary JSON).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Typescript&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;TypeScript is a superset of JavaScript developed by Microsoft that adds static typing and other features to JavaScript.&lt;/li&gt;
&lt;li&gt;TypeScript code is transpiled into plain JavaScript, which can run in any environment that supports JavaScript (e.g., browsers, Node.js).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; let name: string = "John"; // Type-safe
 name = 42; // Error in TypeScript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Prevents unintended bugs caused by incorrect data types or usage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function add(a: number, b: number): number {
    return a + b;
  }
  add(5, "10"); //
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are lot of advantages in using typescript over javascript, let's look into it in detail later. But for now let's go ahead with Typescript.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Docker and AWS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Docker ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Docker is an open-source platform that enables developers to build, package, and deploy applications in lightweight, portable containers. These containers include everything needed to run an application (code, runtime, libraries) and ensure consistency across environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS for Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Amazon Web Services (AWS) is a comprehensive and widely adopted cloud computing platform offered by Amazon. It provides over 200 fully featured services from data centers globally, enabling individuals, companies, and governments to access on-demand computing resources.&lt;/p&gt;

&lt;p&gt;We will be using AWS to deploy and make our application live for users across the globe.&lt;/p&gt;

&lt;p&gt;Oh my god !!! Everything is new to me. &lt;/p&gt;

&lt;p&gt;No worries. This course will teach you in detail every individual tech stack you see here. You don't have to go learn every single thing and then come build the application. We will be learning each technology here practically as we move forward. &lt;/p&gt;

&lt;p&gt;You cannot learn every stack end-to-end spending hours, even if it is done so, you should implement it real-time to get expertise. This course will teach you what all base knowledge you should be having in each stack and domain so that you will be able to adapt to new technologies easily. &lt;/p&gt;

&lt;p&gt;In addition to the above, you will also be gaining hands on expertise in&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Version Control [GIT]&lt;/li&gt;
&lt;li&gt;HTML/CSS &lt;/li&gt;
&lt;li&gt;Industry Best Practices for software development&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>fullstack</category>
      <category>mern</category>
      <category>ecommerce</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Bridging the Gap: Integrating Microsoft Copilot with Zendesk Using Sunshine Conversations</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Fri, 07 Jun 2024 08:15:28 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/bridging-the-gap-integrating-microsoft-copilot-with-zendesk-using-sunshine-conversations-l6f</link>
      <guid>https://dev.to/hariraghupathy/bridging-the-gap-integrating-microsoft-copilot-with-zendesk-using-sunshine-conversations-l6f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today's digital landscape, seamless integration between various tools is essential for efficient operations and enhanced user experience. Recently, we embarked on a journey to integrate Microsoft Copilot with Zendesk, despite the lack of direct connectivity. This blog post details our collaborative effort with Zendesk and Microsoft, leveraging Sunshine Conversations to achieve this integration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Challenge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Microsoft Copilot is a powerful tool for automating tasks and enhancing productivity. However, it does not have native connectivity to Zendesk, a popular customer service platform. This posed a significant challenge, as no existing solutions or community efforts had addressed this gap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To overcome this challenge, we worked closely with both Zendesk and Microsoft. Our solution involved leveraging Sunshine Conversations, a powerful API for integrating various messaging channels. The process was as follows:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sequence of API Calls:&lt;/strong&gt; When an agent interaction is initiated, we trigger a series of API calls – createUser, createConversation, and postMessage. These calls create a ticket in Zendesk and pass all basic information, including the conversation transcript.&lt;/p&gt;

&lt;p&gt;**Webhook Creation: **We developed a webhook using JavaScript/TypeScript and deployed it on a serverless solution. This webhook is responsible for sending and receiving messages between Copilot and Zendesk via Sunshine Conversations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Handling:&lt;/strong&gt; The webhook listens for the ticket:closed event from Zendesk. Upon receiving this event, the webhook ends the conversation on our side, ensuring a seamless closure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Implementation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Sequence of API Calls&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a user requests to talk to an agent, the following API calls are made:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;createUser:&lt;/strong&gt; This API call creates a new user in the Sunshine Conversations platform.&lt;br&gt;
&lt;strong&gt;createConversation:&lt;/strong&gt; This call initiates a new conversation for the user.&lt;br&gt;
&lt;strong&gt;postMessage:&lt;/strong&gt; Finally, this API sends the initial message from Copilot to the newly created conversation.&lt;/p&gt;

&lt;p&gt;This sequence ensures that all relevant information is captured and a ticket is created in Zendesk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Webhook for Message Handling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We developed a webhook that handles communication between Copilot and Zendesk. The webhook performs the following tasks:&lt;/p&gt;

&lt;p&gt;Sends messages from Copilot to Zendesk via Sunshine Conversations.&lt;br&gt;
Receives responses from Zendesk and relays them back to Copilot.&lt;br&gt;
The webhook is deployed on a serverless platform, ensuring scalability and reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Event Handling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The webhook listens for the &lt;strong&gt;ticket:closed&lt;/strong&gt; event from Zendesk. When this event is detected, the webhook performs necessary actions to end the conversation on our side, maintaining consistency and ensuring a smooth user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By collaborating with Zendesk and Microsoft, and leveraging Sunshine Conversations, we successfully bridged the gap between Microsoft Copilot and Zendesk. This integration enables seamless communication and enhances the overall efficiency of our customer service operations.&lt;/p&gt;

&lt;p&gt;Our journey demonstrates the power of collaborative efforts and innovative solutions in overcoming technical challenges. We hope this blog post provides valuable insights and inspiration for your own integration projects.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Open API &amp; Client-SDK [Best Practices]</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Wed, 08 Nov 2023 06:29:49 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/open-api-client-sdk-best-practices-5b31</link>
      <guid>https://dev.to/hariraghupathy/open-api-client-sdk-best-practices-5b31</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today’s interconnected digital landscape, APIs (Application Programming Interfaces) play a crucial role in enabling seamless communication and integration between different software systems. With the increasing complexity of modern applications, having a well-defined and standardized API contract becomes essential. In this blog post, we will explore the significance of Open API contracts and how the generation of client SDKs using Open API generators can benefit both front-end developers and consumers. Additionally, we will highlight the drawbacks of not having this practice in place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Understanding Open API Contracts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open API contracts, often defined using the OpenAPI Specification (formerly Swagger), serve as a formal definition of an API. They outline the available endpoints, request/response payloads, authentication methods, error codes, and other important details. Open API contracts provide a clear and structured way to document and communicate the capabilities of an API, making it easier for developers to understand and consume it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Advantages for Front-end Developers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Improved Developer Experience&lt;/strong&gt; : Open API contracts provide a single source of truth for front-end developers. They can easily refer to the contract to understand the API’s capabilities without digging through extensive documentation or consulting back-end developers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Efficient Collaboration&lt;/strong&gt; : With Open API contracts, front-end and back-end teams can collaborate more effectively. The contract serves as a shared understanding, enabling developers from different teams to work in parallel, reducing dependencies, and accelerating development cycles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;c. Code Generation&lt;/strong&gt; : Open API generators can automatically generate client SDKs based on the contract. This eliminates the need for manual coding of API integrations, saving time and effort. Generated SDKs provide ready-to-use client libraries, reducing the chances of errors and ensuring consistent API consumption across multiple platforms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;d. Rapid Iteration&lt;/strong&gt; : Open API contracts allow for rapid iteration and evolution of APIs. By defining the contract first, changes and additions to the API can be made more easily without breaking existing integrations. Front-end developers can adapt their codebase to new API versions by regenerating the SDK, streamlining the update process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Benefits for Consumers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Easy Integration&lt;/strong&gt; : Open API contracts empower consumers of an API to quickly understand its capabilities, reducing the learning curve. With generated client SDKs, they can integrate the API into their applications with minimal effort, enabling faster time-to-market.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Reduced Errors&lt;/strong&gt; : Client SDKs generated from Open API contracts ensure adherence to the defined API structure. This reduces the risk of manual errors while making API calls, improving the overall reliability and quality of integrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;c. Consistent Experience&lt;/strong&gt; : When multiple consumers use the same generated SDK, the API integration experience becomes consistent across different applications. This consistency enhances usability and reduces confusion for end-users interacting with those applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Drawbacks of Not Having Open API Contracts and SDK Generation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;a. Increased Development Complexity&lt;/strong&gt; : Without a standardized API contract, front-end developers have to rely on fragmented and possibly outdated documentation. This increases the complexity of understanding and integrating with the API, leading to longer development cycles and potential errors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;b. Inconsistent Implementations&lt;/strong&gt; : In the absence of an Open API contract, different front-end developers might interpret the API’s behavior differently. This can result in inconsistent implementations, making it harder to maintain and update the API over time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;c. Manual Integration Efforts&lt;/strong&gt; : Without client SDK generation, front-end developers have to write custom code to integrate with each API. This manual approach is time-consuming, error-prone, and increases the chances of inconsistencies across different parts of an application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;d. Compatibility Issues&lt;/strong&gt; : In the absence of a contract-driven approach, backward-incompatible changes to an API can break existing integrations, leading to disruptions and potential customer dissatisfaction.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Sensible Defaults [Cloud Infrastructure]</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Wed, 08 Nov 2023 06:20:55 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/sensible-defaults-cloud-infrastructure-58e2</link>
      <guid>https://dev.to/hariraghupathy/sensible-defaults-cloud-infrastructure-58e2</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--frbbraCO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/foex1w376phnsb64pmmc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--frbbraCO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/foex1w376phnsb64pmmc.png" alt="Image description" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In any data-focused business, managing cloud operations is crucial for the effective handling of your digital infrastructure. Drawing from my previous experience in software development, I've learned that defaults play a fundamental role in establishing, deploying, and overseeing your cloud resources. They ensure that everything is secure, dependable, and in line with your business objectives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sensible Defaults in Cloud Operations:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Automated Deployments&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Our approach revolves around continuous integration and deployment (CI/CD), using strong pipelines that automate software releases.&lt;/p&gt;

&lt;p&gt;This ensures your applications are deployed consistently and with minimal risk across different environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Monitoring and Alerting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We implement monitoring capabilities using tools, allowing us to capture and analyze metrics in real time. Our predefined thresholds trigger alerts, enabling us to address potential issues before they impact your operations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Incident Management&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We should always have an incident response plan documented, grounded in industry best practices, which streamlines communication and coordination during critical moments. With predefined roles and escalation paths, we address incidents, minimizing disruption and ensuring a speedy recovery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Logs as Insights&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We should recommend centralizing logs in a dedicated platform, enabling us to gain insights into your system’s behavior, diagnose anomalies, and optimize performance. Our log analysis helps discover patterns and enhances your infrastructure’s reliability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Security should be our top priority. Our defaults include regular security assessments, vulnerability scans, and policy enforcement to safeguard your data and applications from evolving threats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scaling&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every team should continuously monitor resource utilization, ensuring your infrastructure scales efficiently based on demand. Our capacity planning is rooted in performance metrics, ensuring a speedy user experience during peak times.&lt;/p&gt;

&lt;p&gt;We should often provision the infra to auto scale during peak times and spin down when there is very less demand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Software Updates&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We should manage software updates and patches rigorously, ensuring that your systems remain protected and resilient against emerging vulnerabilities. Infra is provisioned in such a way that stakeholders are notified about vulnerabilities and in times we also auto upgrade the patches for sure cases where we know the system won’t break due to transitive dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Compliance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We must stay aligned with industry regulations and standards, ensuring that your cloud operations remain compliant and well-governed. We always take into consideration the security and governance policies of the client and their domain while provisioning the infrastructure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Documentation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We should document every step of our process, providing you with clear insights into your infrastructure. This helps your team with the knowledge needed to manage and optimize your resources effectively.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Flutter in-app purchases setup</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Fri, 24 Jun 2022 21:21:43 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/flutter-in-app-purchases-4mil</link>
      <guid>https://dev.to/hariraghupathy/flutter-in-app-purchases-4mil</guid>
      <description>&lt;p&gt;In app purchases are those which you make in any android or iOS store. It might be directly the app itself, or advanced features in the app or just game coins in case of a game app.&lt;/p&gt;

&lt;p&gt;There are three main types of in-app purchases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Consumables&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consumables are products that are depleted and they can be purchased multiple times. Simple example would be coins in a game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Non-consumable&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They are one time purchase from the app provider and it never needs to purchased again. Like a premium feature in some app you are using.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Subscription&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This type gives the user access to the purchase for a given amount of time. Then after it expires you have to purchase it again or you can make recurring payments to the same.&lt;/p&gt;

&lt;p&gt;Setup process has some differences for android and iOS. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Initial setup for iOS&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For iOS you need to have an apple developer account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You need to have a release of your iOS app in AppStore connect. It doesn't need to be on the public app store, just on the app store connect for use with things like test flight. Refer &lt;a href="https://docs.flutter.dev/deployment/ios"&gt;https://docs.flutter.dev/deployment/ios&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In app store connect, go to My Apps -&amp;gt; Your app -&amp;gt; Features (In-app purchases)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It will prompt for the in-app purchase type, for now you can try creating a consumable in-app purchase. Keep a note of the product id since this has to be the same in google play store also.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Check the availability check box to make the in app purchase available in the app store.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Under price schedule, you have to select the price category for the in app purchase. Feel free to select your own country and respective currency. Start date is the date when that specific price will take effect in the app store for that purchase.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Select the tax category in which your app lies, for example if your app is a game app, try selecting the &lt;em&gt;Games&lt;/em&gt; category and for each purchase the actual tax for that category would be chargeable&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After creating the in-app purchase, you have to open your project in XCode and enable the in-app purchases capability. Under &lt;em&gt;signing and capabilities&lt;/em&gt; create the in app purchase capability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When you are again building, make sure you add the in app purchase capability to the provisioning profile you are using to sign your app&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Initial setup for Android&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For Android, you should be having a google play developer account. You also should have a signed release apk uploaded in google play. Refer &lt;a href="https://docs.flutter.dev/deployment/android"&gt;https://docs.flutter.dev/deployment/android&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once you create a singed apk, you will need to atleast create an alpha release for your app in google play. This will allow you to test the google play billing api locally in your test device&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Google billing api won't work if you have not created a release for your app. You also want to add the email address of the tester of that app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Go to Monetize -&amp;gt; Products -&amp;gt; In-app products. You will be prompted to set up a google play merchant's account. For that you need to create a payment profile which can be one of google cloud's billing account or you can create one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;So here you won't be prompted for the purchase type as it did in iOS. You have to handle the type of purchase from code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;While creating the unit in the play store, give the name, description, status to active, price and the same product id which you used in iOS while creating the in-app purchase.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Plugin for implementing in app purchase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pub.dev/packages/in_app_purchase"&gt;https://pub.dev/packages/in_app_purchase&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Typescript - Advanced Types</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Wed, 15 Jun 2022 02:34:25 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/typescript-advanced-types-5ed3</link>
      <guid>https://dev.to/hariraghupathy/typescript-advanced-types-5ed3</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Intersection types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Intersection types allow us to combine multiple types into one type. In the below code consider we combine the left and the right type to get the combined Intersection Type.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type LeftType = {
  id: number;
  left: string;
};

type RightType = {
  id: number;
  right: string;
};

type IntersectionType = LeftType &amp;amp; RightType;

const joinedValue: IntersectionType = {
  id: 1,
  left: "left value",
  right: "right value",
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This intersection can also be achieved using interfaces. With the above code, left and right can be separate interfaces and we can have an intersection interface which implements both the interfaces. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Type Guards&lt;/strong&gt; &lt;em&gt;(typeof, in , instanceof)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;typeof&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider we have a union type which holds two other types. And also consider you need to add or concatenate based on whether it is a number or string, how to identify in runtime whether the incoming value is a string or a number ?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type UnionType = string | number;

function add(a: UnionType, b: UnionType) {
  return a + b; 
  // error: Operator '+' cannot be applied to types 'UnionType' and 'UnionType'.
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Typescript cannot add or concatenate because it cannot infer the exact type it received in the add method. Type guards can be used here to check the type in runtime and add or concatenate the values accordingly. So the method will be modified as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function add(a: UnionType, b: UnionType) {
  if (typeof a === "string" || typeof b === "string") {
    return a.toString() + b.toString();
  }
  return a + b;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;in&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This keyword is provided by javascript itself. The in keyword can be used in cases where we have to check if an object has a property we are looking for in it.&lt;/p&gt;

&lt;p&gt;Consider the same example above where we had two types the left and the right. Now we want to have a common print method which will print the information based on the left or right type we pass as input to the method.&lt;/p&gt;

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

&lt;p&gt;We can find from the above image that typescript cannot identify the left and right properties as they can vary based on the input given to the method. In this case we can make use of the in keyword to check if the properties are present, and then typescript will be satisfied to ensure that the properties are present and it will print them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type LeftType = {
  id: number;
  left: string;
};

type RightType = {
  id: number;
  right: string;
};

function printTypeInformation(typeInfo: LeftType | RightType) {
  console.log("id : " + typeInfo.id);
  if ("left" in typeInfo) {
    console.log(typeInfo.left);
  }
  if ("right" in typeInfo) {
    console.log(typeInfo.right);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;instance of&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Consider we have two classes one as the Car and the other as the Truck. Both the classes will have a common method to drive and only the truck will have the loadGoods method. &lt;/p&gt;

&lt;p&gt;We also have a common type called Vehicle which contains the union of Car and Truck.&lt;/p&gt;

&lt;p&gt;Consider the case we want to have a method called useVehicle and we want to make use of all the methods available in the vehicle instance. &lt;/p&gt;

&lt;p&gt;Now here also there is a situation where we cannot make use of the loadGoods method as it cannot be inferred by typescript. In this case we can make use of the instanceof to check in runtime and access their methods accordingly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Car {
  drive() {
    console.log("Driving a car");
  }
}

class Truck {
  drive() {
    console.log("Driving a truck");
  }

  loadGoods(amount: number) {
    console.log("Loading cargo : " + amount);
  }
}

type Vehicle = Car | Truck;

const car = new Car();
const truck = new Truck();

function useVehicle(vehicle: Vehicle) {
  vehicle.drive();
  if (vehicle instanceof Truck) {
    vehicle.loadGoods(100);
  }
}

useVehicle(car);
useVehicle(truck);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An important point to note here instead of classes we cannot apply the same for interfaces, because only classes are compiled to something that javascript can understand but javascript does not know what an interface is.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Discriminated Unions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A special type of type guard. It is a pattern which we can use when working with union types that makes implementing type guards easier. &lt;/p&gt;

&lt;p&gt;There are disadvantages in using the in keyword as well as the instance of keyword. When using the in keyword we might do a typo in specifying the property name and in case of the instanceof keyword, we cannot apply the same for interfaces.&lt;/p&gt;

&lt;p&gt;So discriminated union comes handy with addressing all the disadvantages. It is a suggested pattern to follow when we want identify types in runtime.&lt;/p&gt;

&lt;p&gt;We simply add a type which would denote the type in the form of a string. And we use switch statement over this type to identify the type in runtime.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;interface Car {
  type: "Car";
  carSpeed: number;
}

interface Truck {
  type: "Truck";
  truckSpeed: number;
}

type Vehicle = Car | Truck;

function printVehicleSpeed(vehicle: Vehicle) {
  let speed;
  switch (vehicle.type) {
    case "Car":
      speed = vehicle.carSpeed;
      break;
    case "Truck":
      speed = vehicle.truckSpeed;
  }
  console.log("vehicle speed : " + speed);
}

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

&lt;/div&gt;



&lt;p&gt;How can discriminated unions help in avoiding typos ?&lt;/p&gt;

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

&lt;p&gt;When any union type property is used in a switch statement, as in the above image, typescript intelligently identifies the type and shows suggestions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Utility Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Typescript provides utilities that help to manipulate types easily. In order to use them, you need to pass into the &amp;lt;&amp;gt; the type you want to transform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Partial&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It helps in making all the properties of a particular type optional. It will add a ? mark next to every field.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// initially all props in the below type are required by default
type User = {
  id: number;
  firstName: string;
  lastName: string;
};

const printUser = (user: Partial&amp;lt;User&amp;gt;) =&amp;gt; {
  console.log(user);
};

printUser({ id: 1 });

printUser({ firstName: "first name", lastName: "last name" });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the printUser method received only a partial user type, we need not specify all the props.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Required&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is opposite to the Partial utility, it makes all props of a particular types mandatory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// lastName property is optional in the below User type
type User = {
  id: number;
  firstName: string;
  lastName?: string;
};

const printUser = (user: Required&amp;lt;User&amp;gt;) =&amp;gt; {
  console.log(user);
};

printUser({ id: 1, firstName: "first name", lastName: "last name" });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the printUser method expects the User type with Required utility, you have to always provide all the props in the User Type.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Readonly&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The readonly utility will help in transforming all properties of type T, in order to make them not reassignable with a new value.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type User = {
  id: number;
  firstName: string;
  lastName: string;
};

const printUser = (user: Readonly&amp;lt;User&amp;gt;) =&amp;gt; {
  console.log(user);
  // user.id = 2;
  // cannot assign value to any prop in user, as it is readonly
};

printUser({ id: 1, firstName: "first name", lastName: "last name" });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here the print user method receives only a readonly type and inside the method, no property of the user type can be reassigned with a value.&lt;/p&gt;

</description>
      <category>typescript</category>
    </item>
    <item>
      <title>Confluent - MQTT &lt;-&gt; KAFKA</title>
      <dc:creator>Hari Krishnan</dc:creator>
      <pubDate>Sun, 22 May 2022 09:29:23 +0000</pubDate>
      <link>https://dev.to/hariraghupathy/confluent-mqtt-kafka-38ac</link>
      <guid>https://dev.to/hariraghupathy/confluent-mqtt-kafka-38ac</guid>
      <description>&lt;p&gt;Spark structured streaming has some limitations on listening to MQTT data sources in its latest version, though there are some extensions available, they support only Spark version 2.0.&lt;/p&gt;

&lt;p&gt;Supported Spark Streaming sources &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Flume&lt;/li&gt;
&lt;li&gt;Kafka&lt;/li&gt;
&lt;li&gt;file sources&lt;/li&gt;
&lt;li&gt;TCP/IP port&lt;/li&gt;
&lt;li&gt;Kinesis&lt;/li&gt;
&lt;li&gt;Twitter&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For people looking for what MQTT is ?&lt;br&gt;
&lt;a href="https://mqtt.org/"&gt;https://mqtt.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So to make mqtt data available for spark to stream, we have to connect MQTT with Kafka, there are many tools available to achieve this. One such is &lt;a href="https://www.confluent.io/"&gt;https://www.confluent.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the below steps to bring your MQTT device data to a Kafka queue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;INSTALL CONFLUENT&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    -&amp;gt; install confluent in local machine (https://www.confluent.io/installation/)
    -&amp;gt; set the path for confluent cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CHECK FOR THE STATUS OF SERVICES&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    confluent local services kafka status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;START KAFKA USING CONFLUENT CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    confluent local services kafka start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;AFTER STARTING KAFKA, START THE KAFKA CONNECT SERVICE&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    confluent local services connect start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;INSTALL MOSQUITTO&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We would need mosquitto to run an MQTT broker which will expose topics on which we can publish and subscribe data.&lt;br&gt;
&lt;a href="https://mosquitto.org/"&gt;https://mosquitto.org/&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    brew instal mosquitto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;START MOSQUITTO BROKER LOCALLY&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    brew services start mosquitto
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CHECK IF WE CAN PUBLISH TO THE MOSQUITTO TOPIC&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    mosquitto_pub -h localhost -p 1883 -t temperature -m "sample-msg-1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;SUBSCRIBE TO THE TOPIC AND TRY SENDING MESSAGES *&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    mosquitto_sub -h localhost -p 1883 -t temperature 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;INSTALL THE MQTT CONNECTOR PLUGIN&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      confluent-hub install confluentinc/kafka-connect-mqtt:latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;RESTART AND START THE CONNECT SERVICE&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      confluent local services connect stop &amp;amp;&amp;amp; confluent local services connect start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CHECK IF MQTT PLUGIN IS INSTALLED USING THE BELOW COMMAND&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      curl -s "http://localhost:8083/connector-plugins"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CONNECT KAFKA WITH MQTT BROKER USING THE BELOW COMMAND&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -s -X POST -H 'Content-Type: application/json' http://localhost:8083/connectors -d '{
    "name" : "mqtt-source",
"config" : {
    "connector.class" : "io.confluent.connect.mqtt.MqttSourceConnector",
    "tasks.max" : "1",
    "mqtt.server.uri" : "tcp://127.0.0.1:1883",
    "mqtt.topics" : "temperature",
    "kafka.topic" : "mqtt.temperature",
    "confluent.topic.bootstrap.servers": "localhost:9092",
    "confluent.topic.replication.factor": "1",
    "confluent.license":""
    }
}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CHECK IF THE CONNECTOR HAS A STATUS : RUNNING&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      curl -s "http://localhost:8083/connectors"
      curl -s "http://localhost:8083/connectors/mqtt-source/status"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;CREATE A KAFKA TOPIC *&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic mqtt.temperature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;FINALLY TEST BY CREATING TWO CONSUMERS&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   mosquitto_sub -h localhost -p 1883 -t temperature
   kafka-console-consumer --bootstrap-server localhost:9092 --topic mqtt.temperature --property print.key=true --from-beginning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if we publish the data to the mqtt topic, both the consumers created above will receive the data pushed in the mqtt topic.&lt;/p&gt;

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