<?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: Jotty John</title>
    <description>The latest articles on DEV Community by Jotty John (@jottyjohn).</description>
    <link>https://dev.to/jottyjohn</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1602032%2Fe2011afd-4ce6-44f2-ae9b-52b13c3b8218.jpg</url>
      <title>DEV Community: Jotty John</title>
      <link>https://dev.to/jottyjohn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jottyjohn"/>
    <language>en</language>
    <item>
      <title>RAG Architecture</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Thu, 26 Mar 2026 11:38:22 +0000</pubDate>
      <link>https://dev.to/jottyjohn/rag-architecture-ioc</link>
      <guid>https://dev.to/jottyjohn/rag-architecture-ioc</guid>
      <description>&lt;p&gt;RAG stands for Retrieval-Augmented Generation — a technique used in AI to give more accurate and up-to-date answers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instead of the AI only using what it already “knows”&lt;/li&gt;
&lt;li&gt;It first searches for relevant information&lt;/li&gt;
&lt;li&gt;Then uses that information to generate a better answer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can build a RAG app by combining 3 core pieces:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Store knowledge&lt;/strong&gt; from your documents in a searchable form
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieve relevant chunks&lt;/strong&gt; for a user question
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ask an LLM&lt;/strong&gt; to answer using only that retrieved context&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Think of it as: &lt;strong&gt;search first, generate second&lt;/strong&gt;. The model gets smarter &lt;em&gt;for your data&lt;/em&gt; without retraining—very budget-friendly, very civilized.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a RAG app needs
&lt;/h2&gt;

&lt;p&gt;A typical RAG pipeline looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb1q427yscy0a11yhxi3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcb1q427yscy0a11yhxi3.png" alt=" " width="800" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The basic architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Data ingestion
&lt;/h3&gt;

&lt;p&gt;Load your source data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PDFs&lt;/li&gt;
&lt;li&gt;Word docs&lt;/li&gt;
&lt;li&gt;Markdown files&lt;/li&gt;
&lt;li&gt;HTML/web pages&lt;/li&gt;
&lt;li&gt;database records&lt;/li&gt;
&lt;li&gt;internal knowledge base&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2) Chunking
&lt;/h3&gt;

&lt;p&gt;Split large documents into smaller passages, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;300–800 tokens per chunk&lt;/li&gt;
&lt;li&gt;some overlap, like 50–100 tokens&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Why? Because embedding and retrieval work better on focused pieces of text.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Embeddings
&lt;/h3&gt;

&lt;p&gt;Convert each chunk into a numeric vector using an embedding model.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;OpenAI embeddings&lt;/li&gt;
&lt;li&gt;sentence-transformers&lt;/li&gt;
&lt;li&gt;Cohere embeddings&lt;/li&gt;
&lt;li&gt;Voyage AI embeddings&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4) Vector database
&lt;/h3&gt;

&lt;p&gt;Store the embeddings and original text.&lt;/p&gt;

&lt;p&gt;Popular options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chroma&lt;/strong&gt;: easiest for local prototypes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FAISS&lt;/strong&gt;: very fast local similarity search&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pinecone&lt;/strong&gt;: managed hosted service&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Weaviate&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Qdrant&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Milvus&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5) Retriever
&lt;/h3&gt;

&lt;p&gt;When the user asks a question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;embed the question&lt;/li&gt;
&lt;li&gt;search the vector DB for top-k similar chunks&lt;/li&gt;
&lt;li&gt;optionally rerank them&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6) Generation
&lt;/h3&gt;

&lt;p&gt;Send the retrieved chunks + question to the LLM with a prompt like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Answer using only the provided context. If the answer is not in the context, say you don’t know.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That reduces hallucinations a lot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Easiest stack for a first RAG app
&lt;/h2&gt;

&lt;p&gt;If you want the fastest path, I’d suggest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Python&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI&lt;/strong&gt; or &lt;strong&gt;Streamlit&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangChain&lt;/strong&gt; or &lt;strong&gt;LlamaIndex&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chroma&lt;/strong&gt; for local vector storage&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenAI&lt;/strong&gt; or another chat model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That’s a very beginner-friendly setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Minimal build plan
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option A: super simple prototype
&lt;/h3&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;Chroma&lt;/li&gt;
&lt;li&gt;OpenAI API&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;uploading docs&lt;/li&gt;
&lt;li&gt;asking questions in a browser UI&lt;/li&gt;
&lt;li&gt;learning the flow&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Option B: production-ish starter
&lt;/h3&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;FastAPI backend&lt;/li&gt;
&lt;li&gt;React/Next.js frontend&lt;/li&gt;
&lt;li&gt;Qdrant or Pinecone&lt;/li&gt;
&lt;li&gt;background ingestion jobs&lt;/li&gt;
&lt;li&gt;auth + logging + evaluation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Good for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;team/internal tool&lt;/li&gt;
&lt;li&gt;customer-facing app&lt;/li&gt;
&lt;li&gt;scaling beyond hobby level&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  A simple MVP flow
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: install packages
&lt;/h3&gt;

&lt;p&gt;For a simple Python version, you’d usually need packages like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;langchain&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chromadb&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;openai&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pypdf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tiktoken&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;streamlit&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: load documents
&lt;/h3&gt;

&lt;p&gt;Read your files from a folder like &lt;code&gt;data/&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: split into chunks
&lt;/h3&gt;

&lt;p&gt;Use a text splitter with overlap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: create embeddings
&lt;/h3&gt;

&lt;p&gt;Generate embeddings for each chunk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: store them in Chroma
&lt;/h3&gt;

&lt;p&gt;Persist the vector store locally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: build a query function
&lt;/h3&gt;

&lt;p&gt;Take a user question, retrieve top matches, and send them to the model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: add a UI
&lt;/h3&gt;

&lt;p&gt;A simple chat box is enough for v1.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tiny example in Python
&lt;/h2&gt;

&lt;p&gt;Here’s the shape of a minimal RAG script:&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;langchain_openai&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ChatOpenAI&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.vectorstores&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.text_splitter&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RecursiveCharacterTextSplitter&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain_community.document_loaders&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PyPDFLoader&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;langchain.chains&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;

&lt;span class="c1"&gt;# 1. Load document
&lt;/span&gt;&lt;span class="n"&gt;loader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PyPDFLoader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;docs/manual.pdf&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;docs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;loader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# 2. Split into chunks
&lt;/span&gt;&lt;span class="n"&gt;splitter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RecursiveCharacterTextSplitter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;chunk_size&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;chunk_overlap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;splitter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 3. Embed + store
&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;OpenAIEmbeddings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;vectorstore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Chroma&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_documents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;documents&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;embeddings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;persist_directory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;./chroma_db&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 4. Retriever
&lt;/span&gt;&lt;span class="n"&gt;retriever&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;vectorstore&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;as_retriever&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;search_kwargs&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;k&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;# 5. LLM
&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;ChatOpenAI&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="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gpt-4o-mini&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 6. QA chain
&lt;/span&gt;&lt;span class="n"&gt;qa&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;RetrievalQA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_chain_type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;retriever&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;retriever&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# 7. Ask a question
&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;How do I reset the device?&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;answer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;qa&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;query&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;answer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s the basic idea. Real apps add citations, source display, better prompts, and error handling.&lt;/p&gt;




&lt;h2&gt;
  
  
  What makes a RAG app actually good
&lt;/h2&gt;

