<?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: Agrima Gupta</title>
    <description>The latest articles on DEV Community by Agrima Gupta (@agrima-06).</description>
    <link>https://dev.to/agrima-06</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%2F4125872%2Fe7a3bcb7-fe2b-4e47-94f4-65badc467977.png</url>
      <title>DEV Community: Agrima Gupta</title>
      <link>https://dev.to/agrima-06</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/agrima-06"/>
    <language>en</language>
    <item>
      <title>RAG vs Fine-Tuning: Which One Should You Use for Your AI App?</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:10:33 +0000</pubDate>
      <link>https://dev.to/agrima-06/rag-vs-fine-tuning-which-one-should-you-use-for-your-ai-app-cfa</link>
      <guid>https://dev.to/agrima-06/rag-vs-fine-tuning-which-one-should-you-use-for-your-ai-app-cfa</guid>
      <description>&lt;p&gt;&lt;strong&gt;RAG vs Fine-Tuning Explained: The Difference Every AI Developer Should Know&lt;/strong&gt;&lt;br&gt;
Imagine you're building an AI assistant for a company.&lt;/p&gt;

&lt;p&gt;It needs to answer questions about internal documents, follow a specific response format, and communicate in the company's tone.&lt;/p&gt;

&lt;p&gt;You have two options: &lt;strong&gt;RAG&lt;/strong&gt; and &lt;strong&gt;fine-tuning&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Both can help you customize an AI application, but they work in very different ways. Choosing the wrong one can add unnecessary complexity, cost, and development time.&lt;/p&gt;

&lt;p&gt;Let's understand the difference with a practical example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, What Is RAG?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RAG stands for Retrieval-Augmented Generation.&lt;/p&gt;

&lt;p&gt;Instead of expecting an LLM to already know all the information it needs, RAG retrieves relevant information from external sources and provides it to the model when answering a question.&lt;/p&gt;

&lt;p&gt;Imagine you're building a customer support chatbot for an online store. The store's refund policy changes regularly, and customers ask questions about returns, delivery, and replacements.&lt;/p&gt;

&lt;p&gt;With RAG, the chatbot can retrieve the latest relevant policy before generating an answer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Customer asks a question
          ↓
Search company documents
          ↓
Retrieve relevant information
          ↓
Send context + question to LLM
          ↓
Generate an answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can update the documents without retraining the LLM. That's one of RAG's biggest advantages.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is Fine-Tuning?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fine-tuning takes a pretrained model and trains it further on carefully prepared examples so its behavior adapts to a particular task.&lt;/p&gt;

&lt;p&gt;For example, suppose your AI assistant needs to convert customer messages into structured support tickets.&lt;/p&gt;

&lt;p&gt;You want it to consistently identify the issue, assign a category, and summarize the request in a particular style.&lt;/p&gt;

&lt;p&gt;Fine-tuning may help the model learn that pattern from examples.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pretrained LLM
      ↓
Training Examples
      ↓
Fine-Tuning
      ↓
Adapted Model
      ↓
Generate Responses
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unlike RAG, fine-tuning changes the model's learned parameters. It doesn't automatically give the model access to your latest company documents or guarantee that it will memorize every fact in your training data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Biggest Difference: Knowledge vs Behavior&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's return to our customer support chatbot.&lt;/p&gt;

&lt;p&gt;A customer asks, “What is your current refund policy?”&lt;/p&gt;

&lt;p&gt;This information can change over time. RAG is a natural choice because the system can retrieve the latest policy from an approved source.&lt;/p&gt;

&lt;p&gt;Now imagine the customer asks a question that requires the assistant to produce a ticket in a consistent format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"refund"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"priority"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"medium"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"summary"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Customer requests a refund"&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;/div&gt;



&lt;p&gt;Fine-tuning may help the model learn this output pattern when prompt instructions alone aren't giving reliable enough results.&lt;/p&gt;

&lt;p&gt;Here's a simple way to think about it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Requirement&lt;/th&gt;
&lt;th&gt;Approach to consider&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Answer using changing documents&lt;/td&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reference private company information&lt;/td&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Follow a specialized response style&lt;/td&gt;
&lt;td&gt;Fine-tuning may help&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Perform a consistent task using examples&lt;/td&gt;
&lt;td&gt;Fine-tuning may help&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Improve access to current facts&lt;/td&gt;
&lt;td&gt;RAG&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Improve both information access and task behavior&lt;/td&gt;
&lt;td&gt;Combine them if needed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These aren't strict rules. Prompt engineering, structured outputs, and other techniques may solve some problems without fine-tuning.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does RAG Work in Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's a simplified Python example. Imagine &lt;code&gt;retrieve_documents()&lt;/code&gt; searches your document collection and returns relevant text chunks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;answer_question&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;retrieve_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
    Answer using the context below.
    If the answer isn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t available, say so.

    Context:
    &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;

    Question:
    &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;question&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function &lt;code&gt;retrieve_documents()&lt;/code&gt; and the method &lt;code&gt;llm.generate()&lt;/code&gt; are placeholders; you'll need to implement them using your chosen retrieval system and model provider.&lt;/p&gt;

&lt;p&gt;The important idea is that the relevant information is supplied at answer time. When the refund policy changes, you update the document collection rather than retraining the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does Fine-Tuning Look in Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fine-tuning depends on the model and training framework. Here's a simplified example using the Hugging Face Transformers ecosystem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;AutoTokenizer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;AutoModelForCausalLM&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Trainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;TrainingArguments&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;model_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;your-base-model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="n"&gt;tokenizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AutoTokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AutoModelForCausalLM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;training_args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TrainingArguments&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;output_dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./fine-tuned-model&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;num_train_epochs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;per_device_train_batch_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;trainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Trainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;training_args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;train_dataset&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;your_tokenized_dataset&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;trainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;train&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This illustrates the training setup, not a complete, ready-to-run fine-tuning pipeline. You still need a compatible model, a properly tokenized dataset, and any required configuration such as a padding token or data collator.&lt;/p&gt;

&lt;p&gt;The idea is that the model learns from examples during training, and you can later use the resulting model for inference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can You Use RAG and Fine-Tuning Together?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Absolutely.&lt;/p&gt;

&lt;p&gt;Imagine your company assistant needs to answer questions using current product documentation while consistently following a specific support workflow.&lt;/p&gt;

&lt;p&gt;You could use RAG to supply relevant product information and a fine-tuned model to improve the response behavior.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Question
      ↓
RAG retrieves relevant information
      ↓
Context + Question
      ↓
Fine-Tuned LLM
      ↓
Final Answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This combination can be useful, but it adds complexity. It's better to start with the simplest approach that meets your requirements and combine techniques only when testing shows a real need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What About Cost and Maintenance?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RAG requires a retrieval pipeline, document processing, and a way to store and search information. You also need to evaluate whether the retrieved context is relevant.&lt;/p&gt;

&lt;p&gt;Fine-tuning requires suitable training examples, training resources or a supported fine-tuning service, and evaluation to make sure the model improves without losing important capabilities.&lt;/p&gt;

&lt;p&gt;RAG can make updating factual information easier, while fine-tuning can require another training run when you want to change the model's learned behavior. Actual costs depend on model choice, usage, infrastructure, and implementation.&lt;/p&gt;

&lt;p&gt;Neither approach is automatically cheaper or more accurate in every situation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Do You Choose?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start by identifying the problem you're actually trying to solve.&lt;/p&gt;

&lt;p&gt;If the model needs access to information that changes frequently, try RAG first. If it consistently struggles with a specialized task or response pattern despite good instructions and examples, evaluate fine-tuning.&lt;/p&gt;

&lt;p&gt;If it needs both current external information and specialized behavior, consider combining them after measuring the results.&lt;/p&gt;

&lt;p&gt;Most importantly, test your approach against realistic questions. Check answer correctness, retrieval quality, response consistency, latency, and cost instead of choosing based on hype.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;RAG and fine-tuning aren't competing solutions to exactly the same problem.&lt;/p&gt;

&lt;p&gt;RAG gives an LLM relevant information at the time it answers. Fine-tuning changes the model's learned behavior through additional training.&lt;/p&gt;

&lt;p&gt;Remember the distinction:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need better access to information? Consider RAG.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Need to adapt how a model performs a task? Consider fine-tuning.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And if your AI application needs both, you can combine them — as long as the added complexity is worth it.&lt;/p&gt;

&lt;p&gt;The best choice isn't the most advanced technique. It's the one that solves your actual problem reliably.&lt;/p&gt;

</description>
      <category>rag</category>
      <category>ai</category>
    </item>
    <item>
      <title>How Do LLMs Predict the Next Word? Understanding Token Prediction</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Mon, 19 Oct 2026 07:06:01 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-do-llms-predict-the-next-word-understanding-token-prediction-3gbk</link>
      <guid>https://dev.to/agrima-06/how-do-llms-predict-the-next-word-understanding-token-prediction-3gbk</guid>
      <description>&lt;p&gt;Ever wondered how ChatGPT can finish your sentences, explain complicated topics, or write an entire story from a single prompt?&lt;/p&gt;

&lt;p&gt;It might seem like the AI understands your question and then magically produces an answer.&lt;/p&gt;

&lt;p&gt;But one of the fundamental ideas behind large language models (LLMs) is surprisingly simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;They predict what token is likely to come next.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's understand what that actually means, how the process works, and how a simple prediction turns into an entire response.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, What Is a Token?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We often say that an LLM predicts the next &lt;em&gt;word&lt;/em&gt;, but that's not entirely accurate.&lt;/p&gt;

&lt;p&gt;Most LLMs work with &lt;strong&gt;tokens&lt;/strong&gt;. A token can be a whole word, part of a word, punctuation, or another piece of text.&lt;/p&gt;

