<?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[Amit Wani's Blog]]></title><description><![CDATA[𝗪𝗔𝗥𝗥𝗜𝗢𝗥!
Full Stack Developer | SDE Reliance Jio 🖥️
Tech Enthusiastic 💻
Man Utd 🔴
Sachin & Dravid fan! ⚾
Photography 📸
Get Hands Dirty on Keyboard!]]></description><link>https://blog.amitwani.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 23:33:54 GMT</lastBuildDate><atom:link href="https://blog.amitwani.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building an MCP Server with Spring Boot and Java]]></title><description><![CDATA[Discover how to build a Model Context Protocol (MCP) server using Spring Boot and Java. This guide covers setting up an MCP server, creating model classes,]]></description><link>https://blog.amitwani.dev/building-an-mcp-server-with-spring-boot-and-java</link><guid isPermaLink="true">https://blog.amitwani.dev/building-an-mcp-server-with-spring-boot-and-java</guid><category><![CDATA[Springboot]]></category><category><![CDATA[AI]]></category><category><![CDATA[mcp]]></category><category><![CDATA[Java]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[llm]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 22 Mar 2025 06:33:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1742624742703/d264fc59-68e5-4281-81e5-9464fde27ca6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Model Context Protocol (MCP) is an emerging protocol that standardizes the way AI assistants communicate with external tools and services. In this blog post, we'll explore how to build and use an MCP server using Spring Boot and Java, making it easy for AI assistants to access structured tools.</p>
<h2 id="heading-what-is-model-context-protocol-mcp">What is Model Context Protocol (MCP)?</h2>
<p>MCP is a protocol that enables AI assistants to invoke tools and access information from external servers in a standardized way. It provides:</p>
<ul>
<li><p>A consistent interface for AI assistants to call external tools</p>
</li>
<li><p>Structured communication between AI models and servers</p>
</li>
<li><p>Tool discovery and documentation capabilities</p>
</li>
</ul>
<h2 id="heading-why-spring-boot-for-mcp">Why Spring Boot for MCP?</h2>
<p>Spring Boot offers several advantages for building MCP servers:</p>
<ul>
<li><p>Robust REST API capabilities</p>
</li>
<li><p>Dependency injection and auto-configuration</p>
</li>
<li><p>Easy integration with various data sources</p>
</li>
<li><p>Spring AI's built-in MCP server support</p>
</li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>To follow along with this tutorial, you'll need:</p>
<ul>
<li><p>Java 21 or higher</p>
</li>
<li><p>Maven</p>
</li>
<li><p>An IDE (IntelliJ IDEA, Eclipse, or VS Code)</p>
</li>
<li><p>Basic knowledge of Spring Boot</p>
</li>
</ul>
<h2 id="heading-project-setup">Project Setup</h2>
<p>Let's start by setting up a new Spring Boot project:</p>
<ol>
<li><p>Create a new Spring Boot project using Spring Initializer or your IDE</p>
</li>
<li><p>Add the Spring AI MCP Server Starter dependency to your <code>pom.xml</code>:</p>
</li>
</ol>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>org.springframework.ai<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>spring-ai-mcp-server-webmvc-spring-boot-starter<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<ol start="3">
<li>Create a basic project structure:</li>
</ol>
<pre><code class="lang-bash">src/main/java/com/example/mcpserver/
├── config/
├── model/
├── service/
└── McpServerApplication.java
</code></pre>
<h2 id="heading-configuring-the-mcp-server">Configuring the MCP Server</h2>
<p>First, let's configure our MCP server in <code>application.yml</code>:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">spring:</span>
  <span class="hljs-attr">application:</span>
    <span class="hljs-attr">name:</span> <span class="hljs-string">mcp-demo-server</span>
  <span class="hljs-attr">main:</span>
    <span class="hljs-attr">banner-mode:</span> <span class="hljs-string">off</span>
  <span class="hljs-attr">ai:</span>
    <span class="hljs-attr">mcp:</span>
      <span class="hljs-attr">server:</span>
        <span class="hljs-attr">name:</span> <span class="hljs-string">my-tool-server</span>
        <span class="hljs-attr">version:</span> <span class="hljs-number">0.0</span><span class="hljs-number">.1</span>
        <span class="hljs-attr">type:</span> <span class="hljs-string">SYNC</span>
        <span class="hljs-attr">stdio:</span> <span class="hljs-literal">true</span>
        <span class="hljs-attr">sse-message-endpoint:</span> <span class="hljs-string">/mcp/message</span>
        <span class="hljs-attr">resource-change-notification:</span> <span class="hljs-literal">true</span>
        <span class="hljs-attr">tool-change-notification:</span> <span class="hljs-literal">true</span>
        <span class="hljs-attr">prompt-change-notification:</span> <span class="hljs-literal">true</span>

<span class="hljs-attr">server:</span>
  <span class="hljs-attr">port:</span> <span class="hljs-number">8090</span>
</code></pre>
<p>This configuration:</p>
<ul>
<li><p>Names our server "my-tool-server"</p>
</li>
<li><p>Sets up synchronous communication mode</p>
</li>
<li><p>Enables Standard I/O (STDIO) for terminal-based communication</p>
</li>
<li><p>Exposes the <code>/mcp/message</code> endpoint for Server-Sent Events (SSE)</p>
</li>
<li><p>Sets the server port to 8090</p>
</li>
</ul>
<h2 id="heading-creating-model-classes">Creating Model Classes</h2>
<p>Let's create model classes for our domain. In this example, we'll build a user management service:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Data</span>
<span class="hljs-meta">@NoArgsConstructor</span>
<span class="hljs-meta">@AllArgsConstructor</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">User</span> </span>{
  <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> id;
  <span class="hljs-keyword">private</span> String firstName;
  <span class="hljs-keyword">private</span> String lastName;
  <span class="hljs-keyword">private</span> String email;
  <span class="hljs-keyword">private</span> String username;
  <span class="hljs-comment">// Additional fields as needed</span>
}

<span class="hljs-meta">@Data</span>
<span class="hljs-meta">@NoArgsConstructor</span>
<span class="hljs-meta">@AllArgsConstructor</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">UsersResponse</span> </span>{
  <span class="hljs-keyword">private</span> List&lt;User&gt; users;
  <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> total;
  <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> skip;
  <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> limit;
}
</code></pre>
<h2 id="heading-implementing-service-layer-with-tool-annotations">Implementing Service Layer with Tool Annotations</h2>
<p>The core of our MCP server lies in the service layer where we define tools using the <code>@Tool</code> annotation:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Service</span>
<span class="hljs-meta">@Slf4j</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">UserService</span> </span>{

  <span class="hljs-keyword">private</span> <span class="hljs-keyword">final</span> RestTemplate restTemplate;
  <span class="hljs-keyword">private</span> <span class="hljs-keyword">final</span> String BASE_URL = <span class="hljs-string">"https://dummyjson.com"</span>;

  <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">UserService</span><span class="hljs-params">(RestTemplateBuilder restTemplateBuilder)</span> </span>{
    <span class="hljs-keyword">this</span>.restTemplate = restTemplateBuilder.build();
  }

  <span class="hljs-meta">@Tool(name = "getAllUsers", description = "Get all users")</span>
  <span class="hljs-function"><span class="hljs-keyword">public</span> UsersResponse <span class="hljs-title">getAllUsers</span><span class="hljs-params">(<span class="hljs-keyword">int</span> limit, <span class="hljs-keyword">int</span> skip)</span> </span>{
    String url = BASE_URL + <span class="hljs-string">"/users?limit="</span> + limit + <span class="hljs-string">"&amp;skip="</span> + skip;
    <span class="hljs-keyword">return</span> restTemplate.getForObject(url, UsersResponse.class);
  }

  <span class="hljs-meta">@Tool(name = "getUserById", description = "Get a single user by ID")</span>
  <span class="hljs-function"><span class="hljs-keyword">public</span> User <span class="hljs-title">getUserById</span><span class="hljs-params">(<span class="hljs-keyword">int</span> id)</span> </span>{
    String url = BASE_URL + <span class="hljs-string">"/users/"</span> + id;
    <span class="hljs-keyword">return</span> restTemplate.getForObject(url, User.class);
  }

  <span class="hljs-meta">@Tool(name = "searchUsers", description = "Search for users by query")</span>
  <span class="hljs-function"><span class="hljs-keyword">public</span> UsersResponse <span class="hljs-title">searchUsers</span><span class="hljs-params">(String query)</span> </span>{
    String url = BASE_URL + <span class="hljs-string">"/users/search?q="</span> + query;
    <span class="hljs-keyword">return</span> restTemplate.getForObject(url, UsersResponse.class);
  }

  <span class="hljs-comment">// Additional tool methods...</span>
}
</code></pre>
<p>Each <code>@Tool</code> annotation defines a tool that an AI assistant can invoke. The annotation specifies:</p>
<ul>
<li><p>A name for the tool</p>
</li>
<li><p>A description that helps the AI understand what the tool does</p>
</li>
<li><p>Parameters that can be extracted from the AI's request</p>
</li>
</ul>
<h2 id="heading-registering-tools-with-mcp">Registering Tools with MCP</h2>
<p>To make our tools available to the MCP server, we need to register them using a configuration class:</p>
<pre><code class="lang-java"><span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MCPConfig</span> </span>{

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">final</span> UserService userService;

    <span class="hljs-meta">@Autowired</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">MCPConfig</span><span class="hljs-params">(UserService userService)</span> </span>{
        <span class="hljs-keyword">this</span>.userService = userService;
    }

    <span class="hljs-meta">@Bean</span>
    <span class="hljs-function">ToolCallbackProvider <span class="hljs-title">userTools</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> MethodToolCallbackProvider
                .builder()
                .toolObjects(userService)
                .build();
    }
}
</code></pre>
<p>This configuration creates a <code>ToolCallbackProvider</code> that registers all methods annotated with <code>@Tool</code> in the <code>UserService</code> class.</p>
<h2 id="heading-using-the-mcp-server-with-ai-assistants">Using the MCP Server with AI Assistants</h2>
<p>To use your MCP server with an AI assistant, you'll need to configure the MCP client. This typically involves:</p>
<ol>
<li>Creating an MCP configuration file (e.g., <code>mcp-config.json</code>):</li>
</ol>
<pre><code class="lang-json">{
  <span class="hljs-attr">"mcpServers"</span>: {
    <span class="hljs-attr">"user-tools-server"</span>: {
      <span class="hljs-attr">"command"</span>: <span class="hljs-string">"java"</span>,
      <span class="hljs-attr">"args"</span>: [
        <span class="hljs-string">"-Dspring.ai.mcp.server.stdio=true"</span>,
        <span class="hljs-string">"-Dspring.main.web-application-type=none"</span>,
        <span class="hljs-string">"-Dlogging.pattern.console="</span>,
        <span class="hljs-string">"-jar"</span>,
        <span class="hljs-string">"path/to/your-mcp-server.jar"</span>
      ]
    }
  }
}
</code></pre>
<ol start="2">
<li>Referencing this configuration when starting your AI assistant</li>
</ol>
<h2 id="heading-code">Code</h2>
<p>You can find the source code here: <a target="_blank" href="https://github.com/mtwn105/mcp-server-spring-java">mtwn105/mcp-server-spring-java: MCP Server using Spring Boot Ja</a><a target="_blank" href="https://github.com/mtwn105/mcp-server-spring-java">va</a></p>
<h2 id="heading-conclusionhttpsgithubcommtwn105mcp-server-spring-java"><a target="_blank" href="https://github.com/mtwn105/mcp-server-spring-java">Conclusion</a></h2>
<p><a target="_blank" href="https://github.com/mtwn105/mcp-server-spring-java">Building an MCP server with Spring Boot and Java provide</a>s a powerful way to expose your services to AI assistants. By leveraging Spring's robust ecosystem and the standardized MCP protocol, you can create tools that enhance AI capabilities while maintaining control over your business logic.</p>
<p>The MCP approach offers several benefits:</p>
<ul>
<li><p>Clear separation between AI and business logic</p>
</li>
<li><p>Standardized communication protocol</p>
</li>
<li><p>Tool discovery and documentation</p>
</li>
<li><p>Secure execution of sensitive operations</p>
</li>
</ul>
<p>As AI assistants become more integrated into our workflows, MCP servers will play a crucial role in extending their capabilities while keeping sensitive operations secure and controlled.</p>
<h2 id="heading-resources">Resources</h2>
<ul>
<li><p><a target="_blank" href="https://docs.spring.io/spring-ai/reference/index.html">Spring AI Documentation</a></p>
</li>
<li><p><a target="_blank" href="http://spec.modelcontextprotocol.io/">Model Context Protocol Specification</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[How to Self-Host Umami: A Step-by-Step Guide to Privacy-Focused Web Analytics (With Docker Setup)]]></title><description><![CDATA[Umami is a simple, privacy-focused, open-source web analytics solution. It’s lightweight, doesn’t rely on cookies, and offers clean, insightful dashboards…]]></description><link>https://blog.amitwani.dev/how-to-self-host-umami-a-step-by-step-guide-to-privacy-focused-web-analytics-with-docker-setup</link><guid isPermaLink="true">https://blog.amitwani.dev/how-to-self-host-umami-a-step-by-step-guide-to-privacy-focused-web-analytics-with-docker-setup</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[analytics]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[umami]]></category><category><![CDATA[Node.js]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sun, 16 Mar 2025 16:02:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1742140906505/1329774b-3293-4ef4-adee-9d2d5928e89c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Umami</strong> is a simple, privacy-focused, open-source web analytics solution. It’s lightweight, doesn’t rely on cookies, and offers clean, insightful dashboards — making it a great alternative to tools like Google Analytics if you’re serious about privacy and data ownership.</p>
<p>In this guide, we’ll walk through how to self-host Umami on your server, both <strong>manually</strong> and using <strong>Docker</strong>. Whether you prefer fine-grained control or a quick containerized deployment, you’ll find everything you need here.</p>
<h3 id="heading-why-self-host-umami">🚀 Why Self-Host Umami?</h3>
<ul>
<li><p><strong>Data Privacy</strong>: You control your analytics data.</p>
</li>
<li><p><strong>Lightweight</strong>: Fast and minimal resource consumption.</p>
</li>
<li><p><strong>No Tracking Consent Needed</strong>: Since Umami doesn’t use cookies or collect personal data.</p>
</li>
<li><p><strong>Open-Source</strong>: Free to use and customizable.</p>
</li>
</ul>
<h3 id="heading-manual-setup-guide-for-umami">Manual Setup Guide for Umami</h3>
<h3 id="heading-prerequisites">🛠️ Prerequisites</h3>
<ul>
<li><p>A Linux-based server (Ubuntu recommended)</p>
</li>
<li><p>Node.js (v18.18 or newer)</p>
</li>
<li><p>MySQL (v8+) or PostgreSQL (v12+)</p>
</li>
<li><p>Nginx (for reverse proxy)</p>
</li>
<li><p>Domain name (optional but recommended)</p>
</li>
</ul>
<h3 id="heading-1-install-dependencies">1️⃣ Install Dependencies</h3>
<h4 id="heading-nodejs-amp-npm">Node.js &amp; npm</h4>
<pre><code class="lang-bash">curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v
npm -v
</code></pre>
<h4 id="heading-database-postgresql-example">Database (PostgreSQL Example)</h4>
<pre><code class="lang-bash">sudo apt update
sudo apt install postgresql postgresql-contrib
sudo -u postgres psql
CREATE DATABASE umami;
CREATE USER umami WITH ENCRYPTED PASSWORD <span class="hljs-string">'strongpassword'</span>;
GRANT ALL PRIVILEGES ON DATABASE umami TO umami;
</code></pre>
<h3 id="heading-2-install-umami">2️⃣ Install Umami</h3>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/umami-software/umami.git
<span class="hljs-built_in">cd</span> umami
npm install
cp .env.example .env
</code></pre>
<p>Edit your <code>.env</code> file to include your <strong>database credentials</strong>:</p>
<pre><code class="lang-bash">DATABASE_URL=postgresql://umami:strongpassword@localhost:5432/umami
HASH_SALT=some-random-salt-value
</code></pre>
<h3 id="heading-3-build-and-start-umami">3️⃣ Build and Start Umami</h3>
<pre><code class="lang-bash">npm run build
npm start
</code></pre>
<p>(Optional) Use PM2 to keep the app running:</p>
<pre><code class="lang-bash">npm install pm2 -g
pm2 start npm --name umami -- start
pm2 save
</code></pre>
<h3 id="heading-4-set-up-nginx-reverse-proxy-optional-but-recommended">4️⃣ Set Up Nginx Reverse Proxy (Optional but recommended)</h3>
<pre><code class="lang-nginx"><span class="hljs-section">server</span> {
    <span class="hljs-attribute">server_name</span> analytics.yourdomain.com;
    <span class="hljs-attribute">location</span> / {
        <span class="hljs-attribute">proxy_pass</span> http://localhost:3000;
        <span class="hljs-attribute">proxy_set_header</span> Host <span class="hljs-variable">$host</span>;
        <span class="hljs-attribute">proxy_set_header</span> X-Real-IP <span class="hljs-variable">$remote_addr</span>;
        <span class="hljs-attribute">proxy_set_header</span> X-Forwarded-For <span class="hljs-variable">$proxy_add_x_forwarded_for</span>;
    }
}
</code></pre>
<p>Don’t forget SSL! Use Let’s Encrypt or another certificate provider.</p>
<h3 id="heading-docker-setup-guide-for-umami">⚓ Docker Setup Guide for Umami</h3>
<p>If you want a <strong>quicker and easier</strong> deployment option, <strong>Docker</strong> is your friend!</p>
<h3 id="heading-prerequisites-1">🛠️ Prerequisites</h3>
<ul>
<li><p>Docker</p>
</li>
<li><p>Docker Compose (optional, but helpful)</p>
</li>
<li><p>A server (local or cloud)</p>
</li>
</ul>
<h3 id="heading-1-clone-the-repository">1️⃣ Clone the Repository</h3>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/umami-software/umami.git
<span class="hljs-built_in">cd</span> umami
</code></pre>
<h3 id="heading-2-modify-docker-environment-variables">2️⃣ Modify Docker Environment Variables</h3>
<p>Rename and edit the <code>.env</code> file:</p>
<pre><code class="lang-bash">cp .env.example .env
</code></pre>
<p>Modify the following variables as needed (Postgres example):</p>
<pre><code class="lang-bash">DATABASE_URL=postgresql://umami:strongpassword@db:5432/umami
HASH_SALT=some-random-salt-value
</code></pre>
<h3 id="heading-3-create-the-docker-compose-file">3️⃣ Create the Docker Compose File</h3>
<p>Here’s a sample <code>docker-compose.yml</code> for Umami with PostgreSQL:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3'</span>