&lt;p&gt;A lot of RAG apps work, but only a few work &lt;em&gt;well&lt;/em&gt;. The difference usually comes from these:&lt;/p&gt;

&lt;h3&gt;
  
  
  Better chunking
&lt;/h3&gt;

&lt;p&gt;Bad chunks = bad retrieval.&lt;/p&gt;

&lt;p&gt;Tips:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;keep sections semantically meaningful&lt;/li&gt;
&lt;li&gt;don’t split tables badly&lt;/li&gt;
&lt;li&gt;preserve headings/metadata&lt;/li&gt;
&lt;li&gt;include source info like filename and page number&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Metadata filtering
&lt;/h3&gt;

&lt;p&gt;Store metadata such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;file name&lt;/li&gt;
&lt;li&gt;page number&lt;/li&gt;
&lt;li&gt;department&lt;/li&gt;
&lt;li&gt;date&lt;/li&gt;
&lt;li&gt;access level&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then retrieve with filters, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;only HR docs&lt;/li&gt;
&lt;li&gt;only 2025 policies&lt;/li&gt;
&lt;li&gt;only docs user is allowed to see&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hybrid search
&lt;/h3&gt;

&lt;p&gt;Use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;vector search + keyword search&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This helps when users ask for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;exact product codes&lt;/li&gt;
&lt;li&gt;error IDs&lt;/li&gt;
&lt;li&gt;names/acronyms&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reranking
&lt;/h3&gt;

&lt;p&gt;After getting top 10 chunks, rerank them with a stronger relevance model and keep top 3–5.&lt;/p&gt;

&lt;p&gt;This often improves quality a lot.&lt;/p&gt;

&lt;h3&gt;
  
  
  Grounded prompting
&lt;/h3&gt;

&lt;p&gt;Use prompts that force the model to stay within context and cite sources.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;answer only from context&lt;/li&gt;
&lt;li&gt;quote source passages when possible&lt;/li&gt;
&lt;li&gt;say “I don’t know” if unsupported&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Citations
&lt;/h3&gt;

&lt;p&gt;Show users where the answer came from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;file name&lt;/li&gt;
&lt;li&gt;page number&lt;/li&gt;
&lt;li&gt;snippet preview&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This builds trust and makes debugging much easier.&lt;/p&gt;




&lt;h2&gt;
  
  
  Common mistakes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Chunks are too large
&lt;/h3&gt;

&lt;p&gt;If chunks are giant, retrieval gets fuzzy.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) No overlap
&lt;/h3&gt;

&lt;p&gt;Then important context gets chopped in half like an unfortunate sandwich.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Bad PDFs
&lt;/h3&gt;

&lt;p&gt;Some PDFs extract terribly. You may need OCR or better parsing.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) No evaluation
&lt;/h3&gt;

&lt;p&gt;If you don’t test retrieval quality, you won’t know whether the issue is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieval&lt;/li&gt;
&lt;li&gt;prompt&lt;/li&gt;
&lt;li&gt;model&lt;/li&gt;
&lt;li&gt;data quality&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5) Letting the model answer without guardrails
&lt;/h3&gt;

&lt;p&gt;Always tell it to use only retrieved context.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to evaluate your RAG app
&lt;/h2&gt;

&lt;p&gt;You should test 3 things separately:&lt;/p&gt;

&lt;h3&gt;
  
  
  Retrieval quality
&lt;/h3&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did the right chunks come back?&lt;/li&gt;
&lt;li&gt;Was the right answer present in retrieved docs?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Answer quality
&lt;/h3&gt;

&lt;p&gt;Ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the answer accurate?&lt;/li&gt;
&lt;li&gt;Is it complete?&lt;/li&gt;
&lt;li&gt;Does it cite sources?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Latency/cost
&lt;/h3&gt;

&lt;p&gt;Track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;embedding cost&lt;/li&gt;
&lt;li&gt;retrieval speed&lt;/li&gt;
&lt;li&gt;generation speed&lt;/li&gt;
&lt;li&gt;token usage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A very practical evaluation set is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;20–50 real user questions&lt;/li&gt;
&lt;li&gt;expected source documents&lt;/li&gt;
&lt;li&gt;expected answer points&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Good first project ideas
&lt;/h2&gt;

&lt;p&gt;Start with one of these:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;PDF question-answering app&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Company handbook assistant&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Support docs chatbot&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Course notes tutor&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Codebase documentation assistant&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a first build, I’d recommend:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;upload PDFs&lt;/li&gt;
&lt;li&gt;ask questions&lt;/li&gt;
&lt;li&gt;show citations&lt;/li&gt;
&lt;li&gt;keep everything local except the model API&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That’s enough to learn the full RAG loop.&lt;/p&gt;




&lt;h2&gt;
  
  
  If you want a production-ready design
&lt;/h2&gt;

&lt;p&gt;A more serious app usually has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ingestion service&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Embedding/index pipeline&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vector DB&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chat backend&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Frontend&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Evaluation dashboard&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;User auth&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Document permissions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Observability/logging&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common production flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;user uploads document
&lt;/li&gt;
&lt;li&gt;backend extracts text
&lt;/li&gt;
&lt;li&gt;text is chunked and embedded
&lt;/li&gt;
&lt;li&gt;vectors stored with metadata
&lt;/li&gt;
&lt;li&gt;chat query retrieves relevant chunks
&lt;/li&gt;
&lt;li&gt;model answers with citations
&lt;/li&gt;
&lt;li&gt;logs stored for debugging and eval&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Best beginner recommendation
&lt;/h2&gt;

&lt;p&gt;If you want the shortest path, do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;Streamlit&lt;/li&gt;
&lt;li&gt;LangChain&lt;/li&gt;
&lt;li&gt;Chroma&lt;/li&gt;
&lt;li&gt;OpenAI API&lt;/li&gt;
&lt;li&gt;local folder of PDFs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That lets you learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ingestion&lt;/li&gt;
&lt;li&gt;chunking&lt;/li&gt;
&lt;li&gt;embeddings&lt;/li&gt;
&lt;li&gt;retrieval&lt;/li&gt;
&lt;li&gt;prompting&lt;/li&gt;
&lt;li&gt;UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;&lt;br&gt;
RAG is an effective solution for business scenarios that involve large volumes of documentation and complex rules, where users need reliable and authoritative answers. It is particularly well-suited for enhancing LLM-based chatbots by incorporating proprietary or domain-specific knowledge, while significantly reducing the risk of hallucinations.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Happy to share in the current era of AI and Zero Carbonization</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Tue, 14 Oct 2025 08:13:48 +0000</pubDate>
      <link>https://dev.to/jottyjohn/happy-to-share-in-the-current-era-of-ai-and-zero-carbonization-218c</link>
      <guid>https://dev.to/jottyjohn/happy-to-share-in-the-current-era-of-ai-and-zero-carbonization-218c</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/jottyjohn" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1602032%2Fe2011afd-4ce6-44f2-ae9b-52b13c3b8218.jpg" alt="jottyjohn"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/jottyjohn/harnessing-ai-for-zero-carbonization-innovations-and-impacts-3aga" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Harnessing AI for Zero Carbonization: Innovations and Impacts&lt;/h2&gt;
      &lt;h3&gt;Jotty John ・ Jun 19 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#ai&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>ai</category>
    </item>
    <item>
      <title>Is my phone eavesdropping on me?</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Mon, 04 Aug 2025 08:12:33 +0000</pubDate>
      <link>https://dev.to/jottyjohn/is-my-phone-eavesdropping-on-me-3h8k</link>
      <guid>https://dev.to/jottyjohn/is-my-phone-eavesdropping-on-me-3h8k</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Is My Phone Eavesdropping on Me?&lt;/li&gt;