&lt;p&gt;For example, the sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Machine learning is fascinating!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;might be split into tokens resembling:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;["Machine", " learning", " is", " fascinating", "!"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact tokenization depends on the model's tokenizer.&lt;/p&gt;

&lt;p&gt;Why not just use complete words? Because tokenization lets models handle common words, unfamiliar words, punctuation, and different languages using a manageable vocabulary.&lt;/p&gt;

&lt;p&gt;So when we say an LLM predicts the next word, we're usually talking about predicting the next token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does an LLM Predict the Next Token?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine you start typing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The sun rises in the ...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What could come next?&lt;/p&gt;

&lt;p&gt;Maybe &lt;code&gt;east&lt;/code&gt;, &lt;code&gt;morning&lt;/code&gt;, or something else.&lt;/p&gt;

&lt;p&gt;The model processes the text you've provided and estimates the probabilities of possible next tokens based on patterns learned during training.&lt;/p&gt;

&lt;p&gt;For a simplified example, it might produce:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Possible next token&lt;/th&gt;
&lt;th&gt;Example probability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;east&lt;/td&gt;
&lt;td&gt;75%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;morning&lt;/td&gt;
&lt;td&gt;15%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sky&lt;/td&gt;
&lt;td&gt;7%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;other tokens&lt;/td&gt;
&lt;td&gt;3%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These numbers are illustrative, not actual model outputs.&lt;/p&gt;

&lt;p&gt;The model can then select a token based on its generation strategy. If it selects &lt;code&gt;east&lt;/code&gt;, the text becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The sun rises in the east
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But it doesn't stop there. It predicts the next token using the updated text, then repeats the process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;From One Token to an Entire Answer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's the important part: the model generates text one token at a time, repeatedly using the context available to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Prompt
    ↓
Process Existing Tokens
    ↓
Calculate Next-Token Probabilities
    ↓
Select a Token
    ↓
Add It to the Text
    ↓
Predict Again
    ↓
Continue Until Generation Stops
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose you ask:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Explain machine learning in simple terms.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The model generates a token, then another, and then another. Each new token becomes part of the context used for subsequent predictions.&lt;/p&gt;

&lt;p&gt;This is how a single prompt can turn into paragraphs of coherent text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But Where Do These Predictions Come From?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An LLM doesn't begin with a built-in list of every possible answer.&lt;/p&gt;

&lt;p&gt;During training, it processes enormous amounts of text and learns statistical patterns in how tokens relate to their context.&lt;/p&gt;

&lt;p&gt;For example, it may learn that certain words commonly appear together, how sentences are structured, how explanations are written, and how questions are often answered.&lt;/p&gt;

&lt;p&gt;Modern LLMs typically use the &lt;strong&gt;Transformer architecture&lt;/strong&gt;, which helps them process relationships between tokens through mechanisms such as self-attention.&lt;/p&gt;

&lt;p&gt;During training, the model adjusts its internal parameters to improve its predictions. Over time, it learns complex patterns that help it generate useful text.&lt;/p&gt;

&lt;p&gt;This is more sophisticated than simply looking up the most common next word. The predictions depend on the surrounding context and the patterns encoded in the model's parameters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's Build a Tiny Next-Word Predictor in Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We don't need a neural network to understand the basic idea. Let's create a tiny example using word frequencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;collections&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Counter&lt;/span&gt;

&lt;span class="n"&gt;sentences&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;machine learning is useful&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;machine learning is powerful&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;machine learning is fascinating&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deep learning is powerful&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;next_words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;defaultdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sentence&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sentences&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;words&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sentence&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;next_words&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]][&lt;/span&gt;&lt;span class="n"&gt;words&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;

&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;machine learning is&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;last_word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next_words&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;last_word&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;most_common&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[('useful', 1), ('powerful', 1), ('fascinating', 1)]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our tiny program counts which words follow &lt;code&gt;is&lt;/code&gt; in the training sentences.&lt;/p&gt;

&lt;p&gt;Because all three candidates appear once after &lt;code&gt;is&lt;/code&gt; in this small dataset, they have equal counts.&lt;/p&gt;

&lt;p&gt;This is &lt;strong&gt;not how a modern LLM works internally&lt;/strong&gt;. It simply demonstrates the core idea of using previously observed patterns to estimate what might come next. Real LLMs use learned neural network parameters to produce contextual probability distributions over their token vocabulary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Doesn't ChatGPT Give the Same Answer Every Time?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the model estimates probabilities for possible next tokens, why doesn't it always choose the most likely one?&lt;/p&gt;

&lt;p&gt;Because text generation can use different sampling strategies.&lt;/p&gt;

&lt;p&gt;With greedy decoding, the model selects the highest-scoring token at each step. With sampling, it can choose among candidate tokens according to their probabilities.&lt;/p&gt;

&lt;p&gt;One setting you might encounter is &lt;strong&gt;temperature&lt;/strong&gt;, which changes how concentrated or spread out the token probabilities are during sampling. Lower temperatures generally make choices more predictable, while higher temperatures generally allow more variation.&lt;/p&gt;

&lt;p&gt;For example, when answering a factual question, you might prefer a more predictable response. When writing a creative story, you might want more variety.&lt;/p&gt;

&lt;p&gt;Temperature doesn't add knowledge to the model; it changes how token choices are made.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If It's Predicting Tokens, Does That Mean It Doesn't Understand Anything?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is where things get interesting.&lt;/p&gt;

&lt;p&gt;Next-token prediction describes a fundamental part of how many LLMs are trained and generate text. But learning to predict tokens across diverse contexts can require the model to represent grammar, concepts, relationships, and aspects of the world in its internal parameters.&lt;/p&gt;

&lt;p&gt;At the same time, fluent text isn't proof that every statement is true or that the model understands things exactly as a human does.&lt;/p&gt;

&lt;p&gt;An LLM can produce a convincing answer and still make a factual mistake. Its output depends on its training, context, model design, and generation process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Big Picture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An LLM doesn't write an entire answer in one magical step. It repeatedly processes context, estimates probabilities for the next token, selects a token, and continues generating.&lt;/p&gt;

&lt;p&gt;Remember the basic loop:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Context → Predict → Select → Add → Repeat.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That simple-sounding process, powered by enormous neural networks trained on large amounts of data, is one of the foundations behind modern conversational AI.&lt;/p&gt;

&lt;p&gt;And the next time ChatGPT gives you a surprisingly detailed answer, you'll know the basic mechanism behind how those words appear — one token at a time.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>rag</category>
      <category>llm</category>
    </item>
    <item>
      <title>What Actually Happens When You Tap Your Phone to Pay?</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Mon, 19 Oct 2026 06:52:03 +0000</pubDate>
      <link>https://dev.to/agrima-06/what-actually-happens-when-you-tap-your-phone-to-pay-4k9d</link>
      <guid>https://dev.to/agrima-06/what-actually-happens-when-you-tap-your-phone-to-pay-4k9d</guid>
      <description>&lt;p&gt;You've probably done this hundreds of times.&lt;/p&gt;

&lt;p&gt;You walk into a store, pick up something, open your payment app or wallet, tap your phone against the payment terminal, and within seconds, you hear that familiar beep.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Payment successful.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But how did a small tap communicate with a payment terminal, verify your payment, contact the bank, and complete the transaction in seconds?&lt;/p&gt;

&lt;p&gt;There's no magic involved. A combination of wireless communication, secure payment technology, and banking infrastructure makes it possible.&lt;/p&gt;

&lt;p&gt;Let's break down what actually happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Your Phone Communicates Using NFC&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first technology involved is &lt;strong&gt;NFC (Near Field Communication)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;NFC allows two compatible devices to exchange small amounts of data when they're very close to each other, usually within a few centimeters.&lt;/p&gt;

&lt;p&gt;It's the technology behind many contactless card payments, phone wallets, and other tap-based interactions.&lt;/p&gt;

&lt;p&gt;When you tap your phone against a compatible payment terminal, the devices establish a short-range communication link and exchange the information required by the payment protocol.&lt;/p&gt;

&lt;p&gt;Think of NFC as the messenger. It helps the devices communicate, but it doesn't independently approve your payment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Phone
    ↓
  NFC Signal
    ↓
Payment Terminal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your phone doesn't need to connect to the terminal through Wi-Fi or Bluetooth for this tap-based communication to happen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Your Phone Uses Secure Payment Credentials&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's where things get more interesting.&lt;/p&gt;

&lt;p&gt;You might assume your phone simply sends your actual card number to the terminal. Modern mobile payment systems often use a more secure approach.&lt;/p&gt;

&lt;p&gt;Wallets such as Apple Pay and Google Wallet can use &lt;strong&gt;tokenization&lt;/strong&gt;, where a payment token substitutes for the actual card number in supported transactions.&lt;/p&gt;

&lt;p&gt;The wallet may also use a transaction-specific cryptogram: a piece of cryptographic data that helps the payment system verify that the transaction is legitimate.&lt;/p&gt;

&lt;p&gt;The exact process depends on the wallet, device, payment network, and transaction type.&lt;/p&gt;

&lt;p&gt;Here's a simplified example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Actual Card Details
          ↓
Secure Wallet Setup
          ↓
Payment Token Stored
          ↓
Transaction-Specific Data
          ↓
Payment Terminal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means that even if a payment uses a token instead of your actual card number, the payment system can still associate the transaction with the appropriate underlying payment account.&lt;/p&gt;

&lt;p&gt;Your phone isn't simply broadcasting your full card details to every nearby device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: The Payment Terminal Sends a Request&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once the terminal receives the required payment data, it creates a transaction request.&lt;/p&gt;

&lt;p&gt;For example, imagine you're buying headphones worth ₹2,000.&lt;/p&gt;

&lt;p&gt;The terminal combines the transaction amount with the payment information and sends the request into the payment processing system.&lt;/p&gt;

&lt;p&gt;A simplified version looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Amount: ₹2,000
Payment Credential: Token
Transaction Data: Security Information
              ↓
      Payment Request
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The terminal typically communicates with a payment processor or acquiring bank, which routes the transaction through the appropriate payment network.&lt;/p&gt;

&lt;p&gt;The request eventually reaches the card issuer — the bank or financial institution responsible for the payment account.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Your Bank Decides Whether to Approve It&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now the bank needs to decide whether the transaction should be authorized.&lt;/p&gt;

&lt;p&gt;It may evaluate factors such as available funds or credit, account status, transaction details, security checks, and fraud signals.&lt;/p&gt;

&lt;p&gt;The exact checks depend on the payment method and the issuer's systems.&lt;/p&gt;

&lt;p&gt;Imagine the bank receives this request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transaction Amount: ₹2,000
Account Status: Active
Security Checks: Passed
Available Funds: Sufficient
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are illustrative fields, not a literal bank message.&lt;/p&gt;

&lt;p&gt;If the transaction passes the relevant checks, the bank can approve the authorization. Otherwise, it may decline the request.&lt;/p&gt;

&lt;p&gt;The response travels back through the payment processing system to the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment Terminal
       ↓
Acquiring Bank / Processor
       ↓
  Payment Network
       ↓
   Card-Issuing Bank
       ↓
  Approve or Decline
       ↓
Payment Terminal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That familiar beep or on-screen confirmation appears after the terminal receives the result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Is the Money Transferred Instantly?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;This is an important distinction: &lt;strong&gt;payment authorization and settlement are different things.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Authorization means the transaction has been approved. Depending on the payment method, it may reserve funds or establish that the transaction can proceed.&lt;/p&gt;

&lt;p&gt;Settlement is the process through which the financial institutions reconcile the transaction and move the corresponding funds.&lt;/p&gt;

&lt;p&gt;The customer sees a successful payment almost immediately, but the underlying settlement process may happen later.&lt;/p&gt;

&lt;p&gt;So, when your terminal displays "Payment Successful," it doesn't necessarily mean every part of the financial transaction has already been settled.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's Understand the Whole Process With a Flowchart&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's the complete journey, simplified:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       Tap Your Phone
              ↓
       NFC Communication
              ↓
   Exchange Payment Information
              ↓
      Terminal Creates Request
              ↓
    Processor / Payment Network
              ↓
       Issuing Bank Checks
              ↓
       ┌──────┴──────┐
       ↓             ↓
    Approved      Declined
       ↓             ↓
  Confirmation   Failure Message
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual architecture varies by wallet and payment network, but this captures the basic idea behind a typical contactless card transaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can We Simulate This in Code?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's create a tiny Python example to understand how a payment terminal might handle an approval response.&lt;/p&gt;

&lt;p&gt;This is only a simulation. It doesn't use NFC, contact a real bank, or process an actual payment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_payment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;approved&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Payment amount: ₹&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;approved&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Payment successful!&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Payment declined.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;process_payment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Payment amount: ₹2000
Payment successful!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a real payment system, the terminal wouldn't simply trust a Boolean value like &lt;code&gt;approved&lt;/code&gt;. It would communicate with authorized payment infrastructure, receive a response, and follow the relevant security and transaction protocols.&lt;/p&gt;

&lt;p&gt;The example only demonstrates the final decision in a much larger process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Happens If Your Phone Has No Internet?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This depends on the payment method and its configuration.&lt;/p&gt;

&lt;p&gt;NFC communication itself doesn't require your phone to have an internet connection. However, the overall payment may still need network connectivity to reach the payment processing infrastructure.&lt;/p&gt;

&lt;p&gt;Some payment systems support limited offline transactions under specific conditions, but offline acceptance isn't universally available and may involve additional limits and risks.&lt;/p&gt;

&lt;p&gt;So, don't assume that every tap-to-pay transaction will work when your phone is disconnected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is Tapping Your Phone Safer Than Swiping a Card?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mobile wallets can provide additional security through tokenization, device-level protections, and transaction authentication.&lt;/p&gt;

&lt;p&gt;For example, a wallet may require a fingerprint, face authentication, or a device passcode before allowing a payment. The precise requirements depend on the device, wallet, transaction amount, and settings.&lt;/p&gt;

&lt;p&gt;However, security isn't determined by one feature alone. The payment network, bank, device security, and how the user protects their account all matter.&lt;/p&gt;

&lt;p&gt;Contactless payments are designed with security controls, but no payment method is completely immune to fraud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Bigger Picture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The next time you tap your phone at a store, remember that several technologies are working together behind that tiny interaction.&lt;/p&gt;

&lt;p&gt;NFC establishes the nearby communication. Secure payment credentials help protect sensitive account information. The terminal sends a transaction request through the payment infrastructure, and the issuing bank decides whether to authorize it.&lt;/p&gt;

&lt;p&gt;All of this happens quickly enough that the experience feels almost instantaneous.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One tap. Multiple systems. A whole lot of engineering.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Can One Fake Email Compromise an Entire Company?</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Tue, 13 Oct 2026 05:00:37 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-can-one-fake-email-compromise-an-entire-company-28hc</link>
      <guid>https://dev.to/agrima-06/how-can-one-fake-email-compromise-an-entire-company-28hc</guid>
      <description>&lt;p&gt;Imagine you're working at a company and receive an email from the IT department.&lt;/p&gt;

&lt;p&gt;It says your work account needs an urgent security update. There's a link to verify your credentials, and the email looks completely legitimate. It has the company logo, professional language, and even a convincing sender name.&lt;/p&gt;

&lt;p&gt;You click the link, enter your email and password, and get back to work.&lt;/p&gt;

&lt;p&gt;Nothing unusual happens.&lt;/p&gt;

&lt;p&gt;But somewhere in the background, an attacker may now have access to your account.&lt;/p&gt;

&lt;p&gt;This is how a phishing attack can begin. And in the wrong circumstances, one compromised account can become a much bigger security incident.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is Phishing, Really?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Phishing is a type of cyberattack in which someone impersonates a trusted person or organization to trick people into revealing sensitive information, clicking malicious links, or performing actions that compromise security.&lt;/p&gt;

&lt;p&gt;The important part is that phishing doesn't necessarily rely on sophisticated hacking.&lt;/p&gt;

&lt;p&gt;Sometimes, the attacker simply convinces someone to trust the wrong message.&lt;/p&gt;

&lt;p&gt;And that makes it particularly dangerous in workplaces, where employees receive dozens of emails every day and often have to act quickly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's Follow One Email&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine a fictional company called NovaTech.&lt;/p&gt;

&lt;p&gt;An employee receives this message:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Subject: Urgent — Your Work Account Requires Verification&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;As part of a scheduled security update, please verify your work account to avoid temporary access restrictions.&lt;/p&gt;

&lt;p&gt;Complete the verification using the link below.&lt;/p&gt;

&lt;p&gt;— IT Support Team&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The email looks routine. The employee is busy, the request sounds reasonable, and the deadline creates a sense of urgency.&lt;/p&gt;

&lt;p&gt;They open the link and land on a page that resembles the company's login portal.&lt;/p&gt;

&lt;p&gt;They enter their credentials.&lt;/p&gt;

&lt;p&gt;The page might display an error or redirect them somewhere else. The employee assumes it was a technical issue and moves on.&lt;/p&gt;

&lt;p&gt;But if the page was designed to steal credentials, the attacker may now have the employee's username and password.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does One Click Become a Bigger Problem?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Getting someone's password is only the beginning. What happens next depends on the account's permissions, the company's security controls, and whether the attacker can bypass additional protections.&lt;/p&gt;

&lt;p&gt;Here's a simplified view of how the incident could develop.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fake Email
    ↓
Employee Clicks Link
    ↓
Credentials Are Stolen
    ↓
Attacker Attempts Account Access
    ↓
Unauthorized Access
    ↓
Sensitive Data May Be Exposed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice that every step isn't guaranteed to happen. A well-secured company might detect the login attempt, block it, or require additional verification.&lt;/p&gt;

&lt;p&gt;But if the compromised account has access to internal documents, shared drives, customer records, or other business systems, the potential impact can extend beyond one employee.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Would an Attacker Target an Employee?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You might wonder why someone would target an ordinary employee instead of directly attacking the company's servers.&lt;/p&gt;

&lt;p&gt;Because an employee's account can already have legitimate access to valuable systems.&lt;/p&gt;

&lt;p&gt;For example, an employee might have access to internal project documents, customer information, shared folders, or business communication tools.&lt;/p&gt;

&lt;p&gt;An attacker who compromises that account may be able to misuse those existing permissions.&lt;/p&gt;

&lt;p&gt;This is why cybersecurity isn't just about protecting servers. It's also about protecting identities and controlling what each account can access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does the Attack Become a Company-Wide Incident?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's say the compromised account belongs to someone who can access internal documents and communicate with other employees.&lt;/p&gt;

&lt;p&gt;Depending on the situation, an attacker might misuse that access to collect sensitive files, impersonate the employee, or send convincing messages to colleagues.&lt;/p&gt;

&lt;p&gt;Those messages may be more believable because they come from a real, trusted account.&lt;/p&gt;

&lt;p&gt;If another employee trusts the message, the attack could spread further.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Compromised Employee Account
             ↓
   Access to Internal Systems
             ↓
  Sensitive Data or Communications
             ↓
 Potential Wider Security Incident
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In more serious cases, attackers may discover additional weaknesses or gain access to more privileged accounts. However, a single phishing email doesn't automatically give someone control of an entire company.&lt;/p&gt;

&lt;p&gt;The extent of the damage depends on the access obtained and how quickly the incident is detected and contained.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Are Phishing Emails So Convincing Today?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Phishing messages aren't always filled with spelling mistakes or suspicious formatting.&lt;/p&gt;

&lt;p&gt;Attackers can imitate company branding, copy the tone of real business communications, and create convincing login pages. Some messages also use information about a person's role or workplace to make the request seem more believable.&lt;/p&gt;

&lt;p&gt;A message can look professional and still be fraudulent.&lt;/p&gt;

&lt;p&gt;That's why checking grammar or looking for a suspicious design isn't enough.&lt;/p&gt;

&lt;p&gt;Pay attention to the actual sender address, the destination of links, unexpected requests for credentials, and unusual urgency. When a message asks you to perform a sensitive action, verify it through a separate, trusted channel.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Can Companies Prevent This?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer isn't simply to tell employees to be more careful. People can make mistakes, especially when they're busy or under pressure.&lt;/p&gt;

&lt;p&gt;Companies need multiple layers of protection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Multi-factor authentication (MFA)&lt;/strong&gt; makes account access harder for attackers who have stolen a password. Phishing-resistant methods, such as passkeys or hardware security keys, provide stronger protection against fake login pages than codes that can be captured or relayed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Least-privilege access&lt;/strong&gt; ensures employees and applications only have the permissions they need. If an ordinary account is compromised, limited permissions can reduce the potential damage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Email security controls&lt;/strong&gt; can help detect spoofed senders, suspicious links, and malicious attachments before they reach an inbox.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Employee awareness and reporting&lt;/strong&gt; also matter. Employees should know how to recognize suspicious requests and report them without fear of blame.&lt;/p&gt;

&lt;p&gt;Finally, monitoring and incident response help security teams detect unusual activity, disable compromised sessions, reset affected credentials, and investigate what was accessed.&lt;/p&gt;

&lt;p&gt;No single measure is perfect. The goal is to prevent one mistake from turning into a major incident.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Should You Do If You Clicked a Suspicious Link?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, don't panic. Clicking a link doesn't automatically mean your account has been compromised.&lt;/p&gt;

&lt;p&gt;If you entered your credentials, report it to your IT or security team immediately. Use a trusted device and official route to change the affected password, and follow your organization's instructions for revoking sessions or securing the account.&lt;/p&gt;

&lt;p&gt;If you downloaded or opened a suspicious file, report that too. Don't try to investigate or delete evidence on your own if your organization's security team needs to examine the device.&lt;/p&gt;

&lt;p&gt;Quick reporting gives the company a better chance of containing the incident before it spreads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Bigger Picture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A phishing attack is often described as a technical problem, but it usually involves technology, human behavior, and access controls working together.&lt;/p&gt;

&lt;p&gt;An email alone doesn't compromise an entire company. The risk grows when stolen credentials provide access to important systems, permissions are too broad, and suspicious activity goes undetected.&lt;/p&gt;

&lt;p&gt;That's why good cybersecurity doesn't depend on expecting every employee to spot every fake email.&lt;/p&gt;

&lt;p&gt;It depends on building systems that can withstand mistakes, limit damage, and respond quickly when something goes wrong.&lt;/p&gt;

&lt;p&gt;Because sometimes, the most important security boundary isn't a firewall.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It's the moment someone decides whether to trust an email.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>From Localhost to the Cloud: Understanding AWS for Beginners</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Mon, 12 Oct 2026 12:59:42 +0000</pubDate>
      <link>https://dev.to/agrima-06/from-localhost-to-the-cloud-understanding-aws-for-beginners-3dda</link>
      <guid>https://dev.to/agrima-06/from-localhost-to-the-cloud-understanding-aws-for-beginners-3dda</guid>
      <description>&lt;p&gt;If you've ever built a website, you've probably run it on &lt;code&gt;localhost:3000&lt;/code&gt; or &lt;code&gt;localhost:8000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Everything works perfectly on your laptop. Your frontend connects to your backend, your API returns data, and your application runs just fine.&lt;/p&gt;

&lt;p&gt;But there's one problem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What happens when someone else wants to use your application?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;They can't access your &lt;code&gt;localhost&lt;/code&gt; because it points to their own computer, not yours.&lt;/p&gt;

&lt;p&gt;So, how do you take an application from your laptop and make it accessible to the entire world?&lt;/p&gt;

&lt;p&gt;That's where cloud computing comes in. And one of the most popular platforms for it is &lt;strong&gt;AWS (Amazon Web Services)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's understand how it works.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Actually Is the Cloud?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Forget the technical definition for a moment.&lt;/p&gt;

&lt;p&gt;Imagine you want to run a backend application 24/7. You could buy a physical server, keep it running, maintain its hardware, manage its network connection, and handle failures yourself.&lt;/p&gt;

&lt;p&gt;Sounds expensive, right?&lt;/p&gt;

&lt;p&gt;Instead, you can rent computing resources from a cloud provider and access them over the internet.&lt;/p&gt;

&lt;p&gt;That's the basic idea behind cloud computing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The cloud is essentially someone else's infrastructure that you can use to run your applications, store your data, and build services without owning all the physical hardware yourself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And AWS is one of the platforms that provides these services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, What Is AWS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS stands for Amazon Web Services. It offers cloud services for running applications, storing files, managing databases, networking, security, and much more.&lt;/p&gt;

&lt;p&gt;Think of it this way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Laptop
    ↓
Write and test your code locally
    ↓
Deploy your application
    ↓
AWS provides the infrastructure
    ↓
Users access your application online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;AWS isn't a single server or tool. It's a collection of services that work together to help you build and run applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let's Understand This With an Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you've built a simple Notes application.&lt;/p&gt;

&lt;p&gt;Your frontend is written in React, your backend uses FastAPI, and your database stores users and notes.&lt;/p&gt;

&lt;p&gt;On your laptop, everything might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;React Frontend
      ↓
FastAPI Backend
      ↓
PostgreSQL Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All three components run locally.&lt;/p&gt;

&lt;p&gt;But now you want your friends to open the application from their own devices.&lt;/p&gt;

&lt;p&gt;You need to deploy the application somewhere accessible over the internet.&lt;/p&gt;

&lt;p&gt;AWS gives you different services to help with that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The AWS Services You'll Actually Need to Know&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You don't need to learn hundreds of AWS services as a beginner. Start by understanding what a few important ones do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon EC2 — A Computer in the Cloud&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;EC2 stands for Elastic Compute Cloud.&lt;/p&gt;

&lt;p&gt;Remember how your backend runs on your laptop? EC2 lets you launch a virtual server in the cloud and run your backend on it.&lt;/p&gt;

&lt;p&gt;You can choose its operating system, configure its resources, and install the software your application needs.&lt;/p&gt;

&lt;p&gt;Think of it as renting a computer that can stay online and serve your application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon S3 — Storing Your Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose users can upload profile pictures, PDFs, or other documents.&lt;/p&gt;

&lt;p&gt;Instead of keeping those files on your backend server, you can store them in Amazon S3, a service designed for storing objects such as files and media.&lt;/p&gt;

&lt;p&gt;Your backend can then manage access to those files according to your application's requirements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon RDS — Your Database in the Cloud&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Your application needs to save information such as user accounts, notes, and transactions.&lt;/p&gt;

&lt;p&gt;Amazon RDS provides managed relational databases, including PostgreSQL and MySQL.&lt;/p&gt;

&lt;p&gt;Instead of managing every aspect of the database infrastructure yourself, AWS handles many routine administrative tasks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AWS IAM — Who Can Access What?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine your backend needs access to files in S3.&lt;/p&gt;

&lt;p&gt;You don't want to give it unlimited access to your entire AWS account.&lt;/p&gt;

&lt;p&gt;IAM (Identity and Access Management) helps you control which users and applications can access which resources.&lt;/p&gt;

&lt;p&gt;It's an essential part of building applications securely in the cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Do These Services Work Together?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's return to our Notes application.&lt;/p&gt;

&lt;p&gt;A simplified setup could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         User's Browser
                ↓
          React Frontend
                ↓
        FastAPI on EC2
           ↙        ↘
     Amazon RDS    Amazon S3
     (Notes data)  (Uploaded files)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The frontend sends requests to the backend. The backend processes those requests, retrieves information from the database when needed, and returns a response.&lt;/p&gt;

&lt;p&gt;If a user uploads a PDF, the application can store it in S3.&lt;/p&gt;

&lt;p&gt;Each service has a different responsibility, but together they help run one application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What About Deployment?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Deploying means making your application available in an environment where other people can use it.&lt;/p&gt;

&lt;p&gt;When deploying to AWS, you typically configure your application, choose the appropriate services, set up networking and permissions, and make the necessary endpoints accessible.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Local Development
        ↓
Test Your Application
        ↓
Configure AWS Resources
        ↓
Deploy Frontend + Backend
        ↓
Connect Database and Storage
        ↓
Users Access Your App Online
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The exact process depends on your tech stack and the AWS services you choose. EC2 is one option for hosting a backend, but AWS also offers services that reduce how much server management you need to do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does AWS Cost Money?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is something beginners should understand before deploying anything.&lt;/p&gt;

&lt;p&gt;AWS has different pricing models depending on the service. Some resources are charged according to usage, while others have different billing structures.&lt;/p&gt;

&lt;p&gt;Some services offer free usage allowances for eligible accounts, but not everything is free.&lt;/p&gt;

&lt;p&gt;Before experimenting, check the current pricing, configure billing alerts, and delete resources you no longer need. Simply stopping development doesn't always mean every resource has stopped generating charges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Should You Start Learning AWS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don't try to memorize every service name. Start with a project you already understand.&lt;/p&gt;

&lt;p&gt;Build a small application locally, then learn how to deploy it. Understand EC2, S3, IAM, and basic networking before moving on to more advanced services.&lt;/p&gt;

&lt;p&gt;Once you're comfortable, explore managed databases, serverless computing with AWS Lambda, and content delivery with CloudFront.&lt;/p&gt;

&lt;p&gt;You'll understand cloud computing much faster when you can connect each service to a real problem you've faced while building software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Moving from localhost to the cloud is an important step in becoming a developer who can build and deploy real applications.&lt;/p&gt;

&lt;p&gt;AWS makes that journey possible by providing the infrastructure and tools you need without requiring you to own physical servers.&lt;/p&gt;

&lt;p&gt;You don't have to learn everything at once. Start small, deploy something simple, understand how its components communicate, and build from there.&lt;/p&gt;

&lt;p&gt;Because writing code is one thing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Making it available to the world is where the real fun begins.&lt;/strong&gt; ☁️&lt;/p&gt;

</description>
      <category>aws</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How Can AI Answer Questions About Your PDFs? Meet RAG</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Fri, 09 Oct 2026 11:44:33 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-can-ai-answer-questions-about-your-pdfs-meet-rag-45bd</link>
      <guid>https://dev.to/agrima-06/how-can-ai-answer-questions-about-your-pdfs-meet-rag-45bd</guid>
      <description>&lt;p&gt;Have you ever wanted to upload your college notes and simply ask an AI, “Explain Unit 3” or “What is the difference between these two concepts?”&lt;/p&gt;

&lt;p&gt;Instead of searching through 50 pages yourself, the AI finds the relevant information and explains it to you.&lt;/p&gt;

&lt;p&gt;But how does it know which part of your notes to look at?&lt;/p&gt;

&lt;p&gt;One of the techniques that makes this possible is &lt;strong&gt;RAG (Retrieval-Augmented Generation)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Let's understand it with a simple example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagine You're Preparing for an Exam&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Suppose you have a PDF containing 100 pages of DBMS notes. You ask an AI:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Explain primary keys with an example.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The AI shouldn't need to read all 100 pages every time you ask a question. It should find the relevant section, understand the context, and explain it to you.&lt;/p&gt;

&lt;p&gt;That's exactly what RAG helps it do.&lt;/p&gt;

&lt;p&gt;Think of RAG as an open-book exam. You find the relevant page first, read it, and then answer the question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, How Does RAG Work?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The process has two main parts: finding the right information and using it to generate an answer.&lt;/p&gt;

&lt;p&gt;Here's the complete flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your PDF or Documents
        ↓
Break them into smaller pieces
        ↓
Make those pieces searchable by meaning
        ↓
Find the relevant pieces when asked
        ↓
Give them to the AI
        ↓
Generate the answer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's understand each step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Break Documents Into Smaller Pieces&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine your 100-page PDF is one huge book.&lt;/p&gt;

&lt;p&gt;Searching through the entire book for every question would be inefficient. So, we divide the text into smaller sections called &lt;strong&gt;chunks&lt;/strong&gt;.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DBMS Notes
    ↓
Chunk 1: Introduction to DBMS
Chunk 2: Primary and Foreign Keys
Chunk 3: SQL Joins
Chunk 4: Normalization
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, if you ask about primary keys, the system can look for the section about keys instead of processing the whole document.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Help the Computer Understand Meaning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's where things get interesting.&lt;/p&gt;

&lt;p&gt;Suppose you ask:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“How do I get my money back?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;But your document contains the words “Refund Policy.”&lt;/p&gt;

&lt;p&gt;A simple keyword search might miss the connection because the wording is different.&lt;/p&gt;

&lt;p&gt;To help with this, RAG systems often use something called &lt;strong&gt;embeddings&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An embedding converts text into a list of numbers that represents its meaning. Text with similar meanings can have similar numerical representations.&lt;/p&gt;

&lt;p&gt;Think of it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"How do I get my money back?"
             ↓
          Embedding
             ↕
       Similar meaning
             ↕
       "Refund Policy"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This helps the system find relevant information even when the exact words don't match.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Store the Information So It Can Be Found Later&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once the document chunks have been converted into embeddings, we store them in a system that can search these vectors. This is where a &lt;strong&gt;vector database&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;Tools like Chroma, Pinecone, and Weaviate can help with this.&lt;/p&gt;

&lt;p&gt;Think of a vector database as a smart library. Instead of searching only by a book's title, it helps you find the sections that are closest in meaning to your question.&lt;/p&gt;

&lt;p&gt;When you ask a question, the system converts it into an embedding and searches for the most relevant chunks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your Question
      ↓
Convert to Embedding
      ↓
Search Vector Database
      ↓
Find Relevant Text
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Give the Relevant Information to the AI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now the system has found the right section of your notes.&lt;/p&gt;

&lt;p&gt;It sends that information to the language model along with your question.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Relevant information:
A primary key uniquely identifies
each record in a table.

Your question:
What is a primary key?

AI instruction:
Explain using the information provided.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The AI uses this context to create a clear answer.&lt;/p&gt;

&lt;p&gt;Notice something important: the AI isn't searching through your PDF by itself at this stage. The RAG system retrieves the relevant information and provides it to the AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Generate the Answer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finally, the AI responds:&lt;/p&gt;

&lt;p&gt;“A primary key is a column that uniquely identifies each record in a database table. For example, a student ID can be a primary key because every student has a unique ID.”&lt;/p&gt;

&lt;p&gt;And there you have it!&lt;/p&gt;

&lt;p&gt;You asked a question, the system found the relevant information in your document, and the AI turned it into an understandable answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Where Is RAG Used?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you understand the idea, you'll start noticing how useful it is.&lt;/p&gt;

&lt;p&gt;RAG can power PDF chatbots, AI study assistants, customer support bots, company knowledge assistants, and tools that answer questions from technical documentation.&lt;/p&gt;

&lt;p&gt;For example, you could build an AI study assistant where students upload their notes and ask questions without manually searching every page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does RAG Always Give Correct Answers?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;Imagine asking about SQL joins, but the system retrieves a section about normalization instead.&lt;/p&gt;

&lt;p&gt;The AI might produce an answer that sounds convincing but doesn't answer your question correctly.&lt;/p&gt;

&lt;p&gt;RAG improves the chances of getting a relevant answer by providing useful context, but it doesn't eliminate mistakes or hallucinations completely.&lt;/p&gt;

&lt;p&gt;That's why retrieving the right information is just as important as generating the answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Big Picture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You don't need to train a new AI model to build a chatbot that answers questions about your documents.&lt;/p&gt;

&lt;p&gt;You can connect an existing language model to your own information using RAG.&lt;/p&gt;

&lt;p&gt;Just remember this simple workflow:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Find the information → Give it to the AI → Generate the answer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the basic idea behind Retrieval-Augmented Generation.&lt;/p&gt;

&lt;p&gt;And if you want to put this into practice, a great next project is building a PDF chatbot that lets users upload their notes and ask questions about them.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>rag</category>
    </item>
    <item>
      <title>How Does a Neural Network Actually Learn?</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Wed, 07 Oct 2026 15:27:03 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-does-a-neural-network-actually-learn-31i2</link>
      <guid>https://dev.to/agrima-06/how-does-a-neural-network-actually-learn-31i2</guid>
      <description>&lt;p&gt;We've all heard this sentence:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Neural networks learn from data."&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But what does &lt;em&gt;learn&lt;/em&gt; actually mean?&lt;/p&gt;

&lt;p&gt;Does the model somehow understand the data? Does it remember every example? And how does it know when it's getting something wrong?&lt;/p&gt;

&lt;p&gt;The answer is surprisingly simple.&lt;/p&gt;

&lt;p&gt;A neural network basically follows this loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Predict → Check the Error → Adjust → Repeat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's see what that actually means.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Let's Start With a Simple Example&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine we're building a model that predicts whether a student will pass an exam based on how many hours they studied.&lt;/p&gt;

&lt;p&gt;Our data could look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hours Studied     Result

2                 Fail
4                 Fail
5                 Pass
7                 Pass
9                 Pass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We give the model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6 hours
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Will this student pass?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The model makes a prediction.&lt;/p&gt;

&lt;p&gt;Maybe it says:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;35% chance of passing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the actual answer is:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;So the model got it wrong.&lt;/p&gt;

&lt;p&gt;Now comes the interesting part: &lt;strong&gt;how does it improve?&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Model Starts With Weights&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Inside a neural network, there are lots of numbers called &lt;strong&gt;weights&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can think of weights as the importance given to different inputs.&lt;/p&gt;

&lt;p&gt;A very simple neuron looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input
  ↓
× Weight
  ↓
+ Bias
  ↓
Activation
  ↓
Output
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;output = (input × weight) + bias
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the beginning, these weights are usually initialized with small values.&lt;/p&gt;

&lt;p&gt;The model doesn't know the correct values yet.&lt;/p&gt;

&lt;p&gt;So it starts making predictions with basically a rough guess.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;First, It Makes a Prediction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is called &lt;strong&gt;forward propagation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Data moves through the network:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input
  ↓
Hidden Layers
  ↓
Output
  ↓
Prediction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6 hours
   ↓
Neural Network
   ↓
Prediction = 0.35
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But how do we know whether &lt;code&gt;0.35&lt;/code&gt; is good or bad?&lt;/p&gt;

&lt;p&gt;We compare it with the actual answer.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Then It Measures How Wrong It Was&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is where the &lt;strong&gt;loss function&lt;/strong&gt; comes in.&lt;/p&gt;

&lt;p&gt;The loss function basically asks:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"How far was the prediction from the actual answer?"&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Prediction
    ↓
Compare with Actual
    ↓
Calculate Loss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Large loss:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌ Very wrong
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small loss:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;✅ Pretty close
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal of training is to make this loss smaller.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Now the Model Has to Fix Itself&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is where you hear two important words:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Backpropagation&lt;/strong&gt; and &lt;strong&gt;Gradient Descent&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Don't let the names scare you.&lt;/p&gt;

&lt;p&gt;Backpropagation basically works backward through the network to figure out:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Which weights contributed to this mistake, and how should they change?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then gradient descent helps decide &lt;strong&gt;which direction&lt;/strong&gt; those weights should move.&lt;/p&gt;

&lt;p&gt;Think about standing on a mountain and trying to reach the lowest point.&lt;/p&gt;

&lt;p&gt;You look at the slope and take a small step downhill.&lt;/p&gt;

&lt;p&gt;Then another.&lt;/p&gt;

&lt;p&gt;And another.&lt;/p&gt;

&lt;p&gt;That's the basic intuition behind gradient descent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;High Loss
    ●
     \
      ●
       \
        ●
         \
          ●  ← Lower Loss
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  &lt;strong&gt;And Then It Does It Again... and Again...&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is the part that makes the model learn.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Data
 ↓
Prediction
 ↓
Calculate Loss
 ↓
Backpropagation
 ↓
Update Weights
 ↓
Prediction again
 ↓
Calculate Loss
 ↓
Update Weights
 ↓
Repeat...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After thousands or millions of these tiny adjustments, the model's parameters become much better at making predictions.&lt;/p&gt;

&lt;p&gt;That's basically &lt;strong&gt;training&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Where Do Epochs Come In?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You might see something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Epoch 1/50
Epoch 2/50
...
Epoch 50/50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An &lt;strong&gt;epoch&lt;/strong&gt; simply means the model has gone through the entire training dataset once.&lt;/p&gt;

&lt;p&gt;So if you have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 training examples
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 epoch = model sees all 10,000 examples once
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Train for 50 epochs, and it sees that dataset 50 times.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;So What Is the Model Actually Learning?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is probably the most important part.&lt;/p&gt;

&lt;p&gt;The model isn't memorizing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;6 hours = Pass
7 hours = Pass
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead, it's learning &lt;strong&gt;patterns by adjusting its weights and biases&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;At a very high level:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Training Data
      ↓
Adjust Parameters
      ↓
Reduce Error
      ↓
Learn Patterns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And when we give it data it hasn't seen before, those learned patterns help it make a prediction.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Whole Idea in One Picture&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you remember only one thing from this article, remember this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Training Data
                   ↓
             Neural Network
                   ↓
               Prediction
                   ↓
             Loss Function
                   ↓
              "How wrong?"
                   ↓
            Backpropagation
                   ↓
            Update Weights
                   ↓
               Try Again
                   ↓
              Better Model
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's neural network learning in its simplest form.&lt;/p&gt;

&lt;p&gt;Of course, real-world models get &lt;strong&gt;much&lt;/strong&gt; more complicated — millions of parameters, GPUs, different optimizers, regularization, huge datasets, and architectures like Transformers.&lt;/p&gt;

&lt;p&gt;But underneath all that complexity, the basic idea is still:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Predict → Measure the mistake → Adjust → Repeat.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's how a neural network actually learns. 🧠&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
    </item>
    <item>
      <title>How Caching Saves Your Website From Thousands of Requests</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Tue, 06 Oct 2026 11:18:00 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-caching-saves-your-website-from-thousands-of-requests-4nda</link>
      <guid>https://dev.to/agrima-06/how-caching-saves-your-website-from-thousands-of-requests-4nda</guid>
      <description>&lt;h1&gt;
  
  
  How Does Netflix Load So Fast? The Secret Is Caching.
&lt;/h1&gt;

&lt;p&gt;Have you ever wondered why Netflix can serve millions of users without making its database work insanely hard for every single request?&lt;/p&gt;

&lt;p&gt;Or why YouTube thumbnails appear almost instantly?&lt;/p&gt;

&lt;p&gt;Or why a website you've already visited sometimes loads noticeably faster the second time?&lt;/p&gt;

&lt;p&gt;One of the biggest reasons is &lt;strong&gt;caching&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You might have heard this word a hundred times, but the idea behind it is actually pretty simple:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If you've already done the expensive work once, why do it again?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's see how this works in real applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;So, What Exactly Is Caching?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine you go to a restaurant and order coffee.&lt;/p&gt;

&lt;p&gt;The waiter doesn't go to the farm, collect coffee beans, roast them, grind them, and make the coffee from scratch every time you ask for another cup.&lt;/p&gt;

&lt;p&gt;The restaurant already has the ingredients ready.&lt;/p&gt;

&lt;p&gt;Caching follows a similar idea.&lt;/p&gt;

&lt;p&gt;Instead of repeatedly fetching or calculating the same data, we temporarily store the result somewhere that can be accessed much faster.&lt;/p&gt;

&lt;p&gt;Without caching, a request might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
 ↓
Server
 ↓
Database
 ↓
Get Data
 ↓
Server
 ↓
User
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User
 ↓
Server
 ↓
Cache ⚡
 ↓
Data
 ↓
User
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The database doesn't have to do the same work over and over again.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Let's Take a Simple Example&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine your website has an API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /api/products
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every time someone visits your website, the backend might query the database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now imagine 10,000 people visit your website.&lt;/p&gt;

&lt;p&gt;You could end up with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 requests
      ↓
10,000 database queries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But what if the product list only changes occasionally?&lt;/p&gt;

&lt;p&gt;There's no reason to ask the database the exact same question 10,000 times.&lt;/p&gt;

&lt;p&gt;Instead, we can cache the result.&lt;/p&gt;

&lt;p&gt;The first request goes to the database:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Backend
   ↓
Database
   ↓
Products
   ↓
Cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next requests can simply use the cached result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Backend
   ↓
Cache ⚡
   ↓
Products
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the basic idea behind caching.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Cache Hit vs Cache Miss&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You'll often hear developers use the terms &lt;strong&gt;cache hit&lt;/strong&gt; and &lt;strong&gt;cache miss&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A cache hit means the data you're looking for is already in the cache.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Cache
   ↓
Found ✅
   ↓
Return Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A cache miss means the cache doesn't have the data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Cache
   ↓
Not Found ❌
   ↓
Database
   ↓
Store Result in Cache
   ↓
Return Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The goal is generally to have a high cache hit rate for data that makes sense to cache.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Your Browser Is Already Using Caching&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Caching isn't something you only encounter in backend development.&lt;/p&gt;

&lt;p&gt;Your browser does it all the time.&lt;/p&gt;

&lt;p&gt;When you visit a website, your browser may store things like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Images
CSS
JavaScript
Fonts
Other static resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Suppose you download:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;logo.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next time you visit the same website, your browser may already have that image.&lt;/p&gt;

&lt;p&gt;Instead of downloading it again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Server → Browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the browser can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Browser Cache → logo.png
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is one of the reasons websites can feel faster when you revisit them.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Then There Are CDNs&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now imagine your main server is located in the US, but your users are all over the world.&lt;/p&gt;

&lt;p&gt;A user in India requesting a large image might have to communicate with a server thousands of kilometres away.&lt;/p&gt;

&lt;p&gt;That's where a &lt;strong&gt;CDN — Content Delivery Network&lt;/strong&gt; — becomes useful.&lt;/p&gt;

&lt;p&gt;A CDN stores copies of content across servers distributed around the world.&lt;/p&gt;

&lt;p&gt;Without a CDN:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;India
  ↓
US Server
  ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a CDN:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;India
  ↓
Nearby CDN
  ↓
Response ⚡
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CDNs are commonly used for images, videos, JavaScript, CSS, static pages, and sometimes API responses.&lt;/p&gt;

&lt;p&gt;This is one of the techniques that allows large platforms to deliver content efficiently to users around the world.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What About Backend Caching?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's move one level deeper.&lt;/p&gt;

&lt;p&gt;Suppose your backend has this endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /api/products
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
  ↓
Backend
  ↓
Database
  ↓
Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
  ↓
Backend
  ↓
Cache
 ↙     ↘
Hit    Miss
 ↓       ↓
Data   Database
         ↓
       Cache
         ↓
      Response
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where technologies like &lt;strong&gt;Redis&lt;/strong&gt; are commonly used.&lt;/p&gt;

&lt;p&gt;Redis is an in-memory data store, which makes it extremely useful for storing frequently accessed data.&lt;/p&gt;

&lt;p&gt;For example, we might store:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Key:
products

Value:
[
  { id: 1, name: "Laptop" },
  { id: 2, name: "Mouse" }
]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of hitting the database for every request, the backend can first check Redis.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;A Simple Backend Example&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine a Python backend.&lt;/p&gt;

&lt;p&gt;Without caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;

    &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every request goes directly to the database.&lt;/p&gt;

&lt;p&gt;With caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;

    &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;

    &lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_products&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;products&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the logic is basically:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Request
   ↓
Check Cache
   ↓
Is data there?
  ↙       ↘
YES       NO
 ↓         ↓
Return   Database
           ↓
         Cache
           ↓
        Return
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simple idea, but extremely powerful when an application gets large.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;But Here's the Problem With Caching&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Imagine your website stores:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Product price = ₹999
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in the cache.&lt;/p&gt;

&lt;p&gt;Then the actual price changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹999 → ₹899
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But the cache still contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;₹999
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your users are seeing old information.&lt;/p&gt;

&lt;p&gt;This is called &lt;strong&gt;stale data&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So caches usually have an expiration time, commonly called &lt;strong&gt;TTL — Time To Live&lt;/strong&gt;.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cache Data
    ↓
TTL = 60 seconds
    ↓
60 seconds pass
    ↓
Cache expires
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next request can fetch fresh data and store it again.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Cache Invalidation Is Where Things Get Interesting&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;There's a famous saying in software:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"There are only two hard things in Computer Science: cache invalidation and naming things."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And cache invalidation really can become complicated.&lt;/p&gt;

&lt;p&gt;Suppose we have:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Database:
₹899

Cache:
₹999
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the product changes, we need to make sure the cache is updated or removed.&lt;/p&gt;

&lt;p&gt;One approach is to delete the cached value:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;cache&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;product:123&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then the next request fetches fresh data from the database.&lt;/p&gt;

&lt;p&gt;Another approach is to update the cache whenever the database changes.&lt;/p&gt;

&lt;p&gt;The right strategy depends on the application.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why Not Cache Everything?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If caching makes things faster, why not cache the entire application?&lt;/p&gt;

&lt;p&gt;Because caching comes with trade-offs.&lt;/p&gt;

&lt;p&gt;Caches consume memory.&lt;/p&gt;

&lt;p&gt;Cached data can become stale.&lt;/p&gt;

&lt;p&gt;And now you have another system to manage.&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 plaintext"&gt;&lt;code&gt;Backend → Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;your architecture becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Backend → Cache → Database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you have to think about what should be cached, how long it should live, and what should happen when the cache is unavailable.&lt;/p&gt;

&lt;p&gt;Caching is powerful, but it isn't free.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What Makes Good Data for Caching?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;A good candidate is usually data that is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Frequently requested, expensive to calculate or retrieve, and doesn't change constantly.&lt;/strong&gt;&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Product catalog
Popular posts
API responses
Configuration
Frequently accessed database queries
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Data that changes constantly or must always be completely real-time may be less suitable.&lt;/p&gt;

&lt;p&gt;The important question isn't:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Can I cache this?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Does caching this actually improve my application?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;How Much Faster Can Caching Be?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Let's use a simplified example.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Database query = 200ms
Cache lookup   = 5ms
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If 1,000 requests all hit the database, that's a lot of unnecessary work.&lt;/p&gt;

&lt;p&gt;But if most of those requests can be served from the cache, the database can focus on requests that actually need it.&lt;/p&gt;

&lt;p&gt;The exact numbers will vary depending on your architecture, network, database, query, and cache setup.&lt;/p&gt;

&lt;p&gt;But the fundamental idea remains:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Avoid expensive work when you already have the answer.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Caching Exists at Multiple Levels&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;One interesting thing about caching is that there isn't just one cache.&lt;/p&gt;

&lt;p&gt;A modern application might look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              USER
                ↓
         Browser Cache
                ↓
               CDN
                ↓
        Application Cache
                ↓
             Redis
                ↓
            Database
                ↓
         Database Cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Different layers solve different problems.&lt;/p&gt;

&lt;p&gt;And together, they can dramatically reduce the amount of work your backend and database need to perform.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;The Mental Model I Use for Caching&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Whenever you hear the word &lt;strong&gt;cache&lt;/strong&gt;, think about one simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"Do I already have this?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If yes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Return it ⚡
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fetch / Calculate
       ↓
Store
       ↓
Return
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's caching at its core.&lt;/p&gt;

&lt;p&gt;Everything else — Redis, CDNs, TTLs, cache invalidation, cache hit rates — is built around this basic idea.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Final Takeaway&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Caching isn't some complicated trick that only companies like Netflix or YouTube use.&lt;/p&gt;

&lt;p&gt;It's a simple idea that becomes incredibly powerful at scale:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Don't do expensive work repeatedly when you can reuse the result.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your browser caches images.&lt;/p&gt;

&lt;p&gt;CDNs cache content.&lt;/p&gt;

&lt;p&gt;Backends cache API responses.&lt;/p&gt;

&lt;p&gt;Redis stores frequently accessed data.&lt;/p&gt;

&lt;p&gt;Databases have their own caching mechanisms.&lt;/p&gt;

&lt;p&gt;Together, these layers help modern applications serve huge amounts of traffic without forcing the database to handle every single request.&lt;/p&gt;

&lt;p&gt;So the next time Netflix loads your homepage almost instantly, remember:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It probably isn't asking the database to figure everything out from scratch.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Somewhere along the way, someone already did the work — and the result is waiting in a cache. ⚡&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>database</category>
      <category>redis</category>
    </item>
    <item>
      <title>How API Calls Actually Work: From Button Click to Server Response</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Mon, 05 Oct 2026 16:12:45 +0000</pubDate>
      <link>https://dev.to/agrima-06/how-api-calls-actually-work-from-button-click-to-server-response-1j2h</link>
      <guid>https://dev.to/agrima-06/how-api-calls-actually-work-from-button-click-to-server-response-1j2h</guid>
      <description>&lt;p&gt;If you've worked with React, Next.js, or any frontend framework, you've probably written something like:&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks simple, right?&lt;/p&gt;

&lt;p&gt;But I used to wonder:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What actually happens after I call &lt;code&gt;fetch()&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Where does the request go?&lt;br&gt;&lt;br&gt;
How does the backend know what I want?&lt;br&gt;&lt;br&gt;
Where does the database fit in?&lt;br&gt;&lt;br&gt;
And how does the response come back to my UI?&lt;/p&gt;

&lt;p&gt;Let's break down the entire journey of one API call.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Big Picture
&lt;/h2&gt;

&lt;p&gt;Imagine we have a button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;onclick=&lt;/span&gt;&lt;span class="s"&gt;"getUsers()"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  Get Users
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the user clicks it, the flow looks roughly like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Button Click
     ↓
Frontend JavaScript
     ↓
HTTP Request
     ↓
Backend API
     ↓
Database
     ↓
Backend Response
     ↓
Frontend
     ↓
UI Update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;Now let's see what's actually happening at each step.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Button Click
&lt;/h2&gt;

&lt;p&gt;Let's say we want to fetch a list of users.&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="p"&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:8000/api/users&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important line is:&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:8000/api/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;We're basically telling the browser:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Hey, send a request to this API and give me whatever comes back."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. The Browser Sends an HTTP Request
&lt;/h2&gt;

&lt;p&gt;Behind that simple &lt;code&gt;fetch()&lt;/code&gt; call, the browser creates an HTTP request.&lt;/p&gt;

&lt;p&gt;Something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;GET /api/users
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;GET&lt;/code&gt; is the HTTP method.&lt;/p&gt;

&lt;p&gt;Some common methods are:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET     → Get data
POST    → Create data
PUT     → Replace data
PATCH   → Update data
DELETE  → Delete data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /api/users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;blockquote&gt;
&lt;p&gt;"Give me the users."&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. The Backend Receives It
&lt;/h2&gt;

&lt;p&gt;Now imagine our backend is built using FastAPI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;fastapi&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;FastAPI&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;FastAPI&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/api/users&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_users&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Agrima&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Rahul&lt;/span&gt;&lt;span class="sh"&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;This line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nd"&gt;@app.get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/api/users&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is basically telling the backend:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Whenever someone sends a GET request to &lt;code&gt;/api/users&lt;/code&gt;, run this function."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So our request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /api/users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;finds this function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="nf"&gt;get_users&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. What About the Database?
&lt;/h2&gt;

&lt;p&gt;In a real application, we're obviously not going to hardcode users.&lt;/p&gt;

&lt;p&gt;The backend would probably query a database.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&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;The database might return:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1 | Agrima
2 | Rahul
3 | Priya
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The backend then converts this into a response, usually JSON:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&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;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Agrima"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rahul"&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="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now our flow becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Frontend
   ↓
API Request
   ↓
Backend
   ↓
Database
   ↓
Backend
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. The Response Comes Back
&lt;/h2&gt;

&lt;p&gt;The backend sends an HTTP response.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;200 OK
Content-Type: application/json
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&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;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Agrima"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rahul"&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="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this is where our frontend gets the data.&lt;/p&gt;

&lt;p&gt;Remember this?&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/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;Now we do:&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And &lt;code&gt;data&lt;/code&gt; becomes:&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="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Agrima&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Rahul&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can finally use it in our UI.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. What Does &lt;code&gt;await&lt;/code&gt; Actually Do?
&lt;/h2&gt;

&lt;p&gt;This was another thing that confused me when I started.&lt;/p&gt;

&lt;p&gt;An API request takes time.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;50ms
200ms
1 second
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JavaScript can't just assume the response will instantly arrive.&lt;/p&gt;

&lt;p&gt;That's why we use:&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="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're basically saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Send the request and wait for the response before continuing this function."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's why API calls are commonly written with:&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="k"&gt;async&lt;/span&gt;&lt;span class="sr"&gt;/awai&lt;/span&gt;&lt;span class="err"&gt;t
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  7. What If the API Fails?
&lt;/h2&gt;

&lt;p&gt;Things go wrong. A lot.&lt;/p&gt;

&lt;p&gt;Maybe the server is down.&lt;/p&gt;

&lt;p&gt;Maybe the URL is wrong.&lt;/p&gt;

&lt;p&gt;Maybe the user isn't authenticated.&lt;/p&gt;

&lt;p&gt;Maybe the backend crashes.&lt;/p&gt;

&lt;p&gt;So don't write API calls assuming everything will always work.&lt;/p&gt;

&lt;p&gt;A basic pattern is:&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;try&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/users&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s2"&gt;`Request failed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
            &lt;span class="p"&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;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
            &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Something went wrong:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="nx"&gt;error&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;Some status codes you'll see often:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 → Success
201 → Created
400 → Bad Request
401 → Unauthorized
403 → Forbidden
404 → Not Found
500 → Server Error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  The Complete Flow
&lt;/h1&gt;

&lt;p&gt;So that tiny line:&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/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;actually triggers a much bigger process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        USER
          │
          ↓
    Clicks Button
          │
          ↓
     JavaScript
          │
          ↓
     fetch()
          │
          ↓
    HTTP Request
          │
          ↓
      Backend
          │
          ↓
      Database
          │
          ↓
      Backend
          │
          ↓
    HTTP Response
          │
          ↓
     JavaScript
          │
          ↓
       UI Update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's basically the &lt;strong&gt;request-response cycle&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  One More Real-World Example
&lt;/h1&gt;

&lt;p&gt;Think about an AI notes app.&lt;/p&gt;

&lt;p&gt;You type:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Summarize these notes"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and click &lt;strong&gt;Summarize&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Behind the scenes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You click "Summarize"
        ↓
Next.js frontend
        ↓
POST /api/summarize
        ↓
Backend
        ↓
AI API
        ↓
AI generates summary
        ↓
Backend sends response
        ↓
Frontend receives it
        ↓
Summary appears on screen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You only see a button and a result.&lt;/p&gt;

&lt;p&gt;But underneath, multiple systems are talking to each other.&lt;/p&gt;

&lt;p&gt;That's the part I find most interesting about APIs.&lt;/p&gt;




&lt;h1&gt;
  
  
  Final Takeaway
&lt;/h1&gt;

&lt;p&gt;An API call isn't just:&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/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;It's a conversation between different parts of an application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client → Request → Server → Process → Response → Client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once you understand this flow, things like &lt;strong&gt;REST APIs, Axios, FastAPI, Express, authentication, CORS, and even AI APIs&lt;/strong&gt; start making a lot more sense.&lt;/p&gt;

&lt;p&gt;So next time you write:&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="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you'll know what's actually happening behind that one line. 🚀&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;If you're learning APIs right now, try this:&lt;/strong&gt; build a tiny frontend + backend with just three endpoints:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET    /users
POST   /users
DELETE /users/:id
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll learn more by building those three endpoints than by reading ten API tutorials.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>beginners</category>
    </item>
    <item>
      <title>An LLM Is Not Your Backend — Here's What I Learned</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Wed, 16 Sep 2026 04:53:23 +0000</pubDate>
      <link>https://dev.to/agrima-06/an-llm-is-not-your-backend-heres-what-i-learned-3p0f</link>
      <guid>https://dev.to/agrima-06/an-llm-is-not-your-backend-heres-what-i-learned-3p0f</guid>
      <description>&lt;p&gt;When I first started working with AI, I used to think of an LLM as something like a super-smart backend. You give it some input, it understands it, processes it, and gives you an answer. So naturally, I started thinking, "Why do I need so much backend logic? Can't I just tell the LLM what my application does and let it handle everything?"&lt;/p&gt;

&lt;p&gt;Turns out, no.&lt;br&gt;
And understanding why completely changed the way I think about building AI applications.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, What Even Is an LLM?&lt;/strong&gt;&lt;br&gt;
LLM stands for Large Language Model. In simple terms, an LLM is a system trained on huge amounts of text that learns patterns in language and uses those patterns to generate text.&lt;/p&gt;

&lt;p&gt;Imagine you've spent your entire life reading books, articles, conversations, documentation, stories, emails, questions, answers, and code. After seeing enough examples, you become really good at understanding how language works and predicting what kind of sentence would make sense next. If someone says, "The sun rises in the..." your brain immediately expects the word "east." If someone says, "Can you pass me the..." you might expect "salt" or "water."&lt;/p&gt;

&lt;p&gt;An LLM does something conceptually similar, except it does this using mathematical representations and neural networks at a massive scale.This is also why LLMs can do so many different things. They can explain concepts, write code, summarize documents, translate languages, generate stories, analyze text, and have conversations. It can feel like you're talking to something that understands everything. But underneath all of that, the model is still working with patterns it learned during training and generating tokens based on those patterns.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is an LLM Just Autocomplete?&lt;/strong&gt;&lt;br&gt;
In a way, yes. But modern LLMs are obviously much more complicated than the autocomplete on your phone.Your keyboard might see "I'll see you" and predict that "tomorrow" could come next. That's a very simple example of predicting what comes next.&lt;/p&gt;

&lt;p&gt;An LLM takes this basic idea to a completely different scale. Instead of looking at just a few words, it can process much larger contexts and has learned incredibly complicated patterns across language and code.That's why you can give it a paragraph of context and ask it to summarize it, give it a programming problem and ask for an implementation, or give it a messy explanation and ask it to turn that into structured information.&lt;/p&gt;

&lt;p&gt;The important thing to understand is that the model doesn't work exactly like a human brain. It processes language mathematically and predicts what should come next based on the context it has received.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does an LLM Learn?&lt;/strong&gt;&lt;br&gt;
This is probably the most important part to understand.&lt;/p&gt;

&lt;p&gt;Imagine teaching a child a language. You don't simply give them a dictionary and ask them to memorize every word. They hear people speaking, read things, see patterns, make mistakes, receive feedback, and gradually become better at understanding and producing language.Training an LLM is obviously much more complicated than this, but the basic intuition is somewhat similar.&lt;/p&gt;

&lt;p&gt;The model is exposed to enormous amounts of training data. It processes pieces of text and repeatedly tries to predict what comes next. When its prediction is different from the actual data, the model's parameters are adjusted. This process happens again and again across huge amounts of data.&lt;/p&gt;

&lt;p&gt;Over time, the model becomes extremely good at recognizing patterns in language.&lt;/p&gt;

&lt;p&gt;This doesn't mean it stores every sentence it has seen like a giant database. Instead, the training process changes the model's internal parameters so that it becomes better at representing and generating language.&lt;/p&gt;

&lt;p&gt;Here's a Simple Example,&lt;br&gt;
Imagine I say, "I went to the restaurant and ordered..." Your brain might expect words like "food", "pizza", "dinner", or "burger."&lt;/p&gt;

&lt;p&gt;An LLM does something conceptually similar, but mathematically. It calculates probabilities for possible next tokens based on the context. For example, the probabilities might conceptually look something like 32% for "pizza", 21% for "food", 15% for "dinner", and so on. These numbers are only an illustration, not actual probabilities from a specific model. The important idea is that the model is constantly predicting what should come next based on the context it has.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Then Why Does It Feel Like It's Thinking?&lt;/strong&gt;&lt;br&gt;
This is where things get really interesting.&lt;/p&gt;

&lt;p&gt;If I ask an LLM, "Explain recursion like I'm five," I get a completely different kind of response than if I ask, "Write a Java solution for this problem."&lt;/p&gt;

&lt;p&gt;If I ask it to rewrite an email professionally, it changes its tone. If I give it a long document, it can summarize the important parts. If I give it a programming problem, it can reason through possible approaches.&lt;/p&gt;

&lt;p&gt;It can feel like there is an actual person sitting behind the screen thinking through my question. Modern models can perform surprisingly sophisticated reasoning and problem-solving tasks. But we shouldn't confuse that capability with an LLM being a complete software system.&lt;/p&gt;

&lt;p&gt;The model generates an output.&lt;br&gt;
Your application still needs to decide what happens after that output.&lt;/p&gt;

&lt;p&gt;And that's where the title of this article comes in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An LLM Is Not Your Backend&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's imagine you're building an online food delivery application with an AI assistant.&lt;/p&gt;

&lt;p&gt;A user says, "Order me a pizza."&lt;/p&gt;

&lt;p&gt;You send that message to an LLM, and the LLM replies, "Sure! Your pizza has been ordered."&lt;/p&gt;

&lt;p&gt;Sounds great.&lt;br&gt;
But wait.&lt;br&gt;
Did it actually order anything?&lt;/p&gt;

&lt;p&gt;No.&lt;br&gt;
The LLM generated a sentence. That's it.&lt;/p&gt;

&lt;p&gt;It didn't check which restaurants are open. It didn't check whether the pizza is available. It didn't verify your address. It didn't process your payment. It didn't create an order in the database. It didn't send the order to the restaurant.&lt;/p&gt;

&lt;p&gt;Those are &lt;em&gt;backend responsibilities.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This distinction became very clear to me when I started thinking about AI applications as actual software products instead of just chatbots.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LLM vs Backend&lt;/strong&gt;&lt;br&gt;
The LLM is great at understanding natural language, extracting intent, generating responses, summarizing information, working with context, and deciding which tool might be useful.&lt;/p&gt;

&lt;p&gt;The backend is responsible for things like authentication, authorization, database operations, business rules, transactions, validation, payments, APIs, security, and other deterministic operations.&lt;/p&gt;

&lt;p&gt;These aren't competing responsibilities.&lt;br&gt;
They're different responsibilities.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The LLM provides flexibility and intelligence around human language, while the backend provides control and reliability.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>ai</category>
      <category>backend</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>I Built an AI Voice Sales Agent — Here’s the Architecture Behind It</title>
      <dc:creator>Agrima Gupta</dc:creator>
      <pubDate>Tue, 15 Sep 2026 08:55:51 +0000</pubDate>
      <link>https://dev.to/agrima-06/i-built-an-ai-voice-sales-agent-heres-the-architecture-behind-it-g4g</link>
      <guid>https://dev.to/agrima-06/i-built-an-ai-voice-sales-agent-heres-the-architecture-behind-it-g4g</guid>
      <description>&lt;p&gt;I Built an AI Voice Sales Agent — Here’s the Architecture Behind It&lt;/p&gt;

&lt;p&gt;What if a dealer could simply call a number, tell an AI what they need, and place an order through a normal conversation?&lt;/p&gt;

&lt;p&gt;No app.&lt;br&gt;
No searching through products.&lt;br&gt;
No filling out forms.&lt;/p&gt;

&lt;p&gt;Just talk.&lt;/p&gt;

&lt;p&gt;That was the idea behind a project I've been working on: an AI Voice Sales Agent for dealers.&lt;/p&gt;

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

&lt;p&gt;"I need 50 boxes of Product X and 20 of Product Y."&lt;/p&gt;

&lt;p&gt;The AI should understand the request, check whether the products are available, figure out the dealer's pricing, apply any applicable schemes, confirm the order, and eventually push it into the company's ERP.&lt;/p&gt;

&lt;p&gt;This isn't a finished enterprise product yet. I'm still building and figuring things out, but I wanted to document how I'm approaching the architecture and some of the decisions I've made along the way.&lt;/p&gt;




&lt;p&gt;The Architecture&lt;/p&gt;

&lt;p&gt;The basic flow looks something like this:&lt;/p&gt;

&lt;p&gt;Dealer&lt;br&gt;
   ↓&lt;br&gt;
Phone Call&lt;br&gt;
   ↓&lt;br&gt;
Twilio&lt;br&gt;
   ↓&lt;br&gt;
OpenAI Realtime API&lt;br&gt;
   ↓&lt;br&gt;
LangGraph&lt;br&gt;
   ↓&lt;br&gt;
Business Tools&lt;br&gt;
   ↓&lt;br&gt;
FastAPI Backend&lt;br&gt;
   ↓&lt;br&gt;
PostgreSQL / Redis&lt;br&gt;
   ↓&lt;br&gt;
ERP&lt;/p&gt;

&lt;p&gt;The interesting part isn't just getting an LLM to talk.&lt;/p&gt;

&lt;p&gt;The AI actually needs to do things.&lt;/p&gt;

&lt;p&gt;It should be able to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Understand what the dealer wants&lt;/li&gt;
&lt;li&gt;Search for products&lt;/li&gt;
&lt;li&gt;Check inventory&lt;/li&gt;
&lt;li&gt;Get dealer-specific pricing&lt;/li&gt;
&lt;li&gt;Check applicable schemes&lt;/li&gt;
&lt;li&gt;Remember useful customer context&lt;/li&gt;
&lt;li&gt;Create draft orders&lt;/li&gt;
&lt;li&gt;Eventually sync with an ERP&lt;/li&gt;
&lt;li&gt;Handle failures without making things up&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's break down how I'm thinking about each part.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The Voice Layer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first challenge is simple:&lt;/p&gt;

&lt;p&gt;How does the dealer actually talk to the system?&lt;/p&gt;

&lt;p&gt;I'm using Twilio as the telephony layer.&lt;/p&gt;

&lt;p&gt;The basic flow is:&lt;/p&gt;

&lt;p&gt;Dealer calls&lt;br&gt;
    ↓&lt;br&gt;
Twilio receives the call&lt;br&gt;
    ↓&lt;br&gt;
Audio goes to the AI system&lt;br&gt;
    ↓&lt;br&gt;
AI processes the conversation&lt;br&gt;
    ↓&lt;br&gt;
Response is generated&lt;br&gt;
    ↓&lt;br&gt;
Dealer hears the response&lt;/p&gt;

&lt;p&gt;Initially, I thought of voice as simply:&lt;/p&gt;

&lt;p&gt;Speech → Text → LLM → Text → Speech&lt;/p&gt;

&lt;p&gt;But once you start thinking about an actual conversation, latency becomes a huge deal.&lt;/p&gt;

&lt;p&gt;Imagine saying something to an AI and waiting 4–5 seconds for every response.&lt;/p&gt;

&lt;p&gt;Technically, it works.&lt;/p&gt;

&lt;p&gt;As a conversation?&lt;/p&gt;

&lt;p&gt;Not great.&lt;/p&gt;

&lt;p&gt;That's why I'm looking at real-time voice capabilities rather than treating the system like a normal chatbot with a microphone attached to it.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;The AI Layer&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the conversational intelligence, I'm using the OpenAI Realtime API.&lt;/p&gt;

&lt;p&gt;But here's something I realized pretty quickly:&lt;/p&gt;

&lt;p&gt;The LLM shouldn't be responsible for everything.&lt;/p&gt;

&lt;p&gt;For example, if a dealer says:&lt;/p&gt;

&lt;p&gt;"Give me 50 of the blue ones."&lt;/p&gt;

&lt;p&gt;The AI needs to understand what "blue ones" refers to.&lt;/p&gt;

&lt;p&gt;That requires conversation context.&lt;/p&gt;

&lt;p&gt;The system might have something like:&lt;/p&gt;

&lt;p&gt;Dealer:&lt;br&gt;
ABC Distributors&lt;/p&gt;

&lt;p&gt;Current conversation:&lt;br&gt;
Product: Product X&lt;br&gt;
Variant: Blue&lt;br&gt;
Requested quantity: 50&lt;/p&gt;

&lt;p&gt;Dealer preferences:&lt;br&gt;
Preferred warehouse: Pune&lt;br&gt;
Preferred language: English&lt;/p&gt;

&lt;p&gt;So the AI understands the conversation instead of treating every sentence as an isolated question.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;LangGraph — Making the AI Actually Do Things&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is probably one of the parts I'm most interested in.&lt;/p&gt;

&lt;p&gt;I don't want the LLM to directly interact with my database and randomly decide what to do.&lt;/p&gt;

&lt;p&gt;Instead, I'm giving the agent specific tools.&lt;/p&gt;

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

&lt;p&gt;search_product()&lt;br&gt;
check_inventory()&lt;br&gt;
get_dealer_price()&lt;br&gt;
get_scheme()&lt;br&gt;
get_customer_history()&lt;br&gt;
create_draft_order()&lt;/p&gt;

&lt;p&gt;So a conversation could look something like:&lt;/p&gt;

&lt;p&gt;Dealer:&lt;br&gt;
"I need 50 units of Product X."&lt;/p&gt;

&lt;p&gt;AI:&lt;br&gt;
"Let me check the availability."&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;check_inventory("Product X")&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;Inventory:&lt;br&gt;
72 units available&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;AI:&lt;br&gt;
"We have 72 units available. Would you like me to create the order for 50?"&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;Dealer:&lt;br&gt;
"Yes."&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;create_draft_order(...)&lt;/p&gt;

&lt;p&gt;This is where LangGraph becomes useful.&lt;/p&gt;

&lt;p&gt;Instead of having one massive prompt trying to handle the entire business workflow, the agent can move through different states and use specific tools.&lt;/p&gt;

&lt;p&gt;Conceptually:&lt;/p&gt;

&lt;p&gt;START&lt;br&gt;
  ↓&lt;br&gt;
Understand Request&lt;br&gt;
  ↓&lt;br&gt;
Identify Product&lt;br&gt;
  ↓&lt;br&gt;
Check Inventory&lt;br&gt;
  ↓&lt;br&gt;
Check Dealer Pricing&lt;br&gt;
  ↓&lt;br&gt;
Apply Scheme&lt;br&gt;
  ↓&lt;br&gt;
Confirm Order&lt;br&gt;
  ↓&lt;br&gt;
Create Draft Order&lt;br&gt;
  ↓&lt;br&gt;
END&lt;/p&gt;

&lt;p&gt;This also makes debugging much easier.&lt;/p&gt;

&lt;p&gt;If something goes wrong, I can ask:&lt;/p&gt;

&lt;p&gt;Which step failed?&lt;/p&gt;

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

&lt;p&gt;Why did the AI randomly do that?&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;PostgreSQL — Where the Real Data Lives&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One thing I definitely don't want is for the AI to become the source of truth.&lt;/p&gt;

&lt;p&gt;The LLM can understand things.&lt;/p&gt;

&lt;p&gt;It can reason.&lt;/p&gt;

&lt;p&gt;It can communicate.&lt;/p&gt;

&lt;p&gt;But it shouldn't be the database.&lt;/p&gt;

&lt;p&gt;The system needs structured data for things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dealers&lt;/li&gt;
&lt;li&gt;Dealer contacts&lt;/li&gt;
&lt;li&gt;Dealer addresses&lt;/li&gt;
&lt;li&gt;Products&lt;/li&gt;
&lt;li&gt;Product variants&lt;/li&gt;
&lt;li&gt;SKUs&lt;/li&gt;
&lt;li&gt;Inventory&lt;/li&gt;
&lt;li&gt;Orders&lt;/li&gt;
&lt;li&gt;Pricing&lt;/li&gt;
&lt;li&gt;Schemes&lt;/li&gt;
&lt;li&gt;Customer preferences&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Dealer&lt;br&gt;
 ├── Contacts&lt;br&gt;
 ├── Addresses&lt;br&gt;
 ├── Credit Limit&lt;br&gt;
 ├── Language Preference&lt;br&gt;
 └── Preferred Warehouse&lt;/p&gt;

&lt;p&gt;Product&lt;br&gt;
 ├── Product Variant&lt;br&gt;
 ├── SKU&lt;br&gt;
 ├── Pricing&lt;br&gt;
 └── Inventory&lt;/p&gt;

&lt;p&gt;I'm using PostgreSQL for this persistent data.&lt;/p&gt;

&lt;p&gt;I'm also using UUIDs for primary keys and keeping things like timestamps, foreign keys, indexes, and soft-delete support in the domain design.&lt;/p&gt;

&lt;p&gt;I'm still refining the schema, but getting this foundation right is important because adding AI on top of a messy data model isn't going to magically fix it.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Redis — The Fast Stuff&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Not everything needs to be stored permanently in PostgreSQL.&lt;/p&gt;

&lt;p&gt;A voice conversation can have a lot of temporary state.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;Current session&lt;/li&gt;
&lt;li&gt;Conversation state&lt;/li&gt;
&lt;li&gt;Temporary context&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Rate limits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's where Redis comes in.&lt;/p&gt;

&lt;p&gt;The mental model I'm using is basically:&lt;/p&gt;

&lt;p&gt;PostgreSQL&lt;br&gt;
= Persistent business data&lt;/p&gt;

&lt;p&gt;Redis&lt;br&gt;
= Fast temporary state + caching&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Inventory Is Where Things Get Real&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Let's say a dealer says:&lt;/p&gt;

&lt;p&gt;"I need 100 units."&lt;/p&gt;

&lt;p&gt;The AI can't just say:&lt;/p&gt;

&lt;p&gt;"Sure, I've placed the order."&lt;/p&gt;

&lt;p&gt;It needs to check what's actually available.&lt;/p&gt;

&lt;p&gt;Something like:&lt;/p&gt;

&lt;p&gt;Dealer Request&lt;br&gt;
      ↓&lt;br&gt;
Identify SKU&lt;br&gt;
      ↓&lt;br&gt;
Inventory Service&lt;br&gt;
      ↓&lt;br&gt;
Available Quantity&lt;br&gt;
      ↓&lt;br&gt;
AI Response&lt;/p&gt;

&lt;p&gt;If the system only has 60 units, the AI should say:&lt;/p&gt;

&lt;p&gt;"We currently have 60 units available. Would you like me to create the order for 60?"&lt;/p&gt;

&lt;p&gt;This is a principle I'm trying to stick to throughout the project:&lt;/p&gt;

&lt;p&gt;The AI should reason about business data, not invent business data.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Dealer-Specific Pricing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is another place where a normal chatbot approach isn't enough.&lt;/p&gt;

&lt;p&gt;In B2B, everyone doesn't necessarily get the same price.&lt;/p&gt;

&lt;p&gt;Different dealers might have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different price lists&lt;/li&gt;
&lt;li&gt;Different discounts&lt;/li&gt;
&lt;li&gt;Different schemes&lt;/li&gt;
&lt;li&gt;Different credit limits&lt;/li&gt;
&lt;li&gt;Different warehouses&lt;/li&gt;
&lt;li&gt;Different purchasing histories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the flow could look like:&lt;/p&gt;

&lt;p&gt;Base Product Price&lt;br&gt;
        ↓&lt;br&gt;
Dealer-specific Price&lt;br&gt;
        ↓&lt;br&gt;
Applicable Scheme&lt;br&gt;
        ↓&lt;br&gt;
Discount&lt;br&gt;
        ↓&lt;br&gt;
Final Price&lt;/p&gt;

&lt;p&gt;But here's an important architectural decision:&lt;/p&gt;

&lt;p&gt;The LLM shouldn't calculate the final business-critical price itself.&lt;/p&gt;

&lt;p&gt;The backend should do that.&lt;/p&gt;

&lt;p&gt;The AI can explain the result to the dealer.&lt;/p&gt;

&lt;p&gt;The actual calculation should come from deterministic business logic.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Customer Memory&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is probably one of the coolest parts of the idea.&lt;/p&gt;

&lt;p&gt;A useful sales agent shouldn't feel like it has amnesia after every phone call.&lt;/p&gt;

&lt;p&gt;Suppose a dealer usually orders a particular product or prefers a particular warehouse.&lt;/p&gt;

&lt;p&gt;The system could remember useful information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preferred warehouse&lt;/li&gt;
&lt;li&gt;Preferred products&lt;/li&gt;
&lt;li&gt;Typical order quantity&lt;/li&gt;
&lt;li&gt;Preferred language&lt;/li&gt;
&lt;li&gt;Previous orders&lt;/li&gt;
&lt;li&gt;Communication preferences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then a future conversation could be much smoother.&lt;/p&gt;

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

&lt;p&gt;"Which warehouse do you want?"&lt;/p&gt;

&lt;p&gt;every single time, the system could already know the dealer's preferred warehouse and simply confirm it when needed.&lt;/p&gt;

&lt;p&gt;But there's an important distinction here.&lt;/p&gt;

&lt;p&gt;Not everything the dealer says should automatically become permanent memory.&lt;/p&gt;

&lt;p&gt;Memory needs rules.&lt;/p&gt;

&lt;p&gt;Some information is temporary conversation context.&lt;/p&gt;

&lt;p&gt;Some information is actual customer data.&lt;/p&gt;

&lt;p&gt;And some information probably shouldn't be stored at all.&lt;/p&gt;

&lt;p&gt;That's something I want to handle carefully as the project develops.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;ERP Integration&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Eventually, the AI needs to connect with the systems that the business already uses.&lt;/p&gt;

&lt;p&gt;That's where ERP integration comes in.&lt;/p&gt;

&lt;p&gt;The architecture I'm aiming for is:&lt;/p&gt;

&lt;p&gt;AI Agent&lt;br&gt;
    ↓&lt;br&gt;
Backend&lt;br&gt;
    ↓&lt;br&gt;
Business Logic&lt;br&gt;
    ↓&lt;br&gt;
ERP APIs&lt;br&gt;
    ↓&lt;br&gt;
Orders / Inventory / Customers&lt;/p&gt;

&lt;p&gt;I don't want the AI agent directly modifying ERP data.&lt;/p&gt;

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

&lt;p&gt;AI&lt;br&gt;
 ↓&lt;br&gt;
Tool&lt;br&gt;
 ↓&lt;br&gt;
Backend Validation&lt;br&gt;
 ↓&lt;br&gt;
ERP&lt;/p&gt;

&lt;p&gt;That gives us a much safer boundary between the unpredictable nature of AI and the deterministic nature of enterprise systems.&lt;/p&gt;




&lt;ol&gt;
&lt;li&gt;Why I'm NOT Giving the LLM Direct Database Access&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is probably one of the biggest things I've learned while designing this.&lt;/p&gt;

&lt;p&gt;It can be tempting to just give an LLM database access and say:&lt;/p&gt;

&lt;p&gt;"Do whatever you need."&lt;/p&gt;

&lt;p&gt;But for a system dealing with real orders, pricing and customer information, that's a very bad idea.&lt;/p&gt;

&lt;p&gt;I'd rather have:&lt;/p&gt;

&lt;p&gt;❌ LLM → Database&lt;/p&gt;

&lt;p&gt;✅ LLM → Tool → Backend → Database&lt;/p&gt;

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

&lt;p&gt;LLM&lt;br&gt;
 ↓&lt;br&gt;
get_inventory("SKU123")&lt;br&gt;
 ↓&lt;br&gt;
Backend validates request&lt;br&gt;
 ↓&lt;br&gt;
Database query&lt;br&gt;
 ↓&lt;br&gt;
Structured result&lt;br&gt;
 ↓&lt;br&gt;
LLM&lt;/p&gt;

&lt;p&gt;Now I have a proper place for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Authorization&lt;/li&gt;
&lt;li&gt;Validation&lt;/li&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Auditing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And most importantly, I know exactly what the AI is allowed to do.&lt;/p&gt;




&lt;p&gt;The Tech Stack&lt;/p&gt;

&lt;p&gt;Frontend: Next.js&lt;/p&gt;

&lt;p&gt;Styling: Tailwind CSS + shadcn/ui&lt;/p&gt;

&lt;p&gt;Backend: FastAPI&lt;/p&gt;

&lt;p&gt;Database: PostgreSQL&lt;/p&gt;

&lt;p&gt;Cache / State: Redis&lt;/p&gt;

&lt;p&gt;ORM: SQLAlchemy&lt;/p&gt;

&lt;p&gt;Migrations: Alembic&lt;/p&gt;

&lt;p&gt;Voice: Twilio&lt;/p&gt;

&lt;p&gt;Real-time AI: OpenAI Realtime API&lt;/p&gt;

&lt;p&gt;Agent Orchestration: LangGraph&lt;/p&gt;

&lt;p&gt;Vector Search: pgvector&lt;/p&gt;

&lt;p&gt;Version Control: Git + GitHub&lt;/p&gt;

&lt;p&gt;Monitoring: Sentry + OpenTelemetry&lt;/p&gt;

&lt;p&gt;I'm trying to avoid choosing technologies just because they're popular.&lt;/p&gt;

&lt;p&gt;I want every piece of the stack to have a reason for being there.&lt;/p&gt;




&lt;p&gt;What I'm Still Figuring Out&lt;/p&gt;

&lt;p&gt;The project is still a work in progress, so there are a lot of things I'm actively figuring out.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Voice latency&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A voice agent has to feel like a conversation.&lt;/p&gt;

&lt;p&gt;Even a technically correct answer feels bad if it takes too long.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hallucinations&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The agent absolutely cannot randomly invent:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Product availability&lt;/li&gt;
&lt;li&gt;Prices&lt;/li&gt;
&lt;li&gt;Discounts&lt;/li&gt;
&lt;li&gt;Order status&lt;/li&gt;
&lt;li&gt;Credit information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those things need to come from actual systems.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Conversation recovery&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What happens when the dealer says:&lt;/p&gt;

&lt;p&gt;"No, not that one. The other blue one."&lt;/p&gt;

&lt;p&gt;The agent needs enough context to understand what they're referring to.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Tool failures&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What if the inventory service is down?&lt;/p&gt;

&lt;p&gt;The AI shouldn't pretend that everything worked.&lt;/p&gt;

&lt;p&gt;It needs to understand that the tool failed and communicate that properly.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Security&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once you're dealing with actual business transactions, security becomes a major part of the architecture.&lt;/p&gt;

&lt;p&gt;Things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Authorization&lt;/li&gt;
&lt;li&gt;PII protection&lt;/li&gt;
&lt;li&gt;Call verification&lt;/li&gt;
&lt;li&gt;Audit logs&lt;/li&gt;
&lt;li&gt;Tool permissions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;can't just be an afterthought.&lt;/p&gt;




&lt;p&gt;The Biggest Thing I've Learned&lt;/p&gt;

&lt;p&gt;The biggest lesson from this project so far is:&lt;/p&gt;

&lt;p&gt;Building an AI application isn't the same as putting an LLM inside an application.&lt;/p&gt;

&lt;p&gt;The LLM is only one part of the system.&lt;/p&gt;

&lt;p&gt;A useful AI product needs:&lt;/p&gt;

&lt;p&gt;AI&lt;br&gt;
+&lt;br&gt;
Business Logic&lt;br&gt;
+&lt;br&gt;
Data&lt;br&gt;
+&lt;br&gt;
Tools&lt;br&gt;
+&lt;br&gt;
State&lt;br&gt;
+&lt;br&gt;
Security&lt;br&gt;
+&lt;br&gt;
Observability&lt;br&gt;
+&lt;br&gt;
Reliable Infrastructure&lt;/p&gt;

&lt;p&gt;The model provides the intelligence.&lt;/p&gt;

&lt;p&gt;But the architecture around it provides the reliability.&lt;/p&gt;

&lt;p&gt;And I think that's an important distinction, especially when moving from AI demos to actual products.&lt;/p&gt;




&lt;p&gt;What's Next?&lt;/p&gt;

&lt;p&gt;Right now, I'm focusing on building the foundation properly before trying to make everything "smart."&lt;/p&gt;

&lt;p&gt;The next things on my list are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Building the core backend APIs&lt;/li&gt;
&lt;li&gt;Implementing the voice pipeline&lt;/li&gt;
&lt;li&gt;Connecting the agent to business tools&lt;/li&gt;
&lt;li&gt;Building the order workflow&lt;/li&gt;
&lt;li&gt;Adding customer memory&lt;/li&gt;
&lt;li&gt;Connecting inventory&lt;/li&gt;
&lt;li&gt;Designing ERP synchronization&lt;/li&gt;
&lt;li&gt;Adding observability&lt;/li&gt;
&lt;li&gt;Testing real-world conversations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The end goal is pretty simple:&lt;/p&gt;

&lt;p&gt;A dealer should be able to pick up a phone and complete a business transaction through a natural conversation.&lt;/p&gt;

&lt;p&gt;Something like:&lt;/p&gt;

&lt;p&gt;Call&lt;br&gt;
 ↓&lt;br&gt;
Talk&lt;br&gt;
 ↓&lt;br&gt;
Confirm&lt;br&gt;
 ↓&lt;br&gt;
Order&lt;/p&gt;

&lt;p&gt;That's the experience I'm trying to build.&lt;/p&gt;




&lt;p&gt;Final Thoughts&lt;/p&gt;

&lt;p&gt;This project has also changed the way I think about software engineering.&lt;/p&gt;

&lt;p&gt;Earlier, I mostly thought about applications as:&lt;/p&gt;

&lt;p&gt;Frontend&lt;br&gt;
+&lt;br&gt;
Backend&lt;br&gt;
+&lt;br&gt;
Database&lt;/p&gt;

&lt;p&gt;Now I'm asking a lot more questions:&lt;/p&gt;

&lt;p&gt;What should the AI be allowed to decide?&lt;/p&gt;

&lt;p&gt;What should the backend decide?&lt;/p&gt;

&lt;p&gt;Where does the actual source of truth live?&lt;/p&gt;

&lt;p&gt;What happens when the AI is wrong?&lt;/p&gt;

&lt;p&gt;What happens when a tool fails?&lt;/p&gt;

&lt;p&gt;How do we recover from a misunderstood request?&lt;/p&gt;

&lt;p&gt;How do we make the whole thing observable?&lt;/p&gt;

&lt;p&gt;And honestly, I'm still figuring out many of these answers.&lt;/p&gt;

&lt;p&gt;That's probably my favorite part of building this.&lt;/p&gt;

&lt;p&gt;I'm not trying to pretend I have the perfect architecture figured out.&lt;/p&gt;

&lt;p&gt;I'm building it, breaking things, learning, and improving it as I go.&lt;/p&gt;

&lt;p&gt;Build → Break → Learn → Improve.&lt;/p&gt;

&lt;p&gt;If you're also building AI agents, voice applications, or AI-powered SaaS products, I'd love to hear what you're working on and what problems you've run into.&lt;/p&gt;

&lt;p&gt;Let's learn from each other. 🚀&lt;/p&gt;

</description>
      <category>ai</category>
      <category>voiceai</category>
      <category>systemdesign</category>
      <category>softwaredevelopment</category>
    </item>
  </channel>
</rss>
