<?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: Bhargav Patel</title>
    <description>The latest articles on Forem by Bhargav Patel (@newavtar).</description>
    <link>https://forem.com/newavtar</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%2F663691%2Fce3c6a6c-82da-41cb-8daf-eb3db85665b9.jpg</url>
      <title>Forem: Bhargav Patel</title>
      <link>https://forem.com/newavtar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/newavtar"/>
    <language>en</language>
    <item>
      <title>Part 3: Types of RAG</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Sun, 10 May 2026 17:51:58 +0000</pubDate>
      <link>https://forem.com/newavtar/part-3-types-of-rag-3di</link>
      <guid>https://forem.com/newavtar/part-3-types-of-rag-3di</guid>
      <description>&lt;p&gt;Now that we understand what RAG is and how the ingestion and retrieval pipeline works, the next natural question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Is there only one type of RAG?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is no.&lt;/p&gt;

&lt;p&gt;In real-world systems, RAG is not a single fixed architecture. It is a &lt;strong&gt;family of approaches&lt;/strong&gt;, and each one is designed for different levels of accuracy, complexity, and performance requirements.&lt;/p&gt;

&lt;p&gt;Let’s go through the most important types of RAG used in production systems today.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Naive RAG (Basic RAG)
&lt;/h1&gt;

&lt;p&gt;This is the simplest form of RAG.&lt;/p&gt;

&lt;p&gt;It follows exactly the same pipeline we already discussed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;documents are chunked&lt;/li&gt;
&lt;li&gt;embeddings are created&lt;/li&gt;
&lt;li&gt;stored in a vector database&lt;/li&gt;
&lt;li&gt;top matching chunks are retrieved&lt;/li&gt;
&lt;li&gt;sent to the LLM for generation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Embedding → Vector Search → Context → LLM → Answer&lt;/p&gt;

&lt;h3&gt;
  
  
  Where it is used:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;simple chatbots&lt;/li&gt;
&lt;li&gt;basic document Q&amp;amp;A systems&lt;/li&gt;
&lt;li&gt;prototypes and demos&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Limitation:
&lt;/h3&gt;

&lt;p&gt;Although it works, it is not very intelligent.&lt;/p&gt;

&lt;p&gt;Common issues include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;irrelevant chunks sometimes get retrieved&lt;/li&gt;
&lt;li&gt;no ranking refinement&lt;/li&gt;
&lt;li&gt;weak handling of complex queries&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  2. Hybrid RAG
&lt;/h1&gt;

&lt;p&gt;Hybrid RAG improves retrieval by combining two search methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keyword search (BM25)&lt;/li&gt;
&lt;li&gt;vector search (semantic search)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why this matters:
&lt;/h3&gt;

&lt;p&gt;Sometimes keyword matching performs better than semantic search.&lt;/p&gt;

&lt;p&gt;For example, if a user searches:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“GPT-4 pricing”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Keyword search can directly match exact terms more effectively.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Keyword Search + Vector Search → Merge Results → Rerank → LLM&lt;/p&gt;

&lt;h3&gt;
  
  
  Where it is used:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;enterprise search systems&lt;/li&gt;
&lt;li&gt;SaaS knowledge bases&lt;/li&gt;
&lt;li&gt;large documentation platforms&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Benefit:
&lt;/h3&gt;

&lt;p&gt;It is significantly more reliable than naive RAG because it balances both exact and semantic matching.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Reranking RAG (Quality-Focused RAG)
&lt;/h1&gt;

&lt;p&gt;This approach adds an extra intelligence layer after retrieval.&lt;/p&gt;

&lt;p&gt;Instead of directly sending retrieved chunks to the LLM, the system first re-evaluates them using a &lt;strong&gt;reranker model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The reranker assigns relevance scores and reorders the results.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Retrieval → Reranker → Best Context → LLM&lt;/p&gt;

&lt;h3&gt;
  
  
  Why this matters:
&lt;/h3&gt;

&lt;p&gt;Vector search is fast, but it is not always precise in ranking results.&lt;/p&gt;

&lt;p&gt;Reranking improves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;relevance quality&lt;/li&gt;
&lt;li&gt;context filtering&lt;/li&gt;
&lt;li&gt;removal of noisy chunks&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Where it is used:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;legal AI systems&lt;/li&gt;
&lt;li&gt;enterprise copilots&lt;/li&gt;
&lt;li&gt;high-accuracy assistants&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  4. Multi-Query RAG
&lt;/h1&gt;

&lt;p&gt;Sometimes a single user query is not enough to capture intent.&lt;/p&gt;

&lt;p&gt;So instead of retrieving once, the system generates multiple variations of the same query.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;

&lt;p&gt;User query:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“How does refund work?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;System expands it into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;refund policy conditions&lt;/li&gt;
&lt;li&gt;return process steps&lt;/li&gt;
&lt;li&gt;money-back rules&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Query Expansion → Multiple Searches → Merge → LLM&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefit:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;better coverage of information&lt;/li&gt;
&lt;li&gt;higher recall&lt;/li&gt;
&lt;li&gt;fewer missed results&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  5. Graph RAG (Knowledge Graph-Based RAG)
&lt;/h1&gt;

&lt;p&gt;Graph RAG treats information as connected entities instead of isolated chunks.&lt;/p&gt;

&lt;p&gt;Instead of independent documents, it builds relationships between concepts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example relationships:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;product → policy → exception → user cases&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is connected in a structured graph.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Graph Traversal → Connected Context → LLM&lt;/p&gt;

&lt;h3&gt;
  
  
  Where it is used:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;enterprise knowledge systems&lt;/li&gt;
&lt;li&gt;research assistants&lt;/li&gt;
&lt;li&gt;complex domain reasoning&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Benefit:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;stronger logical reasoning&lt;/li&gt;
&lt;li&gt;better relationship understanding&lt;/li&gt;
&lt;li&gt;more structured answers&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  6. Agentic RAG (Tool-Using RAG)
&lt;/h1&gt;

&lt;p&gt;This is one of the most advanced modern approaches.&lt;/p&gt;

&lt;p&gt;Here, the LLM behaves like an &lt;strong&gt;autonomous agent&lt;/strong&gt;, not just a response generator.&lt;/p&gt;

&lt;p&gt;It can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plan how to answer a question&lt;/li&gt;
&lt;li&gt;decide what to search&lt;/li&gt;
&lt;li&gt;refine queries&lt;/li&gt;
&lt;li&gt;call external tools or APIs&lt;/li&gt;
&lt;li&gt;perform multiple retrieval steps&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Query → Plan → Retrieve → Reflect → Retrieve Again → Answer&lt;/p&gt;

&lt;h3&gt;
  
  
  Key idea:
&lt;/h3&gt;

&lt;p&gt;Instead of a single retrieval step, it performs &lt;strong&gt;iterative reasoning&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where it is used:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;AI copilots&lt;/li&gt;
&lt;li&gt;coding assistants&lt;/li&gt;
&lt;li&gt;research automation systems&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  7. Self-RAG (Self-Checking RAG)
&lt;/h1&gt;

&lt;p&gt;Self-RAG adds a verification layer after generation.&lt;/p&gt;

&lt;p&gt;After producing an answer, the system checks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Is this answer actually supported by retrieved context?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If not, it corrects itself by retrieving again or refining the response.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flow:
&lt;/h3&gt;