&lt;li&gt;How Can We Use Smartphones Wisely?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Almost every person — regardless of age, profession, or location — uses a smartphone. Concerns about privacy, data tracking, and screen addiction affect all of us. I think this is a good topic for discussion..&lt;/p&gt;

</description>
      <category>dis</category>
    </item>
    <item>
      <title>Bridging the Gender Gap in STEM — One Step at a Time</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Mon, 04 Aug 2025 08:07:33 +0000</pubDate>
      <link>https://dev.to/jottyjohn/bridging-the-gender-gap-in-stem-one-step-at-a-time-2phg</link>
      <guid>https://dev.to/jottyjohn/bridging-the-gender-gap-in-stem-one-step-at-a-time-2phg</guid>
      <description>&lt;p&gt;&lt;strong&gt;STEM&lt;/strong&gt; — science, technology, engineering, and math — is changing the world we live in. From building apps and curing diseases to solving climate issues and sending rockets into space, STEM is where the future is being shaped. But here’s the thing: women are still hugely underrepresented in these fields.&lt;/p&gt;

&lt;p&gt;So, what’s holding us back? And more importantly, what can we do about it?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Let’s Start with the Facts&lt;/strong&gt;&lt;br&gt;
Women make up less than 30% of the global STEM workforce.&lt;/p&gt;

&lt;p&gt;In areas like AI, cybersecurity, and system design, the number of women is even lower — sometimes under 15%.&lt;/p&gt;

&lt;p&gt;Many girls lose interest in STEM subjects by the time they reach high school, often because they don’t see enough role models who look like them or because they’re told — subtly or directly — that it’s “not for them.”&lt;/p&gt;

&lt;p&gt;This gender gap isn't just a diversity problem — it's a missed opportunity. When women aren’t fully part of STEM, the solutions being built don’t reflect the full range of human needs or perspectives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Is There Still a Gap?&lt;/strong&gt;&lt;br&gt;
The reasons are many — and layered:&lt;/p&gt;

&lt;p&gt;Stereotypes: From an early age, girls are often told (directly or indirectly) that STEM is “hard” or “not for girls.”&lt;/p&gt;

&lt;p&gt;Lack of role models: If you can’t see it, it’s hard to believe you can be it.&lt;/p&gt;

&lt;p&gt;Workplace culture: Many women who enter STEM fields leave mid-career because the environment isn’t always welcoming or flexible.&lt;/p&gt;

&lt;p&gt;Balancing life and work: Without supportive policies, many women struggle to juggle caregiving responsibilities with demanding STEM careers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, How Do We Bridge This Gap?&lt;/strong&gt;&lt;br&gt;
The good news? Change is happening — and we can all be part of it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start Early
We need to spark curiosity in STEM from a young age — through fun, hands-on activities, coding clubs, science experiments, and storytelling. Let girls build, break, explore, and solve.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;“I didn’t know tech was for me until someone handed me a Raspberry Pi and told me to make it talk.” — A story we hear too often, too late.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Show Real Role Models&lt;br&gt;
We need to put more women in STEM in the spotlight — on panels, in textbooks, in classrooms, on social media. Young girls (and even grown women!) need to see that being a scientist, developer, engineer, or mathematician isn’t just possible — it’s happening right now.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make Workplaces More Inclusive&lt;br&gt;
Companies and institutions must take real steps — not just posters and hashtags — to make STEM careers more inclusive. That means:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Fair hiring and promotions&lt;/p&gt;

&lt;p&gt;Equal pay&lt;/p&gt;

&lt;p&gt;Parental leave policies&lt;/p&gt;

&lt;p&gt;Mentorship programs&lt;/p&gt;

&lt;p&gt;Safe and respectful work environments&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Support Women at Every Stage&lt;br&gt;
It’s not just about getting more women into STEM — it’s about helping them stay and grow. Let’s normalize career breaks, offer returnships, and support flexible work. And most importantly, let’s listen to what women actually need in their careers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Celebrate the Stories&lt;br&gt;
Every woman in STEM has a story worth telling. Let’s celebrate the wins — big or small — and amplify these journeys. It inspires others and reminds us that we’re not alone.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Why This Matters for Everyone&lt;/strong&gt;&lt;br&gt;
Bridging the gender gap in STEM isn’t just about fairness. It’s about creating better solutions, stronger teams, and a more innovative world. We all benefit when more voices are included.&lt;/p&gt;

&lt;p&gt;Imagine a world where:&lt;/p&gt;

&lt;p&gt;AI is built with less bias&lt;/p&gt;

&lt;p&gt;Medical research includes women’s health&lt;/p&gt;

&lt;p&gt;Smart cities are designed by diverse minds&lt;/p&gt;

&lt;p&gt;Girls grow up seeing STEM as an exciting, natural path for them&lt;/p&gt;

&lt;p&gt;That’s the world we’re working toward.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Thoughts: Let’s Build the Bridge Together&lt;/strong&gt;&lt;br&gt;
There’s no quick fix to closing the gender gap in STEM, but every step counts — whether it’s encouraging a young girl to explore tech, mentoring a woman returning to work, or making room for new voices at the table.&lt;/p&gt;

&lt;p&gt;We don’t have to wait for the world to change — we can start building it ourselves.&lt;/p&gt;

&lt;p&gt;If you're a woman in STEM, keep going.&lt;br&gt;
If you're not in STEM but care, support and speak up.&lt;br&gt;
And if you're hiring, mentoring, or leading — lift as you climb.&lt;/p&gt;

&lt;p&gt;The future of STEM is inclusive. Let’s build it together&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Spring Boot Application Works Internally?</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Thu, 13 Feb 2025 08:34:14 +0000</pubDate>
      <link>https://dev.to/jottyjohn/how-spring-boot-application-works-internally-4nf6</link>
      <guid>https://dev.to/jottyjohn/how-spring-boot-application-works-internally-4nf6</guid>
      <description>&lt;p&gt;Ever wonder what happens when we select 'Rua As' -&amp;gt; 'Spring Boot App'?&lt;br&gt;
I always thought 'Wow!', SptingBoot is so simple. So what happens internally when we run a Spring Boot App from our IDE?&lt;/p&gt;

&lt;p&gt;I found couple of interesting posts and it helped me understand the flow.&lt;br&gt;
So thought of sharing for the people who are ingterested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w2oef9qtcdyr9x6yf4m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4w2oef9qtcdyr9x6yf4m.png" alt=" " width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@kkgsanjeewac77/curious-engineering-facts-spring-boot-internal-keycloak-january-release-27-25-c91a9ebba29f" rel="noopener noreferrer"&gt;https://medium.com/@kkgsanjeewac77/curious-engineering-facts-spring-boot-internal-keycloak-january-release-27-25-c91a9ebba29f&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.php.cn/faq/537379.html" rel="noopener noreferrer"&gt;https://www.php.cn/faq/537379.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope its interesting for curious minds like me :)&lt;/p&gt;