<span class="hljs-attr">services:</span>
  <span class="hljs-attr">db:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">postgres:15</span>
    <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">POSTGRES_DB:</span> <span class="hljs-string">umami</span>
      <span class="hljs-attr">POSTGRES_USER:</span> <span class="hljs-string">umami</span>
      <span class="hljs-attr">POSTGRES_PASSWORD:</span> <span class="hljs-string">strongpassword</span>
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">umami-db-data:/var/lib/postgresql/data</span>

  <span class="hljs-attr">umami:</span>
    <span class="hljs-attr">image:</span> <span class="hljs-string">ghcr.io/umami-software/umami:postgresql-latest</span>
    <span class="hljs-attr">restart:</span> <span class="hljs-string">always</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"3000:3000"</span>
    <span class="hljs-attr">environment:</span>
      <span class="hljs-attr">DATABASE_URL:</span> <span class="hljs-string">postgresql://umami:strongpassword@db:5432/umami</span>
      <span class="hljs-attr">HASH_SALT:</span> <span class="hljs-string">some-random-salt-value</span>
    <span class="hljs-attr">depends_on:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">db</span>

<span class="hljs-attr">volumes:</span>
  <span class="hljs-attr">umami-db-data:</span>
</code></pre>
<h3 id="heading-4-start-the-containers">4️⃣ Start the Containers</h3>
<p>Run the following command to spin up the services:</p>
<pre><code class="lang-bash">docker-compose up -d
</code></pre>
<h3 id="heading-5-access-your-umami-instance">5️⃣ Access Your Umami Instance</h3>
<p>Visit <code>http://your-server-ip:3000</code> or your configured domain.</p>
<p>Default login credentials:</p>
<pre><code class="lang-plaintext">Username: admin
Password: umami
</code></pre>
<p>Make sure to <strong>change your password immediately</strong> after logging in!</p>
<h3 id="heading-optional-secure-umami-with-ssl-nginx-recommended">🔒 Optional: Secure Umami with SSL + Nginx (Recommended)</h3>
<p>Add an Nginx reverse proxy and set up SSL for your Docker deployment too! Same as the manual setup Nginx block above.</p>
<h3 id="heading-conclusion">✅ Conclusion</h3>
<p>That’s it! You’ve successfully self-hosted Umami either <strong>manually</strong> or using <strong>Docker</strong>. You now have a privacy-first analytics solution where you <strong>own your data</strong> and keep your users’ privacy intact.</p>
<p>For more information or advanced configurations, refer to the official Umami documentation: <a target="_blank" href="https://umami.is/docs">https://umami.is/docs</a></p>
<h3 id="heading-whats-next">💡 What’s Next?</h3>
<ul>
<li>Connect your websites by adding the Umami script:</li>
</ul>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">async</span> <span class="hljs-attr">defer</span> <span class="hljs-attr">data-website-id</span>=<span class="hljs-string">"YOUR-WEBSITE-ID"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"https://analytics.yourdomain.com/script.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre>
<ul>
<li><p>Create custom reports and share dashboards.</p>
</li>
<li><p>Explore advanced tracking options with events and goals.</p>
</li>
</ul>
<p>👉 Have questions or feedback? Drop them in the comments!</p>
<p>👉 Like the post if you found it helpful!</p>
]]></content:encoded></item><item><title><![CDATA[Explore Your GitHub Journey with GitHub Wrapped]]></title><description><![CDATA[Your Year in Code 2024]]></description><link>https://blog.amitwani.dev/explore-your-github-journey-with-github-wrapped</link><guid isPermaLink="true">https://blog.amitwani.dev/explore-your-github-journey-with-github-wrapped</guid><category><![CDATA[GitHub]]></category><category><![CDATA[coding]]></category><category><![CDATA[Next.js]]></category><category><![CDATA[Spring]]></category><category><![CDATA[Springboot]]></category><category><![CDATA[Java]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[GraphQL]]></category><category><![CDATA[Git]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Wed, 18 Dec 2024 04:20:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1734495062201/74ab8179-b5c2-4791-8934-d4fcd36e6ed7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Have you ever wondered how much you've grown as a developer over the past year? What milestones you've hit, or what projects defined your coding journey? Enter <a target="_blank" href="https://githubwrapped.xyz"><strong>GitHub Wrapped</strong></a>, a delightful way to visualize and celebrate your year in code.</p>
<h2 id="heading-what-is-github-wrapped">What is GitHub Wrapped?</h2>
<p>Inspired by Spotify Wrapped, GitHub Wrapped is a creative project that generates a personalized report of your GitHub activity for the year. From the number of commits you’ve made to the repositories you’ve contributed to, it showcases the highlights of your coding journey in a visually engaging format.</p>
<p>The project is hosted on GitHub and is open-source, meaning anyone can contribute or customize it to fit their needs. Additionally, you can access it directly via its dedicated website: <a target="_blank" href="https://githubwrapped.xyz">GitHubWrapped.xyz</a></p>
<h2 id="heading-features-of-github-wrapped">Features of GitHub Wrapped</h2>
<p>Here are some of the key features that make GitHub Wrapped a must-try for developers:</p>
<ol>
<li><p><strong>Commit Insights</strong>: See how many commits you've made throughout the year and identify your most productive months.</p>
</li>
<li><p><strong>Repository Highlights</strong>: Discover which repositories you’ve spent the most time contributing to.</p>
</li>
<li><p><strong>Language Trends</strong>: Get a breakdown of the programming languages you’ve used the most.</p>
</li>
<li><p><strong>Visualization</strong>: Enjoy beautifully designed charts and graphs that make your GitHub journey come alive.</p>
</li>
<li><p><strong>Shareable Reports</strong>: Export your Wrapped report and share it with your network to celebrate your achievements.</p>
</li>
</ol>
<h2 id="heading-how-to-use-github-wrapped">How to Use GitHub Wrapped</h2>
<p>Getting started with GitHub Wrapped is incredibly easy. Simply visit <a target="_blank" href="https://githubwrapped.xyz">GitHubWrapped.xyz</a>, enter your GitHub username, and let the platform generate your personalized report. Within moments, you’ll have a visually stunning summary of your year in code ready to explore, save, and share. You don’t need to log in, and you can access your report anytime via <strong>GitHubWrapped.xyz/&lt;username&gt;</strong>.</p>
<h2 id="heading-why-celebrate-your-github-journey">Why Celebrate Your GitHub Journey?</h2>
<p>As developers, we often get caught up in the daily grind of coding, debugging, and meeting deadlines. GitHub Wrapped offers a moment to pause and reflect on your growth, achievements, and the impact you’ve made through your code. It’s not just about numbers; it’s about celebrating your passion for technology and the community you’re a part of.</p>
<h2 id="heading-contribute-to-github-wrapped">Contribute to GitHub Wrapped</h2>
<p>Since GitHub Wrapped is an open-source project, you can contribute by:</p>
<ul>
<li><p>Adding new features or improving existing ones.</p>
</li>
<li><p>Fixing bugs or optimizing performance.</p>
</li>
<li><p>Enhancing the UI/UX for a better user experience.</p>
</li>
<li><p>Translating the project into other languages to reach a global audience.</p>
</li>
</ul>
<p>To explore the code or contribute, visit the GitHub repository here: Y</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/GitHubWrapped">https://github.com/mtwn105/GitHubWrapped</a></div>
<p> </p>
<p>Fork the repository, make your changes, and submit a pull request. Your contributions could help make GitHub Wrapped even more enjoyable for developers worldwide.</p>
<h2 id="heading-final-thoughts">Final Thoughts</h2>
<p>GitHub Wrapped is more than just a tool; it’s a celebration of your coding journey. Whether you’re a seasoned developer or just starting out, it’s a fun and insightful way to look back on your year and set new goals for the future.</p>
<p>So, what are you waiting for? Dive into GitHub Wrapped and relive your year in code. Share your report with the world and inspire others to reflect on their own journeys. Happy coding!</p>
<h3 id="heading-check-out-my-other-creations">Check Out My Other Creations</h3>
<p><strong>My GitHub:</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105">https://github.com/mtwn105</a></div>
<p> </p>
<p>If you enjoyed GitHub Wrapped, you might also like some of my other projects:</p>
<ul>
<li><p><a target="_blank" href="https://audiointel.amitwani.dev"><strong>AudioIntel</strong></a>: A powerful tool for audio analysis and insights.</p>
</li>
<li><p><a target="_blank" href="https://sgbanalyzer.com"><strong>SGBAnalyzer</strong></a>: A comprehensive platform for analyzing Sovereign Gold Bonds.</p>
</li>
</ul>
<p>Stay tuned for more exciting projects and updates!</p>
]]></content:encoded></item><item><title><![CDATA[Xpenser - AI Expense Manger using Twilio & Gemini AI with WhatsApp Integration]]></title><description><![CDATA[Power of Twilio & Gemini AI]]></description><link>https://blog.amitwani.dev/xpenser-ai-expense-manger-using-twilio-gemini-ai-with-whatsapp-integration</link><guid isPermaLink="true">https://blog.amitwani.dev/xpenser-ai-expense-manger-using-twilio-gemini-ai-with-whatsapp-integration</guid><category><![CDATA[AI]]></category><category><![CDATA[gemini]]></category><category><![CDATA[whatsapp]]></category><category><![CDATA[twilio]]></category><category><![CDATA[Angular]]></category><category><![CDATA[Bulma]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 27 Jul 2024 06:48:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1722062811942/c46cbef8-6703-471f-9358-37be3c0b8fb2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-i-built">What I Built</h2>
<p><strong>Xpenser</strong> is not just a simple expense manager. It is an advanced expense management tool that simplifies logging and analyzing your spending habits. With robust features, including seamless <strong>WhatsApp integration</strong> powered by <strong>Twilio</strong>, Xpenser stands out as a unique solution for personal finance management.</p>
<h2 id="heading-demo">Demo</h2>
<p>Checkout the Demo on YouTube at:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/r4B9uW-3aeQ">https://youtu.be/r4B9uW-3aeQ</a></div>
<p> </p>
<p>Experience Xpenser live <a target="_blank" href="https://xpenser.amitwani.dev">https://xpenser.amitwani.dev</a>.</p>
<p>Explore the project on GitHub: <a target="_blank" href="https://github.com/mtwn105/xpenser-whatsapp-bot">https://github.com/mtwn105/xpenser-whatsapp-bot</a></p>
<p>To test the WhatsApp integration, join the Twilio Sandbox WhatsApp Number: <a target="_blank" href="https://wa.me/+14155238886">+14155238886</a> by sending <code>join per-mud</code></p>
<h3 id="heading-workflow">Workflow</h3>
<h3 id="heading-user-registration">User Registration</h3>
<p>Users register on the web portal, verifying their phone numbers via OTP (Powered by Twilio Verify).</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ctisw6tmbqvdw25n4mxa.png" alt="User Registration" /></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qvwyja8ag0phud3vf98t.png" alt="User Registration OTP" /></p>
<h3 id="heading-dashboard">Dashboard</h3>
<p>The dashboard offers detailed analytics, including <strong>AI-driven insights</strong>, <strong>category-wise distribution</strong>, and <strong>average spending</strong>.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nv197f1m3jx8zigb4kcr.png" alt="Dashboard" /></p>
<h3 id="heading-expenses">Expenses</h3>
<p>Users can easily <strong>add</strong>, <strong>manage</strong>, and <strong>delete</strong> expenses. The <strong>AI</strong> automatically categorizes expenses upon saving.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6pjvv9ns0w14ck167sia.png" alt="Add Expense" /></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i07vsr7abupddbc4a748.png" alt="Expense List" /></p>
<h3 id="heading-whatsapp-integration">WhatsApp Integration</h3>
<p>Join the Twilio Sandbox WhatsApp Number: <a target="_blank" href="https://wa.me/+14155238886">+14155238886</a> by sending <code>join per-mud</code></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7gfgmz5yodgw51wakav.png" alt="WhatsApp Join" /></p>
<p>Log new expenses effortlessly via WhatsApp. The <strong>AI</strong> interprets user messages to gather details for saving the expense.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qmtvcrhzffom52r14jpz.png" alt="WhatsApp Log Expense" /></p>
<p>Request insights on spending, such as top categories or average spending. The AI provides answers based on the last 100 expenses.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3mgvenhhzy7yp4j5tunl.png" alt="WhatsApp Expense Analysis" /></p>
<h2 id="heading-tech-stack">Tech Stack</h2>
<p><strong>Backend:</strong> NodeJS, Express <strong>Frontend:</strong> Angular, Typescript <strong>Database:</strong> MongoDB <strong>Deployment:</strong> Docker, Northflank <strong>AI:</strong> Gemini 1.5 Flash <strong>Twilio:</strong> Verify, Functions, WhatsApp</p>
<h3 id="heading-architecture">Architecture</h3>
<h3 id="heading-whatsapp-integration-1">WhatsApp Integration</h3>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g2kwfuz0xisu96uhinl9.png" alt="WhatsApp Integration" /></p>
<h3 id="heading-portal">Portal</h3>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ftxcofyz1hawirhjeq0k.png" alt="Xpenser Portal" /></p>
<h2 id="heading-twilio-and-ai">Twilio and AI</h2>
<h3 id="heading-twilio">Twilio</h3>
<p>Xpenser leverages three Twilio services: <strong>Verify</strong>, <strong>Functions</strong> and <strong>WhatsApp Messaging</strong></p>
<p><strong>Verify</strong></p>
<p>Twilio's Verify service sends OTPs for user authentication.</p>
<p><strong>Send OTP</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> verification = <span class="hljs-keyword">await</span> client.verify.v2.services(otpServiceId)
      .verifications
      .create({ to: req.body.phonenumber, channel: <span class="hljs-string">'sms'</span> });