&lt;p&gt;Retrieve → Generate → Verify → Fix → Final Answer&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefit:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;reduces hallucinations further&lt;/li&gt;
&lt;li&gt;improves factual accuracy&lt;/li&gt;
&lt;li&gt;adds self-correction ability&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Comparison of RAG Types
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Type&lt;/th&gt;
&lt;th&gt;Strength&lt;/th&gt;
&lt;th&gt;Complexity&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Naive RAG&lt;/td&gt;
&lt;td&gt;Simple setup&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hybrid RAG&lt;/td&gt;
&lt;td&gt;Better retrieval&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reranking RAG&lt;/td&gt;
&lt;td&gt;Higher accuracy&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-Query RAG&lt;/td&gt;
&lt;td&gt;Better recall&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Graph RAG&lt;/td&gt;
&lt;td&gt;Strong reasoning&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agentic RAG&lt;/td&gt;
&lt;td&gt;Autonomous workflows&lt;/td&gt;
&lt;td&gt;Very High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Self-RAG&lt;/td&gt;
&lt;td&gt;Self-correction&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  Key Insight
&lt;/h1&gt;

&lt;p&gt;As we move from Naive RAG to Agentic RAG:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We are not just improving retrieval — we are improving reasoning ability.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the real evolution of RAG systems.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Mental Model
&lt;/h1&gt;

&lt;p&gt;To simplify everything:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Naive RAG → basic retrieval&lt;/li&gt;
&lt;li&gt;Hybrid RAG → smarter search&lt;/li&gt;
&lt;li&gt;Reranking RAG → better ordering&lt;/li&gt;
&lt;li&gt;Multi-Query RAG → better coverage&lt;/li&gt;
&lt;li&gt;Graph RAG → connected knowledge&lt;/li&gt;
&lt;li&gt;Agentic RAG → decision-making system&lt;/li&gt;
&lt;li&gt;Self-RAG → self-correcting system&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;RAG is not a single architecture.&lt;/p&gt;

&lt;p&gt;It is a &lt;strong&gt;complete ecosystem of retrieval-based AI systems&lt;/strong&gt;, evolving based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;accuracy requirements&lt;/li&gt;
&lt;li&gt;data complexity&lt;/li&gt;
&lt;li&gt;cost constraints&lt;/li&gt;
&lt;li&gt;reasoning needs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But despite all variations, the foundation remains the same:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Retrieve relevant knowledge → provide it to the model → generate grounded answers&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is still the core idea behind every RAG system in production today.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>rag</category>
    </item>
    <item>
      <title>Part 2: RAG Architecture: How Retrieval-Augmented Generation Actually Works</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Sun, 10 May 2026 17:47:59 +0000</pubDate>
      <link>https://forem.com/newavtar/part-2-rag-architecture-how-retrieval-augmented-generation-actually-works-3821</link>
      <guid>https://forem.com/newavtar/part-2-rag-architecture-how-retrieval-augmented-generation-actually-works-3821</guid>
      <description>&lt;p&gt;Now that we understand what RAG is and why it is so popular, let’s understand how RAG actually works in real systems.&lt;/p&gt;

&lt;p&gt;So now we will talk about the &lt;strong&gt;complete RAG pipeline&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;RAG pipeline has two main components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First is called the ingestion pipeline&lt;/li&gt;
&lt;li&gt;Second is called the retrieval pipeline&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are very important concepts, but they are actually very simple once you understand them.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Ingestion Pipeline
&lt;/h1&gt;

&lt;p&gt;Let’s first understand the ingestion pipeline.&lt;/p&gt;

&lt;p&gt;Ingestion pipeline basically means how we prepare the data before giving it to the model.&lt;/p&gt;

&lt;p&gt;You can think of it like preparing an open book before the exam.&lt;/p&gt;

&lt;p&gt;We first prepare all the information in a structured format so that the model can later access it easily.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: Collect Data
&lt;/h2&gt;

&lt;p&gt;First we collect all the data.&lt;/p&gt;

&lt;p&gt;This data can be anything like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PDF files&lt;/li&gt;
&lt;li&gt;simple documents&lt;/li&gt;
&lt;li&gt;Excel files&lt;/li&gt;
&lt;li&gt;websites&lt;/li&gt;
&lt;li&gt;or even an entire company’s internal database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So basically, we take all possible sources of information.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Extract Useful Data
&lt;/h2&gt;

&lt;p&gt;Once we collect the data, the next step is extraction.&lt;/p&gt;

&lt;p&gt;We extract useful text from all these sources.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;from PDFs we extract text&lt;/li&gt;
&lt;li&gt;from websites we extract content&lt;/li&gt;
&lt;li&gt;from databases we extract structured information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now we have clean usable text.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Split Data into Chunks
&lt;/h2&gt;

&lt;p&gt;Now we split this data into small parts.&lt;/p&gt;

&lt;p&gt;We do not process the whole document at once.&lt;/p&gt;

&lt;p&gt;We divide it into small pieces called &lt;strong&gt;chunks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, a document can be split into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;chunk 1&lt;/li&gt;
&lt;li&gt;chunk 2&lt;/li&gt;
&lt;li&gt;chunk 3&lt;/li&gt;
&lt;li&gt;chunk 4&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each chunk contains a small meaningful portion of information.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Convert Chunks into Embeddings
&lt;/h2&gt;

&lt;p&gt;Now comes a very important step.&lt;/p&gt;

&lt;p&gt;We convert each chunk into embeddings.&lt;/p&gt;

&lt;p&gt;Now what are embeddings?&lt;/p&gt;

&lt;p&gt;Basically, models cannot directly understand text. They only understand numbers.&lt;/p&gt;

&lt;p&gt;So we convert text into numbers using embedding models.&lt;/p&gt;

&lt;p&gt;Each chunk is converted into a &lt;strong&gt;vector of numbers&lt;/strong&gt;, which represents its meaning.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Refunds are allowed within 30 days"
→ [0.21, -0.67, 0.92, ...]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now every chunk has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;its original text&lt;/li&gt;
&lt;li&gt;and its embedding (vector representation)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 5: Store in Vector Database
&lt;/h2&gt;

&lt;p&gt;Now we store all these embeddings in a vector database.&lt;/p&gt;

&lt;p&gt;A vector database is different from a normal database.&lt;/p&gt;

&lt;p&gt;Normal databases like MongoDB or MySQL use keyword-based search.&lt;/p&gt;

&lt;p&gt;For example, if I search:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“heart attack symptoms”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I will only get documents that contain these exact words.&lt;/p&gt;

&lt;p&gt;But vector databases work differently.&lt;/p&gt;

&lt;p&gt;They use &lt;strong&gt;semantic search&lt;/strong&gt;, which means meaning-based search.&lt;/p&gt;

&lt;p&gt;So even if the exact words are not present, but the meaning is similar, it will still return results.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“heart attack symptoms”&lt;/li&gt;
&lt;li&gt;“cardiac arrest signs”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if words are different, meaning is similar, so results will still be retrieved.&lt;/p&gt;




&lt;p&gt;So this entire process of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;collecting data&lt;/li&gt;
&lt;li&gt;extracting text&lt;/li&gt;
&lt;li&gt;chunking&lt;/li&gt;
&lt;li&gt;creating embeddings&lt;/li&gt;
&lt;li&gt;storing in vector database&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;is called the &lt;strong&gt;data ingestion pipeline&lt;/strong&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%2Fl2w2wxl6xe75of0u7nlj.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%2Fl2w2wxl6xe75of0u7nlj.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Retrieval Pipeline
&lt;/h1&gt;