</description>
      <category>spring</category>
      <category>programming</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Tue, 07 Jan 2025 13:56:57 +0000</pubDate>
      <link>https://dev.to/jottyjohn/-4hmn</link>
      <guid>https://dev.to/jottyjohn/-4hmn</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/jottyjohn" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1602032%2Fe2011afd-4ce6-44f2-ae9b-52b13c3b8218.jpg" alt="jottyjohn"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/jottyjohn/data-driven-pattern-1faj" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Data-Driven Pattern&lt;/h2&gt;
      &lt;h3&gt;Jotty John ・ Jan 7&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>development</category>
      <category>designpatterns</category>
      <category>coding</category>
    </item>
    <item>
      <title>Data-Driven Pattern</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Tue, 07 Jan 2025 13:52:25 +0000</pubDate>
      <link>https://dev.to/jottyjohn/data-driven-pattern-1faj</link>
      <guid>https://dev.to/jottyjohn/data-driven-pattern-1faj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Data-Driven Pattern: An In-Depth Look with Examples&lt;/strong&gt;&lt;br&gt;
The Data-Driven Pattern is an architectural style where the flow of data dictates the behavior of the system. This pattern emphasizes the centrality of data, focusing on its storage, processing, and retrieval. It is particularly suited for systems where data consistency, integrity, and complex queries are critical.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Components of a Data-Driven System&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Data Source&lt;/strong&gt;: Where data is generated or collected (e.g., sensors, user inputs).&lt;br&gt;
&lt;strong&gt;Data Storage&lt;/strong&gt;: Centralized databases or data warehouses.&lt;br&gt;
&lt;strong&gt;Data Processing&lt;/strong&gt;: Business logic that processes the stored data, often in batch mode.&lt;br&gt;
&lt;strong&gt;Data Access Layer&lt;/strong&gt;: Interfaces for accessing and manipulating the data (e.g., APIs, SQL queries).&lt;br&gt;
&lt;strong&gt;Data Presentation&lt;/strong&gt;: Dashboards or reports that display processed data to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Characteristics&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Centralized Data Management&lt;/strong&gt;: A single source of truth for data.&lt;br&gt;
&lt;strong&gt;Complex Querying&lt;/strong&gt;: Supports intricate data operations, often using SQL or similar querying languages.&lt;br&gt;
&lt;strong&gt;Data Integrity and Consistency&lt;/strong&gt;: Ensures that data remains consistent across the system.&lt;br&gt;
&lt;strong&gt;Batch Processing&lt;/strong&gt;: Data is processed in large batches, which may not be real-time but ensures thorough data integrity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples of Data-Driven Pattern Applications&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;1. Enterprise Data Warehouse (EDW)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Use Case:&lt;/strong&gt; A retail company wants to analyze sales trends across various regions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Collection:&lt;/strong&gt; Point of Sale (POS) systems collect transaction data.&lt;br&gt;
&lt;strong&gt;Data Storage:&lt;/strong&gt; The data is stored in a centralized data warehouse.&lt;br&gt;
&lt;strong&gt;Data Processing:&lt;/strong&gt; ETL (Extract, Transform, Load) processes clean and aggregate data into meaningful formats.&lt;br&gt;
&lt;strong&gt;Data Access:&lt;/strong&gt; Business intelligence tools like Tableau or Power BI query the data to generate reports.&lt;br&gt;
&lt;strong&gt;Outcome:&lt;/strong&gt; The company can analyze past sales data to make informed decisions about inventory and marketing strategies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Customer Relationship Management (CRM) Systems&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Use Case:&lt;/strong&gt; A company wants to track customer interactions to improve service.&lt;br&gt;
&lt;strong&gt;Data Collection:&lt;/strong&gt; Customer interactions via emails, calls, and social media are logged.&lt;br&gt;
&lt;strong&gt;Data Storage:&lt;/strong&gt; All interactions are stored in a centralized CRM database.&lt;br&gt;
&lt;strong&gt;Data Processing:&lt;/strong&gt; The system processes the data to provide a unified view of customer interactions.&lt;br&gt;
&lt;strong&gt;Data Access:&lt;/strong&gt; Sales and support teams access the data through the CRM’s interface to understand customer needs.&lt;br&gt;
&lt;strong&gt;Outcome:&lt;/strong&gt; Improved customer service due to a comprehensive view of customer history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Healthcare Records System&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Use Case:&lt;/strong&gt; A hospital wants to maintain detailed patient records.&lt;br&gt;
&lt;strong&gt;Data Collection:&lt;/strong&gt; Patient data is collected during consultations and treatments.&lt;br&gt;
&lt;strong&gt;Data Storage:&lt;/strong&gt; Data is stored in a centralized electronic health record (EHR) system.&lt;br&gt;
&lt;strong&gt;Data Processing:&lt;/strong&gt; The system processes data to flag potential health risks based on medical history.&lt;br&gt;
&lt;strong&gt;Data Access:&lt;/strong&gt; Healthcare professionals access patient records to provide informed care.&lt;br&gt;
&lt;strong&gt;Outcome:&lt;/strong&gt; Enhanced patient care due to readily available and accurate patient history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Data-Driven Pattern&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Consistency:&lt;/strong&gt; A centralized data repository ensures all users have access to the same data.&lt;br&gt;
&lt;strong&gt;Complex Data Analysis:&lt;/strong&gt; Enables detailed analytics and reporting, essential for data-driven decision-making.&lt;br&gt;
&lt;strong&gt;Data Integrity:&lt;/strong&gt; Centralized control helps maintain high data quality and integrity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges of Data-Driven Pattern&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Scalability Issues:&lt;/strong&gt; Centralized data storage can become a bottleneck as data volume grows.&lt;br&gt;
&lt;strong&gt;Latency:&lt;/strong&gt; Batch processing may lead to delays in data availability, making real-time decision-making challenging.&lt;br&gt;
&lt;strong&gt;Complexity in Data Management:&lt;/strong&gt; Managing a large, centralized data store requires sophisticated infrastructure and governance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example in a Real-World Scenario&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Company:&lt;/strong&gt; A large e-commerce platform.&lt;br&gt;
&lt;strong&gt;Data Collection:&lt;/strong&gt; Tracks customer purchases, returns, and website interactions.&lt;br&gt;
&lt;strong&gt;Data Storage:&lt;/strong&gt; Data is stored in a centralized data warehouse.&lt;br&gt;
&lt;strong&gt;Data Processing:&lt;/strong&gt; Processes data to identify trends such as popular products or customer churn rates.&lt;br&gt;
&lt;strong&gt;Outcome:&lt;/strong&gt; The company can offer personalized recommendations and improve customer retention by analyzing past behavior patterns.&lt;/p&gt;

&lt;p&gt;In summary, the Data-Driven Pattern is ideal for applications that require detailed analysis and consistency in data handling, making it a cornerstone of systems where data is the lifeblood of operations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Role of Renewable Energy in Achieving Zero Carbon Societies</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Mon, 16 Dec 2024 11:16:57 +0000</pubDate>
      <link>https://dev.to/jottyjohn/the-role-of-renewable-energy-in-achieving-zero-carbon-societies-340l</link>
      <guid>https://dev.to/jottyjohn/the-role-of-renewable-energy-in-achieving-zero-carbon-societies-340l</guid>
      <description>&lt;p&gt;As the world grapples with the growing threat of climate change, the urgency of transitioning to zero-carbon societies has never been clearer. Central to this transition is the role of renewable energy. Renewable energy sources like solar, wind, hydropower, and geothermal are not just vital for reducing carbon emissions—they are also key to building a sustainable and resilient energy system for the future. In this article, we explore the pivotal role renewable energy plays in achieving zero-carbon societies and the potential it holds to reshape the global energy landscape.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Need for Zero Carbon Societies&lt;/strong&gt;&lt;br&gt;
