<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Talha Kazmi</title>
    <description>The latest articles on Forem by Talha Kazmi (@talhakazmi1).</description>
    <link>https://forem.com/talhakazmi1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3776847%2Fc4be1692-54c1-4465-a99a-3c640410c353.png</url>
      <title>Forem: Talha Kazmi</title>
      <link>https://forem.com/talhakazmi1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/talhakazmi1"/>
    <language>en</language>
    <item>
      <title>How I Built a "Living" AI Chatbot with Next.js, Mistral, and Framer Motion</title>
      <dc:creator>Talha Kazmi</dc:creator>
      <pubDate>Thu, 19 Feb 2026 04:50:01 +0000</pubDate>
      <link>https://forem.com/talhakazmi1/how-i-built-a-living-ai-chatbot-with-nextjs-mistral-and-framer-motion-2hcg</link>
      <guid>https://forem.com/talhakazmi1/how-i-built-a-living-ai-chatbot-with-nextjs-mistral-and-framer-motion-2hcg</guid>
      <description>&lt;p&gt;&lt;strong&gt;🚀 The Introduction&lt;/strong&gt;&lt;br&gt;
Most AI chatbots are boring. They are usually just a static box in the corner of the screen. When I was building the AI assistant for &lt;a href="https://www.trainlytic.net/" rel="noopener noreferrer"&gt;Trainlytic&lt;/a&gt;, I wanted something different. I wanted a bot that felt "alive",an assistant that acknowledges your presence before you even start typing.&lt;/p&gt;

&lt;p&gt;In this post, I’ll show you how I built a futuristic, robot-faced AI coach using Mistral AI, Next.js, and some clever Framer Motion math to make its eyes follow your cursor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🤖 The Vision: A Bot with Personality&lt;/strong&gt;&lt;br&gt;
I didn't want a "wrapper." I wanted a UI that felt like the year 3026. The goal was to combine Glassmorphism, Neon accents, and Interactive Animation to create a high-fidelity user experience.&lt;/p&gt;

&lt;p&gt;Key Features:&lt;br&gt;
Cursor Tracking: Eyes follow the user's mouse movement.&lt;/p&gt;

&lt;p&gt;Natural Blinking: Randomized double-blinks to mimic biological behavior.&lt;/p&gt;

&lt;p&gt;Mistral AI Integration: Specialized fitness and nutrition coaching.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftair76t2j5atrzxtl3mp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftair76t2j5atrzxtl3mp.png" alt="Close-up of the Trainlytic AI interactive robot face featuring glowing emerald eyes and a metallic visor" width="131" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;👁️ The "Eye" Logic: Mathematical Cursor Tracking&lt;/strong&gt;&lt;br&gt;
The standout feature is the eye-tracking. The eyes don't just move; they calculate the distance between your cursor and the center of the bot's face using a limited "visor" range.&lt;/p&gt;