&lt;p&gt;Now let’s understand the second part, which is the retrieval pipeline.&lt;/p&gt;

&lt;p&gt;This is the actual runtime system where user interacts with the model.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 1: User Query
&lt;/h2&gt;

&lt;p&gt;First, the user asks a question.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What are heart attack symptoms?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This query enters the system.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Convert Query into Embeddings
&lt;/h2&gt;

&lt;p&gt;Just like we converted documents into embeddings, we also convert the user query into embeddings.&lt;/p&gt;

&lt;p&gt;We use the same embedding model that was used during ingestion.&lt;/p&gt;

&lt;p&gt;This is important because both must exist in the same vector space.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Search in Vector Database
&lt;/h2&gt;

&lt;p&gt;Now we search the vector database.&lt;/p&gt;

&lt;p&gt;We compare the query embedding with all stored embeddings.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;semantic search&lt;/strong&gt; or &lt;strong&gt;similarity search&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So instead of matching keywords, we match meaning.&lt;/p&gt;

&lt;p&gt;For example, if the query is about:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;heart attack symptoms&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We may retrieve documents about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cardiac arrest&lt;/li&gt;
&lt;li&gt;chest pain&lt;/li&gt;
&lt;li&gt;emergency conditions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if exact words are not present, we still get relevant results.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 4: Retrieve Relevant Documents (Context)
&lt;/h2&gt;

&lt;p&gt;Now we get the relevant documents from the vector database.&lt;/p&gt;

&lt;p&gt;These retrieved pieces of information are called &lt;strong&gt;context&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This context contains useful information related to the user query.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 5: Augmentation (Create Prompt)
&lt;/h2&gt;

&lt;p&gt;Now instead of directly sending the user query to the LLM, we create a full prompt.&lt;/p&gt;

&lt;p&gt;This prompt contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the original user query&lt;/li&gt;
&lt;li&gt;the retrieved context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So we are basically enhancing the prompt with external knowledge.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;augmentation&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 6: Generation
&lt;/h2&gt;

&lt;p&gt;Finally, this augmented prompt is passed to the LLM.&lt;/p&gt;

&lt;p&gt;Now the LLM generates the final answer based on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user query&lt;/li&gt;
&lt;li&gt;retrieved context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then we return the response to the user.&lt;/p&gt;




&lt;p&gt;So this entire process of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;taking a user query&lt;/li&gt;
&lt;li&gt;converting it into embeddings&lt;/li&gt;
&lt;li&gt;searching the vector database using semantic similarity&lt;/li&gt;
&lt;li&gt;retrieving relevant documents as context&lt;/li&gt;
&lt;li&gt;augmenting the prompt with query and context&lt;/li&gt;
&lt;li&gt;generating the final answer using the LLM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;is called the retrieval pipeline.&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%2Fhxxv93wheqn71dr5rsy7.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%2Fhxxv93wheqn71dr5rsy7.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Why It is Called Retrieval Augmented Generation
&lt;/h1&gt;

&lt;p&gt;Now let’s understand the naming clearly.&lt;/p&gt;

&lt;p&gt;It is called Retrieval Augmented Generation because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retrieval → we first retrieve relevant documents from vector database&lt;/li&gt;
&lt;li&gt;Augmented → we add that retrieved context into the prompt&lt;/li&gt;
&lt;li&gt;Generation → the LLM generates the final response&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So all three steps together form RAG.&lt;/p&gt;




&lt;h1&gt;
  
  
  Complete RAG Pipeline (Simple View)
&lt;/h1&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%2Fl2pggw9ljc4cjhg84gib.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%2Fl2pggw9ljc4cjhg84gib.png" alt=" "&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Understanding
&lt;/h1&gt;

&lt;p&gt;So now you should clearly understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ingestion pipeline is where we prepare data&lt;/li&gt;
&lt;li&gt;Retrieval pipeline is where we use that data at runtime&lt;/li&gt;
&lt;li&gt;Vector databases help us search based on meaning&lt;/li&gt;
&lt;li&gt;LLM generates answers using retrieved context&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  One Line Summary
&lt;/h1&gt;

&lt;p&gt;RAG works by preparing data into embeddings during ingestion, storing it in a vector database, and retrieving relevant context at query time to help the LLM generate accurate answers.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>rag</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Part 1: What is RAG?</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Sun, 10 May 2026 16:59:38 +0000</pubDate>
      <link>https://forem.com/newavtar/part-1-what-is-rag-1pb</link>
      <guid>https://forem.com/newavtar/part-1-what-is-rag-1pb</guid>
      <description>&lt;p&gt;Artificial Intelligence changed dramatically after the rise of Large Language Models (LLMs) like GPT, Gemini, Claude, and Llama.&lt;/p&gt;

&lt;p&gt;Suddenly, AI could:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;write code&lt;/li&gt;
&lt;li&gt;summarize documents&lt;/li&gt;
&lt;li&gt;answer complex questions&lt;/li&gt;
&lt;li&gt;generate reports&lt;/li&gt;
&lt;li&gt;help with research&lt;/li&gt;
&lt;li&gt;even solve reasoning problems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a lot of people, it felt like AI became intelligent almost overnight.&lt;/p&gt;

&lt;p&gt;But once developers started building real products with these models, a major issue became impossible to ignore.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;LLMs are powerful, but they don’t actually know your data.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;They only know what they learned during training.&lt;/p&gt;

&lt;p&gt;And that limitation led to one of the most important ideas in modern AI engineering:&lt;/p&gt;

&lt;h1&gt;
  
  
  Retrieval-Augmented Generation (RAG)
&lt;/h1&gt;

&lt;p&gt;Today, RAG is used almost everywhere in production AI systems, especially in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI assistants&lt;/li&gt;
&lt;li&gt;enterprise search tools&lt;/li&gt;
&lt;li&gt;customer support bots&lt;/li&gt;
&lt;li&gt;research copilots&lt;/li&gt;
&lt;li&gt;coding assistants&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before understanding how RAG works, it’s important to understand &lt;em&gt;why it became necessary in the first place&lt;/em&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem with Traditional LLMs
&lt;/h1&gt;

&lt;p&gt;Traditional language models are trained on massive datasets collected from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;books&lt;/li&gt;
&lt;li&gt;websites&lt;/li&gt;
&lt;li&gt;articles&lt;/li&gt;
&lt;li&gt;code repositories&lt;/li&gt;
&lt;li&gt;public internet content&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;During training, the model learns patterns in language and stores that knowledge inside billions of parameters.&lt;/p&gt;

&lt;p&gt;But after training finishes, the model’s knowledge becomes static.&lt;/p&gt;

&lt;p&gt;That means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it cannot automatically learn new information&lt;/li&gt;
&lt;li&gt;it cannot access private company data&lt;/li&gt;
&lt;li&gt;it does not know recent updates unless retrained&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, imagine a model trained in 2024.&lt;/p&gt;

&lt;p&gt;That model may have no idea about:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;product updates released in 2025&lt;/li&gt;
&lt;li&gt;new company policies&lt;/li&gt;
&lt;li&gt;recently published research&lt;/li&gt;
&lt;li&gt;live financial information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This became one of the biggest limitations of standard LLMs.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Hallucination Problem
&lt;/h1&gt;