</code></pre>
<p><strong>Verify OTP</strong></p>
<pre><code class="lang-typescript"> <span class="hljs-keyword">const</span> verification = <span class="hljs-keyword">await</span> client.verify.v2.services(otpServiceId)
      .verificationChecks
      .create({ to: req.body.phonenumber, code: req.body.code })
</code></pre>
<p><strong>Functions</strong></p>
<p>Twilio Functions handles incoming WhatsApp messages, interfacing with the <strong>backend</strong> and <strong>Gemini AI</strong>.</p>
<p>Generated functions using</p>
<pre><code class="lang-bash"> twilio serverless:init twilio --typescript
</code></pre>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> handler: ServerlessFunctionSignature = <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> (<span class="hljs-params">
  context: Context&lt;MyContext&gt;,
  event: MyEvent,
  callback: ServerlessCallback
</span>) </span>{
  <span class="hljs-comment">// Handle Incoming Message </span>
}
</code></pre>
<p><strong>WhatsApp Messaging</strong></p>
<p>Twilio's Programmable WhatsApp Messaging facilitates user interaction through WhatsApp.</p>
<p><strong>Send WhatsApp Message using TwiML</strong></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> twiml = <span class="hljs-keyword">new</span> Twilio.twiml.MessagingResponse();
twiml.message(<span class="hljs-string">"Please ask about spends you have done or spend you want to log."</span>);
callback(<span class="hljs-literal">null</span>, twiml);
</code></pre>
<h3 id="heading-ai">AI</h3>
<p><strong>Gemini 1.5 Flash</strong>, a Google AI Model, enhances Xpenser with advanced analytics and predictions.</p>
<p><strong>Expense Analytics</strong></p>
<p>Analyzing user expense history to provide insights and respond to user queries.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> analyticsModel = genAI.getGenerativeModel({
    model: <span class="hljs-string">"gemini-1.5-flash"</span>,
    systemInstruction: <span class="hljs-string">"Based on below expenses done by user give answer to user. Optimize as WhatsApp message reply and add emojis.\n\nExpense History:\n"</span> + expenseCsvText,
  });

<span class="hljs-keyword">const</span> generationConfig = {
  temperature: <span class="hljs-number">0.6</span>,
  topP: <span class="hljs-number">0.95</span>,
  topK: <span class="hljs-number">64</span>,
  maxOutputTokens: <span class="hljs-number">8192</span>,
  responseMimeType: <span class="hljs-string">"application/json"</span>,
};

<span class="hljs-keyword">const</span> chatSession = model.startChat({
  generationConfig
});

<span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> chatSession.sendMessage(event.Body);
<span class="hljs-keyword">const</span> aiResponse = result.response.text()
</code></pre>
<p><strong>Expense Categorization</strong></p>
<p>Categorizing expenses based on user-provided descriptions.</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> analyticsModel = genAI.getGenerativeModel({
    model: <span class="hljs-string">"gemini-1.5-flash"</span>,
    systemInstruction: <span class="hljs-string">"detect the category and subcategory from below\n1. Housing - Rent, Taxes, Insurance, Utilities, Repairs, Improvement, Fees\n2. Transportation - Payments, Fuel, Insurance, Repairs, Public, Parking, Tolls, Licensing\n3. Food - Groceries, Dining, Coffee, Delivery, Snacks, etc."</span>,
  });

<span class="hljs-keyword">const</span> generationConfig = {
  temperature: <span class="hljs-number">0.6</span>,
  topP: <span class="hljs-number">0.95</span>,
  topK: <span class="hljs-number">64</span>,
  maxOutputTokens: <span class="hljs-number">8192</span>,
  responseMimeType: <span class="hljs-string">"application/json"</span>,
};

<span class="hljs-keyword">const</span> chatSession = model.startChat({
  generationConfig
});

<span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> chatSession.sendMessage(event.Body);
<span class="hljs-keyword">const</span> aiResponse = result.response.text()
</code></pre>
<h2 id="heading-future-scope">Future Scope</h2>
<ul>
<li><p>Spending Habits: Use AI to identify spending patterns and suggest ways to optimize expenses based on historical data.</p>
</li>
<li><p>Mobile Applications: Develop native iOS and Android applications for enhanced accessibility and seamless user experience.</p>
</li>
<li><p>Custom Reports: Allow users to generate customizable reports based on various parameters such as date range, categories, or tags.</p>
</li>
<li><p>Investment Tracking: Add features to track investments and provide insights into portfolio performance.</p>
</li>
<li><p>Manage Categories: Create and manage custom categories and sub-categories for a more personalized experience.</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>It was a great experience to work on this project while exploring <strong>Twilio</strong> services and integrating AI to enhance the user experience.</p>
]]></content:encoded></item><item><title><![CDATA[Recruitify - Built using AWS Amplify, DynamoDB, Lambda, Bedrock]]></title><description><![CDATA[Where Talent Meets Opportunity]]></description><link>https://blog.amitwani.dev/recruitify-built-using-aws-amplify-dynamodb-lambda-bedrock</link><guid isPermaLink="true">https://blog.amitwani.dev/recruitify-built-using-aws-amplify-dynamodb-lambda-bedrock</guid><category><![CDATA[AWS]]></category><category><![CDATA[AWS Amplify]]></category><category><![CDATA[Angular]]></category><category><![CDATA[Angular 2]]></category><category><![CDATA[aws lambda]]></category><category><![CDATA[TypeScript]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[DynamoDB]]></category><category><![CDATA[Amazon Bedrock]]></category><category><![CDATA[AI]]></category><category><![CDATA[Artificial Intelligence]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 29 Jun 2024 08:37:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1719650175610/8d783648-65ca-43f5-b686-da76beb033e5.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-i-built">What I Built</h2>
<p><strong>Recruitify</strong> is a platform designed to bridge the gap between job seekers and employers. It provides a seamless experience for both parties to find the perfect match for their needs.</p>
<h2 id="heading-features">Features</h2>
<p><strong>Employer</strong></p>
<ul>
<li><p>Create Job Postings: Employers can create detailed job listings specifying required skills, experience, location, and more.</p>
</li>
<li><p>Manage Applications: Employers can efficiently manage and validate applications received for their job postings.</p>
</li>
</ul>
<p><strong>Job Seeker</strong></p>
<ul>
<li><p>Browse Jobs: Job seekers can search and filter job listings based on their preferences.</p>
</li>
<li><p>Apply for Jobs: Easily apply for various job opportunities.</p>
</li>
<li><p>Receive Notifications: Get notified about new job listings that match your skills</p>
</li>
</ul>
<h2 id="heading-demo-and-code">Demo and Code</h2>
<p><strong>Recruitify</strong> is available <a target="_blank" href="https://main.d14oy3wnmg7qbg.amplifyapp.com/">here</a> and the code is available on GitHub.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/recruitify">https://github.com/mtwn105/recruitify</a></div>
<p> </p>
<h3 id="heading-screenshots">Screenshots</h3>
<p>Browse Jobs Page</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c0zoqco99fx2x0zyq3mc.png" alt="Browse Jobs Page" /></p>
<p>Edit Profile</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3rvwyhqc3ep9fpbu26hk.png" alt="Edit Profile" /></p>
<p>Create/Edit Job Posting</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9xcu601w7fid33rqus1z.png" alt="Create/Edit Job Posting" /></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ww7prb0rdtiz2ctcwo0v.png" alt="Create/Edit Job Posting2" /></p>
<p>Generate Job Description</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/llvf6zgnnru0mxj0adjk.png" alt="Generate Job Description
" /></p>
<p>Job Details Page (Job Creator)</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72o7a91ymvwmba1eyz3m.png" alt="Job Details Page (Job Creator)" /></p>
<p>Job Details Page (Job Seeker)</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abmxtlvbt18jtjgoo738.png" alt="Job Details Page (Job Seeker)" /></p>
<p>Job Applications Page (Job Seeker)</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqhea926ewge6qbap3r3.png" alt="Job Seeker" /></p>
<p>Job Applications Page (Job Creator)</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e7r39avlzyrishvioszp.png" alt="Job Applications Page (Job Creator)" /></p>
<p>New Job Notification</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ejyto9hwbxyv0plev8p.png" alt="New Job Notification" /></p>
<h2 id="heading-integrations">Integrations</h2>
<h3 id="heading-tech-stack">Tech Stack</h3>
<ul>
<li><p><strong>Backend</strong>: AWS Amplify</p>
</li>
<li><p><strong>Frontend</strong>: Angular 17, Angular Material, Tailwind CSS</p>
</li>
<li><p><strong>AWS Technologies</strong>: Data (DynamoDB), Authentication (Cognito), Serverless Functions (Lambda), File Storage (S3), AI (Bedrock)</p>
</li>
<li><p><strong>Hosting</strong>: AWS Amplify</p>
</li>
</ul>
<p><strong>Connected Components and Feature Full</strong></p>
<p>This project uses Amplify-connected components for Angular - <strong>Authenticator</strong> for users to sign up and log in.</p>
<p>This project also integrates all four integrations - <strong>Data, Authentication, Serverless Functions, File Storage</strong></p>
<h3 id="heading-aws-amplify">AWS Amplify</h3>
<p><strong>Architecture</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k24glf82owsx0w66p5qd.png" alt="recruitify-aws-architecture" /></p>
<p><strong>Authentication</strong></p>
<p>Utilizes AWS Amplify Authentication for user sign-up and login via email which uses AWS Cognito services.</p>
<p>Configured in <code>amplify/auth/resource.ts</code></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> auth = defineAuth({
  loginWith: {
    email: <span class="hljs-literal">true</span>,
  }
});
</code></pre>
<p>Implemented with the Amplify UI component <code>&lt;amplify-authenticator&gt;</code> for Angular.</p>
<p><strong>Data</strong></p>
<p>Utilizes AWS Amplify Data to store information about <strong>Users</strong>, <strong>Companies</strong>, and <strong>Jobs</strong> which uses AWS DynamoDB. Database Design is shown above.</p>
<p>Configured in <code>amplify/data/resource.ts</code></p>
<p><strong>Database Design</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m2u5ksntgvh84ju606pl.png" alt="Recruityfy-DB" /></p>
<p><strong>Storage</strong></p>
<p>AWS Amplify S3 Storage is used for storing company <strong>logos</strong> and job seeker <strong>resumes</strong>.</p>
<p>Configured in <code>amplify/storage/resource.ts</code></p>
<pre><code class="lang-typescript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> storage = defineStorage({
  name: <span class="hljs-string">'recruitifyFiles'</span>,
  access: <span class="hljs-function">(<span class="hljs-params">allow</span>) =&gt;</span> ({
    <span class="hljs-string">'companyLogos/*'</span>: [
      allow.authenticated.to([<span class="hljs-string">'read'</span>, <span class="hljs-string">'write'</span>]),
      allow.guest.to([<span class="hljs-string">'read'</span>, <span class="hljs-string">'write'</span>])
    ],
    <span class="hljs-string">'resumes/*'</span>: [
      allow.authenticated.to([<span class="hljs-string">'read'</span>, <span class="hljs-string">'write'</span>]),
      allow.guest.to([<span class="hljs-string">'read'</span>, <span class="hljs-string">'write'</span>])
    ],
  })
});
</code></pre>
<p>The files were uploaded using <code>uploadData</code> like below</p>
<pre><code class="lang-typescript"> <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> uploadData({
        data: <span class="hljs-built_in">this</span>.previewUrl,
        path: <span class="hljs-string">`companyLogos/<span class="hljs-subst">${<span class="hljs-built_in">this</span>.authService?.userProfile?.id}</span>`</span>,
      }).result;
</code></pre>
<p>And the files were downloaded when necessary using <code>downloadData</code> like below</p>
<pre><code class="lang-typescript"> downloadData({ path: profile.data[<span class="hljs-number">0</span>].resume })
</code></pre>
<p><strong>Functions</strong></p>
<p>AWS Amplify Lambda Functions are used to send <strong>New Job Notifications</strong> to job seekers matching their skill set and <strong>Generate Job Descriptions</strong> to generate job descriptions for job creators.</p>
<p>Used AWS Amplify <strong>AppSync GraphQL API</strong> inside the function to find relevant job seekers and create new job notifications.</p>
<p>Used <strong>AWS Bedrock</strong> with Mistral AI Model inside the function to generate job descriptions.</p>
<p>Configured in <code>amplify/functions/new-job/handler.ts</code></p>
<p>Triggered when a new job is created by an employer using a mutation in data like the below:</p>
<pre><code class="lang-typescript">sendJobNotification: a.mutation()
    .arguments({ jobId: a.string(), companyId: a.string() })
    .returns(a.string())
    .authorization(<span class="hljs-function"><span class="hljs-params">allow</span> =&gt;</span> [allow.publicApiKey()])
    .handler(a.handler.function(newJob))
</code></pre>
<pre><code class="lang-typescript">client.mutations.sendJobNotification({
        jobId: job.data?.id,
        companyId: job.data?.companyId
      }).then(<span class="hljs-function">(<span class="hljs-params">job</span>) =&gt;</span> {
        <span class="hljs-built_in">console</span>.log(job)
      })
</code></pre>
<p>Triggered generate job description like the below:</p>
<pre><code class="lang-typescript">generateJobDescription: a.mutation()
    .arguments({ title: a.string(), minExperience: a.float(), skills: a.string(), domain: a.string() })
    .returns(a.string())
    .authorization(<span class="hljs-function"><span class="hljs-params">allow</span> =&gt;</span> [allow.publicApiKey()])
    .handler(a.handler.function(generateJobDescription))
</code></pre>
<pre><code class="lang-typescript">client.mutations.generateJobDescription({
      title: <span class="hljs-built_in">this</span>.createJobForm.value.title,
      skills: <span class="hljs-built_in">this</span>.skills.join(<span class="hljs-string">','</span>),
      domain: <span class="hljs-built_in">this</span>.createJobForm.value.domain,
      minExperience: <span class="hljs-built_in">this</span>.createJobForm.value.minExperience,
    }).then(<span class="hljs-function">(<span class="hljs-params">response</span>) =&gt;</span> {
      <span class="hljs-built_in">console</span>.log(response);
      <span class="hljs-keyword">if</span> (response?.data) {
        <span class="hljs-built_in">this</span>.createJobForm.patchValue({
          description: response.data
        })
      }
    }).finally(<span class="hljs-function">() =&gt;</span> {
      <span class="hljs-built_in">this</span>.loadingService.hide();
    })
</code></pre>
<p>Used <strong>Mistral 7B</strong> model with prompt like this:</p>
<pre><code class="lang-typescript"> <span class="hljs-keyword">const</span> text = <span class="hljs-string">`
          Job Title: <span class="hljs-subst">${title}</span>
          Job Domain: <span class="hljs-subst">${domain}</span>
          Job Min Experience: <span class="hljs-subst">${minExperience}</span> years
          Job Required Skills: <span class="hljs-subst">${skills}</span>
        `</span>
    <span class="hljs-keyword">const</span> prompt = <span class="hljs-string">`Your task is to generate a job description for below-given job details.

        Job Details: <span class="hljs-subst">${text}</span>

        Job Description: `</span>
</code></pre>
<p>And invoke the model like below:</p>
<pre><code class="lang-typescript"><span class="hljs-keyword">const</span> input = {
      modelId: <span class="hljs-string">"mistral.mistral-7b-instruct-v0:2"</span>,
      contentType: <span class="hljs-string">"application/json"</span>,
      accept: <span class="hljs-string">"application/json"</span>,
      body: <span class="hljs-built_in">JSON</span>.stringify({
        prompt: <span class="hljs-string">`&lt;s&gt;[INST] <span class="hljs-subst">${prompt}</span> [/INST]`</span>,
        max_tokens: <span class="hljs-number">2000</span>,
        temperature: <span class="hljs-number">0.5</span>,
      }),
    } <span class="hljs-keyword">as</span> InvokeModelCommandInput;