&lt;p&gt;I used useEffect to listen for mouse movements. Here is the core logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TypeScript
// Cursor tracking for eyes
useEffect(() =&amp;gt; {
  const handleMouseMove = (e: MouseEvent) =&amp;gt; {
    if (!robotRef.current || isOpen) return;

    const rect = robotRef.current.getBoundingClientRect();
    const robotCenterX = rect.left + rect.width / 2;
    const robotCenterY = rect.top + rect.height / 2;

    const deltaX = e.clientX - robotCenterX;
    const deltaY = e.clientY - robotCenterY;

    // Limit eye movement range (max 4px offset for natural movement)
    const maxOffset = 4;
    const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
    const normalizedDistance = Math.min(distance / 300, 1);

    const offsetX = (deltaX / (Math.abs(deltaX) + 100)) * maxOffset * normalizedDistance;
    const offsetY = (deltaY / (Math.abs(deltaY) + 100)) * maxOffset * normalizedDistance;

    setEyeOffset({ x: offsetX, y: offsetY });
  };

  window.addEventListener("mousemove", handleMouseMove);
  return () =&amp;gt; window.removeEventListener("mousemove", handleMouseMove);
}, [isOpen]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;⚡ The Brain: Mistral AI &amp;amp; Streaming&lt;/strong&gt;&lt;br&gt;
For the "brain," I chose Mistral AI. It’s incredibly fast and perfect for the specific fitness and nutrition prompts I use to help guys reach their goals.&lt;/p&gt;

&lt;p&gt;To prevent a clunky user experience, I implemented Streaming Responses. Instead of waiting for the full response, the text "flows" into the bubble using a ReadableStream.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzy5jqf9xuqcg1ci323cz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzy5jqf9xuqcg1ci323cz.png" alt="The full Trainlytic AI chat interface showing glassmorphism design, neon accents, and a fitness coaching conversation" width="561" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🎨 UI/UX: Natural Blinking&lt;/strong&gt;&lt;br&gt;
I wrote a performDoubleBlink function that triggers at random intervals. This small detail makes the bot feel less like an icon and more like an entity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;TypeScript
const performDoubleBlink = () =&amp;gt; {
  setIsBlinking(true); // First blink
  setTimeout(() =&amp;gt; {
    setIsBlinking(false);
    setTimeout(() =&amp;gt; {
      setIsBlinking(true); // Second rapid blink
      setTimeout(() =&amp;gt; setIsBlinking(false), 100);
    }, 150);
  }, 100);
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;💡 Conclusion&lt;/strong&gt;&lt;br&gt;
Building this taught me that UX engineering is just as important as the AI itself. People stay on the page longer just to play with the bot's eyes!&lt;/p&gt;

&lt;p&gt;Check it out live at &lt;a href="https://www.trainlytic.net/" rel="noopener noreferrer"&gt;Trainlytic.net&lt;/a&gt; and let me know what you think of the design in the comments!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ai</category>
      <category>tailwindcss</category>
      <category>animation</category>
    </item>
    <item>
      <title>How I Hacked My Cortisol to Lose 26kg and Escape the "Skinny Fat" Trap The High-Intensity Mistake</title>
      <dc:creator>Talha Kazmi</dc:creator>
      <pubDate>Wed, 18 Feb 2026 12:38:27 +0000</pubDate>
      <link>https://forem.com/talhakazmi1/how-i-hacked-my-cortisol-to-lose-26kg-and-escape-the-skinny-fat-trap-the-high-intensity-mistake-5ghj</link>
      <guid>https://forem.com/talhakazmi1/how-i-hacked-my-cortisol-to-lose-26kg-and-escape-the-skinny-fat-trap-the-high-intensity-mistake-5ghj</guid>
      <description>&lt;p&gt;&lt;strong&gt;The High-Intensity Mistake&lt;/strong&gt;&lt;br&gt;
On May 6, 2025, I started my journey at 100kg. Like most people, I thought the answer was "eat nothing and hit the gym hard." I was losing weight, but I was losing my muscle right along with the fat. I ended up in constant physical pain, unable to recover, and trapped in a "skinny fat" physique despite the scale moving down. My nutrition was non-existent, and my body was failing to keep up with the stress of a 12-hour work shift and high-intensity training.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Pivot: Lowering Stress to Burn Fat&lt;/strong&gt;&lt;br&gt;
On December 31, 2025, I made a radical choice: I left the gym. I realized that as a senior developer working 12 hours a day, my cortisol levels were likely through the roof, causing my body to hold onto fat. I shifted my entire focus to a precision diet and exactly 60 minutes of brisk walking per day. No home workouts, no extra supplements, just consistent, low-impact movement and high-quality nutrition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Result: Data Doesn't Lie&lt;/strong&gt;&lt;br&gt;
The shift was immediate. On January 1, 2026, I weighed 80.6kg. By February 18, 2026, I hit 74.6kg. That is a 6kg loss in just 49 days, and unlike my first attempt, this was pure fat loss. My muscle is retained, my energy is high, and for the first time, I am on the correct path for my body type. I plan to continue this cut until April 1st before transitioning into a lean bulk.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;br&gt;
I was always the type of person who gained fat easily but lost it with extreme difficulty. Finally, I’m on the right path. By moving from a "work harder" mindset to a "recover smarter" mindset, I transformed my health without sacrificing my career performance.&lt;/p&gt;

</description>
      <category>fitness</category>
      <category>healthydebate</category>
      <category>productivity</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How I Automated SEO-Ready Blogs Across Next.js and Laravel Using a Custom "Shadcn-Style" Library</title>
      <dc:creator>Talha Kazmi</dc:creator>
      <pubDate>Wed, 18 Feb 2026 09:49:11 +0000</pubDate>
      <link>https://forem.com/talhakazmi1/how-i-automated-seo-ready-blogs-across-nextjs-and-laravel-using-a-custom-shadcn-style-library-1j27</link>
      <guid>https://forem.com/talhakazmi1/how-i-automated-seo-ready-blogs-across-nextjs-and-laravel-using-a-custom-shadcn-style-library-1j27</guid>
      <description>&lt;p&gt;&lt;strong&gt;The "Why" (Paragraph 1: The Bottleneck)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the high-stakes world of agency development, the request "we need a blog for SEO" sounds simple but usually triggers a 20-hour manual setup. Recently, I was tasked with revamping six legacy projects to get them "ad-ready," which meant implementing robust, SEO-optimized blog systems from scratch for every single one. Even with existing headless CMS options, the repetitive cycle of configuring API routes, setting up dynamic slugs, and building accessible UI components across different tech stacks was a massive drain on developer velocity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution (Paragraph 2: The "Super-Admin" Architecture)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I realized I didn't need a new CMS, I needed a standardized distribution engine. I engineered a centralized "Super-Admin" hub live on Vercel. In this ecosystem, each project is treated as a "Normal Admin" instance identified by a unique Organization ID. By centralizing the content management and API key distribution, I created a single source of truth that could feed blogs to any frontend, whether it was a modern Next.js app or a robust Laravel backend.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Transformation (Paragraph 3: From 20 Hours to 10 Minutes)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To make this integration seamless, I built a custom CLI-driven library inspired by the shadcn/ui philosophy. Instead of manual configuration, a developer simply initializes the library in their project. The CLI guides them through selecting a theme and template, then hooks into the Organization ID to automatically scaffold the dynamic /blog and /[slug] routes. What used to be a grueling 20-hour architectural task is now a 5-minute initialization. Once published in the central hub, blogs are immediately fetched and rendered, allowing the team to focus on content instead of configuration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Deep Dive: The Client-Side Engine
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Core logic for fetching blogs from the centralized CMS&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;getBlogs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nl"&gt;search&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BlogListResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUrl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/public/blogs&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="na"&gt;organizationId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;organizationId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;page&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;page&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="na"&gt;search&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;search&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;BlogListResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"The core of the library is a specialized CMSClient. By abstracting the fetch logic and organization scoping, the library ensures that no matter which project is calling the API, the data remains consistent and type-safe across the board."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Standard: From Logic to High-Fidelity UI
&lt;/h2&gt;

&lt;p&gt;"A library is only as good as the interfaces it enables. To ensure my cms-renderer could handle more than just text, I stress-tested the design logic against complex, data-heavy layouts. Below are examples of the UI standards I maintain across my full-stack projects, including my fitness platform, Trainlytic.net. The same principles of clean component architecture and efficient data fetching power these data-rich interfaces."&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xbcmff3fiwgvv499hls.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xbcmff3fiwgvv499hls.png" alt="Dashboard showing nutrition log with daily calorie targets and protein tracking on Trainlytic" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq75225quev4drtlw0byn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq75225quev4drtlw0byn.png" alt="Weight trend chart showing a 9kg loss over 30 days with a high-fidelity dark mode UI" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;"Standardizing the 'boring' parts of development, like setting up an SEO blog for the sixth time, is how we unlock the time to build complex products like Trainlytic. This library started as a way to save my own time, but it’s become a blueprint for how I approach scalable frontend architecture.&lt;/p&gt;

&lt;p&gt;Are you building internal tools to speed up your workflow? Let’s talk in the comments!"&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>laravel</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
