<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ali Hamza</title>
    <description>The latest articles on DEV Community by Ali Hamza (@ali_hamza_589ec7b3eb6688d).</description>
    <link>https://dev.to/ali_hamza_589ec7b3eb6688d</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3939488%2Fffc69754-c900-4599-b972-2a8d900525dd.png</url>
      <title>DEV Community: Ali Hamza</title>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ali_hamza_589ec7b3eb6688d"/>
    <language>en</language>
    <item>
      <title>Day 182 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Tue, 15 Sep 2026 11:27:11 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-182-of-learning-mern-stack-4bgo</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-182-of-learning-mern-stack-4bgo</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is &lt;strong&gt;Day 182&lt;/strong&gt; of my full-stack engineering path! Today, I focused on implementing session-based logout mechanisms in Express.js: &lt;strong&gt;Single-Device Logout&lt;/strong&gt; and &lt;strong&gt;Logout From All Devices&lt;/strong&gt;! 🔐⚡&lt;/p&gt;

&lt;p&gt;Here is a quick look at how session revocation works behind the scenes in MongoDB.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Session Revocation Logic
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Single Device Logout (&lt;code&gt;logout&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Extracts the &lt;code&gt;refreshToken&lt;/code&gt; from incoming HTTP cookies.&lt;/li&gt;
&lt;li&gt;Verifies JWT signature and fetches the active session document where &lt;code&gt;revoke: false&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Marks &lt;code&gt;revoke = true&lt;/code&gt; in MongoDB and clears the HTTP-only cookie on the client.&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
export const logout = async (req, res) =&amp;gt; {
  try {
    const incomingToken = req.cookies.refreshToken;
    if (!incomingToken) return res.status(400).json({ message: "Token not found!" });

    const decoded = jwt.verify(incomingToken, config.JWT_SECRET);
    const session = await sessionModel.findOne({ _id: decoded.sessionId, revoke: false });

    if (!session) return res.status(400).json({ message: "Invalid Token" });

    session.revoke = true;
    await session.save();

    res.clearCookie("refreshToken");
    res.status(200).json({ message: "Logout Successfully" });
  } catch (error) {
    res.status(400).json({ message: "Invalid or expired token" });
  }
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>logout</category>
      <category>backend</category>
      <category>auth0challenge</category>
    </item>
    <item>
      <title>Day 181 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Tue, 15 Sep 2026 11:17:11 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-181-of-learning-mern-stack-2mjh</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-181-of-learning-mern-stack-2mjh</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 181&lt;/strong&gt; of my full-stack engineering journey! Today, I dived deep into JWT Authentication security architectures, specifically focusing on &lt;strong&gt;Access Tokens vs. Refresh Tokens&lt;/strong&gt;! 🔐⚡&lt;/p&gt;

&lt;p&gt;Here is a breakdown of why two tokens are better than one and how to structure a secure authentication pipeline.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Security Architecture Breakdown
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Access Token (Short-Lived Authorization)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lifetime:&lt;/strong&gt; 15 minutes – 1 hour.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Usage:&lt;/strong&gt; Sent in the &lt;code&gt;Authorization&lt;/code&gt; header (&lt;code&gt;Bearer &amp;lt;token&amp;gt;&lt;/code&gt;) on every API request.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Strategy:&lt;/strong&gt; Short expiry window minimizes damage if intercepted.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Refresh Token (Long-Lived Session Persistence)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lifetime:&lt;/strong&gt; 7 – 30 days.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Usage:&lt;/strong&gt; Kept securely (ideally in &lt;code&gt;HttpOnly&lt;/code&gt; cookies) to request new access tokens upon expiration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security Strategy:&lt;/strong&gt; Prevents users from having to log in constantly while keeping sensitive access credentials short-lived.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 The Token Renewal Flow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Login:&lt;/strong&gt; Server issues both &lt;strong&gt;Access Token&lt;/strong&gt; and &lt;strong&gt;Refresh Token&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Request:&lt;/strong&gt; Frontend sends Access Token for API data fetching.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expiry Handled:&lt;/strong&gt; When Access Token expires (&lt;code&gt;401 Unauthorized&lt;/code&gt;), an interceptor calls &lt;code&gt;/api/auth/refresh&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Renewal:&lt;/strong&gt; Server validates Refresh Token and sends a fresh Access Token back.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🎯 Target Milestones for Tomorrow (Day 182)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Implementing Axios Response Interceptors in React/TypeScript to handle token auto-refresh silently.&lt;/li&gt;
&lt;li&gt;Storing refresh tokens securely in database documents for active session management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My active code repository updates daily on GitHub!&lt;br&gt;
[Links in the Comments]&lt;/p&gt;

&lt;p&gt;Day 181 locked in! Access &amp;amp; Refresh token mechanics mastered! 🚀🔐&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>auth</category>
      <category>programming</category>
      <category>jwt</category>
    </item>
    <item>
      <title>Day 180 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 13:45:03 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-180-of-learning-mern-stack-50mh</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-180-of-learning-mern-stack-50mh</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 180&lt;/strong&gt; of my full-stack engineering track! Today, I designed and built the &lt;strong&gt;Credit-Based Pricing Page UI&lt;/strong&gt; for my &lt;strong&gt;AI Website Builder&lt;/strong&gt; platform! 🚀💳&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how I structured the pricing matrix and integrated type-safe component mapping in React &amp;amp; TypeScript.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Architecture &amp;amp; UI Breakdown
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Type-Safe Pricing Contracts
&lt;/h3&gt;

&lt;p&gt;Defined strict TypeScript contracts to govern plan tiers, pricing calculations, credit caps, and feature lists:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
interface Plan {
  id: string;
  name: string;
  price: number;
  credits: number;
  description: string;
  features: string[];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>ai</category>
      <category>typescript</category>
      <category>react</category>
      <category>ui</category>
    </item>
    <item>
      <title>Day 179 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 13:39:25 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-179-of-learning-mern-stack-3l4e</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-179-of-learning-mern-stack-3l4e</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is &lt;strong&gt;Day 179&lt;/strong&gt; of my full-stack engineering milestone journey! Today, I built the &lt;strong&gt;My Projects Dashboard UI&lt;/strong&gt; for the &lt;strong&gt;AI Website Builder&lt;/strong&gt; platform! 🚀🎨&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how I designed a card grid layout with dynamic live preview rendering using TypeScript and React.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Architecture &amp;amp; UI Highlights
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Miniature Live Previews via Scaled iFrames
&lt;/h3&gt;

&lt;p&gt;Instead of storing static preview thumbnails, I embedded live preview previews using scaled &lt;code&gt;iframe&lt;/code&gt; rendering directly from stored markup strings:&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
tsx
&amp;lt;iframe
  srcDoc={project.current_code}
  className="absolute top-0 left-0 w-[1200px] h-[800px] origin-top-left pointer-events-none"
  sandbox="allow-scripts allow-same-origin"
  style={{ transform: 'scale(0.25)' }}
/&amp;gt; const [loading, setLoading] = useState&amp;lt;boolean&amp;gt;(true);
const [projects, setProjects] = useState&amp;lt;Project[]&amp;gt;([]);

const deleteProject = async (projectId: string) =&amp;gt; {
  console.log(projectId);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>react</category>
      <category>typescript</category>
      <category>tailwindcss</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Day 178 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 09:36:10 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-178-of-learning-mern-stack-3dd7</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-178-of-learning-mern-stack-3dd7</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;Today marks &lt;strong&gt;Day 178&lt;/strong&gt; of my full-stack journey, and I’m officially kicking off a new major project: &lt;strong&gt;An AI-Powered Website Builder&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The goal is to turn simple user natural language prompts into responsive web applications instantly.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠️ The Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Frontend:&lt;/strong&gt; React, TypeScript, Tailwind CSS&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Core Feature:&lt;/strong&gt; AI-driven prompt parsing to UI generation&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;UX focus:&lt;/strong&gt; Minimalist, high-contrast premium UI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🖥️ Implementation Highlights (Home Page)
&lt;/h2&gt;

&lt;p&gt;Today I built the Landing Hero Section. The key focus was ensuring a robust, type-safe submission flow. &lt;/p&gt;

&lt;p&gt;Highlights:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript-driven Event Handling:&lt;/strong&gt; Using &lt;code&gt;React.FormEvent&lt;/code&gt; to type the submission handler.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State Orchestration:&lt;/strong&gt; Managing loading states for the AI request lifecycle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Guard Clauses:&lt;/strong&gt; Ensuring authentication and non-empty inputs before hitting the API.&lt;/li&gt;
&lt;/ol&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
const onSubmitHandler = async (e: React.FormEvent) =&amp;gt; {
  e.preventDefault();
  if (!session?.user) return toast.error("Please sign in");
  setLoading(true);
  // Simulate AI API Call
  const { data } = await api.post("/api/user/project", { initial_prompt: input });
  navigate(`/projects/${data.projectId}`);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>Day 177 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 09:10:28 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-177-of-learning-mern-stack-3ac5</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-177-of-learning-mern-stack-3ac5</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 177&lt;/strong&gt; of my full-stack engineering track! Today, I explored &lt;strong&gt;TypeScript Object Modeling&lt;/strong&gt;: &lt;strong&gt;Type Aliases vs Interfaces&lt;/strong&gt;, &lt;strong&gt;Class Implementation Constraints&lt;/strong&gt;, &lt;strong&gt;Intersection Types (&lt;code&gt;&amp;amp;&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;Optional Fields (&lt;code&gt;?&lt;/code&gt;)&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;readonly&lt;/code&gt; Immutability&lt;/strong&gt;! 📘⚡&lt;/p&gt;

&lt;p&gt;Here is a breakdown of how these typing rules dictate contract enforcement across TypeScript codebases.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Object Contracts &amp;amp; Type Mechanics
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Interface Implementation in Classes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Classes require statically known contracts. While union types cannot be directly implemented by classes, &lt;code&gt;interfaces&lt;/code&gt; handle OOP structure cleanly:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  interface Cupsize {
    size: "small" | "large";
  }

  class Chai implements Cupsize {
    size: "small" | "large" = "small";
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Day 176 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 07:38:56 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-176-of-learning-mern-stack-1b88</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-176-of-learning-mern-stack-1b88</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 176&lt;/strong&gt; of my full-stack engineering track! Today, I explored advanced type-safety mechanics in &lt;strong&gt;TypeScript&lt;/strong&gt;: &lt;strong&gt;Type Assertions (&lt;code&gt;as&lt;/code&gt;)&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;unknown&lt;/code&gt; vs &lt;code&gt;any&lt;/code&gt;&lt;/strong&gt;, and the &lt;strong&gt;&lt;code&gt;never&lt;/code&gt; type for exhaustive checks&lt;/strong&gt;! 📘⚡&lt;/p&gt;

&lt;p&gt;Here is how these strict type features make applications bulletproof against runtime failures.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Advanced TypeScript Typing
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Type Assertions (&lt;code&gt;as&lt;/code&gt; Keyword)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Overrode default compiler inference when working with DOM elements and &lt;code&gt;JSON.parse()&lt;/code&gt; results:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  const element = document.querySelector('Element') as HTMLInputElement;
  const bookObject = JSON.parse(stringBook) as Book;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Day 175 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 07:34:12 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-175-of-learning-mern-stack-4pc2</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-175-of-learning-mern-stack-4pc2</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 175&lt;/strong&gt; of my full-stack engineering track! Today, I explored one of the most essential features for writing safe dynamic code in &lt;strong&gt;TypeScript&lt;/strong&gt;: &lt;strong&gt;Type Narrowing &amp;amp; Type Guards&lt;/strong&gt;! 📘⚡&lt;/p&gt;

&lt;p&gt;Type narrowing allows TypeScript to deduce specific types within conditional code blocks, eliminating type ambiguity and runtime crashes.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Type Narrowing Techniques
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Discriminated Unions (Tagged Unions)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Utilized a common literal discriminator property (&lt;code&gt;type&lt;/code&gt;) across distinct object types to cleanly handle polymorphic structures via &lt;code&gt;switch&lt;/code&gt; statements:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  type MasalaChai = { type: 'Masala', spicelevel: number };
  type GingerChai = { type: 'Ginger', amount: number };
  type ElaichiChai = { type: 'Elaichi', packet: number };

  type Chai = MasalaChai | GingerChai | ElaichiChai;

  const makeChai = (order: Chai) =&amp;gt; {
    switch (order.type) {
      case 'Elaichi': return "Elaichi Wali Chai";
      case 'Ginger': return "Ginger Wali Chai";
      case 'Masala': return "Masala Wali Chai";
    }
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>typescript</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Day 174 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 07:30:27 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-174-of-learning-mern-stack-42m6</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-174-of-learning-mern-stack-42m6</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 174&lt;/strong&gt; of my full-stack engineering journey! Today, I explored &lt;strong&gt;Union Types&lt;/strong&gt;, &lt;strong&gt;Literal Types&lt;/strong&gt;, and the dangers of implicit &lt;strong&gt;&lt;code&gt;any&lt;/code&gt;&lt;/strong&gt; in &lt;strong&gt;TypeScript&lt;/strong&gt;! 📘⚡&lt;/p&gt;

&lt;p&gt;Here is how flexible typing and strict status constraints work under the hood.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Unions, Literals &amp;amp; &lt;code&gt;any&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Flexible Union Types &amp;amp; Strict String Literals
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Used bitwise OR operator syntax (&lt;code&gt;|&lt;/code&gt;) to allow multi-type assignments or restrict variables to fixed values:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  let subs: number | string = 10;
  subs = '10M'; // Valid reassignment

  let apiReq: 'pending' | 'success' | 'error' = 'pending'; // Restricts allowed status values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Day 173 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 07:25:32 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-173-of-learning-mern-stack-36b5</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-173-of-learning-mern-stack-36b5</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 173&lt;/strong&gt; of my full-stack engineering track! Today, I explored one of the core mechanisms that make &lt;strong&gt;TypeScript&lt;/strong&gt; powerful and developer-friendly: &lt;strong&gt;Type Inference vs. Type Annotations&lt;/strong&gt;! 📘⚡&lt;/p&gt;

&lt;p&gt;Understanding when to let the TypeScript compiler infer types automatically versus declaring them explicitly makes codebases cleaner and more maintainable.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Inference vs. Annotations
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Type Inference (Implicit Typing)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;TypeScript automatically determines the variable type based on its initial assigned value:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  let drink = "Chai peyo"; // Inferenced as type string
  // drink = 0; // Error: Type 'number' is not assignable to type 'string'.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Day 172 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sun, 16 Aug 2026 07:21:05 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-172-of-learning-mern-stack-42f5</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-172-of-learning-mern-stack-42f5</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 172&lt;/strong&gt; of my full-stack engineering track! After wrapping up my MERN stack Chat Application, today marks the start of my &lt;strong&gt;TypeScript&lt;/strong&gt; journey! 📘⚡&lt;/p&gt;

&lt;p&gt;I explored the core fundamentals of type safety, type annotations, and basic primitive types (&lt;code&gt;string&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;boolean&lt;/code&gt;).&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: Primitive Types &amp;amp; Function Contracts
&lt;/h2&gt;

&lt;p&gt;As captured in my code editor setup (&lt;strong&gt;&lt;code&gt;index.ts&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Function Parameter &amp;amp; Return Annotations
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Defined strict type contracts on function inputs and return values to prevent runtime type mismatch bugs:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
typescript
  function greet(name: string): string {
    return `Hello ${name}`;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>typescript</category>
      <category>types</category>
    </item>
    <item>
      <title>Day 171 of Learning MERN Stack</title>
      <dc:creator>Ali Hamza</dc:creator>
      <pubDate>Sat, 01 Aug 2026 07:49:22 +0000</pubDate>
      <link>https://dev.to/ali_hamza_589ec7b3eb6688d/day-171-of-learning-mern-stack-3jkc</link>
      <guid>https://dev.to/ali_hamza_589ec7b3eb6688d/day-171-of-learning-mern-stack-3jkc</guid>
      <description>&lt;p&gt;Hello Dev Community! 👋&lt;/p&gt;

&lt;p&gt;It is officially &lt;strong&gt;Day 171&lt;/strong&gt; of my full-stack web development journey, and I am thrilled to announce that &lt;strong&gt;QuickChat (MERN Stack Real-Time Chat App)&lt;/strong&gt; is officially complete! 🎉🚀&lt;/p&gt;

&lt;p&gt;Today, I finalized the last key security layer: &lt;strong&gt;JWT Authentication &amp;amp; Route Protection Middleware&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Breakdown: JWT Route Security
&lt;/h2&gt;

&lt;p&gt;As captured in my implementation snapshots (&lt;strong&gt;&lt;code&gt;auth.js&lt;/code&gt; &amp;amp; &lt;code&gt;utils.js&lt;/code&gt;&lt;/strong&gt;):&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Token Signature Utility (&lt;code&gt;utils.js&lt;/code&gt;)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Configured a centralized token generator helper signing payload &lt;code&gt;userId&lt;/code&gt; parameters using environment secrets:&lt;/li&gt;
&lt;/ul&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
javascript
  const generateToken = (userId) =&amp;gt; {
    return jwt.sign({ userId }, process.env.JWT_SECRET);
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>node</category>
      <category>express</category>
      <category>mongodb</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