</code></pre>
<p><strong>Hosting</strong></p>
<p>Utilised AWS Hosting for seamless deployment of the application.</p>
<h2 id="heading-future-scope">Future Scope</h2>
<ul>
<li><p><strong>Application Notifications</strong>: Notifications for Job Application status changes for both job seekers and employers</p>
</li>
<li><p><strong>Realtime chat messaging</strong>: Realtime chat messaging between job seeker and employer</p>
</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p><strong>Recruitify</strong> leverages the power of <strong>AWS Amplify</strong> to deliver a robust, full-stack application. There is a lot to learn while working with AWS and AWS Amplify toolkit along with Angular on this project.</p>
]]></content:encoded></item><item><title><![CDATA[Webbie - Create Bots from Your Data using MindsDB in minutes !]]></title><description><![CDATA[AI Agent Powered by MindsDB]]></description><link>https://blog.amitwani.dev/webbie-create-bots-from-your-data-using-mindsdb-in-minutes</link><guid isPermaLink="true">https://blog.amitwani.dev/webbie-create-bots-from-your-data-using-mindsdb-in-minutes</guid><category><![CDATA[AI]]></category><category><![CDATA[MindsDBHackathon]]></category><category><![CDATA[mindsdb]]></category><category><![CDATA[chatgpt]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Angular]]></category><category><![CDATA[Artificial Intelligence]]></category><category><![CDATA[chatbot]]></category><category><![CDATA[openai]]></category><category><![CDATA[bot]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Full Stack Development]]></category><category><![CDATA[PostgreSQL]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Mon, 15 Jan 2024 13:30:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1705313460555/b2704b54-b2c0-49c3-8925-9b6a15b98a1f.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>Hey, In this day and age of AI, we all want an assistant that will solve our specific problems. There have been many Large Language Models that solve generic problems and provide answers to them. But there's still a gap for tools where you can get answers just for your data. This is where the idea of Webbie comes in.</p>
<p><a target="_blank" href="https://webbie.amitwani.dev"><strong>Webbie - https://webbie.amitwani.dev</strong></a> is a simple tool, where you can create an AI bot in minutes, based on your provided information. This chat-based interface is swiftly generated using MindsDB in the backend, offering a personalized solution to users' unique needs.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705325136257/b6a6a9db-ca0e-43db-a139-7dcc3eaf9f29.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-tech-stack">Tech Stack</h1>
<ol>
<li><p><strong>Backend -</strong> Powered by NodeJS and Express.</p>
</li>
<li><p><strong>Frontend -</strong> Developed using Angular.</p>
</li>
<li><p><strong>Database -</strong> Utilizes PostgreSQL.</p>
</li>
<li><p><strong>Tools -</strong> Leverages MindsDB for machine learning capabilities.</p>
</li>
<li><p><strong>ML Engine -</strong> Employs LlamaIndex and Langchain for robust machine learning.</p>
</li>
<li><p><strong>Deployment -</strong> Utilizes Docker, DigitalOcean, and NorthFlank for efficient deployment.</p>
</li>
</ol>
<h2 id="heading-installation">Installation</h2>
<p><strong>Backend -</strong> The NodeJS server operates on a DigitalOcean droplet using <code>forever start server.js</code>.</p>
<p><strong>Frontend -</strong> The Angular application runs in a NorthFlank container, employing a Docker image with Nginx Reverse Proxy.</p>
<p><strong>Database -</strong> PostgreSQL operates on a DigitalOcean droplet as a service.</p>
<p><strong>Tools -</strong> MindsDB is hosted on a DigitalOcean droplet using <code>python -m mindsdb</code>.</p>
<h1 id="heading-components">Components</h1>
<h2 id="heading-data-sources">Data Sources</h2>
<p>Webbie supports three data sources (with potential for more in the future):</p>
<ol>
<li><p><strong>Text Data -</strong> Simple textual information.</p>
</li>
<li><p><strong>CSV File -</strong> A CSV file containing row/column-based data.</p>
</li>
<li><p><strong>Website Link -</strong> Any website link with pertinent information.</p>
</li>
</ol>
<h2 id="heading-ml-engine">ML Engine</h2>
<p>I have used <code>llama_index</code> handler from MindsDB to create an ML ENGINE first in the MindsDB.</p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> ML_ENGINE llamaindex
<span class="hljs-keyword">FROM</span> llama_index
</code></pre>
<h2 id="heading-openai">OpenAI</h2>
<p>You will have to provide an <strong>OpenAI API Key</strong> to create the bot. <em>This key is not stored in our database.</em></p>
<h2 id="heading-model">Model</h2>
<p>After providing the above details along with the bot name and bot description. Our middleware server built on NodeJS and Express will send queries to MindsDB for creating appropriate models.</p>
<p>I have used <code>llama_index</code> for this model and a <code>SimpleWebPageReader</code> reader of <code>llama_index</code></p>
<p>Now backend will create the model in MindsDB using a query like this -</p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">MODEL</span> abc
PREDICT answer
<span class="hljs-keyword">USING</span>
<span class="hljs-keyword">engine</span> = <span class="hljs-string">'llamaindex'</span>,
index_class = <span class="hljs-string">'GPTVectorStoreIndex'</span>,
reader = <span class="hljs-string">'SimpleWebPageReader'</span>,
source_url_link = <span class="hljs-string">'https://blog.amiwani.dev'</span>,
input_column = <span class="hljs-string">'question'</span>,
openai_api_key = <span class="hljs-string">'&lt;api-key&gt;'</span>;
</code></pre>
<p>Here <code>source_url_link</code> will be changed depending on the data source. Below is an explanation of how it is generated and used.</p>
<h3 id="heading-website-data-model">Website Data Model</h3>
<p>This was the easiest to do, as the user-provided URL can be directly passed to the model in the <code>source_url_link</code>.</p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">MODEL</span> abc
PREDICT answer
<span class="hljs-keyword">USING</span>
<span class="hljs-keyword">engine</span> = <span class="hljs-string">'llamaindex'</span>,
index_class = <span class="hljs-string">'GPTVectorStoreIndex'</span>,
reader = <span class="hljs-string">'SimpleWebPageReader'</span>,
source_url_link = <span class="hljs-string">'https://blog.amiwani.dev'</span>,
input_column = <span class="hljs-string">'question'</span>,
openai_api_key = <span class="hljs-string">'&lt;api-key&gt;'</span>;
</code></pre>
<h3 id="heading-text-data-model">Text Data Model</h3>
<p>For Textual Data, since the <code>llama_index</code> handler does not support text data out of the box, we create a text file and upload it to the server with the data input from the user. And then URL of that text file is provided to the model in the <code>source_url_link</code></p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">MODEL</span> abc
PREDICT answer
<span class="hljs-keyword">USING</span>
<span class="hljs-keyword">engine</span> = <span class="hljs-string">'llamaindex'</span>,
index_class = <span class="hljs-string">'GPTVectorStoreIndex'</span>,
reader = <span class="hljs-string">'SimpleWebPageReader'</span>,
source_url_link = <span class="hljs-string">'http://&lt;server&gt;/api/file/download/&lt;filename&gt;.txt'</span>,
input_column = <span class="hljs-string">'question'</span>,
openai_api_key = <span class="hljs-string">'&lt;api-key&gt;'</span>;
</code></pre>
<h3 id="heading-csv-file-data-model">CSV File Data Model</h3>
<p>For CSV File Data, since the <code>llama_index</code> handler does not support text data out of the box, we upload the CSV File to the server. And then URL of that text file is provided to the model in the <code>source_url_link</code></p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">MODEL</span> abc
PREDICT answer
<span class="hljs-keyword">USING</span>
<span class="hljs-keyword">engine</span> = <span class="hljs-string">'llamaindex'</span>,
index_class = <span class="hljs-string">'GPTVectorStoreIndex'</span>,
reader = <span class="hljs-string">'SimpleWebPageReader'</span>,
source_url_link = <span class="hljs-string">'http://&lt;server&gt;/api/file/download/&lt;filename&gt;.csv'</span>,
input_column = <span class="hljs-string">'question'</span>,
openai_api_key = <span class="hljs-string">'&lt;api-key&gt;'</span>;
</code></pre>
<h2 id="heading-slack">Slack</h2>
<p>You can also enable Slack notifications in a channel. You will receive notifications in a channel for every question asked to the bot along with the answer given by the bot.</p>
<p>You can add your <strong>Slack App Token</strong> and <strong>Slack Channel Name</strong> to enable notifications. <em>This app token is not stored in our database.</em></p>
<p>To obtain slack app token you can go to this <a target="_blank" href="https://docs.mindsdb.com/integrations/app-integrations/slack">guide</a></p>
<p>When the Slack notifications are enabled:</p>
<h3 id="heading-create-slack-database">Create Slack Database</h3>
<p>We will create a Slack database connection in the MindsDB as below:</p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">DATABASE</span> my_slack
<span class="hljs-keyword">WITH</span>
  <span class="hljs-keyword">ENGINE</span> = <span class="hljs-string">'slack'</span>,
  <span class="hljs-keyword">PARAMETERS</span> = {
      <span class="hljs-string">"token"</span>: <span class="hljs-string">"&lt;slack-token&gt;"</span>
    };
