<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ofir Elarat on Medium]]></title>
        <description><![CDATA[Stories by Ofir Elarat on Medium]]></description>
        <link>https://medium.com/@ofirelarat?source=rss-788f42b3c890------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2VdXsw7yLxmsO5jc</url>
            <title>Stories by Ofir Elarat on Medium</title>
            <link>https://medium.com/@ofirelarat?source=rss-788f42b3c890------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 10:50:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ofirelarat/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[RAG vs MCP vs Skills: They’re Not Alternatives - They’re the Same System]]></title>
            <link>https://ai.plainenglish.io/rag-vs-mcp-vs-skills-theyre-not-alternatives-they-re-the-same-system-1c52a7db20e8?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c52a7db20e8</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Fri, 29 May 2026 08:31:34 GMT</pubDate>
            <atom:updated>2026-06-26T09:36:24.665Z</atom:updated>
            <content:encoded><![CDATA[<p>Why retrieval, capabilities, and reasoning patterns are not competing approaches, but different layers in a context orchestration system around the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qZdeXAuBQ1GgqN_x" /><figcaption>Photo by <a href="https://unsplash.com/@omilaev?utm_source=medium&amp;utm_medium=referral">Igor Omilaev</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Most discussions around modern AI architecture break things into buckets:</p><ul><li>RAG</li><li>MCP &amp; Tools</li><li>Skills / Agents</li><li>Prompts</li></ul><p>And then people try to compare them like competing approaches.</p><p>That’s the wrong abstraction.</p><p>Because in real systems:</p><blockquote><em>RAG, MCP, and Skills are not alternatives - they are different ways of constructing and extending context for the same model.</em></blockquote><p>Once you see that, the architecture becomes much clearer.</p><h3>The Core Idea: Everything Is Context</h3><p>Modern LLM systems are not “prompt pipelines”.</p><p>They are:</p><blockquote><em>Context orchestration systems that prepare input for a model, optionally extend it with external knowledge or capabilities, and then execute reasoning.</em></blockquote><p>The model is constant.</p><p>What changes is <strong>how we construct context around it</strong>.</p><p>This is where AI Harness Engineering emerges.</p><blockquote><strong>Harness engineering </strong>refers to the software infrastructure that surrounds an AI agent, managing its lifecycle from context capture to execution and verification</blockquote><p>In simple terms:<br>the harness is everything that wraps the model</p><ul><li>Context pipelines</li><li>Behavioural guides</li><li>Retrieval flows</li><li>Tool access</li><li>Validation systems</li><li>Execution constraints</li></ul><blockquote>The competitive advantage is no longer just who has the bigger model. It’s who can orchestrate context more effectively around the model.</blockquote><h3>Three Ways of Extending Context</h3><p>Let’s break the system into three fundamental mechanisms:</p><h4>1. RAG - Extending Context With Knowledge</h4><p>Retrieval-Augmented Generation is the mechanism of adding <strong>information context</strong>.</p><p>It answers:</p><blockquote><em>“What does the model need to know that is not in its weights?”</em></blockquote><p>RAG works by:</p><ul><li>embedding a query</li><li>retrieving relevant documents</li><li>injecting them into context</li></ul><p>This is powered by infrastructure like vector databases.</p><p>But architecturally:</p><blockquote><em>RAG is just dynamic context injection.</em></blockquote><p>It does not change the model. It expands what the model sees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vVkE-uwznpRGQf5GYZkQRA.png" /></figure><h4>2. MCP - Extending Context With Capabilities</h4><p>Model Context Protocol is the mechanism of adding <strong>action context</strong>.</p><p>It answers:</p><blockquote><em>“What can the model do beyond text generation?”</em></blockquote><p>MCP provides a standardized way to:</p><ul><li>expose tools</li><li>invoke external systems</li><li>return structured results</li></ul><p>This includes:</p><ul><li>APIs</li><li>databases</li><li>workflows</li><li>services</li></ul><p>But importantly:</p><blockquote><em>MCP is not about tools — it’s about extending the model’s </em>interaction surface with the world<em>.</em></blockquote><p>So while RAG adds knowledge, MCP adds capability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JEP_fKX4wh1J6PiXffiqtw.png" /></figure><p>You can read more about how to build MCP yourself here:</p><p><a href="https://javascript.plainenglish.io/part-1-discovering-mcp-my-journey-to-building-a-local-tool-tester-f9e893e68c5c">Part 1: Discovering MCP with JS — My Journey to building and testing MCP</a></p><h4>3. Skills - Extending Context With Behaviour</h4><p>Skills are the least formally defined but most important concept.</p><p>A skill is:</p><blockquote><em>A reusable reasoning pattern encoded as structured context.</em></blockquote><p>Examples:</p><ul><li>summarization</li><li>planning</li><li>classification</li><li>transformation pipelines</li><li>domain-specific reasoning flows</li></ul><p>Skills answer:</p><blockquote><em>“How should the model think in a specific situation?”</em></blockquote><p>Unlike RAG (knowledge) and MCP (capability), skills define:</p><ul><li>reasoning structure</li><li>step patterns</li><li>output formats</li><li>behavioural constraints</li></ul><p>So:</p><blockquote><em>Skills shape </em>how the model reasons<em>, not what it knows or can do.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dr-F8sg8CiydfZJY_p-VBw.png" /></figure><h3>The Key Insight: They Operate on Different Dimensions</h3><p>This is where most mental models break.</p><p>People try to compare:</p><ul><li>RAG vs MCP</li><li>MCP vs Skills</li><li>Skills vs Prompts</li></ul><p>But they are not competing systems.</p><p>They are orthogonal dimensions of context:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*JL2cucfaJbydN2dRdu3qwg.png" /></figure><p>And all three can exist at the same time.</p><h3>The Unified Context Model</h3><p>Instead of thinking in layers or stacks, think in a single system:</p><blockquote><em>A context assembly engine that continuously constructs the input to the model.</em></blockquote><p>This includes:</p><ul><li>Static instructions (system prompt)</li><li>Product-level context (claude.md, agent.md)</li><li>User input</li><li>Retrieved knowledge (RAG)</li><li>Available capabilities (MCP and tools)</li><li>Reasoning patterns (Skills)</li></ul><p>And then The model simply executes over the final constructed context.</p><h3>The Full System</h3><p>This is the real architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgpkkFlkE72aXDb_gm73Pw.png" /></figure><h3>What This Diagram Actually Shows</h3><p>This is the key mental model shift:</p><h4>1. The model is not the system</h4><p>It is the execution engine at the center.</p><h4>2. Context is everything around it</h4><p>All intelligence is constructed before inference:</p><ul><li>Instructions</li><li>Memory</li><li>Knowledge</li><li>Tools</li><li>Reasoning patterns</li></ul><h4>3. RAG, MCP, and Skills are not features</h4><p>They are <strong>different context injection mechanisms</strong></p><p>They all feed the same thing: <em>The model’s input space</em></p><h3>Why This Matters</h3><p>Once you adopt this model, several things become obvious:</p><h4>1. There is no “best architecture”</h4><p>You don’t choose between RAG, MCP, or Skills.</p><p>You compose them and use what fits your needs.</p><h4>2. AI systems are not model-centric</h4><p>They are context-centric systems.</p><h4>3. Most “agent frameworks” are just context builders</h4><p>They don’t add intelligence - they structure it.</p><h4>4. The real engineering challenge is context design</h4><p>Not prompting. Not models. Not tools. <strong><em>Context orchestration and harness engineering.</em></strong></p><p>The model is becoming infrastructure. The harness is becoming the product.</p><h3>Closing Thought</h3><p>We started with prompts.</p><p>Then we added retrieval (RAG).</p><p>Then we added tools (MCP).</p><p>Then we added reasoning patterns (Skills).</p><p>But nothing changed the core reality:</p><blockquote><em>We are not building AI applications. We are building systems that construct context for a reasoning engine.</em></blockquote><p>And the model? It never changed.</p><p>Only the context around it did.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c52a7db20e8" width="1" height="1" alt=""><hr><p><a href="https://ai.plainenglish.io/rag-vs-mcp-vs-skills-theyre-not-alternatives-they-re-the-same-system-1c52a7db20e8">RAG vs MCP vs Skills: They’re Not Alternatives - They’re the Same System</a> was originally published in <a href="https://ai.plainenglish.io/">Artificial Intelligence in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Testing Your MCP - My Journey to Building and testing MCP]]></title>
            <link>https://ofirelarat.medium.com/part-2-testing-your-mcp-building-a-local-mcp-tool-tester-39d51a378a3d?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/39d51a378a3d</guid>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[llm-applications]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 17:01:34 GMT</pubDate>
            <atom:updated>2025-11-06T15:17:48.722Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*Imb05FM3rjPssTLHa2PG2A.png" /></figure><h3>Introduction: The Problem with Testing MCPs</h3><p>After building a few tools in MCP — like the roll_dice and weather examples from Part 1 — I quickly realized that testing them wasn&#39;t straightforward.</p><p>There are several challenges and problems which cause the local testing process to become:</p><ul><li><strong>Slow</strong></li><li><strong>Hard to debug</strong></li><li><strong>Lacks visibility</strong> into what’s happening under the hood</li></ul><p>Later this post I will explain what those challenges exactly.</p><p>That’s when I decided to create my own <strong>local MCP tester</strong>: a simple environment where I can load, call, and inspect tools without spinning up an LLM.</p><p>This post will walk you through:</p><ol><li>How to test your MCP manually</li><li>Challenges with existing approaches</li><li>How I built my own MCP testing environment</li><li>How to use <strong>mcp-tools-tester</strong> to test your own tools</li></ol><h3>Step 1: Testing Your MCP Manually</h3><p>Before building anything custom, you can test your MCP server manually.</p><p>When you run your MCP server (for example, a Next.js route), it exposes endpoints that respond to MCP protocol requests — like fetching tools or invoking them. You can interact with these endpoints using curl, Postman, or any HTTP client.</p><p><strong>Example: List all tools</strong></p><pre>curl http://localhost:3000/api/mcp -X GET</pre><p><strong>Expected response</strong></p><pre>{<br>  &quot;tools&quot;: [<br>    { &quot;name&quot;: &quot;roll_dice&quot;, &quot;description&quot;: &quot;A simple dice rolling tool&quot; }<br>  ]<br>}</pre><p><strong>Example: Invoke a tool</strong></p><pre>curl http://localhost:3000/api/mcp -X POST \<br>-H &quot;Content-Type: application/json&quot; \<br>-d &#39;{&quot;tool&quot;: &quot;roll_dice&quot;, &quot;input&quot;: { &quot;sides&quot;: 10 }}&#39;</pre><p><strong>Expected output</strong></p><pre>{<br>  &quot;content&quot;: [<br>    { &quot;type&quot;: &quot;text&quot;, &quot;text&quot;: &quot;Rolled a d10: 7&quot; }<br>  ]<br>}</pre><blockquote>⚠️ This approach works, but it’s manual, tedious, and can quickly become challenging. It doesn’t scale well for multiple tools, complex inputs, or streaming outputs - <strong>in fact, it won’t work properly with MCP servers that stream results</strong>.</blockquote><p><strong>The Challenge of Multiple MCP Server Connections</strong></p><p>One part of the problem is that MCP servers can be accessed in several ways, and each comes with its own testing challenges:</p><ul><li><strong>HTTP/HTTPS</strong> — the most common approach. Easy to test with curl or Postman, but when your tools stream partial outputs. via <strong>SSE (</strong>widely used for streaming incremental results from LLMs or tools<strong>) </strong>or <strong>WebSocket (</strong>used for bidirectional communication or interactive sessions<strong>)</strong>, manual testing becomes tedious. You either have to handle streaming events manually or wait for the final result, losing visibility into intermediate steps.</li><li><strong>stdin/stdout (local child processes)</strong> — simple for single-host testing, but impossible to simulate networked MCP server behavior, authentication, or streaming responses.</li><li><strong>Other transports</strong> — like gRPC, message queues, or Unix sockets, are even harder to test without specialized tooling.</li></ul><p>💡 The key takeaway: <strong>manual testing becomes painful as soon as your MCP server isn’t just a simple HTTP endpoint returning JSON.</strong> You need a way to invoke tools, watch intermediate outputs, and inspect structured data <strong>without relying on an LLM or full deployment</strong>.</p><h3>Step 2: Why I Built My Own MCP Tester</h3><p>Advanced tools (structured data, API calls, multiple actions) revealed limits of manual testing:</p><ul><li>❌ Tool calls inside an LLM are hard to debug</li><li>❌ You only see the final message, not intermediate steps</li><li>❌ Most setups require deployment before you can test</li></ul><p>Every small change required redeploying and guessing what went wrong.</p><p>There are already great open-source MCP inspector tools — like <a href="https://github.com/modelcontextprotocol/inspector">Model Context Protocol Inspector</a> — that help visualize and debug interactions.<br> But I wanted to <strong>simulate the full flow between Chat, MCP, and Tools</strong>, and honestly, I just <strong>enjoy building dev tools</strong>, so I built my own.</p><p>That’s why I built the <strong>Local MCP Tester</strong>, which lets you:</p><ul><li>✅ Discover MCP servers and see all tools</li><li>⚙️ Invoke tools directly with custom input</li><li>🧩 Inspect structured outputs</li><li>📜 View logs, errors, and execution details in real time</li><li>🚀 Run on all type of MCP servers connections</li></ul><p>Hence, <strong>mcp-tools-tester</strong> was born.</p><h3>Step 3: Introducing mcp-tools-tester</h3><p><strong>mcp-tools-tester</strong> is an open-source project to test MCP tools locally, visually, and interactively.<br> It provides both:</p><ul><li><strong>API layer</strong>: Calls your MCP server</li><li><strong>React UI</strong>: Interactive tool runner</li></ul><p><strong>Features:</strong></p><ul><li>🔍 Tool discovery</li><li>💬 Interactive runner</li><li>📄 Structured output display</li><li>🧠 LLM integration ready</li></ul><h3>Step 4: Running and using the App</h3><h3>Running the app using Docker Compose</h3><p>The easiest way to run the tester is using Docker Compose.</p><ol><li>Clone the repository:</li></ol><pre>git clone https://github.com/ofirelarat/mcp-tools-tester.git<br>cd mcp-tools-tester</pre><ol><li>Build and run with Docker Compose:</li></ol><pre>docker compose up --build</pre><ol><li>Open the client UI in your browser:</li></ol><pre>http://localhost:5173</pre><h3>Sample MCP Servers</h3><p>In the app project, I’ve included two sample MCP servers for testing that you can check and try out:</p><ol><li><strong>Express MCP Sample</strong></li><li><strong>Next.js MCP Sample</strong></li></ol><h4>Running the Express MCP Sample</h4><pre>cd express-mcp-sample<br>npm install<br>npm start</pre><p>This will run the Express MCP server on port 3005, which can be connected via HTTP.</p><h4>Running the Next.js MCP Sample</h4><pre>cd next-mcp-sample<br>npm install<br>npm run dev</pre><p>This will run the Next.js MCP server on port 3000 (default Next.js dev server), which you can also connect to via HTTP.</p><h3>Using the Tester Tabs</h3><p>The app has <strong>three main tabs</strong>:</p><h4>1️⃣ MCP Investigator</h4><ul><li>Inspect and run tools in your MCP servers</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*peun9yoNHxVKFueV4ugsmg.png" /></figure><ul><li>MCP definitions are located under:</li></ul><pre>/api/src/mcps</pre><ul><li>Example definition: example-mcp.json</li></ul><pre>{<br>  &quot;id&quot;: &quot;local-mcp&quot;,<br>  &quot;name&quot;: &quot;Local MCP Server&quot;,<br>  &quot;description&quot;: &quot;MCP endpoint for local testing&quot;,<br>  &quot;url&quot;: &quot;http://localhost:3000/mcp&quot;<br>}</pre><h4>2️⃣ Tools Investigator</h4><ul><li>Inspect and run all tools</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NGKo5r1LzhpVZ5EcTE6lVQ.png" /></figure><ul><li>Tool definitions are in:</li></ul><pre>/api/src/tools/tools.js</pre><ul><li>Example tools:</li></ul><pre>const tools = [<br>  {<br>    id: &quot;example-echo&quot;,<br>    name: &quot;Example Echo&quot;,<br>    description: &quot;Echoes the input message.&quot;,<br>    inputs: { message: { type: &quot;string&quot; } },<br>    outputs: { content: { type: &quot;object&quot; } },<br>    type: &quot;mock&quot;,<br>    execute: async (input) =&gt; {<br>      if (!input.message) return { error: &quot;Missing input: message&quot; };<br>      return { content: [{ type: &quot;text&quot;, text: input.message }] };<br>    },<br>  },<br>  {<br>    id: &quot;reverse-string&quot;,<br>    name: &quot;Reverse String&quot;,<br>    description: &quot;Reverses the input string.&quot;,<br>    inputs: { text: { type: &quot;string&quot; } },<br>    outputs: { content: { type: &quot;object&quot; } },<br>    type: &quot;mock&quot;,<br>    execute: async (input) =&gt; {<br>      if (!input.text) return { error: &quot;Missing input: text&quot; };<br>      return { content: [{ type: &quot;text&quot;, text: input.text.split(&quot;&quot;).reverse().join(&quot;&quot;) }] };<br>    },<br>  },<br>];<br>module.exports = { tools };</pre><h4>3️⃣ Chat View</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qQe2mm8d3P4yVAcCtXeshg.png" /></figure><ul><li>Test your tools and MCP against a real LLM</li><li>Select a provider (OpenAI or Claude) and enter your API key</li><li>Start chatting and verify tool calls behave as expected</li></ul><h3>Why It Matters</h3><p>Fast feedback loops are critical in MCP development.<br> <strong>mcp-tools-tester</strong> removes friction:</p><ul><li>Test and inspect results quickly</li><li>Refine logic safely</li><li>Iterate without LLM dependency or redeploy</li></ul><h3>Closing Thoughts</h3><p>MCP unlocks powerful capabilities for extending LLMs, but you can only leverage them if you can <strong>develop, test, and iterate quickly</strong>.</p><p><strong>mcp-tools-tester</strong> gives developers a fast, transparent, and enjoyable way to experiment locally.</p><p>If you haven’t read it yet, check out <a href="https://medium.com/@ofirelarat/part-1-discovering-mcp-my-journey-to-building-a-local-tool-tester-f9e893e68c5c"><strong>Part 1: Building Your MCP Server</strong></a> to see how to set up your first MCP server and register tools.</p><p>👉 Try it: <a href="https://github.com/ofirelarat/mcp-tools-tester">github.com/ofirelarat/mcp-tools-tester</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39d51a378a3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: Discovering MCP with JS — My Journey to building and testing MCP]]></title>
            <link>https://javascript.plainenglish.io/part-1-discovering-mcp-my-journey-to-building-a-local-tool-tester-f9e893e68c5c?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9e893e68c5c</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Fri, 31 Oct 2025 17:00:41 GMT</pubDate>
            <atom:updated>2026-01-10T08:18:05.375Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Discovering MCP with JS - My Journey to building and testing MCP</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*Imb05FM3rjPssTLHa2PG2A.png" /></figure><h3><strong>Introduction: Why MCP?</strong></h3><p>I recently started exploring MCP — a framework that lets you extend large language models (LLMs) with custom tools.</p><p>Imagine this: you want an AI that can:</p><ul><li>Fetch the latest weather</li><li>Roll dice for a game</li><li>Query your internal database</li><li>Trigger actions in your apps</li></ul><p>Without MCP, you’d need to manually write glue code for each tool, handle inputs/outputs, validate schemas, and orchestrate execution. MCP standardizes all of this.</p><p>In fact, this architecture — tools + schema + standardized execution — is one of the key building blocks that makes <strong>agents</strong> possible: autonomous workflows where an AI decides which tools to call, in what order, and with what input. MCP provides the scaffolding so tools can be registered, discovered, and executed reliably by an LLM or agent.</p><p><strong>Series Overview:</strong></p><ul><li><strong>Part 1:</strong> Building a simple MCP server and registering your first tools</li><li><strong>Part 2:</strong> Testing MCP tools locally with a custom interactive tester</li></ul><p>In this series, I’ll guide you through both parts, showing how to go from server setup to fast, safe experimentation.</p><h3>What is MCP?</h3><p>MCP stands for <strong>Model Context Protocol</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hMiQv4HPGMsufPozsRzyzA.png" /></figure><p>At its core, MCP allows you to:</p><ul><li><strong>Register tools</strong> with input/output definitions</li><li><strong>Expose tools</strong> to an LLM or agent</li><li><strong>Run tools</strong> in a controlled environment</li><li><strong>Combine tools</strong> into workflows</li></ul><p>Think of it as a <strong>plugin system for LLMs</strong>. Without MCP, every new tool would require custom integration logic. MCP makes tools <strong>reusable, reliable, and easy to extend</strong>, while providing a consistent developer experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NBycDJjosFUTYvk79ZfgKg.png" /></figure><h3>The Role of Tools in MCP</h3><p>A <strong>tool</strong> in MCP is essentially:</p><ul><li>A function your LLM can call</li><li><strong>Input schema:</strong> what the tool expects</li><li><strong>Output schema:</strong> what it returns</li><li><strong>Metadata:</strong> name, description, and optionally categories or tags</li></ul><p>At a high level, a tool represents a <strong>bridge between language and action - </strong>it transforms your model from a text generator into an interactive, data-aware system.</p><p>While MCP provides a standardized way to register, expose, and manage tools, it’s important to note that <strong>tools can exist and operate independently of MCP</strong>.<br> You can create and use tools directly in your own applications - for example, connecting an LLM to a weather API, a database, or an internal business system. MCP simply gives you a framework to organize and expose them in a consistent way.</p><p><strong>Example 1: A Simple “Echo Tool”</strong></p><pre>{<br>  &quot;name&quot;: &quot;echo&quot;,<br>  &quot;description&quot;: &quot;Echoes back the input string&quot;,<br>  &quot;parameters&quot;: [<br>    { &quot;name&quot;: &quot;message&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;Text to echo&quot; }<br>  ]<br>}</pre><p>This is a minimal example — it just returns whatever message you pass in.</p><p><strong>Example 2: A “Weather Tool” (Real Data Example)</strong></p><pre>{<br>  &quot;name&quot;: &quot;weather&quot;,<br>  &quot;description&quot;: &quot;Fetches current weather data for a given city&quot;,<br>  &quot;parameters&quot;: [<br>    { &quot;name&quot;: &quot;city&quot;, &quot;type&quot;: &quot;string&quot;, &quot;description&quot;: &quot;City name&quot; }<br>  ],<br>  &quot;returns&quot;: {<br>    &quot;temperature&quot;: &quot;number&quot;,<br>    &quot;condition&quot;: &quot;string&quot;,<br>    &quot;humidity&quot;: &quot;number&quot;<br>  }<br>}</pre><p>In your LLM or MCP server, this tool could call a real weather API (like OpenWeatherMap) behind the scenes:</p><pre>async function weather({ city }) {<br>  const res = await fetch(`https://api.openweathermap.org/data/2.5/weather?q=${city}&amp;appid=YOUR_API_KEY`);<br>  const data = await res.json();<br>  return {<br>    content: [<br>      {<br>        type: &quot;text&quot;,<br>        text: `The weather in ${city} is ${data.weather[0].description}, temperature ${Math.round(data.main.temp - 273.15)}°C.`,<br>      },<br>    ],<br>  };<br>}</pre><p>This demonstrates how <strong>tools expand your LLM’s capabilities - </strong>letting it access real-world data and perform meaningful tasks far beyond pure text generation.</p><p>Later in this series, we’ll see how to build and test tools like these in your <strong>local MCP tester</strong>, including how to safely execute and inspect their structured outputs.</p><h3>Building a Simple MCP Server with Next.js: Roll-a-Dice Example</h3><p>In this section, we’ll create a <strong>minimal MCP server</strong> using <strong>Next.js API routes</strong>. Our tool will be a simple <strong>roll-a-dice function</strong> that the LLM can call.</p><h4>Step 1: Set Up the Next.js Project</h4><pre>npx create-next-app@latest mcp-tester --typescript<br>cd mcp-tester<br>npm install zod<br>npm install @vercel/mcp-adapter zod</pre><p>We’ll use <strong>TypeScript</strong> for type safety and <strong>Zod</strong> for input validation.</p><h4>Step 2: Create the MCP API Route</h4><p>Create pages/api/mcp/route.ts (or app/api/mcp/route.ts if using Next.js App Router):</p><pre>import { createMcpHandler } from &quot;@vercel/mcp-adapter&quot;;<br>import z from &quot;zod&quot;;<br><br>const mcpHandler = createMcpHandler(<br>  (server) =&gt; {<br>    server.tool(<br>      &quot;role_dice&quot;,<br>      &quot;Roll dice in NdM format (e.g., 2d6)&quot;,<br>      {<br>        sides: z.number().min(2).max(20).optional().default(6),<br>      },<br>      async ({ sides }) =&gt; {<br>        const result = Math.floor(Math.random() * sides) + 1;<br>        return {<br>          content: [<br>            {<br>              type: &quot;text&quot;,<br>              text: &quot;Rolled a d&quot; + sides + &quot;: &quot; + result,<br>            },<br>          ],<br>        };<br>      }<br>    );<br>  },<br>  {<br>    serverInfo: { name: &quot;TEST MCP&quot;, version: &quot;1.0&quot; },<br>    capabilities: {<br>      tools: {<br>        role_dice: { description: &quot;A simple dice rolling tool&quot; },<br>      },<br>    },<br>  },<br>  {<br>    redisUrl: process.env.REDIS_URL,<br>    basePath: &quot;&quot;,<br>    verboseLogs: true,<br>    maxDuration: 60,<br>    disableSse: true,<br>  }<br>);<br><br>export { mcpHandler as GET, mcpHandler as POST, mcpHandler as DELETE };</pre><h3>Step 3: How It Works</h3><p>The MCP server setup is simple yet powerful. Here’s a breakdown:</p><ol><li><strong>createMcpHandler</strong><br> This function wraps your server logic and exposes it via HTTP, making your tools accessible programmatically or through a browser.</li><li><strong>Registering a Tool (</strong><strong>server.tool)</strong><br> You can register a new tool with all its metadata and logic:</li></ol><ul><li><strong>Name:</strong> &quot;roll_dice&quot;</li><li><strong>Description:</strong> &quot;Roll dice in NdM format&quot;</li><li><strong>Input Schema:</strong> sides (validated using Zod)</li><li><strong>Handler Function:</strong> Performs the dice roll and returns structured content</li></ul><p><strong>3. Server Info &amp; Capabilities<br></strong>Describe your server and the tools it exposes, helping clients understand what’s available.</p><p><strong>4. Options </strong>Configure additional features such as:</p><ul><li>Redis for caching</li><li>Logging</li><li>Execution duration limits</li><li>SSE (Server-Sent Events) configuration</li></ul><p>You can also check out <strong>working examples</strong> of MCP servers:</p><ul><li><strong>Express MCP Sample:</strong> <a href="https://github.com/ofirelarat/mcp-tools-tester/tree/main/express-mcp-sample">express-mcp-sample</a></li><li><strong>Next.js MCP Sample:</strong> <a href="https://github.com/ofirelarat/mcp-tools-tester/tree/main/next-mcp-sample">next-mcp-sample</a></li></ul><p>These samples demonstrate how to register tools, handle inputs, and expose your MCP server for testing and integration.</p><h3>Next Steps</h3><p>Now that we’ve built our first MCP tool and set up a Next.js MCP server, the next step is testing it in action. While our tool is ready to roll dice, seeing it work interactively and inspecting the outputs will bring it to life.</p><p>In <strong>Part 2</strong>, we’ll dive into building a <strong>custom MCP tester</strong> — a local environment with both UI and API to:</p><ul><li>Call and invoke tools like roll_dice directly from a browser or programmatically</li><li>Log inputs and outputs for easier debugging</li><li>Display structured content returned by tools in a clear format</li><li>Optionally integrate with LLMs so tools can be called automatically as part of AI workflows</li></ul><p>By the end of the next article, you’ll have a complete sandbox for experimenting with MCP tools, making it easy to iterate, test, and expand your toolset safely.</p><h3>Closing Thoughts</h3><p>MCP is a powerful framework, but learning it can be tricky without hands-on experimentation.</p><p>In the next article, we’ll dive into creating your first MCP tool, so you can see it in action.</p><p><a href="https://medium.com/@ofirelarat/part-2-testing-your-mcp-building-a-local-mcp-tool-tester-39d51a378a3d">Continue to Part 2 →</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9e893e68c5c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/part-1-discovering-mcp-my-journey-to-building-a-local-tool-tester-f9e893e68c5c">Part 1: Discovering MCP with JS — My Journey to building and testing MCP</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering War]]></title>
            <link>https://medium.com/codex/rendering-war-95c6ccf06a5e?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/95c6ccf06a5e</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[static-site-generation]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Fri, 17 Jan 2025 08:56:19 GMT</pubDate>
            <atom:updated>2025-11-03T12:54:36.486Z</atom:updated>
            <content:encoded><![CDATA[<p>In the evolving landscape of web development, choosing the right rendering paradigm is crucial to achieving optimal performance, scalability, and user experience. This guide consolidates research on the four primary rendering paradigms — Static Site Generation (SSG), Server-Side Rendering (SSR), Client-Side Rendering (CSR), and Incremental Static Regeneration (ISR) — to provide a unified resource for understanding their benefits, trade-offs, and practical applications. Whether you’re building a dynamic e-commerce platform or a static blog, understanding these paradigms can help you make informed architectural decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*pKWzZsb__1IPa7IbY4VWnA.png" /></figure><h3>Why Knowing the Differences Matters</h3><p>Web rendering paradigms significantly impact key aspects such as:</p><ul><li><strong>Performance:</strong> Faster page loads enhance user engagement and retention.</li><li><strong>SEO:</strong> Search engines rank sites based on factors like content visibility and speed.</li><li><strong>Scalability:</strong> Efficient resource use ensures sites can handle high traffic.</li><li><strong>Developer Experience:</strong> Simplifying workflows leads to faster, more maintainable development cycles.</li></ul><p>Each paradigm has trade-offs — understanding these is essential to selecting the right approach for your specific use case.</p><p><em>(For more information on measuring performance and understanding how it impacts user experience and SEO, click </em><a href="https://medium.com/codex/web-vitals-0af3b747cc11"><em>here</em></a><em>)</em></p><h3>Rendering Paradigms Overview</h3><ol><li><strong>Client-Side Rendering (CSR)</strong><br>Renders content entirely in the browser after downloading a minimal HTML shell and JavaScript. Common for highly interactive single-page applications.<br><a href="https://medium.com/@ofirelarat/rendering-war-client-side-rendering-ad47f906f99b"><strong>Read more about CSR</strong></a></li><li><strong>Static Site Generation (SSG)</strong><br>Pre-renders pages during build time to serve static HTML. Ideal for static or infrequently updated content.<br><a href="https://medium.com/@ofirelarat/rendering-war-static-site-generation-ssg-c87cf8cf7b92"><strong>Read more about SSG.</strong></a></li><li><strong>Incremental Static Regeneration (ISR)</strong><br>Combines the performance of SSG with the flexibility of SSR by allowing static pages to be rebuilt in the background. Ideal for content-driven sites with semi-frequent updates.<br><a href="https://medium.com/@ofirelarat/rendering-war-incremental-static-regeneration-isr-26062166da07"><strong>Read more about ISR</strong></a></li><li><strong>Server-Side Rendering (SSR)<br></strong>Dynamically generates HTML on each request, suitable for real-time or personalized content.<br><a href="https://medium.com/@ofirelarat/rendering-war-server-side-rendering-ssr-26215f3b5304"><strong>Read more about SSR</strong></a></li></ol><h3><strong>Tools of the Trade: Frameworks and Ecosystem</strong></h3><p>Below is a comparison of popular frameworks and tools that support different rendering paradigms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13UzXToLGpGsHwGHK888nQ.png" /></figure><h3>Performance Comparison</h3><p>Our goal is to understand how each paradigm performs in a controlled environment by measuring Core Web Vitals, which are essential for evaluating real-world performance.</p><h4>How We Compare and Why</h4><p>To ensure a fair comparison, we built a demo application using each rendering paradigm. The application fetches and displays a catalog of images, along with metadata, using data from the following mock APIs:</p><ul><li><a href="https://jsonplaceholder.typicode.com/photos">Photos API</a></li><li><a href="https://jsonplaceholder.typicode.com/albums">Albums API</a></li><li><a href="https://jsonplaceholder.typicode.com/users">Users API</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jpdkzr1aVTTN7wv24WgQwQ.png" /><figcaption>The SSG demo for example</figcaption></figure><h4>Metric for Evaluation</h4><ul><li><strong>First Contentful Paint (FCP):</strong> Measures the time it takes for the first piece of content to appear on the screen. This metric is especially relevant as it provides a clear indication of when the rendering process begins for the user.</li></ul><h4>Why FCP?</h4><p>FCP offers a focused and reliable way to evaluate initial performance. While other metrics like Largest Contentful Paint (LCP) depend heavily on image load times, FCP isolates when content starts rendering. Additionally, the use of cpuSlowdownMultiplier in our testing environment emphasizes JavaScript rendering speed, making FCP particularly relevant for comparisons involving CSR.</p><h4>Relationship Between FCP and LCP</h4><p>LCP is heavily influenced by FCP since a faster start to content rendering (better FCP) typically leads to a quicker LCP. In scenarios where FCP is optimized, the LCP naturally benefits as the largest visible content often builds upon what is first rendered. By focusing on FCP in this study, we can infer relative improvements in LCP across paradigms.</p><h4>Why Core Web Vitals?</h4><p>These metrics provide a clear and standardized way to evaluate user experience across the paradigms.</p><h4>Testing Environment</h4><p>We use <a href="https://github.com/harlan-zw/unlighthouse">Unlighthouse</a> for benchmarking. Tests simulate a desktop environment with throttled network and CPU to emulate real-world conditions. Each paradigm is deployed locally to eliminate external variables.</p><h3>How We Built Each Rendering Paradigm</h3><h4>Client-Side Rendering (CSR)</h4><p>The CSR application fetches all data in the browser after the page loads. This approach prioritizes interactivity but may delay content visibility and affect LCP negatively.</p><p>Key steps:</p><ol><li>Initialize a React app using Vite.</li><li>Fetch data with axios inside a useEffect hook.</li><li>Render the catalog dynamically.</li></ol><h4>Static Site Generation (SSG)</h4><p>The SSG application fetches data during build time, producing pre-rendered HTML files. This ensures fast initial load times but requires rebuilding to update content.</p><p>Key steps:</p><ol><li>Use Next.js with getStaticProps.</li><li>Fetch data during the build process.</li><li>Render pre-generated HTML.</li></ol><h4>Incremental Static Regeneration (ISR)</h4><p>The ISR application combines SSG’s benefits with the ability to update content periodically without a full rebuild. This balances performance and freshness.</p><p>Key steps:</p><ol><li>Use Next.js with getStaticProps and revalidate.</li><li>Specify a revalidation period (e.g., 60 seconds).</li></ol><h4>Server-Side Rendering (SSR)</h4><p>The SSR application fetches data and generates HTML on every request. This ensures fresh content but may affect server response time under load.</p><p>Key steps:</p><ol><li>Use Next.js with getServerSideProps.</li><li>Fetch data for each incoming request.</li></ol><h4>Disclaimer</h4><p>The results and insights presented here are specific to this scenario and testing environment. Real-world performance may vary based on application complexity, server infrastructure, network conditions, and caching strategies. Use these results as a guideline rather than an absolute conclusion.</p><p>You can check out the benchmark repo <a href="https://github.com/ofirelarat/rendering-war">here</a>.</p><h3>Results</h3><h4>First Contentful Paint (FCP) Comparison</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*9tWzGkkBdjXPi0-VIJYAtA.png" /></figure><h4>Observations</h4><ol><li><strong>CSR</strong> exhibits the highest FCP due to delayed data fetching and rendering in the browser. This is significantly affected by the CPU throttling applied in our testing environment, which amplifies the impact of JavaScript execution delays.</li><li><strong>SSG</strong> achieves the fastest FCP by serving pre-generated static files.</li><li><strong>ISR</strong> matches SSG in FCP performance, but may introduce minor delays during regeneration periods.</li><li><strong>SSR</strong> balances content freshness with performance but has slightly higher FCP due to server-side processing, the CPU throttling didn’t impact the SSR result as the server generate the content and not client.</li></ol><h3>Summary</h3><ul><li><strong>CSR</strong>: Best suited for highly interactive apps where initial load time is less critical.</li><li><strong>SSG</strong>: Ideal for static content that rarely changes, offering excellent FCP performance.</li><li><strong>ISR</strong>: A hybrid approach that combines the strengths of SSG with content freshness.</li><li><strong>SSR</strong>: Best for dynamic content that requires frequent updates but may struggle with high traffic.</li></ul><p>Each paradigm has its strengths and trade-offs. Choosing the right one depends on your application’s requirements and user expectations. For this specific scenario, <strong>ISR</strong> offer the best balance of performance and content freshness based on FCP results.</p><h3>Guidelines to Choose the Right Paradigm</h3><p>Selecting the best rendering paradigm depends on your project’s specific needs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*iMjtXUEhK8y22qlwKJn88w.png" /></figure><p><strong>Considerations:</strong></p><ul><li>If SEO is a top priority, favor SSG or SSR.</li><li>For frequently updated content, opt for ISR or SSR.</li><li>For lightweight applications with high interactivity, CSR may suffice.</li></ul><h3>The Future of Web Rendering</h3><p>The boundaries between rendering paradigms are blurring as modern frameworks continue to evolve. The future likely includes:</p><ul><li><strong>Hybrid Approaches:</strong> Tools like Next.js and Nuxt.js are already combining paradigms for maximum flexibility.</li><li><strong>Edge Computing:</strong> Serverless and edge-rendering solutions are becoming more prevalent, enabling faster and more localized SSR and ISR.</li><li><strong>Improved Developer Tools:</strong> Simplified workflows and better integration of paradigms will make it easier for developers to deliver optimal performance.</li><li><strong>WebAssembly and Beyond:</strong> Innovations like WebAssembly might shift rendering workloads closer to the browser while maintaining performance.</li><li><strong>React 19 Rendering Features</strong>: With the introduction of its Client, Static, and Server APIs, React 19 empowers developers to seamlessly integrate client-side, static, and server-side rendering. These features enable more efficient hydration, tree-shaking, and concurrent rendering, setting the stage for next-generation hybrid and dynamic web applications.</li></ul><p>As web applications grow more complex, the ability to tailor rendering strategies to specific needs will remain a cornerstone of high-performing, user-friendly applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95c6ccf06a5e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/rendering-war-95c6ccf06a5e">Rendering War</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering War: Server-Side Rendering (SSR)]]></title>
            <link>https://ofirelarat.medium.com/rendering-war-server-side-rendering-ssr-26215f3b5304?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/26215f3b5304</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 20:06:21 GMT</pubDate>
            <atom:updated>2025-01-17T08:57:22.682Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a larger series that explores the different paradigms of web rendering (<a href="https://medium.com/@ofirelarat/rendering-war-95c6ccf06a5e">Read More</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*e0SC0-o1yOGBe8es0s3OqA.png" /></figure><p>In modern web development, selecting the right rendering paradigm is crucial, as each approach — SSR, ISR, SSG, CSR, and RSC — has its unique advantages and trade-offs. These paradigms impact aspects such as performance, scalability, and user experience, all of which are essential for meeting the demands of today’s web.</p><p>In this article, we take a deep dive into Server-Side Rendering (SSR), exploring its benefits, limitations, and its role in modern web applications.</p><h3>What is SSR?</h3><p>Server-Side Rendering (SSR) is a web rendering paradigm where pages are generated dynamically on the server at the time of a user’s request. Instead of serving pre-built static files, SSR generates the HTML for a page on demand, using the latest data and templates.</p><p>This approach allows developers to deliver up-to-date content with every request, making SSR particularly useful for applications requiring real-time or highly dynamic data.</p><h3>How Does SSR Work?</h3><p>With SSR, the server handles the rendering of HTML for each request, ensuring the user receives a fully-rendered page. Here’s a step-by-step overview of how SSR works:</p><h4>Step 1: Request Processing</h4><p>When a user requests a page, the server receives the request and determines which data and templates are needed to generate the HTML.</p><h4>Step 2: Data Fetching and Rendering</h4><p>The server fetches data from APIs, databases, or other sources and combines it with the appropriate templates to create the HTML. This process happens in real time, ensuring the content is always up-to-date.</p><h4>Step 3: Serving the Rendered Page</h4><p>Once the HTML is generated, it is sent to the user’s browser. The browser displays the page immediately, while any additional JavaScript or assets are loaded in the background to enhance interactivity.</p><h3>Visualizing the SSR Lifecycle: From Request to Rendered Page</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gioZV6YIFttrzT5lPl8PlQ.png" /></figure><ol><li><strong>User Request:</strong> The browser sends a request to the server for a specific page.</li><li><strong>Server Rendering:</strong> The server dynamically generates the HTML for the requested page using data and templates.</li><li><strong>Page Delivery:</strong> The fully-rendered HTML is sent to the browser, allowing the user to see the content quickly.</li><li><strong>Hydration:</strong> If the page is built with frameworks like React or Vue, JavaScript is loaded to make the page interactive.</li></ol><h3>Tools of the Trade: Frameworks and Ecosystem</h3><p>Server-Side Rendering is supported by various modern frameworks and libraries, making it easier for developers to implement SSR in their applications. Popular tools include:</p><ul><li><strong>Next.js:</strong> Provides built-in support for SSR with getServerSideProps to fetch and render data on the server.</li><li><strong>Nuxt.js:</strong> Offers SSR capabilities for Vue-based applications.</li><li><strong>Express and Handlebars/EJS:</strong> Traditional approaches for implementing SSR in Node.js environments.</li></ul><p>With React 19, the <strong>Server API</strong> introduces significant advancements in server-rendered applications by streamlining server-side component rendering and enabling concurrent rendering capabilities. This improves performance, reduces latency, and allows for more efficient handling of complex UI updates in SSR workflows.</p><p>These tools simplify the process of fetching data, managing templates, and ensuring efficient delivery of rendered pages.</p><h3>Trade-offs: The Good, the Bad, and the Dynamic</h3><p>While SSR provides unparalleled flexibility and real-time content updates, there are trade-offs to consider:</p><ul><li><strong>Performance Overhead:</strong> Generating HTML on demand can increase server load and response times compared to pre-rendered pages.</li><li><strong>Complexity:</strong> Managing server-side rendering and caching strategies can add development and maintenance challenges.</li><li><strong>Scalability:</strong> Handling high traffic requires robust infrastructure to ensure fast response times.</li></ul><h3>When to Choose SSR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*o3o9O5PQO-RVitgh_zo45Q.png" /></figure><p>SSR is ideal for websites and applications that prioritize real-time updates, dynamic content, and SEO optimization. Common use cases include:</p><ul><li><strong>E-commerce Platforms:</strong> Personalized shopping experiences with dynamic product recommendations and inventory updates.</li><li><strong>News Websites:</strong> Delivering the latest news or live updates to users.</li><li><strong>Web Applications:</strong> Platforms requiring user authentication or personalized dashboards.</li></ul><p>By leveraging SSR, developers can create dynamic, SEO-friendly applications that adapt to user needs in real time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26215f3b5304" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering War: Incremental Static Regeneration (ISR)]]></title>
            <link>https://ofirelarat.medium.com/rendering-war-incremental-static-regeneration-isr-26062166da07?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/26062166da07</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[static-site-generation]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[web-performance]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 20:04:33 GMT</pubDate>
            <atom:updated>2025-01-17T08:58:00.729Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a larger series that explores the different paradigms of web rendering (<a href="https://medium.com/@ofirelarat/rendering-war-95c6ccf06a5e">Read More</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/322/1*kBLJYPdC3nr9AIgPEcaJXQ.png" /></figure><p>In modern web development, selecting the right rendering paradigm is crucial, as each approach — ISR, SSG, CSR, SSR, and RSC — has its unique advantages and trade-offs. These paradigms impact aspects such as performance, scalability, and user experience, all of which are essential for meeting the demands of today’s web.</p><p>In this article, we take a deep dive into Incremental Static Regeneration (ISR), exploring its benefits, limitations, and its role in modern web applications.</p><h3>What is ISR?</h3><p>Incremental Static Regeneration (ISR) is a hybrid web rendering paradigm that combines the performance benefits of Static Site Generation (SSG) with the dynamic flexibility of Server-Side Rendering (SSR). With ISR, pages are pre-rendered at build time and can be updated or regenerated on demand during runtime without requiring a full rebuild of the site.</p><p>This approach enables developers to create static sites that can serve dynamic or frequently updated content efficiently. ISR is particularly useful for scenarios where some content changes frequently while other parts of the site remain relatively static.</p><h3>How Does ISR Work?</h3><p>With ISR, you define specific pages or routes to be regenerated after a certain period or when triggered by user interactions. Here’s a step-by-step overview of how ISR works:</p><h4>Step 1: Build Time Compilation</h4><p>At build time, static pages are generated and deployed as part of the application. These pages are served as static files initially, providing the same benefits as SSG in terms of speed and scalability.</p><h4>Step 2: On-Demand Regeneration</h4><p>Unlike traditional SSG, ISR introduces the ability to regenerate specific pages at runtime. Developers define a “revalidation period” (e.g., 60 seconds), after which the static content can be refreshed. When a user requests a page, if the revalidation period has expired, the server fetches fresh data, regenerates the page, and updates the cached version — all in the background. Subsequent requests will then serve the updated version.</p><h4>Step 3: Serving Cached and Updated Content</h4><p>During regeneration, ISR ensures users always see either the most recent static version or the updated version if regeneration has completed. This results in a seamless experience for end-users while maintaining near-instant page load speeds.</p><h3>Visualizing the ISR Lifecycle: From Build to Regeneration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLjif-qj15qhJP0LQvc50g.png" /></figure><ol><li><strong>Build Time Compilation:</strong> During deployment, pages are pre-rendered as static files using data fetched from APIs, CMS, or other sources.</li><li><strong>Serving Static Content:</strong> Users are served pre-built pages instantly from the CDN cache, ensuring fast load times.</li><li><strong>Regeneration Trigger:</strong> When the revalidation period expires, or a specific API trigger is invoked, fresh data is fetched, and the page is regenerated.</li><li><strong>Background Update:</strong> The updated page replaces the old version in the cache, ready to be served for subsequent requests.</li></ol><h3>Tools of the Trade: Frameworks and Ecosystem</h3><p>Incremental Static Regeneration is primarily supported by frameworks like <strong>Next.js</strong>, which provides out-of-the-box ISR functionality through its getStaticProps and revalidation configuration. These tools allow developers to define revalidation intervals or trigger updates via APIs.</p><p>With React 19, the <strong>Static API</strong> further complements ISR by enabling more granular control over static content generation, making it easier to integrate pre-rendered and regenerated content seamlessly in hybrid applications.</p><p>Since ISR generates pages on demand, hosting providers like <strong>Vercel</strong> and <strong>Netlify</strong> offer optimized deployment environments for such applications. These providers handle caching, regeneration, and distribution seamlessly, allowing developers to focus on building features rather than managing infrastructure.</p><h3>Trade-offs: The Good, the Bad, and the Flexible</h3><p>While ISR offers an excellent middle ground between SSG and SSR, providing significant SEO and performance benefits, there are trade-offs to consider:</p><ul><li><strong>Complexity:</strong> Implementing ISR requires careful configuration of revalidation periods and caching strategies.</li><li><strong>Data Fetching Overhead:</strong> Regeneration involves fetching fresh data, which can add latency during the update process.</li><li><strong>Limited Real-Time Capabilities:</strong> While ISR handles frequent updates well, it’s not a substitute for truly real-time rendering (e.g., WebSockets or live APIs).</li></ul><h3>When to Choose ISR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*2ezx-5lt3zcn6bYRdkOJ8Q.png" /></figure><p>ISR is ideal for websites that need the performance benefits of static sites but require dynamic or frequently updated content. Common use cases include:</p><ul><li><strong>E-commerce Sites:</strong> Product inventory or pricing updates.</li><li><strong>News Portals:</strong> Publishing breaking news or articles with high traffic.</li><li><strong>Content Platforms:</strong> Blogs or documentation sites where some pages change frequently while others remain static.</li></ul><p>By leveraging ISR, developers can deliver fast, scalable, and dynamic experiences without compromising on performance or SEO.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26062166da07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering War: Static Site Generation (SSG)]]></title>
            <link>https://ofirelarat.medium.com/rendering-war-static-site-generation-ssg-c87cf8cf7b92?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/c87cf8cf7b92</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[static-site-generation]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Wed, 15 Jan 2025 20:01:46 GMT</pubDate>
            <atom:updated>2025-01-17T08:58:26.041Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a larger series that explores the different paradigms of web rendering (<a href="https://medium.com/@ofirelarat/rendering-war-95c6ccf06a5e">Read More</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/311/1*h1_3aVRE5EZbcYEbZdzy0Q.png" /></figure><p>In modern web development, selecting the right rendering paradigm is crucial, as each approach — SSG, CSR, SSR, ISR, and RSC — has its unique advantages and trade-offs. These paradigms impact aspects such as performance, scalability, and user experience, all of which are essential for meeting the demands of today’s web.</p><p>In this article, we take a deep dive into Static Site Generation (SSG), exploring its benefits, limitations, and its role in modern web applications.</p><h3>What is SSG?</h3><p>Static Site Generation (SSG) is a web rendering paradigm where pages are pre-rendered at build time, meaning the HTML for each page is generated beforehand, and the resulting files are served as static assets. This approach contrasts with server-side rendering (SSR) and client-side rendering (CSR), as it does not rely on runtime computation to generate pages. Instead, pages are pre-built and ready to be served as static files, offering several key advantages.</p><p>SSG is highly performant since it delivers pre-rendered HTML to the user, allowing for fast load times and seamless scalability. It is also SEO-friendly because search engines can easily index the content. However, SSG is best suited for sites with relatively static content, as any changes to the content require a rebuild of the site.</p><h3>The Process of Static Site Generation</h3><p>When working with Static Site Generation, the process typically involves building a site during the deployment phase. Here’s a step-by-step overview of how SSG works:</p><h4>Step 1: Build Time Compilation</h4><p>At build time, the static site generator (such as Next.js, Gatsby, or Hugo) compiles the entire site into static HTML, CSS, and JavaScript files. This is the key characteristic of SSG: all pages are generated upfront, rather than on-demand at runtime. During this process, data is fetched from external sources like APIs or a CMS, and the content is embedded into the static pages.</p><h4>Step 2: Serving Pre-Built HTML</h4><p>Once the build process is complete, the generated HTML files, along with associated assets (images, CSS, JavaScript), are deployed to a static file hosting server (such as Netlify, Vercel, or Amazon S3). When users visit the site, they are served the pre-built HTML directly, which results in extremely fast load times.</p><h4>Step 3: Interactivity and Hydration</h4><p>In some cases, additional JavaScript is loaded to add interactivity to the site. This process is known as “hydration,” where the static HTML becomes a fully interactive page. For example, a static site built with React or Vue.js can be enhanced with dynamic features after the initial page load.</p><h3>Visualizing the SSG Lifecycle: From Build to Interactivity</h3><p>The diagram below illustrates the lifecycle of an SSG application during a typical page load:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxMhLWDZ_UH3SAAM4eaPaw.png" /></figure><ol><li><strong>Build Time Compilation</strong>: During the build process, the site generator creates pre-rendered HTML files based on content data.</li><li><strong>Serving Static Assets</strong>: Once the site is built, the static assets are deployed to the server. When a user requests a page, the pre-rendered HTML is served instantly.</li><li><strong>Hydration</strong>: If needed, the static page is hydrated with JavaScript to enable interactivity, such as form submissions or client-side routing.</li></ol><h4><strong>Here an example of next.js SSG app page load</strong></h4><p>in build time next generate the static files of each page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*ZfCw-M7RPPiz7S1uVzv8vg.png" /></figure><p>and then when fetching the first page the html request contains all the content:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FWMYJpYvhD0W4kWTuMx-lg.png" /></figure><h3>Tools of the Trade: Frameworks and Ecosystem</h3><p>Static Site Generation is powered by frameworks that provide optimized tools for pre-rendering static pages. Popular frameworks for SSG include Next.js, Gatsby, and Hugo. These tools offer features like automatic data fetching, template generation, and hot-reloading, simplifying the development process. For example, Next.js allows developers to build static pages alongside dynamic, server-rendered content in a hybrid approach.</p><p>With React 19, the <strong>Static API</strong> enhances SSG workflows by providing a streamlined way to define static components and pre-render them more efficiently, improving build times and reducing client-side JavaScript payloads.</p><p>Since SSG sites consist of pre-built files, hosting and deployment are simplified. You can host an SSG site on virtually any static hosting provider like GitHub Pages, Netlify, or Vercel without needing a dedicated server to process requests, which makes scaling the site much easier.</p><h3>Trade-offs: The Good, the Bad, and the Ugly</h3><p>While SSG offers excellent performance and SEO benefits, there are several trade-offs to consider:</p><ul><li><strong>Build Time Overhead</strong>: If your site contains a large number of pages or relies on real-time data, the build process can become slow, as every page must be generated at build time.</li><li><strong>Content Updates</strong>: Since pages are pre-built, any content changes require a rebuild of the site. This can be problematic for sites with frequently updated content unless you implement a more dynamic solution (e.g., Incremental Static Regeneration (ISR) in Next.js).</li><li><strong>Limited Real-Time Interactivity</strong>: Although SSG sites can be hydrated with JavaScript for dynamic behaviour, they are not as suitable for highly dynamic, real-time content updates.</li></ul><h3>When to Choose SSG</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*0f6IF4MKSQhErKjQ8d2TIA.png" /></figure><p>SSG is ideal for websites with static or rarely changing content, such as blogs, documentation, marketing pages, or portfolio sites. It’s a great choice if you need fast load times, excellent SEO, and scalability with minimal server-side complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c87cf8cf7b92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rendering War: Client-Side Rendering (CSR)]]></title>
            <link>https://ofirelarat.medium.com/rendering-war-client-side-rendering-ad47f906f99b?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad47f906f99b</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[rendering-pattern]]></category>
            <category><![CDATA[client-side-rendering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-performance]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 09:50:07 GMT</pubDate>
            <atom:updated>2025-01-17T15:33:42.864Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is part of a larger series that delves into the diverse paradigms of web rendering (<a href="https://medium.com/@ofirelarat/rendering-war-95c6ccf06a5e">Read More</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*bXhWqFo8VOHALU41shS6eA.png" /></figure><p>In modern web development, selecting the right rendering paradigm is crucial, as each approach — SSG, CSR, SSR, ISR, and RSC — has its unique advantages and trade-offs. These paradigms impact aspects such as performance, scalability, and user experience, all of which are essential for meeting the demands of today’s web.</p><p>In this article, we take a deep dive into Client-Side Rendering (CSR), exploring its unique advantages, limitations, and the role it plays in building modern web applications.</p><h3>What is it CSR?</h3><p><strong>Client-Side Rendering (CSR)</strong> is a web rendering paradigm where the browser downloads a minimal HTML shell and uses JavaScript to construct the entire user interface dynamically. <strong>In CSR, the logic for fetching data, rendering components, and managing application state occurs primarily on the client-side</strong>. While this approach enables<strong> highly interactive</strong>, single-page applications (SPAs) and smooth transitions between views, it often results in <strong>slower initial page load</strong> times as the browser must fetch and execute JavaScript before displaying meaningful content. This trade-off makes CSR ideal for applications requiring rich interactivity but less optimal for scenarios emphasizing fast first-content display or SEO.</p><h3>Let’s dive into Client-Side Rendering:</h3><p>When working with Client-Side Rendering, a look at the <strong>network tab</strong> in a tool like Create React App (a boilerplate for building React CSR applications) reveals how this paradigm operates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uv-B4txsrfdVgALu46Knfw.png" /><figcaption>Simple app network on load</figcaption></figure><h4>The First Request: The HTML Shell</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1Y92ia557m1WDe2lpOXNQ.png" /></figure><p>The initial request fetches the <strong>HTML document</strong>, which is a minimal shell containing:</p><ul><li><strong>Default metadata:</strong> This includes the page title, meta tags, manifest links, and logo links.</li><li><strong>A </strong><strong>&lt;noscript&gt; tag:</strong> CSR applications rely on JavaScript to function. If JavaScript is disabled, this tag displays an error message, warning the user that the application won’t work without it.</li><li><strong>An empty </strong><strong>&lt;div&gt; element:</strong> This is the mounting point where React (or other JavaScript frameworks) will render your application.</li><li><strong>A link to the JavaScript bundle:</strong> The HTML document includes a &lt;script&gt; tag pointing to the bundle file, which will be requested and executed by the browser.</li></ul><p>Regardless of the complexity of a CSR application, this basic structure of the initial HTML response is consistent across implementations.</p><h4>The Second Request: The JavaScript Bundle</h4><p>The next key request fetches the <strong>JavaScript bundle</strong>, which contains your application’s logic, dependencies, and everything needed to run the app. Once this bundle is loaded:</p><ol><li>React (or the chosen framework) takes control of the DOM.</li><li>It dynamically renders your components into the empty &lt;div&gt;.</li><li>The application becomes interactive, displaying content and responding to user actions.</li></ol><p>This approach allows CSR applications to create rich, interactive user experiences, though it comes with trade-offs, such as delayed rendering until the JavaScript bundle is fully loaded.</p><h3>Visualizing the CSR Lifecycle: From Request to Interactivity</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DzjbYsqcGITVgRg9YZMw6Q.png" /></figure><p>The diagram above illustrates the lifecycle of a <strong>Client-Side Rendering (CSR)</strong> application during a typical page load:</p><ol><li><strong>Initial Request for HTML (Shell Document):</strong><br>The browser sends a request to the server, which responds with a minimal HTML shell. This shell includes basic metadata, a &lt;noscript&gt; fallback, an empty mounting &lt;div&gt;, and links to critical resources like the JavaScript bundle.</li><li><strong>Request for JavaScript Bundle:</strong><br>The browser then requests the JavaScript bundle, which contains the application’s logic, components, and dependencies.</li><li><strong>Dynamic Rendering and Resource Fetching:</strong><br>Once the JavaScript is executed, React (or the selected framework) takes over, rendering components into the mounting &lt;div&gt;. During this phase, additional resources like images, stylesheets (CSS), and data are requested to complete the page rendering.</li><li><strong>Interactive Webpage:</strong><br>After rendering, the page becomes fully interactive, responding to user inputs and dynamically updating as needed.</li></ol><h3>Tools of the Trade: Frameworks and Ecosystem</h3><p>Client-Side Rendering (CSR) is powered by a well-defined ecosystem of frameworks and tools designed to streamline the creation of dynamic and interactive web applications. Frameworks like <strong>React</strong>, <strong>Vue.js</strong>, and <strong>Angular</strong> lead the way, offering component-based structures and robust APIs to build modern user interfaces. For React developers, tools like <strong>Create React App (CRA)</strong> provide a quick and standardized setup for bootstrapping CSR applications, pre-configured for development and production environments.</p><p>One of the defining advantages of CSR is its minimal deployment requirements. Since the bulk of the application logic is executed on the client-side, deploying a CSR app typically requires only a static HTTP server (e.g., <strong>Nginx</strong>, <strong>Apache</strong>, or even <strong>GitHub Pages</strong>) to serve the HTML shell, JavaScript bundles, and other static assets. Unlike other paradigms like Server-Side Rendering (SSR), there’s no need for a persistent application server (e.g., Node.js) to handle runtime rendering, simplifying hosting and scaling.</p><h3><strong>Trade-offs: The Good, the Bad, and the Ugly</strong></h3><p>CSR provides a lightweight server-side setup, making deployment simple and scalable while enabling developers to build highly interactive applications. However, it comes with notable trade-offs:</p><ul><li><strong>Slower initial page loads:</strong> The application remains blank until the JavaScript bundle is downloaded and executed.</li><li><strong>SEO challenges:</strong> Search engines may struggle to index CSR applications, although modern solutions like prerendering or server-side hydration can help.</li><li><strong>Performance optimizations:</strong> Developers often need to employ techniques like code splitting, lazy loading, and caching to mitigate these limitations.</li></ul><p>These considerations shape the decision-making process for when and how to use CSR effectively.</p><h3>When to Choose CSR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*jkLdu_rnqkuvrFagJMVcow.png" /></figure><p>CSR is ideal for highly interactive applications with minimal SEO requirements, quick deployments, low server complexity, and real-time content updates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad47f906f99b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Vitals - Dealing with Web Performance like a Pro]]></title>
            <link>https://javascript.plainenglish.io/web-vitals-0af3b747cc11?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/0af3b747cc11</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-vitals]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Sun, 16 Jun 2024 17:11:16 GMT</pubDate>
            <atom:updated>2025-11-08T07:47:47.212Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tYF3YB2yhrK3oEjz" /></figure><p>I’m sure you’ve all wondered, “How exactly do I measure my web application’s performance and ensure a satisfying experience for a diverse range of users?”</p><p>When it comes to measuring the performance of an HTTP service, the process is relatively straightforward — simply look at the request durations and determine if they meet your standards. However, evaluating a full web application is much more complex. There are numerous influencing factors, and simply scaling up your resources might not address the underlying issues.</p><p>This is the exact question Google came to solve in 2020 when they announced Core Web Vital — <strong>a standardized way to measure user experience and perceived performance.</strong> <br>Unlike traditional metrics that focus solely on speed, Core Web Vitals emphasize the user’s perception of performance.<br>This shift ensures that web developers prioritize what truly matters for a seamless user experience.</p><h3>The Importance of Core Web Vitals</h3><p>Before diving into the specifics of Core Web Vitals, it’s essential to understand their significance.</p><h4>So, what do Core Web Vitals help us measure?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*INCY2nyVVQzg6ZT1XEHgvA.png" /><figcaption>importance of web vitals</figcaption></figure><ol><li><strong>Loading Times:</strong> Slow loading times can frustrate users. Optimizing loading times ensures that users have a smooth experience from the moment they visit your site.</li><li><strong>Interactivity: </strong>Fast interactivity keeps users engaged and reduces frustration, enhancing their overall experience.</li><li><strong>Visual Stability: </strong>Visual stability prevents unexpected layout shifts, which can make your site appear unprofessional and hinder usability.</li></ol><h4>As a result,</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*qmAGSkB0v3ncb2VuzDdj3Q.png" /></figure><p>sites with good loading times, fast interactivity, and visual stability will see a <strong>decrease in bounce rates.</strong><br>Lower bounce rates<strong> lead to higher conversions</strong>, ultimately driving better user satisfaction and improved business outcomes. Prioritizing these metrics not only enhances user experience but also positively impacts your bottom line.</p><p>In addition, google did several case studies that show how to improving web vitals will improve your business performance as well, for example:</p><ul><li><a href="https://web.dev/case-studies/vodafone">Vodafone: A 31% improvement in LCP increased sales by 8%</a></li><li><a href="https://web.dev/case-studies/vitals-business-impact#icook">iCook: improved CLS by 15% to achieve 10% more ad revenue</a></li></ul><p>But that’s not all,<br>Google now takes Core Web Vitals into account in their search engine ranking system.<br>Thats means that improving your Web Vitals can <strong>enhance your site’s search engine visibility, giving you a better chance to rank higher in search results</strong>. You can monitor and analyze these metrics using the Google Search Console.</p><figure><img alt="google search console" src="https://cdn-images-1.medium.com/max/1024/1*VwHfGpM3VZaTbqFi9JeJXA.png" /></figure><h3>What are Web Vitals?</h3><p>Now that we under the importance of measuring and improving our web vitals, let’s take a closer look at what they actually are.</p><blockquote>Web Vitals are a set of metrics designed to measure the perceived performance and user experience of a website. These metrics help you assess key aspects of how users interact with your site.</blockquote><h3>Let’s dive in to the metrics themself</h3><h4><a href="https://web.dev/articles/lcp">Largest Contentful Paint (LCP</a>)</h4><p>LCP will help up measure the loading times.<br>Measures the time it takes for the largest content element to become visible within the viewport. Aim for an LCP under 2.5 seconds for a good user experience.</p><figure><img alt="LCP" src="https://cdn-images-1.medium.com/max/319/1*1HFgPmQmD4RuNYm2V6dOcA.png" /></figure><h4><a href="https://web.dev/articles/inp">Interaction to Next Paint (INP)</a></h4><p>INP will help us measure how fast the interactivity.<br>Assesses the time from a user’s interaction to the next paint of the screen. Keeping this under 200 milliseconds ensures smooth interactivity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*dbFMWueIlE4QYSLMbEOv-w.png" /></figure><h4><a href="https://web.dev/articles/cls">Cumulative Layout Shift (CLS)</a></h4><p>CLS evaluates the visual stability of a webpage by measuring unexpected layout shifts. A CLS score below 0.1 is ideal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/319/1*XMgLRvvvoiWtWVHMtwGvmg.png" /></figure><h4>Additional Performance Metrics</h4><p>While Core Web Vitals are crucial, other metrics also play a significant role in web performance:</p><ul><li><strong>First Contentful Paint (</strong><a href="https://web.dev/articles/fcp"><strong>FCP</strong></a><strong>)</strong>: Time taken for the first content to appear.</li><li><strong>Time to First Byte (</strong><a href="https://web.dev/articles/ttfb"><strong>TTFB</strong></a><strong>)</strong>: Measures server response time.</li><li><strong>Total Blocking Time (</strong><a href="https://web.dev/articles/tbt"><strong>TBT</strong></a><strong>)</strong>: Time during which the main thread is blocked and unresponsive.</li><li><strong>First Input Delay (</strong><a href="https://web.dev/articles/fid"><strong>FID</strong></a><strong>)</strong>: Time from user input to the browser’s response.</li></ul><h4>Visualizing Web Vitals Metrics</h4><p>We can view these metrics as key milestones in the user flow. Here’s an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cZsHeHWWGRdXGBYslAECsA.png" /></figure><p>By examining these milestones within the network flow, we can visualize how they impact the overall performance:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*afBAriZixT1s80IN7HZNMw.png" /></figure><p>These visuals help illustrate the crucial points where performance improvements can significantly enhance user experience.</p><h3>Tools for Measuring Web Performance</h3><p>To effectively measure and optimize these metrics, several tools are available.</p><h4><a href="https://developer.chrome.com/docs/lighthouse/overview">Lighthouse</a></h4><p>Integrated into Chrome DevTools, it provides insights and recommendations for improving web performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*qH_y-_3h_fEXN0STqER7rA.png" /></figure><h4><a href="https://www.webpagetest.org/">WebPageTest</a></h4><p>An open-source tool offering in-depth analysis and advanced features like speed index graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uKPW7-moTSi2RNzriu5KfQ.png" /></figure><h4><a href="https://chromewebstore.google.com/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma?hl=en&amp;pli=1">Web Vitals Extension</a></h4><p>Created by Google, this extension continuously tracks and reports performance metrics during actual user interactions (also open source).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*CTQnGL3rXGYyTA3h" /></figure><h4><a href="https://unlighthouse.dev/">Unlighthouse</a></h4><p>An open-source tool for comprehensive site-wide scans, ideal for large websites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wa-vTgB37Sp0sdMOVU_DNA.png" /></figure><h4><a href="https://developer.chrome.com/docs/crux/dashboard">Chrome UX Report</a></h4><p>Collects real user data to provide performance insights from actual user experiences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*UzB4csyZp2gWZ5QKEyn9bw.png" /></figure><h4><a href="https://docs.sentry.io/">Sentry/Raygun</a></h4><p>Tools for real-time monitoring and historical performance data, useful for identifying trends and issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mV_TSn4dud-UQkJBTu5sdw.png" /></figure><h4><a href="https://www.npmjs.com/package/web-vitals">Web-Vitals library</a></h4><p>For the complete customizability, the open-source Web Vitals library allows you to measure all web vitals metrics and create your own monitoring tools.</p><h3>Optimization Tips and Tricks</h3><p>Optimizing web performance involves several best practices.</p><h4>Bundle Optimization</h4><p>Remember that the bundle affects the FCP (First Contentful Paint), LCP (Largest Contentful Paint), and total blocking time. Therefore, it’s crucial to minimize the network duration required to load the bundle. Here are some key strategies:</p><ul><li><strong>Remove Unused Code and Libraries</strong>: Clean up your codebase to eliminate any unnecessary code and libraries.</li><li><strong>Employ Tree Shaking and Code Splitting</strong>: Utilize these techniques to ensure only the essential code is loaded.</li><li><strong>Use Bundle Analyzers</strong>: Regularly analyze your bundle to identify optimization opportunities and consider replacing bulky libraries with more efficient alternatives.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*gHoijaBU17Uc2aaUZVKhUg.png" /></figure><h4>Image Optimization</h4><p>LCP (Largest Contentful Paint) is a crucial metric in Core Web Vitals, primarily affected by images or videos on the page. To ensure they render as quickly as possible, consider the following key strategies:</p><ul><li><strong>Use Modern File Formats</strong>: Utilize efficient formats like WebP for images and WebM for videos to reduce file sizes and improve loading times.</li><li><strong>Serve Appropriately Sized Images</strong>: Ensure that images are served in the correct size for their display context. If you’re using Next.js, <br>the &lt;Image /&gt; component is highly effective. Alternatively, services like ImageKit.io and Cloudinary can help optimize and deliver images efficiently.</li><li><strong>Set High Priority for Critical Images</strong>: Assign high priority to images that impact LCP to ensure they load quickly and improve perceived performance. <br>&lt;img fetchpriority=&quot;high&quot; src=&quot;lcp-image.jpg&quot; /&gt;</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4dSeLqGCZ8nN1KrpB7AkUA.png" /><figcaption>before and after priority high</figcaption></figure><h4>Font Display Settings</h4><p>Configure font display settings to minimize CLS and improve FCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*Bm9ZSvYDRAKAUhjAD5xoiw.png" /></figure><h4>Script Loading Strategies</h4><p>Use the defer or async attributes for non-essential scripts to ensure they load without blocking the page render, improving overall performance.</p><blockquote>&lt;script defer src=&quot;some_script.js&quot; /&gt;<br><em>&lt;script async src=&quot;some_script.js&quot; /&gt;</em></blockquote><h4>Preconnect/Preload</h4><p>Leverage preconnect and preload strategies to optimize resource loading times, ensuring critical resources are fetched and rendered as quickly as possible.</p><blockquote><em>&lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot; &gt;<br>&lt;link rel=&quot;preload&quot; fetchpriority=&quot;high&quot; href={poster} as=&quot;image&quot; &gt;</em></blockquote><h3>For Conclusion</h3><p>In this article, we explored the importance of measuring and improving your web vitals. Enhancing these metrics can lead to increased conversions and decreased bounce rates. We delved into the specifics of Web Vitals and Core Web Vitals, emphasizing that they focus on perceived performance rather than just speed.</p><p>We also discussed various tools you can use to measure these metrics, ranging from simple and easy-to-use options to more complex tools that provide extensive data. Additionally, we covered several optimization tips that can help you enhance your web application’s performance, ultimately improving user satisfaction. By prioritizing web vitals, you can ensure a better user experience and drive better business outcomes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0af3b747cc11" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/web-vitals-0af3b747cc11">Web Vitals - Dealing with Web Performance like a Pro</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding code architecture patterns]]></title>
            <link>https://medium.com/codex/understanding-code-architecture-patterns-96bdbd8611d4?source=rss-788f42b3c890------2</link>
            <guid isPermaLink="false">https://medium.com/p/96bdbd8611d4</guid>
            <category><![CDATA[micro-front-end]]></category>
            <category><![CDATA[code-architecture]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Ofir Elarat]]></dc:creator>
            <pubDate>Tue, 07 Feb 2023 19:46:18 GMT</pubDate>
            <atom:updated>2023-03-03T12:55:13.585Z</atom:updated>
            <content:encoded><![CDATA[<p>A guide for the beginner full stack developer</p><p>Code architecture is an essential aspect of software development, as it determines the structure and organization of the codebase and plays a crucial role in the maintainability, scalability, and overall success of a project.</p><p>In this article, we will explore some of the most common code architecture patterns used in software development, and discuss when and why to use each one.</p><p>Whether you are a beginner or an experienced developer, understanding code architecture patterns can help you to design and build better software. So, let’s dive in and take a closer look at some of the most popular patterns in use today.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/1*ESLtrHGdlUzPQloYxM_rIw.png" /><figcaption>thumbnail</figcaption></figure><h3>Hexagonal Architecture (Ports and Adapters)</h3><p>This pattern is designed to make it easy to test and maintain applications by separating the application into two distinct layers: <br> — <strong>The domain layer</strong>, which contains the core business logic.<br> — <strong>The interface layer</strong>, which defines the ways in which the application can be used or extended.</p><p>This pattern is often used in applications that need to be highly modular and flexible, such as microservice architectures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/0*dAvxaeJ0F3YISM9q.png" /><figcaption>Hexagonal architecture (Wikipedia)</figcaption></figure><p>For example, a microservice that provides a REST API for managing user accounts might use the Hexagonal Architecture to separate the domain layer (which contains the business logic for creating, updating, and deleting user accounts) from the interface layer (which defines the REST API and handles requests and responses). This makes it easy to test the domain layer in isolation and to add new interfaces or adapters (such as a web UI or a messaging queue) without affecting the rest of the code.</p><h3>Model View Controller (MVC)</h3><p>This is a widely used pattern that separates the application into three parts: — <strong>The model</strong>, which represents the data and business logic.<br> — <strong>The view</strong>, which is responsible for rendering the user interface.<br> — <strong>The controller</strong>, which mediates between the model and the view.</p><p>This pattern is often used in web applications to cleanly separate the different components of the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*rnnKBg2I_TXgT3JR.png" /><figcaption>Model–view–controller (Wikipedia)</figcaption></figure><p>For example, a web application that allows users to view and edit their profile information might use the MVC pattern to separate the data model (which stores the user’s profile information), the view (which displays the user’s profile information on the screen), and the controller (which handles user input and updates the data model accordingly).</p><h3>Model View ViewModel (MVVM)</h3><p>This pattern is similar to MVC, but it introduces an additional layer called the view model, which acts as a bridge between the view and the model. The view model exposes data and operations that the view can bind to, allowing the view to be completely decoupled from the model.</p><p>This pattern is often used in applications that use data binding, such as WPF and Silverlight applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*cmQNZVjnoasK3je5.png" /><figcaption>Model–view–viewmodel (Wikipedia)</figcaption></figure><p>For example, a WPF application that allows users to view and edit a list of products might use the MVVM pattern to separate the data model (which stores the list of products), the view model (which exposes the data and operations needed by the view), and the view (which displays the product list and allows the user to edit it).</p><h3>Clean Architecture</h3><p>This pattern, proposed by Robert C. Martin (“Uncle Bob”), is designed to make it easy to maintain and evolve software over time. It separates the application into four distinct layers: <br> — <strong>The entities</strong>,<strong> </strong>which represent the core business concepts.<br> — <strong>The use cases</strong>,<strong> </strong>which define the business rules and operations.<br> — <strong>The interface adapters</strong>,<strong> </strong>which adapt the use cases to the external world. — <strong>The frameworks and drivers</strong>,<strong> </strong>which provide the infrastructure for running the application.</p><p>This pattern emphasizes the separation of concerns and the independence of the different layers, making it easier to make changes to the application without affecting the rest of the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*noFxKZVYqYMF1PuN.png" /><figcaption>Clean Architecture</figcaption></figure><p>For example, a web application that allows users to sign up, log in, and manage their account information might use the Clean Architecture to separate the entities (which represent the user accounts), the use cases (which define the business rules for creating and managing user accounts), the interface adapters (which handle HTTP requests and responses), and the frameworks and drivers (which provide the web server and database infrastructure). This makes it easy to change the business rules or the user interface without affecting the rest of the code.</p><h3>Publish-Subscribe (Pub-Sub)</h3><p>Pub-Sub is a pattern in which publishers send messages to subscribers through a messaging system or message broker. In this pattern, publishers and subscribers are decoupled from each other, which allows them to operate independently and asynchronously.</p><p>In web applications, Pub-Sub can be used to enable real-time communication between different components or modules.</p><p>For example, in a chat application, users could publish messages to a channel, and other users subscribed to that channel could receive those messages in real-time. This could be implemented using a message broker like Apache Kafka or a WebSocket-based solution.</p><p>Pub-Sub can also be used to implement scalable, event-driven architectures for web applications. By decoupling the different components of a web application using a message broker, developers can build systems that are more resilient, easier to maintain, and more scalable.</p><h3>Micro-Frontend</h3><p>This is a relatively new pattern that is gaining popularity in the full-stack community. It involves decomposing a monolithic frontend application into smaller, independent components called “microfrontends” that can be developed, deployed, and scaled independently. This allows teams to work on different parts of the application in parallel, and to use different technologies and frameworks for different microfrontends.</p><p>This pattern is often used in applications that need to be highly modular and scalable, such as large e-commerce platforms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c13JuDTuYVq-lm2q.png" /><figcaption>Micro-Frontend (microfrontends.com)</figcaption></figure><p>For example, a large e-commerce platform that has a complex and dynamic user interface might use the Microfrontends Architecture to decompose the frontend into several microfrontends, each of which is responsible for a different part of the user experience (such as the homepage, the product catalog, the shopping cart, and the checkout process). This allows different teams to work on different microfrontends independently, and makes it easier to add, remove, or update microfrontends without affecting the rest of the code.</p><h3>Dependency Injection (DI)</h3><p>This pattern is not a code architecture pattern per se, but it is often used in conjunction with other code architecture patterns to manage dependencies between objects. DI allows objects to be constructed with their dependencies injected, rather than having to create them internally.</p><p>This pattern makes it easier to manage complex object graphs and to replace components with stubs or mock objects for testing purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/0*EeP8Fh4afed2KmrG.png" /><figcaption>Dependency Injection (dotnettutorials.net)</figcaption></figure><p>For example, a web application that uses the MVC pattern might use DI to inject the data model into the controller, allowing the controller to operate on the data model without having to create it internally. This makes it easier to test the controller in isolation and to replace the data model with a mock or stub object for testing purposes.</p><h3>In Conclusion</h3><p>Code architecture patterns are a powerful tool for software developers, as they provide a structured and organized way to design and build applications. By understanding the most common code architecture patterns and their use cases, developers can choose the right pattern for their project and build software that is maintainable, scalable, and flexible. Whether you are working on a small web application or a large, complex system, understanding code architecture patterns can help you to build better software and deliver greater value to your users.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96bdbd8611d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/understanding-code-architecture-patterns-96bdbd8611d4">Understanding code architecture patterns</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>