&lt;p&gt;Another major issue is hallucination.&lt;/p&gt;

&lt;p&gt;A hallucination happens when an LLM confidently generates information that is wrong, misleading, or completely fabricated.&lt;/p&gt;

&lt;p&gt;For example, imagine asking a normal LLM:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"What is our company's latest refund policy?"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the model has never seen your company’s internal documents, it may still produce an answer that sounds polished and believable.&lt;/p&gt;

&lt;p&gt;But the response could easily be:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;outdated&lt;/li&gt;
&lt;li&gt;partially incorrect&lt;/li&gt;
&lt;li&gt;or entirely made up&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This happens because LLMs are not databases or search engines.&lt;/p&gt;

&lt;p&gt;They are prediction systems.&lt;/p&gt;

&lt;p&gt;Their job is not:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Tell the truth"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Their actual job is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Predict the most likely next word"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That distinction is incredibly important.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Fine-Tuning Wasn’t Enough
&lt;/h1&gt;

&lt;p&gt;At first, many teams thought fine-tuning would solve these problems.&lt;/p&gt;

&lt;p&gt;The idea sounded straightforward:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;collect company data&lt;/li&gt;
&lt;li&gt;retrain the model&lt;/li&gt;
&lt;li&gt;deploy the updated version&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But things became difficult very quickly.&lt;/p&gt;

&lt;p&gt;Every time new information appeared, companies would need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GPU resources&lt;/li&gt;
&lt;li&gt;retraining pipelines&lt;/li&gt;
&lt;li&gt;evaluation workflows&lt;/li&gt;
&lt;li&gt;redeployment processes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And enterprise data changes constantly.&lt;/p&gt;

&lt;p&gt;Policies get updated.&lt;/p&gt;

&lt;p&gt;Products evolve.&lt;/p&gt;

&lt;p&gt;Research grows daily.&lt;/p&gt;

&lt;p&gt;Customer information changes every minute.&lt;/p&gt;

&lt;p&gt;Retraining large models over and over again simply isn’t practical for most organizations.&lt;/p&gt;

&lt;p&gt;That’s where RAG became the better solution.&lt;/p&gt;




&lt;h1&gt;
  
  
  So What Exactly is RAG?
&lt;/h1&gt;

&lt;p&gt;Retrieval-Augmented Generation (RAG) is a technique that allows an AI system to retrieve external information before generating a response.&lt;/p&gt;

&lt;p&gt;Instead of relying only on memorized training data, the system can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search external knowledge sources&lt;/li&gt;
&lt;li&gt;retrieve relevant information&lt;/li&gt;
&lt;li&gt;use that information while answering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In simple terms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAG gives AI access to external memory.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that single idea changed modern AI systems completely.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Easiest Way to Understand RAG
&lt;/h1&gt;

&lt;p&gt;Here’s the simplest analogy.&lt;/p&gt;

&lt;p&gt;A traditional LLM is like a student taking a closed-book exam.&lt;/p&gt;

&lt;p&gt;The student can only answer questions using memory.&lt;/p&gt;

&lt;p&gt;If they forget something, they may:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;guess&lt;/li&gt;
&lt;li&gt;hallucinate&lt;/li&gt;
&lt;li&gt;fail&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A RAG system is like a student taking an open-book exam.&lt;/p&gt;

&lt;p&gt;Now the student can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;search notes&lt;/li&gt;
&lt;li&gt;check documents&lt;/li&gt;
&lt;li&gt;read references&lt;/li&gt;
&lt;li&gt;retrieve information in real time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Naturally, the second student gives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;more accurate answers&lt;/li&gt;
&lt;li&gt;more updated responses&lt;/li&gt;
&lt;li&gt;better context-aware explanations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s exactly what RAG enables for AI systems.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Modern AI Systems Need RAG
&lt;/h1&gt;

&lt;p&gt;RAG became important because modern AI applications require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;fresh information&lt;/li&gt;
&lt;li&gt;factual grounding&lt;/li&gt;
&lt;li&gt;enterprise knowledge&lt;/li&gt;
&lt;li&gt;private data access&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;without constantly retraining models.&lt;/p&gt;

&lt;p&gt;Let’s break down the major reasons.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. LLMs Have Outdated Knowledge
&lt;/h1&gt;

&lt;p&gt;A normal LLM only knows the information it saw during training.&lt;/p&gt;

&lt;p&gt;It does &lt;strong&gt;not&lt;/strong&gt; automatically know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;today’s news&lt;/li&gt;
&lt;li&gt;recent product launches&lt;/li&gt;
&lt;li&gt;updated policies&lt;/li&gt;
&lt;li&gt;newly uploaded documents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RAG solves this by retrieving the latest information dynamically.&lt;/p&gt;

&lt;p&gt;Instead of retraining the entire model, you simply update the knowledge source.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. RAG Reduces Hallucinations
&lt;/h1&gt;

&lt;p&gt;Without retrieval, LLMs often guess.&lt;/p&gt;

&lt;p&gt;With RAG, responses are grounded in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieved documents&lt;/li&gt;
&lt;li&gt;factual context&lt;/li&gt;
&lt;li&gt;external knowledge sources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This dramatically improves reliability.&lt;/p&gt;

&lt;p&gt;Instead of answering purely from memory, the model answers using actual information.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. RAG Allows AI to Work with Private Data
&lt;/h1&gt;

&lt;p&gt;Most enterprise knowledge is private.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HR documents&lt;/li&gt;
&lt;li&gt;customer records&lt;/li&gt;
&lt;li&gt;legal contracts&lt;/li&gt;
&lt;li&gt;internal reports&lt;/li&gt;
&lt;li&gt;engineering documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This data does not exist publicly on the internet.&lt;/p&gt;

&lt;p&gt;RAG allows companies to connect private knowledge sources directly to AI systems without retraining the model itself.&lt;/p&gt;

&lt;p&gt;That became one of the biggest reasons enterprises adopted RAG so quickly.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. RAG is More Practical Than Constant Fine-Tuning
&lt;/h1&gt;

&lt;p&gt;Continuously fine-tuning large models is expensive.&lt;/p&gt;

&lt;p&gt;RAG is much more scalable because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;you only update documents&lt;/li&gt;
&lt;li&gt;you refresh retrieval indexes&lt;/li&gt;
&lt;li&gt;you avoid retraining massive models repeatedly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For real-world systems, this approach is faster, cheaper, and easier to maintain.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. RAG Enables Real-Time AI Applications
&lt;/h1&gt;

&lt;p&gt;Modern businesses need AI systems that understand constantly changing information.&lt;/p&gt;

&lt;p&gt;Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;stock market assistants&lt;/li&gt;
&lt;li&gt;legal research systems&lt;/li&gt;
&lt;li&gt;healthcare AI&lt;/li&gt;
&lt;li&gt;customer support bots&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These systems need access to live and updated knowledge.&lt;/p&gt;

&lt;p&gt;RAG makes that possible.&lt;/p&gt;




&lt;h1&gt;
  
  
  A Real-World Example
&lt;/h1&gt;

&lt;p&gt;Imagine building a customer support chatbot for an e-commerce company.&lt;/p&gt;