</code></pre>
<h3 id="heading-create-job">Create JOB</h3>
<p>We will create a JOB in MindsDB that will run every minute and send notification for every question asked to the bot:</p>
<pre><code class="lang-sql"><span class="hljs-keyword">CREATE</span> JOB job <span class="hljs-keyword">AS</span> (
<span class="hljs-keyword">INSERT</span> <span class="hljs-keyword">INTO</span> my_slack.channels(channel, <span class="hljs-built_in">text</span>)
<span class="hljs-keyword">SELECT</span>
   <span class="hljs-string">"&lt;channel-name&gt;"</span> <span class="hljs-keyword">as</span> channel,
   message <span class="hljs-keyword">as</span> <span class="hljs-built_in">text</span>
<span class="hljs-keyword">FROM</span> psql_datasource.transcript
<span class="hljs-keyword">WHERE</span> createdAt &gt; <span class="hljs-string">"{{PREVIOUS_START_DATETIME}} AND botId = "</span>&lt;bot-<span class="hljs-keyword">id</span>&gt;<span class="hljs-string">"
) EVERY MINUTE;</span>
</code></pre>
<p>This Job will read from <code>transcript</code> table in our PostgreSQL database for latest messages for this bot using <code>PREVIOUS_START_DATETIME</code> and <code>botId</code> and then send them in the appropriate Slack channel.</p>
<h1 id="heading-workflow">Workflow</h1>
<p>The user will log in to <a target="_blank" href="https://webbie.amitwani.dev"><strong>Webbie - https://webbie.amitwani.dev</strong></a></p>
<h2 id="heading-create-a-bot-and-model">Create a Bot and Model</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705324110272/3e416c43-1146-4a81-861f-229795981c50.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-frontend">Frontend</h3>
<p>The user will create a bot by providing below details -</p>
<ol>
<li><p>Bot Name</p>
</li>
<li><p>Bot Description</p>
</li>
<li><p>Select Data Source - Text/CSV/Website</p>
</li>
<li><p>OpenAI API Key</p>
</li>
<li><p>Enable Slack Notifications (optional)</p>
<ol>
<li><p>Slack App Token</p>
</li>
<li><p>Slack Channel Name</p>
</li>
</ol>
</li>
</ol>
<h3 id="heading-backend">Backend</h3>
<ol>
<li><p>The bot details will be verified</p>
</li>
<li><p>Files will be uploaded if required</p>
</li>
<li><p>CREATE MODEL using MindsDB as explained above</p>
</li>
<li><p>CREATE SLACK DATABASE using MindsDB as explained above if required</p>
</li>
<li><p>CREATE JOB using MindsDB for Slack Notifications as explained above if required</p>
</li>
<li><p>When the Model is Successfully generated, send a bot link to the client</p>
</li>
</ol>
<h2 id="heading-chat-with-the-bot">Chat with the Bot</h2>
<p>Any user can open the bot's chat interface by going to the link https://webbie.amitwani.dev/bot/&lt;bot-id&gt;</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705324597585/a1957f42-1c3a-421d-8de9-80af1ea71944.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-frontend-1">Frontend</h3>
<ol>
<li><p>Users can interact with the bot.</p>
</li>
<li><p>The query will be sent to the backend and the response will be shown to the user</p>
</li>
</ol>
<h3 id="heading-backend-1">Backend</h3>
<ol>
<li>The query will be sent to Model for prediction using MindsDB as below:</li>
</ol>
<pre><code class="lang-sql"><span class="hljs-keyword">SELECT</span> answer <span class="hljs-keyword">FROM</span> modelName <span class="hljs-keyword">WHERE</span> question = <span class="hljs-string">'question'</span>
</code></pre>
<ol>
<li><p>The answer will be sent to the client.</p>
</li>
<li><p>Question and answers will be stored in the <code>transcript</code> table</p>
</li>
<li><p>Slack notification will also be sent in the channel if enabled using MindsDB as below:</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1705324892878/472063b8-ec4f-4504-9898-82db530422b4.png" alt class="image--center mx-auto" /></p>
<h1 id="heading-future-scope">Future Scope</h1>
<p>Several features can be incorporated in the future:</p>
<ol>
<li><p><strong>Support for More Data Sources:</strong> Expand support for additional file types such as PDF/XLSX/DOCX.</p>
</li>
<li><p><strong>Database Connection Support:</strong> Allow users to add actual database connections for bot data.</p>
</li>
<li><p><strong>User Management System:</strong> Implement a user management system for enhanced control.</p>
</li>
<li><p><strong>Notification Integration:</strong> Integrate more notification channels like Microsoft Teams, Twilio, etc.</p>
</li>
</ol>
<p><strong>You are invited to collaborate on the GitHub -</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/webbie">https://github.com/mtwn105/webbie</a></div>
<p> </p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>The development of Webbie provided a valuable learning experience, exploring diverse tech stacks and leveraging MindsDB. This project reflects a journey of exploration, experimentation, and innovation.</p>
<p><strong><em>This is my submission for the MindsDB x Hashnode Hackathon.</em></strong></p>
]]></content:encoded></item><item><title><![CDATA[Redis Performance Testing]]></title><description><![CDATA[Using Redis Benchmark]]></description><link>https://blog.amitwani.dev/redis-performance-testing</link><guid isPermaLink="true">https://blog.amitwani.dev/redis-performance-testing</guid><category><![CDATA[Redis]]></category><category><![CDATA[redis cluster]]></category><category><![CDATA[Performance Testing]]></category><category><![CDATA[performance]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 23 Dec 2023 13:31:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1703338203748/4b0da3d7-6805-4a6a-aca3-50196565144e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-redis-benchmark"><strong>Redis Benchmark</strong></h2>
<p>Redis Benchmark is a command-line tool that comes bundled with Redis. It is designed to simulate various scenarios and workloads, helping you evaluate the performance of your Redis server. Whether you are a developer fine-tuning your application or an administrator optimizing system resources, Redis Benchmark provides valuable insights into your Redis instance's capabilities.</p>
<h3 id="heading-installation">Installation:</h3>
<p>If you have Redis installed on your system, Redis Benchmark is likely available. To use it, open a terminal and simply type:</p>
<pre><code class="lang-bash">redis-benchmark
</code></pre>
<p>This command will execute the benchmark with default settings, providing you with a quick overview of your Redis server's performance.</p>
<h3 id="heading-benchmarking-workloads"><strong>Benchmarking Workloads</strong></h3>
<h4 id="heading-1-simple-operations">1. Simple Operations:</h4>
<p>Start by testing the basic operations, such as GET and SET commands. These operations are fundamental to Redis, and their performance directly impacts the overall responsiveness of your application. Use the following command to run a simple benchmark:</p>
<pre><code class="lang-bash">redis-benchmark -t get,<span class="hljs-built_in">set</span>
</code></pre>
<p>This will test the throughput and latency of GET and SET commands, giving you an idea of how quickly Redis can handle these operations.</p>
<h4 id="heading-2-pipelining">2. Pipelining:</h4>
<p>Pipelining allows you to send multiple commands to Redis in a single request, reducing the number of round trips between the client and server. Test the impact of pipelining on performance with the following command:</p>
<pre><code class="lang-bash">redis-benchmark -t <span class="hljs-built_in">set</span>,get -P 16
</code></pre>
<p>Adjust the value <code>-P</code> to set the number of commands to pipeline.</p>
<h4 id="heading-3-parallel-connections">3. Parallel Connections:</h4>
<p>Simulate real-world scenarios by testing the performance of parallel connections. This helps identify how well your Redis instance scales under increased load:</p>
<pre><code class="lang-bash">redis-benchmark -t <span class="hljs-built_in">set</span>,get -c 50 -n 100000
</code></pre>
<p>In this example, 50 clients will perform 100,000 SET and GET operations concurrently.</p>
<h3 id="heading-analyzing-results"><strong>Analyzing Results</strong></h3>
<p>Once the benchmark is completed, Redis Benchmark provides detailed output, including throughput, latency, and other performance metrics. Analyze this data to identify potential bottlenecks or areas for improvement.</p>
<h3 id="heading-documentation">Documentation</h3>
<p>More documentation can be found at <a target="_blank" href="https://redis.io/docs/management/optimization/benchmarks/">Redis benchmark | Redis</a></p>
]]></content:encoded></item><item><title><![CDATA[Asynchronous Logging in Spring Boot using Logback]]></title><description><![CDATA[In modern software applications, logging plays a crucial role in monitoring and troubleshooting. However, traditional synchronous logging can sometimes…]]></description><link>https://blog.amitwani.dev/asynchronous-logging-in-spring-boot-using-logback</link><guid isPermaLink="true">https://blog.amitwani.dev/asynchronous-logging-in-spring-boot-using-logback</guid><category><![CDATA[Springboot]]></category><category><![CDATA[Java]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 26 Aug 2023 09:29:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1693041737443/bdaa52a9-a7ef-4305-b8da-327b29577927.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-introduction">Introduction</h2>
<p>In modern software applications, logging plays a crucial role in monitoring and troubleshooting. However, traditional synchronous logging can sometimes impact application performance, as it blocks the main application thread while performing I/O operations. To overcome this challenge, Spring Boot provides seamless integration with Logback, a powerful logging framework, allowing you to implement asynchronous logging and improve the overall performance of your application.</p>
<h2 id="heading-logback">Logback</h2>
<p>Logback is a popular logging framework that's known for its flexibility and ease of integration. Spring Boot applications typically use Logback as the default logging framework due to its feature-rich capabilities.</p>
<h2 id="heading-asynchronous-logging">Asynchronous Logging</h2>
<p>Asynchronous logging involves offloading the logging tasks to a separate thread, allowing the main application thread to continue its work without being blocked by I/O-bound operations. This approach is particularly beneficial in high-throughput applications where performance and responsiveness are critical.</p>
<h2 id="heading-configuring-asynchronous-logging-with-logback">Configuring Asynchronous Logging with Logback</h2>
<p>Let's dive into the steps required to set up asynchronous logging in a Spring Boot application using Logback:</p>
<h3 id="heading-dependency-setup">Dependency Setup</h3>
<p>First, ensure that you have the Logback dependency in your <code>pom.xml</code>:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">dependency</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">groupId</span>&gt;</span>ch.qos.logback<span class="hljs-tag">&lt;/<span class="hljs-name">groupId</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">artifactId</span>&gt;</span>logback-classic<span class="hljs-tag">&lt;/<span class="hljs-name">artifactId</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">dependency</span>&gt;</span>
</code></pre>
<h3 id="heading-configuration-file">Configuration File</h3>
<p>Create a <code>logback-spring.xml</code> or <code>logback.xml</code> file in your <code>src/main/resources</code> folder. This file will contain the Logback configuration.</p>
<h3 id="heading-async-appender">Async Appender</h3>
<p>Define an asynchronous appender in your Logback configuration:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">appender</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"ASYNC"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"ch.qos.logback.classic.AsyncAppender"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">appender-ref</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">"CONSOLE"</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">appender</span>&gt;</span>
</code></pre>
<p>Here, the <code>CONSOLE</code> appender can be replaced with any other appender like <code>RollingFileAppender</code> based on your preferences.</p>
<h3 id="heading-async-configuration">Async Configuration</h3>
<p>Configure the asynchronous behavior by setting attributes like <code>queueSize</code> and <code>discardingThreshold</code>:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">appender</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"ASYNC"</span> <span class="hljs-attr">class</span>=<span class="hljs-string">"ch.qos.logback.classic.AsyncAppender"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">appender-ref</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">"CONSOLE"</span> /&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">queueSize</span>&gt;</span>512<span class="hljs-tag">&lt;/<span class="hljs-name">queueSize</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">discardingThreshold</span>&gt;</span>0<span class="hljs-tag">&lt;/<span class="hljs-name">discardingThreshold</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">appender</span>&gt;</span>
</code></pre>
<p>The <code>queueSize</code> represents the number of log events that the asynchronous appender can queue before blocking. The <code>discardingThreshold</code> specifies whether to discard log events if the queue is full.</p>
<p>More options can be found <a target="_blank" href="https://logback.qos.ch/manual/appenders.html#AsyncAppender">here</a></p>
<h3 id="heading-root-logger">Root Logger</h3>
<p>Adjust the root logger to use the asynchronous appender:</p>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">root</span> <span class="hljs-attr">level</span>=<span class="hljs-string">"INFO"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">appender-ref</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">"ASYNC"</span> /&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">root</span>&gt;</span>
</code></pre>
<h2 id="heading-benefits-and-considerations">Benefits and Considerations</h2>
<ul>
<li><p><strong>Performance</strong>: Asynchronous logging improves performance by allowing the main thread to continue executing critical tasks without waiting for I/O operations.</p>
</li>
<li><p><strong>Thread Management</strong>: Proper configuration of the <code>queueSize</code> and <code>discardingThreshold</code> is essential to prevent excessive memory usage and resource consumption.</p>
</li>
<li><p><strong>Contextual Information</strong>: Be cautious when using thread-specific contextual information, as asynchronous logging may impact its accuracy.</p>
</li>
</ul>
<h2 id="heading-testing-and-verification">Testing and Verification</h2>
<p>To verify that asynchronous logging is working as expected, you can create a sample Spring Boot application and observe how the application's responsiveness improves, especially under heavy load.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>Asynchronous logging in Spring Boot using Logback is a powerful technique to enhance the performance and responsiveness of your applications. By offloading logging tasks to separate threads, you can ensure that your application's main thread remains focused on critical tasks. Remember to fine-tune your configuration based on your application's requirements for optimal results. Happy logging!</p>
]]></content:encoded></item><item><title><![CDATA[Shoppable - E-commerce For Everyone]]></title><description><![CDATA[Shoppable is A Platform to create an online store for your business. Powered by Redis Stack!. You can visit it here NodeJS Angular Redis Stack (RedisJSON…]]></description><link>https://blog.amitwani.dev/shoppable-e-commerce-for-everyone</link><guid isPermaLink="true">https://blog.amitwani.dev/shoppable-e-commerce-for-everyone</guid><category><![CDATA[Redis]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Angular]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sun, 04 Sep 2022 06:39:16 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1662273420109/x7In3BUCP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-overview">Overview</h2>
<p><strong>Shoppable</strong> is A Platform to create an online store for your business. <strong><em>Powered by Redis Stack!</em></strong>. You can visit it <strong><a target="_blank" href="https://shoppable.amitwani.dev">here</a></strong></p>
<p><img src="https://user-images.githubusercontent.com/12975481/187288703-1ff8c94f-75d7-4547-b86d-f01959a9511f.png" alt="image" /></p>
<h2 id="heading-languagestechnologies-used">Languages/Technologies Used</h2>
<p><strong>NodeJS</strong>
<strong>Angular</strong>
<strong>Redis Stack</strong> (RedisJSON, RedisSearch, Redis Streams)</p>
<h2 id="heading-demo">Demo</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=sxY6KHoRkn8">https://www.youtube.com/watch?v=sxY6KHoRkn8</a></div>
<h2 id="heading-additional-info">Additional Info</h2>
<h3 id="heading-process-flow">Process Flow</h3>
<ul>
<li>Merchant can register on the platform and create a store</li>
<li>He can add the items to the inventory</li>
<li>A customer can visit that merchant store</li>
<li>Customers can purchase items listed by the merchant</li>
<li>Merchant will receive the order and will fulfil it</li>
<li>Customer will receive notifications regarding the order</li>
</ul>
<h3 id="heading-technical-overview">Technical Overview</h3>
<ul>
<li>There are 6 microservices (merchant, inventory, customer, order, update, file-upload)</li>
<li>All servers are based on <strong>NodeJS</strong></li>
<li>The client is based on <strong>Angular</strong> and <strong>Angular Material</strong></li>
<li>An Nginx is used to route requests to various microservices as a reverse proxy</li>
<li>Redis Stack is integrated with the help of <strong><a target="_blank" href="https://github.com/redis/redis-om-node">Redis OM</a></strong> and <strong><a target="_blank" href="https://github.com/redis/node-redis">Node Redis</a></strong> NodeJS libraries</li>
<li>Redis Stack is hosted on Redis Cloud itself</li>
<li><strong>RedisJSON</strong>, <strong>RedisSearch</strong> and <strong>Redis Streams</strong> has been used</li>
<li><strong>RedisJSON</strong> is used to store JSON documents for various schema such as Merchant, Customer, Product, Order, etc.</li>
<li><strong>RedisSearch</strong> is used alongside RedisJSON to search through different repositories</li>
<li><strong>Redis Streams</strong> is used for publishing and listening to order updates and sending emails using <strong>Mailjet</strong> to the customer regarding the update</li>
<li>Apart from this, <strong>Google Cloud Storage</strong> is also used to store images of the products uploaded by the merchant</li>
</ul>
<h3 id="heading-architecture">Architecture</h3>
<p><img src="https://user-images.githubusercontent.com/12975481/187291224-8f99a51d-ca8b-4f3c-b312-b051ebcf636c.png" alt="shoppable_architecture" /></p>
<h3 id="heading-application-screenshots">Application Screenshots</h3>
<p><strong>Merchant Login</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uij935vwilf4xym8f6uu.png" alt="Login" /></p>
<p><strong>Merchant Dashboard</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijwgxci1lhl9v7v9e1i9.png" alt="Merchant Dashboard" /></p>
<p><strong>Merchant Inventory</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gjbcr7oxc21oy4omn4qx.png" alt="Merchant Inventory" /></p>
<p><strong>Merchant Add/Edit Product</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o2b9d3qdlqwm01n7ax0a.png" alt="Merchant Add/Edit Product" /></p>
<p><strong>Merchant Orders</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6qw9dhjaje7szbdqief.png" alt="Merchant Orders" /></p>
<p><strong>Store Home</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i5cgv45jy2l1ppdlwm81.png" alt="Store Home" /></p>
<p><strong>Product Page</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/weii8m3xqfyxwj2w9a1i.png" alt="Product Page" /></p>
<p><strong>Cart</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iksivh2eog79y91fqvgr.png" alt="Cart" /></p>
<p><strong>Order Details</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ma1kmi75go9u1zro1qsf.png" alt="Order Details" /></p>
<p><strong>Email Notification</strong></p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1skzkpl6a6l7ing76kjk.png" alt="Email Notification" /></p>
<h2 id="heading-link-to-code">Link to Code</h2>
<p>More details are available on the GitHub repo:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/Shopable">https://github.com/mtwn105/Shopable</a></div>
]]></content:encoded></item><item><title><![CDATA[Winnie - AI WhatsApp Chatbot on Linode!]]></title><description><![CDATA[NodeJS, Express, WhatsApp Cloud API, OpenAI, Docker, Redis, ElasticSearch, Kibana, Nginx, Linode, GitHub Actions]]></description><link>https://blog.amitwani.dev/winnie-ai-whatsapp-chatbot-on-linode</link><guid isPermaLink="true">https://blog.amitwani.dev/winnie-ai-whatsapp-chatbot-on-linode</guid><category><![CDATA[Linode]]></category><category><![CDATA[Linode Hackathon]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Docker]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Thu, 30 Jun 2022 14:18:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1656513075475/ubGp2np5H.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello folks, today I am writing about my new creation <strong>Winnie</strong> - an AI-powered WhatsApp Chatbot deployed on <a target="_blank" href="https://linode.com">Linode</a> a cloud provider and much more. </p>
<p>I have already written a blog about how you can configure and setup the WhatsApp Chatbot with NodeJS and Express, you find it here:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.amitwani.dev/create-a-chatbot-using-whatsapp-cloud-api">https://blog.amitwani.dev/create-a-chatbot-using-whatsapp-cloud-api</a></div>
<p>Today in this article, we will be looking at how I have made this whole application end-to-end, the concept behind it, all the components, using various services, deployment and automating all workflow.</p>
<h1 id="heading-concept">🤔 Concept</h1>
<p>I always wanted to create a chatbot which one can talk to, ask questions have funny conversations. When found out about WhatsApp making their Cloud API publically available to all and not only businesses, I had the idea 💡 to create a chatbot using the most used messaging platform on this planet. I thought of using OpenAI's GPT-3 model as a brain for this chatbot, one of the most powerful. That's how the complete concept of this application came in.</p>
<h1 id="heading-demo">👁️‍🗨️ Demo</h1>
<p>An example of a conversation on WhatsApp using this bot</p>
<p><img src="https://winnie.amitwani.dev/dist/images/demo.gif" alt="demo.gif" /></p>
<h1 id="heading-tech-stack">⚙️ Tech Stack</h1>
<p>I tried to use all necessary technologies which I thought will add value to this project. I am also adding the use case of each technology which is used</p>
<ul>
<li><strong>NodeJS &amp; Express</strong>: The basic backend technology to create a server</li>
<li><strong>Redis</strong>: Used as the only database, the key-value database used to store the latest conversation between user and chatbot for giving better context for the chatbot</li>
<li><strong>Docker</strong>: Using docker to ship applications to production and using docker-compose to orchestrate multiple docker services</li>
<li><strong>ElasticSearch &amp; Kibana</strong>: Used for analytics by logging into ElasticSearch and visualising using the Kibana dashboard</li>
<li><strong>Nginx</strong>: Used as an API gateway and reverse proxy to set different routes for different services plus configuration of SSL certificate is done here using <strong>Certbot</strong></li>
<li><strong>Linode</strong>: Used as the cloud provider where all these components are running</li>
</ul>
<h1 id="heading-workflow">⚒️ Workflow</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1657084835230/MGi4_xC0n.png" alt="winnie.drawio.png" /></p>
<h2 id="heading-process-flow">📈 Process flow</h2>
<ol>
<li><strong>User sends a message</strong>: The user sends a message to the WhatsApp number</li>
<li><strong>WhatsApp sends the message to webhook</strong>: WhatsApp sends back an event to the webhook we have registered (i.e. our <strong>Nginx</strong>)</li>
<li><strong>Nginx routes to WhatsApp Connector</strong>: Nginx routes request to <strong>WhatsApp Connector</strong> express server running as a Docker container</li>
<li><strong>Server parses request</strong>: WhatsApp Connector extracts the message from the user and pushes that log to <strong>ElasticSearch</strong></li>
<li><strong>Forwards to Chabot</strong>: WhatsApp Connector calls <strong>Chatbot</strong> server running as a Docker container for prediction of response of user's message</li>
<li><strong>Chatbot calls OpenAI</strong>: Chatbot receives the request, fetches the latest conversation from <strong>Redis</strong> to give AI model more context, passes it as a prompt to <strong>OpenAI</strong> and receives a response in prediction, sends it back to Whatsapp Connector</li>
<li><strong>Response</strong>: WhatsApp Connector gets the response and it sends back the response to WhatsApp using their API and pushes the log to <strong>ElasticSearch</strong></li>
</ol>
<h1 id="heading-code">🧑‍💻Code</h1>
<p>All this code is available on <strong>Github</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/whatsapp-chatbot">https://github.com/mtwn105/whatsapp-chatbot</a></div>
<h1 id="heading-deployment">⚓ Deployment</h1>
<p>I have used <strong>Linode</strong> for hosting this entire project. </p>
<p>I have created a Linode with 1 CPU, 2 GB RAM, 50 GB Storage as below:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656596404147/iePmRnbAg.png" alt="image.png" /></p>
<h2 id="heading-connect-to-server">Connect to Server</h2>
<p>I connected to the server using <strong>SSH keys</strong> generated at the creation of the Linode.</p>
<h2 id="heading-installing-docker">Installing Docker</h2>
<p>The first step was installing docker and docker-compose on the server. Since I chose a Debian machine, I followed basic steps to install docker and docker-compose on the server.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656596754500/qLbBW5qlE.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656596715678/j-u85tAm3.png" alt="image.png" /></p>
<h2 id="heading-installing-elasticsearch-andamp-kibana">Installing ElasticSearch &amp; Kibana</h2>
<p>I installed ElasticSearch &amp; Kibana as a service and made them start whenever the server is booted up. Plus, I had to configure the <code>elastic.yml</code> and <code>kibana.yml</code> files to ensure both are talking to each other perfectly.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656596815953/mmtJc_7y2.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656596848025/qR_eL95iJ.png" alt="image.png" /></p>
<h2 id="heading-push-docker-images">Push Docker Images</h2>
<p>Pushing latest docker images of <strong>whatsapp-connector</strong> and <strong>chatbot</strong> to Docker repository</p>
<h2 id="heading-configure-docker-composeyml-file">Configure <code>docker-compose.yml</code> file</h2>
<p>Create a <code>docker-compose.yml</code> and configure it with all environment variables needed, docker images tags, creating networks, exposing ports, configuring dependencies, etc.</p>
<h2 id="heading-nginx-andamp-certbot">Nginx &amp; Certbot</h2>
<p>Run the containers <strong>Nginx</strong> and <strong>Certbot</strong> containers using a script to generate <strong>SSL Certificates</strong> for the domain registered.</p>
<h2 id="heading-start-containers">Start Containers</h2>
<p>Starting the containers using <code>docker-compose up -d --force-recreate</code> to start all docker containers - <strong>whatsapp-connector</strong>, <strong>chatbot</strong>, <strong>redis</strong>, <strong>nginx</strong>, <strong>certbot</strong> </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656597386212/4lvBQAOpC.png" alt="image.png" /></p>
<h1 id="heading-cicd-pipeline">🚗 CI/CD Pipeline</h1>
<p>To automate this whole deployment process, each time when I make the change, I have used the power of <strong>GitHub Actions</strong> as a CI/CD workflow to fluently deploy my code to the <strong>Linode</strong> server using docker.</p>
<ul>
<li>On every commit on the <code>main</code> branch</li>
<li>Build Docker Images of both microservices</li>
<li>Push Docker Images of both microservices to the docker repository</li>
<li>Update <code>docker-compose.yml</code> by replacing environment variables from GitHub secrets</li>
<li>Copying <code>docker-compose.yml</code> and <code>nginx.conf</code> to the server</li>
<li>Running the <code>docker-compose</code> command to recreate containers</li>
<li>Deployment is done</li>
</ul>
<h1 id="heading-analytics">📊 Analytics</h1>
<p>Since we have pushed logs to ElasticSearch into an index. We can visualize this data on <strong>Kibana</strong>. </p>
<p>Kibana UI is exposed through Nginx with an HTTP authentication on top of it.</p>
<p>On Kibana, we can see logs of all the messages sent and received by the bot and user.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656597732902/ghKKzFU5S.png" alt="image.png" /></p>
<p>I have also created a dashboard to visualize some stats as well.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656598184967/_xoAVNNl1.png" alt="image.png" /></p>
<h1 id="heading-future-scope">🔮 Future Scope</h1>
<p>Future features maybe to add more conversational ability to this bot. </p>
<p>The bot can be joined with various other systems such as for your own business use case as well. </p>
<p>Much better landing page currently (<a target="_blank" href="https://winnie.amitwani.dev">https://winnie.amitwani.dev</a>)</p>
<h1 id="heading-conclusion">🙏Conclusion</h1>
<p>I really enjoyed making this project. Probably one of my bigger projects where I got to interact with a lot of technologies in one project. Special thanks to <strong>Linode</strong> and <strong>Hashnode</strong> for organizing this Hackathon.</p>
<blockquote>
<p>This project is created as a submission for the <strong>Linode x Hashnode</strong> hackathon</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Create a Chatbot using WhatsApp Cloud API]]></title><description><![CDATA[Using WhatsApp Cloud API & OpenAI on NodeJS]]></description><link>https://blog.amitwani.dev/create-a-chatbot-using-whatsapp-cloud-api</link><guid isPermaLink="true">https://blog.amitwani.dev/create-a-chatbot-using-whatsapp-cloud-api</guid><category><![CDATA[Node.js]]></category><category><![CDATA[whatsapp]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 25 Jun 2022 15:47:55 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1656171985085/oNh95es8k.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello folks, today in this article, we will be going through how you can create a chatbot and integrate it with <strong>WhatsApp Cloud API</strong>. We will be also giving this chatbot a brain using an <strong>OpenAI</strong> model.</p>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>To create a WhatsApp chatbot you will need a few Prerequisites:</p>
<ul>
<li>A Meta Business Account</li>
<li>A Meta Developer Account</li>
<li>An OpenAI Account</li>
</ul>
<p>You can create these easily using your existing Facebook account or create a new one.</p>
<p>Once you have all of these ready, we can get started by configuring in Meta Developer account to enable WhatsApp integration.</p>
<h2 id="heading-configuration">Configuration</h2>
<h3 id="heading-create-meta-app">Create Meta App</h3>
<p>Logon to <a target="_blank" href="https://developers.facebook.com/apps/">https://developers.facebook.com/apps/</a>.</p>
<p>Create a New App.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168000372/kbaaCs3VO.png" alt="image.png" /></p>
<p>Choose <strong>Business</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656167956865/EjVaEjYfn.png" alt="image.png" /></p>
<p>Choose your <strong>Business Manager Account</strong> and enter other details</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168082868/F1TaqJ-pD.png" alt="image.png" /></p>
<p>Click on <strong>Create App</strong> and your app will be created.</p>
<h3 id="heading-add-whatsapp-integration">Add WhatsApp Integration</h3>
<p>Open your app page and you will land on this screen.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168295908/39nzhZYHi.png" alt="image.png" /></p>
<p>Scroll down and find <strong>WhatsApp</strong>. Click on <strong>Set up</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168333237/Fr1Tqv1PY.png" alt="image.png" /></p>
<h3 id="heading-whatsapp-configuration">WhatsApp Configuration</h3>
<p>You will see this screen. Here you have been assigned <strong>a Temporary Token</strong> and <strong>a Test WhatsApp Number</strong>. We will use these to send and receive messages on that Test WhatsApp Number. In future, if you want, you can connect real numbers as well which will be a proper WhatsApp Business account. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168515339/1s6yHaB1U.png" alt="image.png" /></p>
<p>You have to configure a few recipient WhatsApp numbers for testing, up to 5 numbers can be added.</p>
<p>The <strong>Phone Number ID</strong> shown will be used later to use WhatsApp Cloud API, so keep it handy.</p>
<h3 id="heading-authentication-token">Authentication Token</h3>
<p>The final piece of configuration is generation of an authentication token which will be used while communicating with Meta APIs. </p>
<p>Log on to <a target="_blank" href="https://business.facebook.com/">https://business.facebook.com/</a> and open your Business Settings.</p>
<p>Navigate to the <strong>System Users</strong> section from left-hand menu</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656168982716/GYC0Wdsrm.png" alt="image.png" /></p>
<p>You can add a user or if it already exists, click on <strong>Generate New Token</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656169043606/pSfbV2n1h.png" alt="image.png" /></p>
<p>Select the app you created earlier and check <strong>whatsapp_business_management</strong> and <strong>whatsapp_business_messaging</strong> permissions and then copy this token.</p>
<h2 id="heading-application">Application</h2>
<p>So we will develop our application using <strong>NodeJS and Express</strong></p>
<p>We will install basic dependencies like <code>express</code> <code>morgan</code> <code>helmet</code> <code>cors</code> <code>axios</code> <code>dotenv</code></p>
<p>We will create two API routes one for verification of the webhook (this will be only used once) and one to receive messages/updates from WhatsApp</p>
<ul>
<li>GET <code>/api/webhook</code> - To verify this webhook</li>
<li>POST <code>/api/webhook</code> - To receive messages from WhatsApp</li>
</ul>
<p>So, we can configure a webhook in WhatsApp so that every time a message or update comes we will get notified of that and we can respond accordingly.</p>
<p>This GET API of <code>/api/webhook</code> will be used for verification of this webhook where WhatsApp will send a token and a couple of parameters and we will verify if all those matches whatever is configured on our server. It is called a Verification Token. We create a random long verification token and store it in the environment variables of our server.</p>
<p>This will be our API route for GET <code>/api/webhook</code></p>
<pre><code class="lang-javascript">app.get(<span class="hljs-string">"/api/webhook"</span>, <span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> VERIFY_TOKEN = process.env.VERIFY_TOKEN;

  <span class="hljs-comment">// Parse params from the webhook verification request</span>
  <span class="hljs-keyword">let</span> mode = req.query[<span class="hljs-string">"hub.mode"</span>];
  <span class="hljs-keyword">let</span> token = req.query[<span class="hljs-string">"hub.verify_token"</span>];
  <span class="hljs-keyword">let</span> challenge = req.query[<span class="hljs-string">"hub.challenge"</span>];

  <span class="hljs-comment">// Check if a token and mode were sent</span>
  <span class="hljs-keyword">if</span> (!mode || !token) {
    <span class="hljs-keyword">return</span> res.status(<span class="hljs-number">403</span>).send({ <span class="hljs-attr">error</span>: <span class="hljs-string">"Missing mode or token"</span> });
  }

  <span class="hljs-comment">// Check the mode and token sent are correct</span>
  <span class="hljs-keyword">if</span> (mode === <span class="hljs-string">"subscribe"</span> &amp;&amp; token === VERIFY_TOKEN) {
    <span class="hljs-comment">// Respond with 200 OK and challenge token from the request</span>
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"WEBHOOK_VERIFIED"</span>);
    <span class="hljs-keyword">return</span> res.status(<span class="hljs-number">200</span>).send(challenge);
  } <span class="hljs-keyword">else</span> {
    <span class="hljs-comment">// Responds with '403 Forbidden' if verify tokens do not match</span>
    <span class="hljs-keyword">return</span> res.sendStatus(<span class="hljs-number">403</span>);
  }
});
</code></pre>
<p>To verify our webhook we go to <strong>WhatsApp Configuration</strong> from the Meta App page</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656169579035/Ai2CX_Qj9.png" alt="image.png" /></p>
<p>Add the <strong>Webhook API URL</strong> and the <strong>Verification token</strong> and click on <strong>Verify and Save</strong>. You can use a proxy like <strong>ngrok</strong> if you are still in development. Webhook URL must be an HTTPS one with no Self-signed certificate in the chain.</p>
<p>In <strong>Webhook fields</strong>, Subscribe to <strong>messages</strong></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656169777914/xJx9sGIbt.png" alt="image.png" /></p>
<p>Now for the receiving messages webhook, POST <code>/api/webhook</code></p>
<pre><code class="lang-javascript">app.post(<span class="hljs-string">"/api/webhook"</span>, <span class="hljs-keyword">async</span> (req, res) =&gt; {
  <span class="hljs-keyword">try</span> {
    <span class="hljs-comment">// Parse the request body from the POST</span>
    <span class="hljs-keyword">const</span> body = req.body;

    <span class="hljs-comment">// Check the Incoming webhook message</span>
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Incoming webhook: "</span> + <span class="hljs-built_in">JSON</span>.stringify(body));

    <span class="hljs-comment">// Validate the webhook</span>
    <span class="hljs-keyword">if</span> (req.body.object) {
      <span class="hljs-comment">// Handle the event</span>
      <span class="hljs-keyword">if</span> (req.body.object === <span class="hljs-string">"whatsapp_business_account"</span>) {
        <span class="hljs-keyword">const</span> entry = req.body.entry[<span class="hljs-number">0</span>];

        <span class="hljs-comment">// Handle the message</span>
        <span class="hljs-keyword">if</span> (entry.changes) {
          <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> change <span class="hljs-keyword">of</span> entry.changes) {
            <span class="hljs-keyword">if</span> (
              change.value &amp;&amp;
              change.field === <span class="hljs-string">"messages"</span> &amp;&amp;
              change.value.contacts &amp;&amp;
              change.value.messages
            ) {
              <span class="hljs-comment">// Handle the value</span>
              <span class="hljs-keyword">const</span> value = change.value;

              <span class="hljs-keyword">const</span> userName = value.contacts[<span class="hljs-number">0</span>].profile.name;

              <span class="hljs-keyword">const</span> messages = value.messages;

              <span class="hljs-comment">// Handle messages</span>
              <span class="hljs-keyword">for</span> (<span class="hljs-keyword">const</span> message <span class="hljs-keyword">of</span> messages) {
                <span class="hljs-keyword">if</span> (
                  message.type === <span class="hljs-string">"text"</span> &amp;&amp;
                  message.text &amp;&amp;
                  message.text.body
                ) {
                  <span class="hljs-keyword">const</span> waid = message.from;
                  <span class="hljs-keyword">const</span> text = message.text.body;
                  <span class="hljs-keyword">const</span> msgId = message.id;
                  <span class="hljs-built_in">console</span>.log(
                    <span class="hljs-string">"Message from "</span> + waid + <span class="hljs-string">" - "</span> + userName + <span class="hljs-string">": "</span> + text
                  );
                }
              }
            }
          }
        }
      }
    }
  } <span class="hljs-keyword">catch</span> (err) {
    <span class="hljs-built_in">console</span>.error(<span class="hljs-string">"Error occured "</span> + err);
  }
});
</code></pre>
<p>This is how we will extract messages from the incoming webhook when the user sends a Text message on the configured number. We can use this text message and then reply accordingly. </p>
<p>For our application, we pass this as a prompt to an OpenAPI model and then get a response from the AI and respond to the user. We are using <code>openai</code> package for this.</p>
<p>For responding to the user, we will use the <code>https://graph.facebook.com/v13.0/&lt;phonenumberid&gt;/messages</code> API endpoint with the authentication token we collected earlier in Headers like below:</p>
<pre><code class="lang-javascript">  <span class="hljs-keyword">await</span> axios.post(
    process.env.WHATSAPP_SEND_MESSAGE_API,
    {
      <span class="hljs-attr">messaging_product</span>: <span class="hljs-string">"whatsapp"</span>,
      <span class="hljs-attr">recipient_type</span>: <span class="hljs-string">"individual"</span>,
      <span class="hljs-attr">to</span>: waid,
      <span class="hljs-attr">type</span>: <span class="hljs-string">"text"</span>,
      <span class="hljs-attr">text</span>: {
        <span class="hljs-attr">preview_url</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-attr">body</span>: reply,
      },
    },
    {
      <span class="hljs-attr">headers</span>: {
        <span class="hljs-attr">Authorization</span>: <span class="hljs-string">"Bearer "</span> + process.env.WHATSAPP_TOKEN,
      },
    }
  );