Zero-carbon societies are those that operate with little to no carbon emissions, primarily focusing on decarbonizing sectors like energy, transportation, agriculture, and industry. The goal is to reach carbon neutrality, where human activities no longer contribute to the accumulation of greenhouse gases (GHGs) in the atmosphere. This is vital in limiting global temperature rise to well below 2°C above pre-industrial levels, as agreed upon in the Paris Agreement.&lt;/p&gt;

&lt;p&gt;The energy sector is the largest contributor to global carbon emissions, responsible for approximately 73% of total emissions. Therefore, to achieve carbon neutrality, transitioning away from fossil fuels to renewable energy is not just an option—it is an absolute necessity. This shift can fundamentally alter the way energy is produced, consumed, and distributed, paving the way for sustainable and resilient societies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Renewable Energy: The Backbone of a Zero-Carbon Future&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Decarbonizing the Power Sector&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most direct way renewable energy contributes to a zero-carbon society is through the decarbonization of the power sector. Fossil fuels, like coal, natural gas, and oil, are the primary sources of carbon emissions in electricity generation. By replacing these with renewable sources, such as solar and wind power, societies can drastically reduce emissions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Solar Power:&lt;br&gt;
Solar energy harnesses the sun's rays to generate electricity, producing no emissions during operation. With the cost of solar panels dropping dramatically over the last decade, solar energy has become one of the most cost-effective and accessible sources of renewable power.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Wind Power:&lt;br&gt;
Wind turbines convert the kinetic energy of the wind into electricity. As wind technology has improved, the cost of onshore and offshore wind power has become competitive with traditional fossil fuels, offering a reliable, clean source of energy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Hydropower: &lt;br&gt;
Hydropower, the largest source of renewable electricity worldwide, uses the flow of water to generate power. While large hydropower plants can have significant environmental and social impacts, small-scale hydro projects and innovations like tidal and wave energy are helping to harness water's power with minimal disruption.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Geothermal Energy: &lt;br&gt;
Geothermal energy taps into the Earth’s internal heat to generate electricity and provide heating. It is a consistent and reliable source of energy, making it ideal for baseload power generation in areas with geothermal resources.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Energy Storage and Grid Integration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the challenges of renewable energy, particularly solar and wind, is their intermittency. The sun doesn’t always shine, and the wind doesn’t always blow, meaning there are times when renewable energy production falls short of demand. However, significant advancements in energy storage technologies—such as lithium-ion batteries and pumped hydro storage—are making it possible to store excess renewable energy during periods of high production and release it when demand is high or renewable generation is low.&lt;/p&gt;

&lt;p&gt;Grid integration is another crucial aspect. Modernizing the electrical grid with smart technologies can improve the efficiency and flexibility of energy distribution. By connecting various renewable energy sources and storage systems, grids can manage fluctuations in supply and demand, ensuring a constant and reliable flow of electricity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Electrification of Other Sectors&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Renewable energy is not just about producing electricity—it is also central to the broader decarbonization of other sectors, especially transportation and industry.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Electric Transportation:&lt;br&gt;
The transportation sector, including cars, trucks, buses, trains, and ships, is one of the largest sources of carbon emissions. By shifting from gasoline and diesel to electric vehicles (EVs) powered by renewable electricity, significant reductions in carbon emissions can be achieved. Furthermore, renewable-powered charging infrastructure can ensure that EVs are truly zero-emission.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Green Hydrogen:&lt;br&gt;
Another exciting development is the potential for renewable energy to produce green hydrogen—a fuel produced through the electrolysis of water using renewable electricity. Green hydrogen can be used as a clean energy carrier for sectors that are hard to electrify, such as heavy industry, shipping, and aviation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Decarbonizing Industry:&lt;br&gt;
Many industries, such as steel and cement manufacturing, rely on high-temperature processes that traditionally depend on fossil fuels. By using renewable electricity or green hydrogen for industrial processes, these sectors can significantly reduce their carbon footprint.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Enhancing Energy Access and Equity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Renewable energy can also contribute to more equitable and inclusive societies. By decentralizing energy production through solar panels, wind turbines, and mini-grids, renewable energy can provide electricity to remote and underserved regions that are not connected to the central grid. This decentralized approach not only improves energy access but can also create local jobs and economic opportunities, empowering communities and reducing energy poverty.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Challenges and Opportunities Ahead&lt;/strong&gt;&lt;br&gt;
While the potential of renewable energy is immense, there are challenges to its widespread adoption. One of the primary obstacles is the need for substantial investment in infrastructure—particularly in energy storage, grid modernization, and clean technologies. Additionally, the shift from fossil fuels to renewable energy will require strong policy frameworks, financial incentives, and international cooperation.&lt;/p&gt;

&lt;p&gt;However, the opportunities presented by renewable energy are equally significant. The rapid advancement of technology, falling costs, and growing global commitment to climate action have made the transition to renewable energy not just feasible, but increasingly attractive. Renewable energy offers not only environmental benefits but also economic growth, job creation, and energy independence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Renewable energy is indispensable to the realization of zero-carbon societies. From decarbonizing power generation to electrifying transportation and industry, renewables provide a comprehensive and sustainable solution to the climate crisis. While challenges remain, the rapid technological advancements and the urgent need for climate action present a unique opportunity to reshape the energy sector for a cleaner, greener, and more sustainable future. By investing in renewable energy, we can take a monumental step toward building zero-carbon societies that safeguard the planet for future generations.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>The Role of Explainable AI in Building Trust and Accountability</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Wed, 04 Dec 2024 06:05:53 +0000</pubDate>
      <link>https://dev.to/jottyjohn/the-role-of-explainable-ai-in-building-trust-and-accountability-4j4p</link>
      <guid>https://dev.to/jottyjohn/the-role-of-explainable-ai-in-building-trust-and-accountability-4j4p</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