&lt;p&gt;Without RAG, the chatbot might:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;provide outdated refund policies&lt;/li&gt;
&lt;li&gt;invent shipping details&lt;/li&gt;
&lt;li&gt;hallucinate product information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With RAG, the chatbot can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieve the latest support documents&lt;/li&gt;
&lt;li&gt;access updated policies&lt;/li&gt;
&lt;li&gt;answer using current company information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;better customer experience&lt;/li&gt;
&lt;li&gt;fewer hallucinations&lt;/li&gt;
&lt;li&gt;more trustworthy AI systems&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  How RAG Changed AI Systems
&lt;/h1&gt;

&lt;p&gt;Before RAG, most LLMs behaved like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Static Knowledge Systems
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After RAG, AI systems became:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Dynamic Knowledge Systems
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was a massive shift in AI architecture.&lt;/p&gt;

&lt;p&gt;Instead of forcing models to memorize everything, systems could now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieve information on demand&lt;/li&gt;
&lt;li&gt;access external memory&lt;/li&gt;
&lt;li&gt;work with continuously updated knowledge&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That fundamentally changed how AI applications are designed.&lt;/p&gt;




&lt;h1&gt;
  
  
  Where RAG is Used Today
&lt;/h1&gt;

&lt;p&gt;Today, RAG powers many modern AI products and enterprise systems.&lt;/p&gt;

&lt;p&gt;Some common examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;enterprise AI assistants&lt;/li&gt;
&lt;li&gt;AI customer support systems&lt;/li&gt;
&lt;li&gt;legal document search tools&lt;/li&gt;
&lt;li&gt;healthcare assistants&lt;/li&gt;
&lt;li&gt;coding copilots&lt;/li&gt;
&lt;li&gt;financial research platforms&lt;/li&gt;
&lt;li&gt;internal company search systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, almost every serious enterprise AI system uses some form of retrieval.&lt;/p&gt;




&lt;h1&gt;
  
  
  One Important Thing to Remember
&lt;/h1&gt;

&lt;p&gt;RAG is &lt;strong&gt;not&lt;/strong&gt; a model.&lt;/p&gt;

&lt;p&gt;It’s an architecture.&lt;/p&gt;

&lt;p&gt;This is a very common interview question.&lt;/p&gt;

&lt;p&gt;RAG combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieval systems&lt;/li&gt;
&lt;li&gt;external knowledge sources&lt;/li&gt;
&lt;li&gt;language models&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;to create smarter and more reliable AI applications.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Traditional LLMs alone are not enough for real-world AI systems.&lt;/p&gt;

&lt;p&gt;Modern AI applications need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;current knowledge&lt;/li&gt;
&lt;li&gt;factual grounding&lt;/li&gt;
&lt;li&gt;private data access&lt;/li&gt;
&lt;li&gt;reduced hallucinations&lt;/li&gt;
&lt;li&gt;real-time updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And RAG solves these problems extremely well.&lt;/p&gt;

&lt;p&gt;That’s why Retrieval-Augmented Generation became one of the foundational building blocks of modern AI engineering.&lt;/p&gt;

&lt;p&gt;The easiest way to remember RAG is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RAG allows LLMs to search for information before answering.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>ai</category>
      <category>rag</category>
      <category>learning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Angular State Management is Changing: Part 2 (And NgRx Isn’t What You Think Anymore)</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Fri, 08 May 2026 21:58:32 +0000</pubDate>
      <link>https://forem.com/newavtar/angular-state-management-is-changing-and-ngrx-isnt-what-you-think-anymore-1okk</link>
      <guid>https://forem.com/newavtar/angular-state-management-is-changing-and-ngrx-isnt-what-you-think-anymore-1okk</guid>
      <description>&lt;p&gt;Let’s be honest, most Angular apps didn’t fail because of &lt;strong&gt;“bad state management”.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you new to state management then revisit my &lt;a href="https://dev.to/newavtar/redux-ngrx-state-management-in-angular-16if"&gt;part 1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;They failed because we kept using NgRx for problems it was never meant to solve.&lt;/p&gt;

&lt;p&gt;And now with Signals, that mistake is getting harder to justify.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why NgRx Was Introduced
&lt;/h1&gt;

&lt;p&gt;NgRx was introduced to solve architectural problems that services could not handle in large applications.&lt;/p&gt;

&lt;p&gt;It brought a strict Redux-style model with a single source of truth and predictable state flow.&lt;/p&gt;

&lt;p&gt;Every state change followed a defined path:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;actions were dispatched, reducers updated state, selectors derived data, and components subscribed to changes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This made state changes explicit, traceable, and easier to debug in large applications.&lt;/p&gt;

&lt;p&gt;NgRx solved the problem of structure, predictability, and scalability.&lt;/p&gt;




&lt;h1&gt;
  
  
  The Problem with NgRx
&lt;/h1&gt;

&lt;p&gt;While NgRx solved architectural issues, it also introduced complexity.&lt;/p&gt;

&lt;p&gt;Even simple state updates required multiple steps: actions, reducers, selectors, and sometimes effects. This resulted in a lot of boilerplate code for simple features.&lt;/p&gt;

&lt;p&gt;In many cases, developers were using NgRx even when the problem did not require that level of structure. This made small and medium applications unnecessarily complex.&lt;/p&gt;

&lt;p&gt;NgRx solved structure, but often added overhead for simplicity.&lt;/p&gt;




&lt;h1&gt;
  
  
  Enter Signals and Signal-Based NgRx
&lt;/h1&gt;

&lt;p&gt;With Signals and APIs like &lt;code&gt;signalStore&lt;/code&gt; and &lt;code&gt;selectSignal&lt;/code&gt;, Angular introduces a more direct way of handling state.&lt;/p&gt;

&lt;p&gt;Instead of always going through actions and reducers, state can now be managed directly using signals inside a store. Components react automatically when state changes, without needing manual subscriptions or selector chains.&lt;/p&gt;

&lt;p&gt;This significantly reduces boilerplate for simple and feature-level state.&lt;/p&gt;

&lt;p&gt;At the same time, NgRx is not being removed. It is evolving to integrate Signals so both approaches can coexist.&lt;/p&gt;




&lt;h1&gt;
  
  
  State Flow Comparison
&lt;/h1&gt;

&lt;h2&gt;
  
  
  🟠 Old NgRx Flow (Redux Style)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Component
   ↓
Dispatch Action
   ↓
Action
   ↓
Reducer / Effect
   ↓
Store Updated
   ↓
Selector
   ↓
Observable Stream
   ↓
Component Subscription
   ↓
UI Update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🟢 New Signal-Based NgRx Flow
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Component
   ↓
Call Store Method
   ↓
Signal State Update
   ↓
Computed Signals Recalculate
   ↓
UI Reacts Automatically
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  🟡 Hybrid Flow (Real-world Applications)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Component
   ↓
Dispatch Action
   ↓
Effect
   ↓
API / Async Logic
   ↓
Signal Store Update
   ↓
Signals
   ↓
Computed Signals
   ↓
UI Updates
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  Effects in a Signal-Based World
&lt;/h1&gt;

&lt;p&gt;Effects remain an important part of NgRx, especially for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API calls&lt;/li&gt;
&lt;li&gt;Authentication flows&lt;/li&gt;
&lt;li&gt;Complex async operations&lt;/li&gt;
&lt;li&gt;Side effects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference is that effects can now directly update Signal-based state instead of always chaining actions.&lt;/p&gt;

&lt;p&gt;This simplifies async flows while keeping structure where needed.&lt;/p&gt;




&lt;h1&gt;
  
  
  Selectors vs Signals