</code></pre>
<p>By this response will be send to the user.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>This is how we will use WhatsApp Cloud API and integrate WhatsApp with your application. There are endless possibilities since Meta recently made this API available to all, which was earlier only available to business owners or BSP (Business Service Partners). </p>
<p><strong>Documentation: </strong> <a target="_blank" href="https://developers.facebook.com/docs/whatsapp/cloud-api/reference">https://developers.facebook.com/docs/whatsapp/cloud-api/reference</a></p>
]]></content:encoded></item><item><title><![CDATA[How to speed up a Web App loading time by 10x faster!]]></title><description><![CDATA[Using Nginx and Gzip how I served my Angular App faster to browsers!]]></description><link>https://blog.amitwani.dev/how-to-speed-up-a-web-app-loading-time-by-10x-faster</link><guid isPermaLink="true">https://blog.amitwani.dev/how-to-speed-up-a-web-app-loading-time-by-10x-faster</guid><category><![CDATA[THW Web Apps]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[nginx]]></category><category><![CDATA[Angular]]></category><category><![CDATA[React]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sun, 15 May 2022 09:53:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1652608390629/4kIAn_1fg.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello folks, Today I will discuss, how I speeded up the loading time of my Web App built using Angular or any SPA (Single Page Application). This article is part of the Epic Hashnode Writeathon submission as well.</p>
<p>Before diving into the article, let's first understand how a Single Page Application (SPA) works be it developed using any web framework (Angular, React, etc.)</p>
<h1 id="heading-single-page-application">Single Page Application</h1>
<p>The single-page application is a web application that interacts with the user by dynamically rewriting the current page, rather than loading entire new pages from the server.  </p>
<p>In SPA, when the browser makes the first request to the server, the server sends back the <code>index.html</code> file. and that's basically it. that's the only time an HTML file is served. the HTML file has a script tag for the <code>.js</code> file which is going to take control of the <code>index.html</code> page. All subsequent calls return just the data, usually in JSON format. the application uses this JSON data to update the page dynamically. However, the page never reloads.</p>
<p>The client (and not the server) handles the job of transforming data to HTML once the application has started. basically, most of the modern SPA frameworks like Angular, React, and Vue has a templating engine of sorts running in your browser to generate the HTML.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652605501025/bKtlYRuuY.png" alt="image.png" /></p>
<h1 id="heading-the-problem">The Problem</h1>
<p>Now let's come to the problem or one of the drawbacks of using a SPA. Since the initial <code>index.html</code> is very lightweight, most hard work is being done by the subsequent Javascript files fetched from the server and the client executing that JS in the browser. </p>
<p>As our project starts to become complex with a lot of components and dependencies, the bundled JS file sizes get bigger with time. </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652605979728/cj-cFnIwP.png" alt="image.png" /></p>
<p>Here you can see this is a bundled JS generated by the building of an Angular App which is more than 1 MB 🤯. This file has to get loaded in browsers which takes a good amount of time and the user has to wait for the first painting of the webpage.</p>
<p>Though React is much lighter weight, one can definitely reduce this size by compressing these JS files. That's what we will do next.</p>
<h1 id="heading-the-solution">The Solution</h1>
<p>We will discuss one of the ways to deal with this problem, which is to compress the bundle JS files and serve their compressed versions.</p>
<h2 id="heading-compress-bundled-js-files">Compress Bundled JS files</h2>
<p>In Angular, to generate a compressed version of these JS files, we can use <code>gzipper</code> to compress files to <code>gzip</code> format. </p>
<p>We add a dev dependency in <code>package.json</code> for <code>gzipper</code>.</p>
<pre><code>  <span class="hljs-string">"devDependencies"</span>: {
   ...
    <span class="hljs-string">"gzipper"</span>: <span class="hljs-string">"^7.0.0"</span>,
   ...
  }