In recent years, AI has transformed industries by enhancing decision-making processes and automating tasks. However, as AI systems grow more complex, understanding how they make decisions becomes increasingly difficult. This lack of transparency can erode trust and raise ethical concerns, particularly in sensitive areas like healthcare, finance, and law enforcement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Need for Explainability&lt;/strong&gt;&lt;br&gt;
Explainable AI (XAI) refers to methods and tools that help users understand the reasoning behind AI decisions. Unlike traditional "black-box" models, XAI aims to provide clear and interpretable insights. This is crucial in high-stakes applications where accountability and trust are paramount. For example, in healthcare, clinicians need to understand AI recommendations to ensure patient safety and comply with regulations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Benefits of XAI&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Building Trust: Transparency in AI processes helps stakeholders feel more confident in adopting AI solutions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enhancing Accountability: Organizations can better justify decisions made by AI, mitigating risks of bias or errors.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compliance with Regulations: As AI governance frameworks evolve, explainability is becoming a legal requirement in regions like the EU (GDPR’s “right to explanation”).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Challenges in Achieving Explainability&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Trade-offs with Performance: Simplifying models for explainability can reduce their predictive power.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Complexity of Some AI Models: Techniques like deep learning are inherently difficult to interpret, posing a challenge for transparency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Balancing Technical and Non-Technical Audiences: Providing explanations that satisfy both technical experts and end-users is tricky.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Use Cases of Explainable AI&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Healthcare: XAI aids in interpreting diagnostic models, ensuring doctors understand why specific treatments are recommended.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Finance: In credit scoring and fraud detection, clear explanations help institutions make fair decisions and avoid regulatory penalties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Legal Systems: XAI supports transparency in AI-assisted sentencing or bail recommendations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Future Trends&lt;/strong&gt;&lt;br&gt;
The future of XAI includes advancements in tools and frameworks like LIME and SHAP, which offer model-agnostic explanations. Researchers are also exploring hybrid models that balance interpretability and accuracy. Additionally, AI governance frameworks will likely continue to evolve, emphasizing the importance of XAI in ethical AI deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Explainable AI is a cornerstone of responsible AI development. By fostering trust, enhancing accountability, and ensuring compliance, XAI paves the way for broader adoption of AI technologies in critical sectors. As AI becomes more integrated into daily life, the demand for explainability will only grow, shaping the future of ethical and transparent AI systems.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Revolutionizing Business with APIs and AI: The New Era of Digital Transformation</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Thu, 03 Oct 2024 08:30:33 +0000</pubDate>
      <link>https://dev.to/jottyjohn/revolutionizing-business-with-apis-and-ai-the-new-era-of-digital-transformation-2gb2</link>
      <guid>https://dev.to/jottyjohn/revolutionizing-business-with-apis-and-ai-the-new-era-of-digital-transformation-2gb2</guid>
      <description>&lt;p&gt;In the ever-evolving landscape of technology, businesses are increasingly embracing two powerful forces: APIs (Application Programming Interfaces) and AI (Artificial Intelligence). These technologies are not just buzzwords but essential drivers of modern business transformation. Together, they are enabling companies to automate processes, personalize experiences, and create innovative products and services at an unprecedented scale.&lt;/p&gt;

&lt;p&gt;This article delves into how APIs and AI are revolutionizing business operations and ushering in a new era of digital transformation, touching on key areas such as automation, data-driven decision-making, customer experience, and innovation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The API Revolution: Connecting the Digital World&lt;/strong&gt;&lt;br&gt;
APIs have become the backbone of digital transformation, allowing different systems and applications to communicate with each other effortlessly. They serve as the "connective tissue" between diverse platforms, enabling data exchange and functional integration across applications, devices, and services.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Streamlining Operations and Automating Workflows&lt;br&gt;
APIs allow businesses to automate repetitive tasks and connect siloed systems. For example, integrating CRM software with accounting systems through an API eliminates the need for manual data entry, reducing human error and saving time. This seamless integration of systems is transforming back-office operations, enabling organizations to focus on higher-value activities.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Building an Ecosystem of Innovation&lt;br&gt;
Companies can expand their services and offerings by leveraging third-party APIs. For instance, fintech firms integrate with banking APIs to provide consumers with secure payment gateways, financial data aggregation, or even credit score monitoring. By tapping into external APIs, businesses can offer new capabilities without needing to build these services from scratch, allowing them to scale faster and innovate continuously.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enabling Omnichannel Experiences&lt;br&gt;
In today’s digital world, customers interact with businesses across various channels—websites, mobile apps, social media, and more. APIs enable businesses to deliver consistent, integrated experiences across all these touchpoints. For example, when customers make a purchase online and return items through a mobile app, APIs ensure that their transaction history, preferences, and loyalty points are updated in real time across all platforms.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The AI Revolution: Intelligence at Scale&lt;/strong&gt;&lt;br&gt;
While APIs connect systems, AI brings intelligence to those connections, enabling businesses to derive actionable insights, make smarter decisions, and personalize customer experiences.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Enhancing Data-Driven Decision-Making&lt;br&gt;
AI enables businesses to analyze vast amounts of data from APIs and other sources quickly and efficiently. Predictive analytics, powered by AI, helps organizations anticipate market trends, optimize pricing strategies, and forecast demand. With AI-driven insights, businesses can make proactive, data-backed decisions rather than relying on intuition or historical data alone. &lt;br&gt;
For example, in retail, AI can analyze customer purchase patterns, identify emerging trends, and help businesses adjust their product offerings in real time to match changing consumer preferences. In the financial sector, AI can analyze market data and suggest optimal investment strategies, improving profitability.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Personalization at Scale&lt;br&gt;
Today’s consumers expect personalized experiences, and AI enables businesses to deliver exactly that. AI algorithms can analyze customer data—ranging from past purchases to browsing history—and generate tailored recommendations or offers. This level of personalization builds stronger customer loyalty and significantly boosts engagement. &lt;br&gt;
E-commerce giants like Amazon use AI to provide personalized product recommendations, while streaming services like Netflix leverage AI to offer tailored content suggestions based on viewing history. AI's ability to predict customer behavior ensures that businesses can meet consumer expectations efficiently, at any scale.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Intelligent Automation and Productivity&lt;br&gt;
AI, combined with APIs, is fueling intelligent automation across industries. Robotic Process Automation (RPA), for example, uses AI to automate complex workflows, from customer service interactions to supply chain management. Businesses can use AI-driven chatbots to handle routine customer inquiries, freeing up human agents to tackle more complex tasks.&lt;br&gt;
In manufacturing, AI can predict equipment failures by analyzing data collected via APIs from IoT sensors, allowing companies to perform proactive maintenance and reduce downtime. By automating these traditionally manual processes, AI increases productivity, reduces costs, and minimizes errors.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The Symbiotic Relationship Between APIs and AI&lt;/strong&gt;&lt;br&gt;
While APIs enable connectivity between systems, AI amplifies the capabilities of these systems by interpreting and acting on the data exchanged. Together, APIs and AI provide a powerful combination that enables businesses to innovate, automate, and thrive in today’s competitive environment.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Innovation and New Business Models&lt;br&gt;
APIs and AI are fueling new business models, particularly in sectors like finance, healthcare, and retail. Open banking, for example, allows third-party developers to build financial services on top of existing banking platforms through APIs, while AI-driven fraud detection ensures the security of these transactions.&lt;br&gt;
In healthcare, APIs connect electronic medical records with AI tools that can analyze patient data to suggest personalized treatment plans. In retail, AI-powered recommendation engines integrated via APIs are improving customer experience, leading to higher sales conversions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enabling Hyper-Connected Ecosystems&lt;br&gt;
With APIs, businesses can become part of larger digital ecosystems, integrating services from different providers to deliver comprehensive solutions to customers. AI enhances these ecosystems by bringing intelligence into the mix—analyzing user interactions, predicting needs, and enabling real-time adjustments.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, a smart home ecosystem may integrate APIs from different vendors for lights, thermostats, and security systems. AI can then analyze usage patterns to automate home settings, offering energy savings and security optimizations that adapt to user preferences.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Challenges and Considerations&lt;/strong&gt;&lt;br&gt;
While APIs and AI present vast opportunities, they also come with challenges. Security remains a key concern, especially as APIs open gateways to sensitive data. Companies must ensure they implement strong authentication, encryption, and monitoring mechanisms to protect against breaches.&lt;/p&gt;