&lt;/h1&gt;

&lt;p&gt;Selectors were previously used to derive and access state via observables.&lt;/p&gt;

&lt;p&gt;Now, Signals reduce the need for selector subscriptions.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectUsers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;selectSignal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectUsers&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or directly consume signal state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;users&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="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;users&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This removes subscription management and simplifies component code.&lt;/p&gt;




&lt;h1&gt;
  
  
  When NgRx Is Less Necessary
&lt;/h1&gt;

&lt;p&gt;With Signals, NgRx is no longer required for every type of state.&lt;/p&gt;

&lt;p&gt;Simple UI state, feature-level state, and small shared state can now be handled using Signals or SignalStore without needing full Redux-style architecture.&lt;/p&gt;

&lt;p&gt;This is one of the biggest practical changes in Angular state management.&lt;/p&gt;




&lt;h1&gt;
  
  
  When NgRx Still Matters
&lt;/h1&gt;

&lt;p&gt;NgRx is still valuable for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Large-scale applications&lt;/li&gt;
&lt;li&gt;Complex state interactions&lt;/li&gt;
&lt;li&gt;Multi-feature coordination&lt;/li&gt;
&lt;li&gt;Strict debugging and traceability&lt;/li&gt;
&lt;li&gt;Heavy asynchronous workflows&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Signals do not replace these architectural needs because they focus on reactivity, not orchestration.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why NgRx Is Moving Toward Signals
&lt;/h1&gt;

&lt;p&gt;According to the official NgRx Signals approach, the goal is to reduce boilerplate, improve developer experience, and modernize state management with Angular’s reactive primitives.&lt;/p&gt;

&lt;p&gt;NgRx is not being replaced — it is being evolved.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://ngrx.io/guide/signals" rel="noopener noreferrer"&gt;https://ngrx.io/guide/signals&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Angular state management is no longer about choosing one approach over another.&lt;/p&gt;

&lt;p&gt;Services handled basic sharing.&lt;br&gt;
NgRx introduced structure and predictability.&lt;br&gt;
Signals introduce simplicity and reduce unnecessary complexity.&lt;/p&gt;

&lt;p&gt;Now all three coexist, each solving a different level of problem.&lt;/p&gt;

&lt;p&gt;Signals are not replacing NgRx. They are simply removing the need to use it everywhere.&lt;/p&gt;




</description>
      <category>angular</category>
      <category>architecture</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Redux / NgRx State Management in Angular: Part 1</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Thu, 07 May 2026 23:50:44 +0000</pubDate>
      <link>https://forem.com/newavtar/redux-ngrx-state-management-in-angular-16if</link>
      <guid>https://forem.com/newavtar/redux-ngrx-state-management-in-angular-16if</guid>
      <description>&lt;p&gt;Managing state in Angular applications becomes difficult as applications grow larger and more complex. Redux and NgRx provide a structured and predictable way to handle shared application state.&lt;/p&gt;

&lt;p&gt;This article explains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What Redux/NgRx solves&lt;/li&gt;
&lt;li&gt;Core concepts&lt;/li&gt;
&lt;li&gt;When to avoid it&lt;/li&gt;
&lt;li&gt;When it becomes useful&lt;/li&gt;
&lt;li&gt;Why established libraries are preferred&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&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%2F4pjfl22nf8kfofl56ime.gif" alt="Alt Text" width="480" height="360"&gt;
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Understanding State in Angular
&lt;/h2&gt;

&lt;p&gt;State in Angular applications can be anything like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Router state&lt;/li&gt;
&lt;li&gt;Component-local state&lt;/li&gt;
&lt;li&gt;Shared state between components&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In small applications, services are often enough for sharing data. However, as applications scale, several problems begin to appear:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complex component relationships&lt;/li&gt;
&lt;li&gt;Difficult state synchronization&lt;/li&gt;
&lt;li&gt;Duplicate state across components&lt;/li&gt;
&lt;li&gt;Unpredictable updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Redux-style architecture solves this problem by introducing a centralized global store.&lt;/p&gt;

&lt;p&gt;The store becomes the single source of truth for application state.&lt;/p&gt;




&lt;h2&gt;
  
  
  Core Redux / NgRx Concepts
&lt;/h2&gt;

&lt;p&gt;Redux/NgRx is built around a few important concepts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store&lt;/li&gt;
&lt;li&gt;Actions&lt;/li&gt;
&lt;li&gt;Reducers&lt;/li&gt;
&lt;li&gt;Effects&lt;/li&gt;
&lt;li&gt;Selectors&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Store
&lt;/h2&gt;

&lt;p&gt;The store contains the entire application state in one centralized location.&lt;/p&gt;

&lt;p&gt;Benefits of using a store:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Single source of truth&lt;/li&gt;
&lt;li&gt;Predictable data flow&lt;/li&gt;
&lt;li&gt;Easier debugging&lt;/li&gt;
&lt;li&gt;Better state sharing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Components subscribe only to the state they need instead of maintaining separate copies.&lt;/p&gt;




&lt;h2&gt;
  
  
  Actions
&lt;/h2&gt;

&lt;p&gt;Actions describe events that happen inside the application.&lt;/p&gt;

&lt;p&gt;Actions are plain JavaScript objects that usually contain:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;type&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;optional payload data&lt;/li&gt;
&lt;/ul&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;LOAD_USERS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Actions help create a clear and trackable update flow.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reducers
&lt;/h2&gt;

&lt;p&gt;Reducers are functions that receive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current state&lt;/li&gt;
&lt;li&gt;Action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reducers return a new updated state.&lt;/p&gt;

&lt;p&gt;Important rules for reducers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Must be pure functions&lt;/li&gt;
&lt;li&gt;Must not contain side effects&lt;/li&gt;
&lt;li&gt;Should not perform:

&lt;ul&gt;
&lt;li&gt;API calls&lt;/li&gt;
&lt;li&gt;Local storage operations&lt;/li&gt;
&lt;li&gt;Async tasks&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Reducers should only focus on transforming state.&lt;/p&gt;




&lt;h2&gt;
  
  
  Effects (NgRx)
&lt;/h2&gt;

&lt;p&gt;Reducers should only update state and remain pure functions. They should not perform API calls, async operations, or side effects.&lt;/p&gt;

&lt;p&gt;NgRx uses &lt;strong&gt;Effects&lt;/strong&gt; to handle side effects separately.&lt;/p&gt;

&lt;p&gt;Common use cases for effects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API requests&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Local storage updates&lt;/li&gt;
&lt;li&gt;Async operations&lt;/li&gt;
&lt;li&gt;Notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Effects help keep components clean and business logic centralized.&lt;/p&gt;




&lt;h2&gt;
  
  
  Selectors
&lt;/h2&gt;

&lt;p&gt;Selectors are functions used to read data from the store.&lt;/p&gt;

&lt;p&gt;Instead of directly accessing store data inside components, selectors provide a reusable and organized way to retrieve state.&lt;/p&gt;

&lt;p&gt;Benefits of Selectors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cleaner components&lt;/li&gt;
&lt;li&gt;Reusable queries&lt;/li&gt;
&lt;li&gt;Better maintainability&lt;/li&gt;
&lt;li&gt;Derived/computed state&lt;/li&gt;
&lt;li&gt;Improved performance through memoization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Selectors make store access predictable, reusable, and easier to maintain in large applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  Example Flow of Redux / NgRx
&lt;/h2&gt;