</code></pre><p>We also update our build script in <code>package.json</code> to gzip the files after building using <code>gzipper</code>.</p>
<pre><code><span class="hljs-string">"build"</span>: <span class="hljs-string">"ng build &amp;&amp; gzipper compress --verbose ./dist/client/"</span>,
</code></pre><p>Now when we build our application using <code>npm run build</code> we will get two versions of that JS file. One is a non-compressed one and one is compressed with the <code>.js.gz</code> extension.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1652606655457/iYX1nkyQE.png" alt="image.png" /></p>
<p>As you can see the gzipped version of the Javascript file is almost 4 times smaller (1.2 MB to 300 KB)
Along with JS, all HTML, CSS and asset files are also gzipped reducing their sizes by more than 50%.</p>
<h2 id="heading-nginx">Nginx</h2>
<p>Now comes the role of Nginx, we need something to serve these compressed versions of Javascript files, we will be using Nginx for this. </p>
<p>In the <code>nginx.conf</code> - The configuration file for Nginx we will these four lines to the <code>server</code> object</p>
<pre><code>    gzip on;
    gzip_min_length <span class="hljs-number">1000</span>;
    gzip_proxied expired no<span class="hljs-operator">-</span>cache no<span class="hljs-operator">-</span>store <span class="hljs-keyword">private</span> auth;
    gzip_types text<span class="hljs-operator">/</span>plain text<span class="hljs-operator">/</span>css application<span class="hljs-operator">/</span>json application<span class="hljs-operator">/</span>javascript application<span class="hljs-operator">/</span>x<span class="hljs-operator">-</span>javascript text<span class="hljs-operator">/</span>xml application<span class="hljs-operator">/</span>xml application<span class="hljs-operator">/</span>xml<span class="hljs-operator">+</span>rss text<span class="hljs-operator">/</span>javascript;