&lt;p&gt;AI, on the other hand, requires quality data for accuracy. Poor data quality or biased data sets can lead to flawed predictions, which could harm business decisions. Transparency and ethical considerations around AI's use are also important, particularly when AI is used to make decisions that directly impact customers or employees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion: The Future of Digital Transformation&lt;/strong&gt;&lt;br&gt;
APIs and AI are not just shaping the future of business—they are defining it. As businesses continue to evolve, the combination of APIs and AI will become even more critical in driving efficiency, innovation, and customer-centric experiences.&lt;/p&gt;

&lt;p&gt;In this new era of digital transformation, businesses that embrace APIs and AI will lead the charge, while those that fail to adopt these technologies risk falling behind. By leveraging the power of APIs to connect systems and AI to make sense of data, companies can stay agile, innovate rapidly, and deliver exceptional value to their customers in an increasingly digital world.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Aliens and Me!!</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Fri, 27 Sep 2024 13:35:45 +0000</pubDate>
      <link>https://dev.to/jottyjohn/aliens-and-me-1nfc</link>
      <guid>https://dev.to/jottyjohn/aliens-and-me-1nfc</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/webgame"&gt;Web Game Challenge&lt;/a&gt;, Build a Game: Alien Edition&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;The player will start on the left side of the game area and can move up and down using up and down arrow keys, while shooting bullets to the right using the space bar. This allows for different strategies when avoiding aliens. When a bullet hits an alien, score will increase by 5 points, a blood splash will appear at the alien's position for a short time before fading out. This gives a visual cue for the hit, enhancing the game's feel. &lt;/p&gt;

&lt;p&gt;If an Alien hits a player, he will lose one life. Max 3 lives a player and 100 bullets.&lt;/p&gt;

&lt;p&gt;Lets play!!!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;index.html&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8"&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
    &amp;lt;title&amp;gt;Alien Shooting Game&amp;lt;/title&amp;gt;
    &amp;lt;link rel="stylesheet" href="style.css"&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div id="game-container"&amp;gt;
        &amp;lt;div id="lives"&amp;gt;Lives: 3&amp;lt;/div&amp;gt;
        &amp;lt;div id="score"&amp;gt;Score: 0&amp;lt;/div&amp;gt;
        &amp;lt;div id="bullet-count"&amp;gt;Bullets Remaining: 100&amp;lt;/div&amp;gt;        
        &amp;lt;div id="game-over" style="display: none;"&amp;gt;Game Over! Press R to Restart&amp;lt;/div&amp;gt;
        &amp;lt;div id="player"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;div id="aliens"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;style.css&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
    margin: 0;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(to bottom, #1c1c1c, #2c2c2c);
    color: white;
    background: url('img/star.jpg') no-repeat center center fixed;
    background-size: cover;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}
@keyframes fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
#score, #bullet-count, #game-over, #lives{
    position: absolute;
    left: 10px;
    color: white;
    font-size: 20px;
    z-index: 10;
}

#score {
    top: 10px;
}

#lives {
    top: 40px;
}


#bullet-count {
    top: 80px;
}

#game-over {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
}
.blood-splash {
    position: absolute;
    width: 50px; /* Adjust according to your blood splash image size */
    height: 50px; /* Adjust according to your blood splash image size */
    background: url('img/blood-splash.png') no-repeat center center;
    background-size: cover;
    animation: fade-out 0.5s forwards; /* Fade out animation */
}


@keyframes fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}
#player {
    position: absolute;
    left: 30px; /* Fixed position on the left */
    bottom: 50%; /* Center vertically (can adjust as needed) */
    width: 30px; /* Adjust according to your player image size */
    height: 50px; /* Adjust according to your player image size */
    background: url('img/player.png') no-repeat center center;
    background-size: cover; /* Make sure the image covers the element */
}
.alien {
    position: absolute;
    width: 25px; /* Adjust according to your image size */
    height: 35px; /* Adjust according to your image size */
    background: url('img/alien.png') no-repeat center center;
    background-size: cover; /* Make sure the image covers the element */
}