&lt;p&gt;Understanding Redux/NgRx becomes easier by following a simple flow.&lt;/p&gt;

&lt;p&gt;Example scenario:&lt;br&gt;
A user opens a page and clicks &lt;strong&gt;Load Users&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  Step 1 — Component Dispatches Action
&lt;/h2&gt;

&lt;p&gt;The component does not directly call the API.&lt;/p&gt;

&lt;p&gt;Instead, it dispatches an action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;loadUsers&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Action:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loadUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[Users] Load Users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Describe what happened&lt;/li&gt;
&lt;li&gt;Start the state update process&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 2 — Effect Handles API Call
&lt;/h2&gt;

&lt;p&gt;The effect listens for the dispatched action.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;loadUsers$&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;actions$&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;ofType&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loadUsers&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="nf"&gt;switchMap&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;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;userService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;loadUsersSuccess&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="p"&gt;}))&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&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;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Perform async operations&lt;/li&gt;
&lt;li&gt;Call APIs&lt;/li&gt;
&lt;li&gt;Keep reducers pure&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 3 — Success Action Is Dispatched
&lt;/h2&gt;

&lt;p&gt;After data is received from the API, another action is dispatched.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loadUsersSuccess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createAction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[Users] Load Users Success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&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;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Notify application that data was loaded successfully&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 4 — Reducer Updates Store
&lt;/h2&gt;

&lt;p&gt;Reducer receives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current state&lt;/li&gt;
&lt;li&gt;Action&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then returns updated state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loadUsersSuccess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;users&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;users&lt;/span&gt;
&lt;span class="p"&gt;}))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update application state&lt;/li&gt;
&lt;li&gt;Keep state immutable and predictable&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 5 — Selector Reads Data
&lt;/h2&gt;

&lt;p&gt;Selectors provide clean access to store data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;selectUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createSelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;selectUserState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read state&lt;/li&gt;
&lt;li&gt;Reuse state queries&lt;/li&gt;
&lt;li&gt;Keep components clean&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 6 — Component Receives Updated Data
&lt;/h2&gt;

&lt;p&gt;Component subscribes to selector data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;users$&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="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selectUsers&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically receive updated state&lt;/li&gt;
&lt;li&gt;Keep UI reactive&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Complete Redux / NgRx Flow
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Component
   ↓
Dispatch Action
   ↓
Effect Handles API Call
   ↓
Success Action
   ↓
Reducer Updates Store
   ↓
Selector Reads State
   ↓
Component Updates UI
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This predictable flow is one of the biggest advantages of Redux/NgRx in large Angular applications.&lt;/p&gt;




&lt;h1&gt;
  
  
  When NOT to Use Redux / NgRx
&lt;/h1&gt;

&lt;p&gt;Redux/NgRx is not always the right solution.&lt;/p&gt;

&lt;p&gt;In many projects, it can introduce unnecessary complexity and slow development.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Small Projects or Prototypes
&lt;/h2&gt;

&lt;p&gt;Avoid Redux/NgRx when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Applications are small&lt;/li&gt;
&lt;li&gt;Requirements change frequently&lt;/li&gt;
&lt;li&gt;Features are experimental&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Too much boilerplate&lt;/li&gt;
&lt;li&gt;Slower development&lt;/li&gt;
&lt;li&gt;Architecture overhead is unnecessary&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Shared UI or Component Libraries
&lt;/h2&gt;

&lt;p&gt;Avoid embedding Redux inside reusable component libraries.&lt;/p&gt;

&lt;p&gt;Reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forces every consuming project to use Redux&lt;/li&gt;
&lt;li&gt;Different projects may not require global state management&lt;/li&gt;
&lt;li&gt;Reduces flexibility&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Teams Without Redux Experience
&lt;/h2&gt;

&lt;p&gt;Avoid Redux/NgRx in important projects if the team lacks experience.&lt;/p&gt;

&lt;p&gt;Possible issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Difficult debugging&lt;/li&gt;
&lt;li&gt;Poor architecture decisions&lt;/li&gt;
&lt;li&gt;Hard-to-maintain code&lt;/li&gt;
&lt;li&gt;Incorrect implementation patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;State management libraries require strong architectural understanding.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Applications Already Using Apollo Client
&lt;/h2&gt;

&lt;p&gt;Apollo Client already provides state management for GraphQL applications.&lt;/p&gt;

&lt;p&gt;Using Redux together with Apollo may create:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple sources of truth&lt;/li&gt;
&lt;li&gt;Synchronization issues&lt;/li&gt;
&lt;li&gt;Extra complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In many GraphQL applications, Apollo alone is enough.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common Drawbacks of Redux / NgRx
&lt;/h2&gt;

&lt;p&gt;Even small features may require:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Actions&lt;/li&gt;
&lt;li&gt;Reducers&lt;/li&gt;
&lt;li&gt;Effects&lt;/li&gt;
&lt;li&gt;Selectors&lt;/li&gt;
&lt;li&gt;Store updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This increases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Boilerplate&lt;/li&gt;
&lt;li&gt;Development time&lt;/li&gt;
&lt;li&gt;Learning curve&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For simple applications, this overhead may not be worth it.&lt;/p&gt;




&lt;h1&gt;
  
  
  When Redux / NgRx Makes Sense
&lt;/h1&gt;

&lt;p&gt;Redux/NgRx becomes valuable in large and state-heavy applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Large Applications
&lt;/h2&gt;

&lt;p&gt;Good fit for applications with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hundreds of components&lt;/li&gt;
&lt;li&gt;Deep component trees&lt;/li&gt;
&lt;li&gt;Complex shared state&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Centralized architecture&lt;/li&gt;
&lt;li&gt;Predictable updates&lt;/li&gt;
&lt;li&gt;Easier debugging&lt;/li&gt;
&lt;li&gt;Better maintainability&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Undo / Redo Functionality
&lt;/h2&gt;

&lt;p&gt;Redux works well for applications requiring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Undo functionality&lt;/li&gt;
&lt;li&gt;Redo functionality&lt;/li&gt;
&lt;li&gt;Reverting changes&lt;/li&gt;
&lt;li&gt;Optimistic UI updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Reason:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;State history can be tracked and restored easily&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. State Persistence
&lt;/h2&gt;

&lt;p&gt;Redux is useful when applications need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Save application state&lt;/li&gt;
&lt;li&gt;Restore sessions&lt;/li&gt;
&lt;li&gt;Synchronize state across clients&lt;/li&gt;
&lt;li&gt;Store state in local storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Redux naturally supports state serialization.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Large Legacy System Migrations
&lt;/h2&gt;

&lt;p&gt;Redux can help when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Migrating large systems&lt;/li&gt;
&lt;li&gt;Scaling existing applications&lt;/li&gt;
&lt;li&gt;Replacing fragile custom state patterns&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using a structured architecture early helps reduce long-term complexity.&lt;/p&gt;




&lt;h1&gt;
  
  
  Signs That Redux May Be Needed
&lt;/h1&gt;

&lt;p&gt;Redux/NgRx becomes worth considering when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multiple services start coordinating state manually&lt;/li&gt;
&lt;li&gt;State synchronization becomes difficult&lt;/li&gt;
&lt;li&gt;Custom state patterns begin appearing&lt;/li&gt;
&lt;li&gt;Debugging shared data becomes painful&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are common indicators that application complexity is increasing.&lt;/p&gt;