</code></pre><p>This will enable the gzip compression and when serving the files, if the gzip compression is supported by the browser, Nginx will serve the smaller gzip version thus reducing the loading time by up to 10X.</p>
<h1 id="heading-conclusion">Conclusion</h1>
<p>This marks the end of this article. This was of the many ways to speed up the loading time of a Single Page Application. As your app gets to production-grade at scale, this will be very useful. </p>
<p>For React, you can refer to <a target="_blank" href="https://codetoart.com/blog/how-to-load-react-web-app-faster">this</a> article to see how to generate build files in gzipped version.</p>
<p>If you like this article, keep in touch with me on my socials or support me if you want. 
If you have any feedback, do let me know in the comments.</p>
<p>Till next time, Peace.! </p>
]]></content:encoded></item><item><title><![CDATA[Manage your GitHub Starred Repositories]]></title><description><![CDATA[Using the Star List feature in GitHub]]></description><link>https://blog.amitwani.dev/manage-your-github-starred-repositories</link><guid isPermaLink="true">https://blog.amitwani.dev/manage-your-github-starred-repositories</guid><category><![CDATA[GitHub]]></category><category><![CDATA[Open Source]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[Programming Tips]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Tue, 05 Apr 2022 04:23:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/wX2L8L-fGeA/upload/v1649100293713/k6kVQvr2K.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello folks, this is a quick article about how you can manage your <strong>GitHub's starred repositories</strong>. </p>
<p>You must have come across hundreds of awesome GitHub repositories but the problem is it's very hard to find the one you want at that moment in time.</p>
<p>For this, we usually <strong>star</strong> our GitHub repositories, but we forget about them.</p>
<p>To solve this, I came across this feature in GitHub (still in beta), where you can <strong>create lists</strong> to <strong>organize</strong> your starred repositories.</p>
<p>To do this you just click on the <strong>arrow icon</strong> next to <strong>Star</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asic2yg6xgkopfxjicew.png" alt="Star" /></p>
<p>You will be presented with a dropdown to <strong>select</strong> an existing list or <strong>create</strong> a new list
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jtpj59q371kdb0ygq22w.png" alt="List" /></p>
<p>Once you select a list, it will be saved in that list.
You can revisit it by going to <strong>Your Stars</strong>
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa7bupeen3cqy3uaikzm.png" alt="YourStars" /></p>
<p>And you can see all your lists, you can go through them, search in them, etc.
<img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rwetnpntw5tszya1dx9u.png" alt="StarList" /></p>
<p>That's it for this article. Hope you found it useful. Share your thoughts down below.</p>
<p>Till next time, peace.</p>
]]></content:encoded></item><item><title><![CDATA[Building an Anonymous Chat App using Hasura & GraphQL - Secretly]]></title><description><![CDATA[Hello Folks, today I am sharing the new small application I built for the Hasura x Hashnode Hackathon. Secretly is a completely anonymous chatting platform…]]></description><link>https://blog.amitwani.dev/building-an-anonymous-chat-app-using-hasura-and-graphql-secretly</link><guid isPermaLink="true">https://blog.amitwani.dev/building-an-anonymous-chat-app-using-hasura-and-graphql-secretly</guid><category><![CDATA[Hasura]]></category><category><![CDATA[Hasura Hackathon]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[GraphQL]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Tue, 29 Mar 2022 18:31:51 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750403983/-46AMhJiE.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello Folks, today I am sharing the new small application I built for the Hasura x Hashnode Hackathon. </p>
<p><strong>Secretly</strong> is a completely anonymous chatting platform to chat with your friends without revealing your identity. Sounds fun, right, let's dive into it.</p>
<h2 id="heading-thinking">Thinking</h2>
<p>This idea has been inspired by the lack of a proper anonymous messaging platform where we can only allow people to chat with us in our own friends/followers circle and connect with them anonymously. Secretly is aimed at solving this very problem.</p>
<p><strong>Let's look at the application before proceeding</strong></p>
<h2 id="heading-demo">Demo</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://youtu.be/aHfiZpiK83U">https://youtu.be/aHfiZpiK83U</a></div>
<p>You can visit the live app <a target="_blank" href="https://secretly.amitwani.dev">here</a></p>
<h2 id="heading-features">Features</h2>
<ul>
<li>Create a unique Chat Link for every session</li>
<li>Share chat link to chat with friends anonymously</li>
<li>No Chat History is retained if the user ends the session</li>
<li>Complete anonymity makes it fun</li>
<li>Funny random usernames</li>
<li>One-click to get started!</li>
</ul>
<h2 id="heading-tech-stack">Tech Stack</h2>
<ul>
<li><strong>Backend:</strong> NodeJS, Express</li>
<li><strong>Frontend:</strong> Angular, Ionic</li>
<li><strong>Database:</strong> Postgres using <em>Railway.app </em></li>
<li><strong>API:</strong> GraphQL using <em>Hasura</em></li>
<li><strong>DevOps:</strong> Docker</li>
<li><strong>Deployment:</strong> Fly.io, Firebase</li>
</ul>
<h2 id="heading-development">Development</h2>
<p>So, I used the above tech stack to build and deploy this project.
I will now walk through the basic steps I took. </p>
<p>First of all, I set up my database structure and Hasura configuration.</p>
<h3 id="heading-database-andamp-hasura">Database &amp; Hasura</h3>
<p>I created 3 tables <strong>users</strong>, <strong>chats</strong>, <strong>messages</strong> and setted up foreign key relationships between them like below:</p>
<h4 id="heading-tables">Tables</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750859498/ZoDYoLMM_.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750884757/IBH8BzUUF.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750897596/lwZ3XcDFl.png" alt="image.png" /></p>
<h4 id="heading-relationships">Relationships</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750960243/EOAinzL2k.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750972164/Tt2pEfQyK.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648750988341/4XRTT57NM.png" alt="image.png" /></p>
<h4 id="heading-permissions">Permissions</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648751014224/ZSIorWoEF.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648751027508/nXb1jSELh.png" alt="image.png" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1648751041233/5-v-KVUlC.png" alt="image.png" /></p>
<h3 id="heading-backend">Backend</h3>
<p>I then spun up an <strong>Express</strong> server using NodeJS with only one API exposed to create a user session and send a unique JWT token. </p>
<h3 id="heading-frontend">Frontend</h3>
<p>This token will be stored by the frontend in the local storage and will be used for subsequent requests and will be validated at the Hasura end as well.</p>
<p>Then on the frontend, I have used GraphQL subscriptions using Hasura API with Apollo Client for Angular for real-time updates of Chats &amp; Messages.</p>
<p>Users can then chat from the chat screen and one can end the session by clicking Logout to clear all chats and messages, all records from the table will be deleted as well.</p>
<h3 id="heading-pwa">PWA</h3>
<p>This is also a PWA (Progressive Web App) which can be installed on any device that supports it.</p>
<h2 id="heading-learnings">Learnings</h2>
<p>There are many things I learned while building and deploying the project. Here are few:</p>
<ul>
<li>Creating <strong>GraphQL</strong> APIs of a relational database using <strong>Hasura</strong></li>
<li>Configuring <strong>Hasura</strong> for Permissions, Authentication</li>
<li>Building a Responsive web app using <strong>Ionic</strong> and Angular</li>
<li>Consuming GraphQL APIs on the client-side using libraries like <strong>Apollo</strong></li>
<li>Building <strong>Progressive Web App</strong></li>
</ul>
<h2 id="heading-future-improvements">Future Improvements</h2>
<p>There are many many improvements that can be done to make this better such as </p>
<ul>
<li>Improve performance of chatting</li>
<li>User profile customization</li>
<li>Improved PWA configuration &amp; push notifications</li>
<li>End individual chats rather than the complete session</li>
</ul>
<h2 id="heading-source-code">Source Code</h2>
<p>This project is open source and can be found on GitHub here:</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/secretly">https://github.com/mtwn105/secretly</a></div>
<h2 id="heading-support-me">Support Me</h2>
<p>If you like what I do, you can support me by clicking <a target="_blank" href="https://buymeacoffee.com/mtwn105">here</a></p>
]]></content:encoded></item><item><title><![CDATA[Journal CLI - Write Journal in Notion using CLI]]></title><description><![CDATA[Built using NodeJS and Notion API]]></description><link>https://blog.amitwani.dev/journal-cli-write-journal-in-notion-using-cli</link><guid isPermaLink="true">https://blog.amitwani.dev/journal-cli-write-journal-in-notion-using-cli</guid><category><![CDATA[cli]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[npm]]></category><category><![CDATA[Linux]]></category><category><![CDATA[JavaScript]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sun, 20 Mar 2022 06:57:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647756808351/9k-EfSdue.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello folks, today I tried to play around with Notion API and NodeJS to create a CLI which can write Journal for you and store it in a Notion Database.</p>
<p>These days, there is a lot of stuff going on in our lives and we want to focus on the ones which matter most to us. One way to solve this is by writing a journal and sorting this chaotic mess. </p>
<p>Using <a target="_blank" href="https://notion.so">Notion</a>, we can create beautiful interactive notes and much more. Using the power of notion and efficiency of CLI, I developed this quick way, you can start journaling, by answering just 5 questions at the end of the day and the Journal will be saved in a database in Notion.!</p>
<p>NPM Link - </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.npmjs.com/package/journal-notion-cli">https://www.npmjs.com/package/journal-notion-cli</a></div>
<h3 id="heading-duplicate-template">Duplicate Template</h3>
<p>To Get Started Duplicate this <a target="_blank" href="https://amit-wani.notion.site/amit-wani/Journal-a19377f6b17d47768e03d4ffe62a030d">Notion Template</a></p>
<h3 id="heading-installation">Installation</h3>
<p>Then Install Journal CLI from NPM using
<code>npm i -g journal-notion-cli</code></p>
<h3 id="heading-connect-to-notion">Connect to Notion</h3>
<p>Connect to the notion by running <code>journal connect</code></p>
<h3 id="heading-write-journal">Write Journal</h3>
<p>Write a journal every day using <code>journal write</code> and answer a few questions.</p>
<h3 id="heading-demo">Demo</h3>
<p><img src="https://media4.giphy.com/media/ZffqaXilCMlfEKH3ZF/giphy.gif?cid=790b7611cf19c040cd8a20ff11c61e62745969f1cccfbc7b&amp;rid=giphy.gif&amp;ct=g" alt="demo.gif" /></p>
<h3 id="heading-source-code">Source Code</h3>
<p>If you like it and want to know more, do check out the GitHub repo at </p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://github.com/mtwn105/journal-cli/">https://github.com/mtwn105/journal-cli/</a></div>
<p>If you like this tool, do support me by using the "Buy me a coffee" button, and keep reading my content by subscribing to newsletters. Till next time, peace.</p>
<h3 id="heading-buy-me-a-coffee">Buy me a coffee</h3>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.buymeacoffee.com/mtwn105">https://www.buymeacoffee.com/mtwn105</a></div>
]]></content:encoded></item><item><title><![CDATA[SGB Analyzer - Analyze & Compare SGBs]]></title><description><![CDATA[Analyze & Compare Sovereign Gold Bonds (SGBs) & Identify SGBs at Discounts!]]></description><link>https://blog.amitwani.dev/sgb-analyzer-analyze-and-compare-sgbs</link><guid isPermaLink="true">https://blog.amitwani.dev/sgb-analyzer-analyze-and-compare-sgbs</guid><category><![CDATA[Node.js]]></category><category><![CDATA[Express]]></category><category><![CDATA[MongoDB]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[Angular]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Mon, 14 Mar 2022 13:32:52 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647262231532/5W_StKyM0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone, a couple of days ago, I wrote <a target="_blank" href="https://blog.amitwani.dev/sgb-discount-calculator-buy-gold-at-a-30-discount">this post</a> about the <strong>SGB Discount Calculator</strong> &amp; created this tool <a target="_blank" href="https://sgbanalyzer.com">https://sgbanalyzer.com</a>.</p>
<p><a target="_blank" href="https://t.me/sgbanalyzercom"><strong>Join the Telegram Channel for Discussions &amp; Updates</strong></a></p>
<p>I have been overwhelmed by the response received for this. Special thanks to <a target="_blank" href="https://twitter.com/WeekendInvestng">Alok Jain sir</a> for sharing this with his followers on Twitter.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/WeekendInvestng/status/1502875206083563523?s=20&amp;t=zvs3wEL5-tDqAh2gIoN4KQ">https://twitter.com/WeekendInvestng/status/1502875206083563523?s=20&amp;t=zvs3wEL5-tDqAh2gIoN4KQ</a></div>
<p> </p>
<p>2500 users used the website on the first day itself. There have been many feedback &amp; feature requests that fellow Twitteratis have shared. I have tried my best to integrate these features, thus making this tool more like an analysis tool, thus changing the name to <a target="_blank" href="https://sgbanalyzer.com"><strong>SGB Analyzer</strong></a></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://sgbanalyzer.com">https://sgbanalyzer.com</a></div>
<p> </p>
<p>Below are the <strong>new features</strong> that have been added as part of this update:</p>
<ul>
<li><p>**Ask Price ** is now considered instead of <strong>Last Traded Price</strong></p>
</li>
<li><p>Gold rate is fetched from <a target="_blank" href="https://sgb.amitwani.dev"><strong>IBJA</strong></a> per RBI reference.</p>
</li>
<li><p>More <strong>Accurate Calculations</strong> for Fair Value &amp; Discounts</p>
</li>
<li><p>Ability to <strong>Download in-depth details of all SGBs in CSV</strong> format containing (Interest Payment Dates, Amount of Interest Payment Remaining, No of Interest payments remaining and a few more along with columns on the screen)</p>
</li>
<li><p>Added <strong>Today's Traded Volume</strong> column &amp; Ability to filter only **liquid **bonds added</p>
</li>
<li><p>Added <strong>Yield To Maturity</strong> column</p>
</li>
<li><p>Added <strong>Discount to Gold Price</strong> column</p>
</li>
<li><p>Ability to <strong>Filter SGBs</strong> by searching</p>
</li>
<li><p>Ability to **Sort **all columns</p>
</li>
<li><p>Added missing <strong>12 SGBs</strong></p>
</li>
<li><p>Few UI/UX improvements</p>
</li>
</ul>
<p>All these features &amp; updates would have only been possible due to constant feedback from the community, would like to thank everyone who used it. Do contact me on <a target="_blank" href="https://twitter.com/mtwn105">Twitter</a> or <a target="_blank" href="mailto:contact@sgbanalyzer.com">Email</a> if you have any feedback or suggestions!</p>
<p><s>The tool is open-sourced on <strong>GitHub </strong>you can check it out here: </s> <a target="_blank" href="https://github.com/mtwn105/sgb-discount-calculator"><s>https://github.com/mtwn105/sgb-discount-calculator</s></a></p>
<p>If you like this tool, do support me by using the "Support Me" button, and keep reading my content by subscribing to newsletters. Till next time, peace.</p>
<p><strong><em>Disc: This is not a piece of investment advice. It is for educational purposes only. Do your due diligence before investing</em></strong></p>
]]></content:encoded></item><item><title><![CDATA[SGB Discount Calculator - Buy Gold at a 30% Discount!]]></title><description><![CDATA[A tool to identify listed SGBs with discounts on their Fair Value]]></description><link>https://blog.amitwani.dev/sgb-discount-calculator-buy-gold-at-a-30-discount</link><guid isPermaLink="true">https://blog.amitwani.dev/sgb-discount-calculator-buy-gold-at-a-30-discount</guid><category><![CDATA[Node.js]]></category><category><![CDATA[Express]]></category><category><![CDATA[MongoDB]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Business and Finance ]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sat, 12 Mar 2022 08:22:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647072818509/hHKJqGrh4.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Please find the feature update article here</em></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://blog.amitwani.dev/sgb-analyzer-analyze-and-compare-sgbs">https://blog.amitwani.dev/sgb-analyzer-analyze-and-compare-sgbs</a></div>
<p> </p>
<p><a target="_blank" href="https://t.me/sgbanalyzercom"><strong>Join the Telegram Channel for Discussions &amp; Updates</strong></a></p>
<p>Hello guys, we all know how important <strong>asset allocation</strong> is when it comes to investing! One of the most proven hedges against Equity has been Gold for the past 50 years. Gold has a very negative correlation most of the time against equity.</p>
<p>In India, it's been well known since the last few years, when RBI launched the <strong>SGB (Sovereign Gold Bonds)</strong> scheme, that it is one of the best if not the best investment products for getting exposure in Gold.</p>
<p>RBI has launched many tranches of SGBs since 2015. They have a great tax advantage as well if someone has held SGB till maturity, capital gains tax will not be charged. It also comes with a 2.5% simple interest paid semi-annually and price appreciation according to the Gold price.</p>
<p>With such benefits, one would want to have their gold portfolio in SGBs and now due to market inefficiencies, you can buy these SGBs from the secondary market (NSE/BSE) for much cheaper than their fair value as of today rather than buying from the primary market.</p>
<p>I have created this tool to calculate this difference (i.e. discount) between the Fair value of that SGB versus its current market price. This idea was inspired by ** Mr Alok Jain (<a target="_blank" href="https://twitter.com/WeekendInvestng">@WeekendInvestng</a>)** of WeekendInvesting.</p>
<p>You can visit here</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://sgb.amitwani.dev/">https://sgb.amitwani.dev/</a></div>
<p> </p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1647068745567/Lvm9giRyr.png" alt="image.png" /></p>
<p>As of now, when writing this article, there are some SGBs available with up to 30% of discount to their Fair value.</p>
<p>More info on different metrics here 👇</p>
<p><strong>Issue Price</strong> is the price at which the SGB was launched.</p>
<p><strong>Years to Maturity</strong> is the time remaining for the maturity of the SGB.</p>
<p><strong>Interest Rate</strong> is the simple interest payable to you every year.</p>
<p><strong>The present value of future dividends</strong> is calculated using the discount/inflation rate (assumed 6%).</p>
<p><strong>Fair value</strong> is calculated based on the present value of future dividends along with the current Gold price in rupee terms.</p>
<p>**Discount **is calculated based on the difference between Fair Value &amp; Current Market Price.</p>
<p>**Yield **is the percentage of interest still remaining to be given compared to the current market price.</p>
<p><strong><em>Prices are updated every hour.</em></strong></p>
<p><s>This tool is built using </s> <strong><s>Node JS</s></strong><s>, </s> <strong><s>Angular</s></strong><s>, and </s> <strong><s>MongoDB</s></strong> <s> and deployed on </s> <strong><s>Northflank</s></strong> <s> as a </s> <strong><s>Docker</s></strong> <s> container. You can look at the source code at </s> <a target="_blank" href="https://github.com/mtwn105/sgb-discount-calculator"><s>https://github.com/mtwn105/sgb-discount-calculator</s></a></p>
<p>If you like my app, do support me by using the "Support Me" button, and keep reading my content by subscribing to newsletters. Till next time, peace.</p>
<p><strong><em>Disc: This is not a piece of investment advice. It is for educational purposes only. Do your due diligence before investing</em></strong></p>
]]></content:encoded></item><item><title><![CDATA[Memer Bot - All in one Telegram Bot for your Meme-ing needs!]]></title><description><![CDATA[Search & Create memes using templates and custom images]]></description><link>https://blog.amitwani.dev/memer-bot-all-in-one-telegram-bot-for-your-meme-ing-needs</link><guid isPermaLink="true">https://blog.amitwani.dev/memer-bot-all-in-one-telegram-bot-for-your-meme-ing-needs</guid><category><![CDATA[bots]]></category><category><![CDATA[bot]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[web scraping]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Fri, 25 Feb 2022 15:32:48 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1645701753374/L63e8G7Gi.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong><em>Memes are a way to take a little break from the stress of life and have a laugh.</em></strong></p>
<p>Hello everyone, today I will be sharing my fun tool called <strong>"Memer Bot"</strong>, which is a telegram bot that you can find here <strong>(<a target="_blank" href="https://t.me/meme_mtwn105_bot">https://t.me/meme_mtwn105_bot</a>). </strong> This is a much more quicker way to search &amp; generate memes than the one which I previously built (<a target="_blank" href="https://memer.amitwani.dev">https://memer.amitwani.dev - obsolete</a>)</p>
<p><strong>We are now live on Product Hunt</strong></p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="&lt;a href=" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=333873&amp;theme=dark" alt="Memer Bot - All in One Telegram Bot for Meme-ing. Search &amp; Create Memes! | Product Hunt" /></a>" data-card-controls="0" data-card-theme="light"&gt;<a href="https://www.producthunt.com/posts/memer-bot?utm_source=badge-featured&amp;utm_medium=badge&amp;utm_souce=badge-memer-bot" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=333873&amp;theme=dark" alt="Memer Bot - All in One Telegram Bot for Meme-ing. Search &amp; Create Memes! | Product Hunt" /></a></div>
<p><strong>Memer Bot</strong> will let you search &amp; create memes using thousands of templates &amp; even your own custom images. </p>
<p>Basically, there are three major features - </p>
<ul>
<li><p><strong>/search </strong> command will let you search for a meme for a word/phrase (it will return the top meme if finds for that phrase)</p>
</li>
<li><p><strong>/create</strong> command will let you create memes using two options - a <strong>Meme Template</strong> or a <strong>Custom Image</strong></p>
</li>
</ul>
<p>Instructions are fairly straightforward while using these bots. </p>
<p>At any point in time, if you feel, the bot is not responding, do try to use the <strong>/reset</strong> command and then try to do the operation again.</p>
<p><em>Sometimes, <strong>Custom Image</strong> meme generation might fail as it's dependent on third-party API, so do try again after some time</em></p>
<p>If you like my stuff or you have some feedback do let me know on my Twitter <a target="_blank" href="https://twitter.com/mtwn105">@mtwn105</a></p>
<p>Application is now open-source on GitHub <a target="_blank" href="https://github.com/mtwn105/memer-telegram-bot">Here</a></p>
<p>Till next time, Peace!</p>
]]></content:encoded></item><item><title><![CDATA[Personal Inflation Calculator - Tool to calculate your inflation for India!]]></title><description><![CDATA[Hello everyone, today I will be sharing my new tool called "Personal Inflation Calculator" for India, which is a tool to calculate personal inflation…]]></description><link>https://blog.amitwani.dev/personal-inflation-calculator-tool-to-calculate-your-inflation-for-india</link><guid isPermaLink="true">https://blog.amitwani.dev/personal-inflation-calculator-tool-to-calculate-your-inflation-for-india</guid><category><![CDATA[Node.js]]></category><category><![CDATA[Angular]]></category><category><![CDATA[MongoDB]]></category><category><![CDATA[Docker]]></category><category><![CDATA[Express]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Thu, 03 Feb 2022 14:26:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1643898323584/5X12ttUh2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone, today I will be sharing my new tool called "Personal Inflation Calculator" for India, which is a tool to calculate personal inflation according to the different expenses among different categories. </p>
<p>This tool was inspired by the concept coined by Mr Vivek Bajaj (<a target="_blank" href="https://twitter.com/vivbajaj">@vivbajaj</a>) in this Youtube video from the 'Learn2Invest' series.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.youtube.com/watch?v=wbJGvxkRlGM">https://www.youtube.com/watch?v=wbJGvxkRlGM</a></div>
<p>The personal Inflation concept tells us how every individual has his/her own inflation rate depending on the amount spent across different categories.</p>
<p>You can log on to <a target="_blank" href="https://personalinflation.in/">https://personalinflation.in/</a></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1643897184497/ReNYykpwQ.png" alt="image.png" /></p>
<p>Also, you can choose between "Rural", "Urban" &amp; "Combined" inflation. </p>
<p>Inflation for each category is sourced from RBI and is released every month. The Source of these values for the latest month is shown at the bottom.</p>
<p>This tool is built using <strong>Node JS</strong>, <strong>Angular</strong>, <strong>MongoDB</strong> and deployed on <strong>Northflank</strong> as a <strong>Docker</strong> container.
You can look at the source code at <a target="_blank" href="https://github.com/mtwn105/personal-inflation-calculator">https://github.com/mtwn105/personal-inflation-calculator</a></p>
<p>If you like my app, do support me by using the "Support Me" button, and keep reading my content by subscribing to newsletters. Till next time, peace.</p>
]]></content:encoded></item><item><title><![CDATA[Crypto & Top Tech Companies - Interesting Correlation?]]></title><description><![CDATA[Hello everyone, today we have an interesting topic. Comparing price movements of top crypto coins and top US tech company stocks. This idea has been spun…]]></description><link>https://blog.amitwani.dev/crypto-and-top-tech-companies-interesting-correlation</link><guid isPermaLink="true">https://blog.amitwani.dev/crypto-and-top-tech-companies-interesting-correlation</guid><category><![CDATA[Cryptocurrency]]></category><category><![CDATA[Python]]></category><category><![CDATA[Data Science]]></category><category><![CDATA[Business and Finance ]]></category><category><![CDATA[Blockchain]]></category><dc:creator><![CDATA[Amit Wani]]></dc:creator><pubDate>Sun, 23 Jan 2022 18:14:25 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/unsplash/5ixVD22x22o/upload/v1642961772786/UDlfFDrRv.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Hello everyone, today we have an interesting topic. Comparing price movements of top crypto coins and top US tech company stocks. This idea has been spun from a tweet by Mr Alok Jain from @<a target="_blank" href="https://twitter.com/WeekendInvestng">WeekendInvesting</a> on Twitter.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://twitter.com/WeekendInvestng/status/1480549068682137601">https://twitter.com/WeekendInvestng/status/1480549068682137601</a></div>
<p>So, I have done a correlation analysis between the top 5 crypto coins &amp; the top 5 US tech stocks by Market Cap. </p>
<p><strong>Crypto</strong>:  BTCUSD (Bitcoin), ETHUSD (Ethereum), ADAUSD (Cardano), SOLUSD (Solana), XRPUSD (XRP)</p>
<p><strong>Tech Stocks</strong>: AAPL (Apple), MSFT (Microsoft), AMZN (Amazon), GOOGL (Google/Alphabet), TSLA (Tesla)</p>
<p>The time period was considered is last 1 year.</p>
<p>Here are the results:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1642961373332/IEcX3QwyM.png" alt="image.png" /></p>
<p>As we can see overall there's not much of a similarity between Crypto price movement &amp; US Tech stocks price movement. So their price movement is not much correlated. So this theory is not quite correct, at least for the last year of data.</p>
<p>But as mentioned by Alok Jain, they fall at the same time, so now we just consider the correlation when crypto is falling &amp; when US tech stocks are falling.</p>
<p>So for crypto, considered BTCUSD as the benchmark, so here's correlation matrix when BTCUSD is falling:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1642961356350/BwAefmH2d.png" alt="image.png" /></p>
<p>Here as well, we see there's not much correlation when BTCUSD is falling.</p>
<p>Now, we look at when top tech is falling, we consider Apple (AAPL) as a benchmark here.
So, when AAPL is falling, here's the correlation matrix:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1642961529448/RpdDw1l3q.png" alt="image.png" /></p>
<p>Here as well, we see there's not much correlation when AAPL falls. So we can safely conclude that there's no significant correlation between Top Cryptos and Top US Stocks.</p>
<p>Thanks for your time and reading this article. Keep supporting and sharing my stuff. Till next time, peace.!</p>
]]></content:encoded></item></channel></rss>