.bullet {
    position: absolute;
    width: 10px;
    height: 3px;
     background: url('img/bullet.png') no-repeat center center;
    background-size: cover; /* Make sure the image covers the element */
    border-radius: 2px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;script.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let score = 0;
const player = document.getElementById('player');
const aliensContainer = document.getElementById('aliens');
const scoreDisplay = document.getElementById('score');
const bulletCountDisplay = document.getElementById('bullet-count');
const gameOverDisplay = document.getElementById('game-over'); // Game Over message
const livesDisplay = document.getElementById('lives'); // Lives display
const gameWidth = window.innerWidth;
const gameHeight = window.innerHeight;

let playerPositionY = (gameHeight / 2) - 25; // Center the player vertically
let bullets = [];
let aliens = [];
const MAX_BULLETS = 20; // Maximum number of bullets
let gameInterval; // To store the game interval
let isGameOver = false; // To check if the game is over
let playerLives = 3; // Player lives

// Set the initial position of the player
player.style.bottom = playerPositionY + 'px';
livesDisplay.innerText = "Lives: " + playerLives; // Display initial lives

document.addEventListener('keydown', (event) =&amp;gt; {
    if (isGameOver) {
        if (event.key === 'r' || event.key === 'R') {
            restartGame();
        }
        return; // Do not allow movement or shooting if game is over
    }

    // Move the player up and down
    if (event.key === 'ArrowUp' &amp;amp;&amp;amp; playerPositionY &amp;lt; gameHeight - 50) {
        playerPositionY += 15; // Move up
    }
    if (event.key === 'ArrowDown' &amp;amp;&amp;amp; playerPositionY &amp;gt; 0) {
        playerPositionY -= 15; // Move down
    }
    if (event.key === ' ' &amp;amp;&amp;amp; bullets.length &amp;lt; MAX_BULLETS) { // Check bullet limit
        shoot();
    }

    player.style.bottom = playerPositionY + 'px'; // Update player position
});

function shoot() {
    const bullet = document.createElement('div');
    bullet.classList.add('bullet');
    bullet.style.left = '40px'; // Set starting position of the bullet (right of player)
    bullet.style.bottom = (playerPositionY + 15) + 'px'; // Center bullet vertically with respect to the player
    bullets.push(bullet);
    aliensContainer.appendChild(bullet);
    updateBulletCount(); // Update bullet count when a bullet is shot
}

function updateBulletCount() {
    bulletCountDisplay.innerText = "Bullets Remaining: " + (MAX_BULLETS - bullets.length);
    if (bullets.length === MAX_BULLETS) {
        stopGame(); // Stop the game if bullets are used up
    }
}

function createAlien() {
    const alien = document.createElement('div');
    alien.classList.add('alien');
    const xPosition = Math.random() * (gameWidth - 50);
    alien.style.left = xPosition + 'px';
    alien.style.top = '0px';
    aliens.push(alien);
    aliensContainer.appendChild(alien);
}

function moveAliens() {
    for (let i = 0; i &amp;lt; aliens.length; i++) {
        const alien = aliens[i];
        let alienTop = parseInt(alien.style.top);
        if (alienTop &amp;lt; gameHeight) {
            alien.style.top = (alienTop + 2) + 'px';
        } else {
            aliensContainer.removeChild(alien);
            aliens.splice(i, 1);
            i--;
        }
    }
}

function moveBullets() {
    for (let i = 0; i &amp;lt; bullets.length; i++) {
        const bullet = bullets[i];
        let bulletLeft = parseInt(bullet.style.left);
        if (bulletLeft &amp;lt; gameWidth) {
            bullet.style.left = (bulletLeft + 10) + 'px'; // Move bullet to the right
        } else {
            aliensContainer.removeChild(bullet);
            bullets.splice(i, 1);
            i--;
            updateBulletCount(); // Update bullet count when a bullet is removed
        }
    }
}

function checkCollision() {
    for (let i = 0; i &amp;lt; bullets.length; i++) {
        const bullet = bullets[i];
        const bulletRect = bullet.getBoundingClientRect();

        for (let j = 0; j &amp;lt; aliens.length; j++) {
            const alien = aliens[j];
            const alienRect = alien.getBoundingClientRect();

            if (
                bulletRect.x &amp;lt; alienRect.x + alienRect.width &amp;amp;&amp;amp;
                bulletRect.x + bulletRect.width &amp;gt; alienRect.x &amp;amp;&amp;amp;
                bulletRect.y &amp;lt; alienRect.y + alienRect.height &amp;amp;&amp;amp;
                bulletRect.y + bulletRect.height &amp;gt; alienRect.y
            ) {
                // Show blood splash effect at alien position
                showBloodSplashAtAlien(alien);

                score+=5; // Increment score
                scoreDisplay.innerText = "Score: " + score;

                // Remove the bullet and the alien from the DOM
                aliensContainer.removeChild(bullet);
                aliensContainer.removeChild(alien);
                bullets.splice(i, 1); // Remove bullet from array
                aliens.splice(j, 1); // Remove alien from array
                updateBulletCount(); // Update bullet count after hit
                i--; // Adjust index after removal
                break;
            }
        }
    }
    checkPlayerCollision(); // Check collision with player
}

function showBloodSplashAtAlien(alien) {
    const bloodSplash = document.createElement('div');
    bloodSplash.classList.add('blood-splash');
    bloodSplash.style.left = (alien.getBoundingClientRect().x + 'px'); // Position the splash at the alien's X position
    bloodSplash.style.top = (alien.getBoundingClientRect().y + 'px');  // Position the splash at the alien's Y position
    document.body.appendChild(bloodSplash);

    // Remove the blood splash after the animation ends
    setTimeout(() =&amp;gt; {
        document.body.removeChild(bloodSplash);
    }, 500); // Adjust timing to match animation duration
}

function checkPlayerCollision() {
    const playerRect = player.getBoundingClientRect(); // Get player dimensions

    for (let alien of aliens) {
        const alienRect = alien.getBoundingClientRect(); // Get alien dimensions
        if (
            playerRect.x &amp;lt; alienRect.x + alienRect.width &amp;amp;&amp;amp;
            playerRect.x + playerRect.width &amp;gt; alienRect.x &amp;amp;&amp;amp;
            playerRect.y &amp;lt; alienRect.y + alienRect.height &amp;amp;&amp;amp;
            playerRect.y + playerRect.height &amp;gt; alienRect.y
        ) {
            playerLives--; // Reduce player life
            livesDisplay.innerText = "Lives: " + playerLives; // Update lives display
            showBloodSplash(); // Show blood splash effect

            // If player has no lives left, stop the game
            if (playerLives &amp;lt;= 0) {
                stopGame(); // Stop the game if the alien touches the player
            }
            break;
        }
    }
}

function showBloodSplash() {
    const bloodSplash = document.createElement('div');
    bloodSplash.classList.add('blood-splash');
    bloodSplash.style.left = (player.getBoundingClientRect().x + 10) + 'px'; // Position it near the player
    bloodSplash.style.top = (player.getBoundingClientRect().y + 10) + 'px'; // Position it near the player
    document.body.appendChild(bloodSplash);

    // Remove the blood splash after animation ends
    setTimeout(() =&amp;gt; {
        document.body.removeChild(bloodSplash);
    }, 500); // Adjust timing according to the duration of your animation
}

function stopGame() {
    clearInterval(gameInterval); // Stop the game loop
    isGameOver = true; // Set game over flag
    gameOverDisplay.style.display = "block"; // Show game over message
}

function restartGame() {
    // Reset variables and clear game state
    score = 0;
    playerPositionY = (gameHeight / 2) - 25; // Reset player position
    bullets = [];
    aliens = [];
    playerLives = 3; // Reset player lives
    isGameOver = false;
    scoreDisplay.innerText = "Score: 0";
    bulletCountDisplay.innerText = "Bullets Remaining: 20";
    livesDisplay.innerText = "Lives: " + playerLives; // Reset lives display
    gameOverDisplay.style.display = "none"; // Hide game over message
    aliensContainer.innerHTML = ""; // Clear aliens and bullets

    gameInterval = setInterval(() =&amp;gt; {
        if (Math.random() &amp;lt; 0.1) {
            createAlien();
        }
        moveAliens();
        moveBullets();
        checkCollision();
    }, 100);
}

gameInterval = setInterval(() =&amp;gt; {
    if (Math.random() &amp;lt; 0.1) {
        createAlien();
    }
    moveAliens();
    moveBullets();
    checkCollision();
}, 100);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;img/alien.png&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikff4ru09rel6ocxbl2t.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikff4ru09rel6ocxbl2t.PNG" alt=" " width="152" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;img/blood-splash.png&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89mgjryesq699f4optcq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89mgjryesq699f4optcq.PNG" alt=" " width="220" height="238"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;img/bullet.png&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0zw4yhkak3359wh5vk1.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0zw4yhkak3359wh5vk1.PNG" alt=" " width="64" height="414"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;img/player.png&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzxurgmhllpo0ih2tpro.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgzxurgmhllpo0ih2tpro.PNG" alt=" " width="299" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;img/star.jpg&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmr1fj2ybl5miorjr08zg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmr1fj2ybl5miorjr08zg.jpg" alt=" " width="686" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Journey
&lt;/h2&gt;

&lt;p&gt;I started with with plain rectangle and circle shapes for aliens and player. Then I used images to make the page more attractive.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>gamechallenge</category>
      <category>gamedev</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Interceptors in Spring Boot</title>
      <dc:creator>Jotty John</dc:creator>
      <pubDate>Mon, 16 Sep 2024 07:15:00 +0000</pubDate>
      <link>https://dev.to/jottyjohn/interceptors-in-spring-boot-3fnp</link>
      <guid>https://dev.to/jottyjohn/interceptors-in-spring-boot-3fnp</guid>
      <description>&lt;p&gt;Interceptors in Spring Boot are typically used to intercept and manipulate HTTP requests before they reach the controller or responses before they are sent to the client.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Implement an Interceptor:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Create an Interceptor Class:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Implement the HandlerInterceptor interface or extend the HandlerInterceptorAdapter class.Override methods like preHandle, postHandle, and afterCompletion based on your needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class MyInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        // Code to execute before the controller method is invoked
        System.out.println("Pre Handle method is called");
        return true; // If false, the request is not further processed
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        // Code to execute after the controller method is invoked, but before the view is rendered
        System.out.println("Post Handle method is called");
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        // Code to execute after the complete request has finished
        System.out.println("After Completion method is called");
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Register the Interceptor:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Implement the WebMvcConfigurer interface in a configuration class and override the addInterceptors method to register your interceptor.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/api/**"); // Specify paths to apply the interceptor
    }
}

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

&lt;/div&gt;



&lt;p&gt;Interceptors are specific to Spring MVC and operate at the controller level. Interceptors are typically used for concerns like logging, authentication, and modifying model attributes.&lt;/p&gt;

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