&lt;h1&gt;
  
  
  Why Established Libraries Are Better
&lt;/h1&gt;

&lt;p&gt;Using mature libraries like Redux/NgRx provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Community support&lt;/li&gt;
&lt;li&gt;Better documentation&lt;/li&gt;
&lt;li&gt;Standardized architecture&lt;/li&gt;
&lt;li&gt;Easier onboarding&lt;/li&gt;
&lt;li&gt;Long-term maintainability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Custom in-house state solutions often become:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Poorly documented&lt;/li&gt;
&lt;li&gt;Difficult to scale&lt;/li&gt;
&lt;li&gt;Hard for new developers to understand&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Established libraries reduce long-term architectural risk.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;Redux/NgRx should be treated as an architectural decision rather than a default choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Avoid Redux/NgRx When
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Applications are small&lt;/li&gt;
&lt;li&gt;Rapid development is important&lt;/li&gt;
&lt;li&gt;Requirements change frequently&lt;/li&gt;
&lt;li&gt;Apollo Client already manages state&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Consider Redux/NgRx When
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Applications are large and complex&lt;/li&gt;
&lt;li&gt;Shared state becomes difficult to manage&lt;/li&gt;
&lt;li&gt;Predictability is important&lt;/li&gt;
&lt;li&gt;Undo/restore features are required&lt;/li&gt;
&lt;li&gt;Long-term scalability matters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The additional complexity of Redux/NgRx is justified only when application scale and state management needs become significant.&lt;/p&gt;

&lt;p&gt;Edit: &lt;a href="https://dev.to/newavtar/angular-state-management-is-changing-and-ngrx-isnt-what-you-think-anymore-1okk"&gt;POV based on signal&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>architecture</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Resolving the "0308010C: Digital Envelope Routines::Unsupported" Error in Angular Apps with Node.js 17+</title>
      <dc:creator>Bhargav Patel</dc:creator>
      <pubDate>Tue, 19 Dec 2023 21:28:30 +0000</pubDate>
      <link>https://forem.com/newavtar/resolving-the-0308010c-digital-envelope-routinesunsupported-error-in-angular-apps-with-nodejs-17-50m9</link>
      <guid>https://forem.com/newavtar/resolving-the-0308010c-digital-envelope-routinesunsupported-error-in-angular-apps-with-nodejs-17-50m9</guid>
      <description>&lt;p&gt;Deploying Angular applications is typically a smooth process, but encountering errors like "0308010C: digital envelope routines::unsupported" can be a source of frustration. In this blog post, we'll delve into the causes of this error and provide comprehensive solutions to address it, ensuring a seamless deployment of your Angular app with Node.js 17+.&lt;/p&gt;

&lt;p&gt;This is the whole error,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/vercel/path0/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/vercel/path0/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/vercel/path0/node_modules/webpack/lib/NormalModule.js:471:10)
    at /vercel/path0/node_modules/webpack/lib/NormalModule.js:503:5
    at /vercel/path0/node_modules/webpack/lib/NormalModule.js:358:12
    at /vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.&amp;lt;anonymous&amp;gt; (/vercel/path0/node_modules/webpack/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
    at Storage.finished (/vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:55:16)
    at /vercel/path0/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:91:9
    at /vercel/path0/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Causes of the "0308010C: Digital Envelope Routines::Unsupported" Error
&lt;/h3&gt;

&lt;p&gt;The error message you're facing originates from changes introduced in Node.js 17 and OpenSSL3, affecting the initialization context of the md family, including md4. This discrepancy may lead to the manifestation of the "0308010C: Digital Envelope Routines::Unsupported" error.&lt;/p&gt;

&lt;p&gt;Also, Refer to the &lt;a href="https://wiki.openssl.org/index.php/OpenSSL_3.0#Upgrading_to_OpenSSL_3.0_from_OpenSSL_1.0.2" rel="noopener noreferrer"&gt;OpenSSL 3.0 upgrade guide&lt;/a&gt; for further insights.&lt;/p&gt;

&lt;h3&gt;
  
  
  Solutions to Resolve the Error
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Solution 1: Upgrade NPM Packages
&lt;/h4&gt;

&lt;p&gt;To address the error, consider upgrading Node.js packages causing the issue to the latest version. Run the following commands in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or, if needed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm audit fix &lt;span class="nt"&gt;--force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will automatically identify and fix packages using outdated OpenSSL versions. Be cautious with the &lt;code&gt;--force&lt;/code&gt; option, as it may introduce breaking changes.&lt;/p&gt;

&lt;h4&gt;
  
  
  Solution 2: Update Webpack
&lt;/h4&gt;

&lt;p&gt;Upgrade Webpack to version 5 (specifically v5.61.0) using the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i webpack@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or, for Yarn users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add webpack@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, update your &lt;code&gt;webpack.config.js&lt;/code&gt; with the provided code snippet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;path&lt;/span&gt;&lt;span class="dl"&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;crypto&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;crypto&lt;/span&gt;&lt;span class="dl"&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;crypto_orig_createHash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createHash&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;crypto&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createHash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;algorithm&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;crypto_orig_createHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;algorithm&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;md4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sha256&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;algorithm&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/index.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;hashFunction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;sha256&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dist&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;devServer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;contentBase&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;9000&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;development&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Recommended Solution: Use --openssl-legacy-provider Option
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option 1. Set NODE_OPTIONS Environment Variable:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Unix-like (Linux, macOS, Git bash, etc.):&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;NODE_OPTIONS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;--openssl-legacy-provider&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;Windows Command Prompt:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt; &lt;span class="nb"&gt;set &lt;/span&gt;&lt;span class="nv"&gt;NODE_OPTIONS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nt"&gt;--openssl-legacy-provider&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;PowerShell:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$&lt;/span&gt;&lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;NODE_OPTIONS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"--openssl-legacy-provider"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Additionally, integrate these into scripts in your &lt;code&gt;package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"export NODE_OPTIONS=--openssl-legacy-provider &amp;amp;&amp;amp; ng serve"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;set&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;instead&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;export&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;windows&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;machine&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Alternatively, install &lt;code&gt;cross-env&lt;/code&gt; globally (&lt;code&gt;npm install --global cross-env&lt;/code&gt;) and use it in your scripts:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cross-env NODE_OPTIONS=--openssl-legacy-provider &amp;amp;&amp;amp; ng serve"&lt;/span&gt;&lt;span class="w"&gt;
 &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Set SSL Legacy Option via NPM:(Best Solution)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For a simpler approach through NPM, set the SSL legacy option in the &lt;code&gt;.npmrc&lt;/code&gt; file.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Example for NodeJS v18 with npm v9:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add or edit &lt;code&gt;.npmrc&lt;/code&gt; file in your project folder and include the option:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt; node-options="--openssl-legacy-provider"
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This setting can be managed per project.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;.npmrc&lt;/code&gt; file in the project will serve as a reminder for necessary updates.&lt;/li&gt;
&lt;li&gt;If the issue occurs in other projects on the server, the error will be addressed consistently.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;By following these solutions, you can overcome the "0308010C: digital envelope routines::unsupported" error and successfully deploy your Angular app with Node.js 17+. Ensure your Node.js version is LTS, upgrade relevant packages, and make necessary adjustments to your Webpack configuration. Happy coding!&lt;/p&gt;

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