<?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 Deniz Peker on Medium]]></title>
        <description><![CDATA[Stories by Deniz Peker on Medium]]></description>
        <link>https://medium.com/@denizpeker?source=rss-81c8110db18d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qsBKtwRKtC-6NnNuo9gjzA.jpeg</url>
            <title>Stories by Deniz Peker on Medium</title>
            <link>https://medium.com/@denizpeker?source=rss-81c8110db18d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 01:56:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@denizpeker/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[Performance-First Frontend: Architectural Code Splitting & Network Optimization in Vue]]></title>
            <link>https://medium.com/@denizpeker/performance-first-frontend-architectural-code-splitting-network-optimization-in-vue-4a5f0e185930?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a5f0e185930</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Sat, 11 Jul 2026 11:12:37 GMT</pubDate>
            <atom:updated>2026-07-11T11:12:37.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OA53PbuXBZNkTtiI8ZqLzg.png" /></figure><p>Welcome to Part 3 of the <em>Performance-First Frontend</em> series. In our previous articles, we protected the browser’s memory from ghost references and mastered the Event Loop to ensure buttery-smooth DOM updates.</p><p>However, your memory management and asynchronous rendering strategies are useless if the user is staring at a blank white screen for five seconds.</p><p>Modern Single Page Applications (SPAs) are heavy. As codebases grow, the default bundling strategies of tools like Webpack or Vite often result in a massive vendor.js file that blocks the main thread during initial load. While most developers know how to lazy-load a route, true frontend architecture requires orchestrating <em>how</em> and <em>when</em> the browser downloads resources.</p><p>In this deep dive, we will move beyond basic lazy loading and explore architectural code splitting, strategic vendor chunking, and network priority manipulation in Vue.</p><h3>The Fallacy of Basic Lazy Loading</h3><p>The standard approach to code splitting in Vue Router looks like this:</p><pre>const routes = [<br>  {<br>    path: &#39;/dashboard&#39;,<br>    component: () =&gt; import(&#39;./views/Dashboard.vue&#39;)<br>  }<br>]</pre><p>While this creates a separate chunk for the Dashboard route, it is only the tip of the iceberg. What happens if Dashboard.vue imports a massive library like ECharts or moment.js? If you are not careful, that heavy library either gets bundled into your global vendor chunk (punishing users who never visit the dashboard) or gets duplicated across multiple route chunks.</p><p>To solve this, we need to take control of the bundler.</p><h3>Strategy 1: Strategic Vendor Chunking (Vite / Rollup)</h3><p>By default, Vite extracts all code inside your node_modules into a single vendor chunk. In a high-traffic enterprise application, this chunk can easily exceed 2MB.</p><p>The goal is to split this monolithic vendor file into logical, cacheable pieces. We want the Vue core libraries to load immediately, but we want UI frameworks (like Vuetify or Element Plus) and heavy utilities to load in their own isolated chunks.</p><p>We achieve this by configuring manualChunks in vite.config.js:</p><pre>// vite.config.js<br>import { defineConfig } from &#39;vite&#39;;<br>import vue from &#39;@vitejs/plugin-vue&#39;;<br><br>export default defineConfig({<br>  plugins: [vue()],<br>  build: {<br>    rollupOptions: {<br>      output: {<br>        manualChunks(id) {<br>          // 1. Core Framework Chunk: Extremely stable, highly cacheable<br>          if (id.includes(&#39;node_modules/vue&#39;) || id.includes(&#39;node_modules/pinia&#39;) || id.includes(&#39;node_modules/vue-router&#39;)) {<br>            return &#39;vue-core&#39;;<br>          }<br>          <br>          // 2. Heavy UI Library Chunk<br>          if (id.includes(&#39;node_modules/element-plus&#39;)) {<br>            return &#39;ui-framework&#39;;<br>          }<br><br>          // 3. Data Visualization Chunk: Only loaded when charts are rendered<br>          if (id.includes(&#39;node_modules/echarts&#39;) || id.includes(&#39;node_modules/d3&#39;)) {<br>            return &#39;data-viz&#39;;<br>          }<br>        }<br>      }<br>    }<br>  }<br>});</pre><p><strong>The Architectural Win:</strong> When you update a utility library in your project, the hash of the vue-core chunk remains unchanged. This means returning users don&#39;t have to re-download the Vue framework; they simply load it from their browser&#39;s disk cache.</p><h3>Strategy 2: Micro-Splitting with defineAsyncComponent</h3><p>Route-level splitting is great, but what about heavy components that sit <em>inside</em> a route?</p><p>Imagine a dashboard with a “Generate PDF Report” button. The PDF generation library (jspdf or pdfmake) is enormous. If you import the Modal component synchronously at the top of your script, that heavy PDF library is downloaded as soon as the user hits the dashboard, even if they never click the button.</p><p>We can isolate this execution cost using Vue 3’s defineAsyncComponent.</p><pre>&lt;script setup&gt;<br>import { ref, defineAsyncComponent } from &#39;vue&#39;;<br><br>// The component (and its heavy dependencies) will ONLY be fetched <br>// over the network when isModalOpen becomes true.<br>const AsyncReportModal = defineAsyncComponent(() =&gt; <br>  import(&#39;./components/HeavyReportModal.vue&#39;)<br>);<br><br>const isModalOpen = ref(false);<br>&lt;/script&gt;<br><br>&lt;template&gt;<br>  &lt;button @click=&quot;isModalOpen = true&quot;&gt;Generate Report&lt;/button&gt;<br>  <br>  &lt;!-- Network request triggers exactly here --&gt;<br>  &lt;AsyncReportModal v-if=&quot;isModalOpen&quot; @close=&quot;isModalOpen = false&quot; /&gt;<br>&lt;/template&gt;</pre><h3>Strategy 3: Orchestrating Network Priority (Prefetch vs. Preload)</h3><p>Splitting code perfectly introduces a new problem: <strong>Network Latency Delays</strong>.</p><p>If a user clicks a link to the /analytics page, they now have to wait for the browser to resolve the DNS, establish a connection, and download the analytics.js chunk. This creates a sluggish feeling.</p><p>As senior engineers, we must anticipate user actions and manipulate the browser’s download queue using Resource Hints.</p><h4>Prefetching (Low Priority, Background Download)</h4><p>Prefetching tells the browser: <em>“The user will probably need this file on the next page. Download it in the background when the main thread is idle.”</em></p><p>In modern build tools (or via Vue Router plugins), you can inject prefetch tags for your async routes. When the user hovers over a navigation link, you can dynamically trigger a fetch for that chunk:</p><pre>// A smart router link concept<br>const prefetchAnalytics = () =&gt; {<br>  // Triggers the download in the background before the user even clicks<br>  const link = document.createElement(&#39;link&#39;);<br>  link.rel = &#39;prefetch&#39;;<br>  link.href = &#39;/assets/analytics-chunk.js&#39;;<br>  document.head.appendChild(link);<br>};</pre><p><em>(Note: Tools like Vite have plugins like </em><em>vite-plugin-prefetch-chunk that automate this process at build time).</em></p><h4>Preloading (High Priority, Critical Path)</h4><p>Preloading is for assets required for the <em>current</em> page that the browser’s parser might discover too late (like a critical hero font or an async component needed above the fold).</p><pre>&lt;!-- Inside index.html --&gt;<br>&lt;link rel=&quot;preload&quot; href=&quot;/assets/vue-core.js&quot; as=&quot;script&quot;&gt;</pre><h3>Conclusion: Delivering the Payload</h3><p>Frontend architecture is not just about writing clean, maintainable logic; it is about managing the delivery of that logic.</p><p>If you let your bundler make all the decisions, you will inevitably ship monolithic, main-thread-blocking payloads to your users. By manually chunking your vendor dependencies, aggressively utilizing asynchronous components, and orchestrating network priorities with prefetching, you transform your application from a heavy SPA into a fluid, progressively enhanced experience.</p><p>Memory, Time, and Network. When you master these three dimensions, you are no longer just building user interfaces — you are engineering high-performance systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a5f0e185930" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance-First Frontend: Mastering Microtasks, Macrotasks, and DOM Updates in Vue]]></title>
            <link>https://medium.com/@denizpeker/performance-first-frontend-mastering-microtasks-macrotasks-and-dom-updates-in-vue-a508981e6a33?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a508981e6a33</guid>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Mon, 06 Jul 2026 10:10:52 GMT</pubDate>
            <atom:updated>2026-07-06T10:10:52.796Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_AjbjaBhspwWGkV1HNMBA.png" /></figure><p>Welcome back to the <em>Performance-First Frontend</em> series. In our previous installment, <strong>“Memory Management and Leak Protection,”</strong> we explored how to protect browser RAM from ghost references in modern Single Page Applications. Today, we shift our focus from memory space to another critical dimension: <strong>Time.</strong></p><p>Specifically, we are going under the hood of the JavaScript Event Loop to understand how Vue orchestrates DOM updates.</p><p>Every frontend developer has experienced this classic race condition: You update a reactive state, instantly try to query the new DOM element to calculate its height or apply focus, and you get undefined or 0. The quick, desperate fix? Wrap it in a setTimeout(() =&gt; {}, 0) and pray it works.</p><p>It usually does. But as engineers, “hoping it works” is not an architectural strategy. To build highly predictable, scalable frontend systems, we must stop guessing and start understanding the precise mechanisms of Microtasks, Macrotasks, and Vue’s rendering pipeline.</p><h3>The Illusion of Synchronicity and Vue’s Batching Engine</h3><p>When you mutate a reactive variable in Vue, the change feels instantaneous. However, the DOM update is explicitly <strong>asynchronous</strong>.</p><p>Why? Imagine a scenario where a WebSocket payload triggers 50 distinct reactive state changes in a single function block. If Vue re-rendered the DOM synchronously after every single mutation, the browser would suffer from massive layout thrashing. The application would freeze, and the CPU would spike.</p><p>To prevent this, Vue implements an <strong>asynchronous batching queue</strong>. When a reactive dependency changes, Vue pushes the watcher to a queue. If the same watcher is triggered multiple times, it is deduplicated. Vue then flushes this queue and updates the DOM only once the current execution stack is clear.</p><p>This brings us to the core of JavaScript’s concurrency model: The Event Loop.</p><h3>The Browser’s Time Machine: Micro vs. Macro</h3><p>To master Vue’s scheduler, you must understand how the browser prioritizes background tasks. The Event Loop has two distinct queues:</p><h4>1. The Microtask Queue (The VIP Lounge)</h4><p>Microtasks are the highest priority asynchronous tasks. They execute immediately after the currently executing synchronous script finishes, <strong>before</strong> the browser is allowed to yield control back to the UI for rendering (painting).</p><p><strong>Examples:</strong> Promise.then(), MutationObserver, queueMicrotask()</p><h4>2. The Macrotask Queue (The Standard Line)</h4><p>Macrotasks (often just called “tasks”) represent discrete, independent blocks of work. Crucially, between the execution of one Macrotask and the next, the browser has the opportunity to update the screen (Paint).</p><ul><li><strong>Examples:</strong> setTimeout, setInterval, UI rendering, I/O events.</li></ul><h3>Enter nextTick: The Microtask Hero</h3><p>Vue’s $nextTick (or the Composition API&#39;s nextTick()) is a utility that allows you to execute code immediately after Vue has flushed its batching queue and updated the Virtual DOM.</p><p>Under the hood in Vue 3, nextTick is simply a wrapper around a native JavaScript <strong>Microtask</strong> (specifically, Promise.resolve().then()).</p><p><strong>When to use it:</strong> Use nextTick when you need to interact with a DOM node that was just created or modified by a state change, but you don&#39;t necessarily need the browser to have painted it on the screen yet.</p><pre>import { ref, nextTick } from &#39;vue&#39;;<br><br>const isDropdownOpen = ref(false);<br>const dropdownElement = ref(null);<br><br>const toggleDropdown = async () =&gt; {<br>  isDropdownOpen.value = true; // State mutates<br>  <br>  // ERROR: dropdownElement is still null because the DOM hasn&#39;t updated.<br>  // console.log(dropdownElement.value.clientHeight); <br><br>  await nextTick(); // We wait for Vue to flush the batch queue (Microtask)<br>  <br>  // SUCCESS: The node exists in the DOM tree, we can read its dimensions.<br>  console.log(dropdownElement.value.clientHeight);<br>};</pre><h3>When nextTick Fails: The Macrotask Hack</h3><p>This is where Senior and Mid-level engineers diverge. There are specific scenarios where nextTick is not enough, and your code still fails.</p><p><strong>The Scenario:</strong> You want to mount a hidden element (display: none to display: block) and instantly trigger a CSS transition on it. If you use nextTick to change the CSS class, the transition won&#39;t play; the element will just instantly appear.</p><p><strong>Why did it fail?</strong> Remember, nextTick is a Microtask. It runs <em>before</em> the browser&#39;s rendering engine paints the pixels to the screen. To the browser, the element went from display: none to having its final transition state in the exact same rendering frame. There is no &quot;before&quot; and &quot;after&quot; for the CSS engine to interpolate.</p><p><strong>The Solution: Yielding with a Macrotask</strong> To solve this, we must force our code to wait until the browser has actually completed its paint cycle. We do this by throwing our logic into the <strong>Macrotask Queue</strong> using setTimeout(..., 0) or by waiting for the next animation frame with requestAnimationFrame.</p><pre>const triggerAnimation = async () =&gt; {<br>  showElement.value = true; // Mount the element<br>  <br>  await nextTick(); // Wait for Vue to append it to the DOM tree<br>  <br>  // We yield to the browser&#39;s rendering engine by using a Macrotask.<br>  // This allows the browser to &#39;paint&#39; the initial state to the screen.<br>  setTimeout(() =&gt; {<br>    // This runs in the next event loop tick, AFTER the paint.<br>    // The CSS engine recognizes the state change and triggers the transition.<br>    isAnimating.value = true; <br>  }, 0);<br>};</pre><p>By wrapping the logic in setTimeout(..., 0), you are explicitly telling the JavaScript engine: <em>&quot;I know you are busy. Go ahead, paint the UI to the screen, and run this function on the next available cycle.&quot;</em></p><h3>Conclusion: Engineering Predictability</h3><p>Throwing random setTimeout functions into a codebase to fix race conditions is a symptom of framework fatigue. True frontend engineering requires a deep understanding of the environment our code runs in.</p><p>When you master the Event Loop, you stop fighting Vue’s reactivity system and start orchestrating it. You know exactly when to use nextTick to access a freshly minted DOM node, and when to strategically yield to the Macrotask queue to allow the browser&#39;s painting engine to breathe.</p><p>Performance isn’t just about reducing bundle sizes or optimizing loops; it’s about executing the right code at the exact right millisecond. Mastering time is the ultimate optimization.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a508981e6a33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance-First Frontend: Memory Management and Leak Protection in Modern SPAs]]></title>
            <link>https://medium.com/@denizpeker/performance-first-frontend-memory-management-and-leak-protection-in-modern-spas-124dfedb291b?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/124dfedb291b</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[frontend-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Mon, 18 May 2026 06:03:29 GMT</pubDate>
            <atom:updated>2026-05-18T06:03:29.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kPSMgFVWtgTyhiW1zoTW4g.png" /></figure><h3>Introduction: The Endurance Problem</h3><p>In the previous parts of this series, we tackled <strong>Runtime Reactivity</strong> and <strong>Build-Time Delivery</strong>. We optimized how our application executes code at 60 FPS and how efficiently it delivers bundles to the browser. But there is a silent, creeping killer that can undo all of this architectural work: <strong>Memory Degradation</strong>.</p><p>When building enterprise SaaS platforms, financial terminals, or long-lived operational dashboards, a core assumption is that the user will keep the application tab open for hours — or even days. If your application leaks just 15MB of RAM every time a user navigates between routes, the tab will eventually slow down, stutter, and ultimately crash due to browser out-of-memory (OOM) errors.</p><p>At a Principal Engineer level, you cannot treat the browser’s Garbage Collector (GC) as a magic black box. You must understand the engine’s heap allocation strategies and actively architect your components to ensure that when a view dies, its memory dies with it.</p><h3>1. The Anatomy of a Leak: How the V8 Heap Works</h3><p>Modern JavaScript engines use a <strong>Mark-and-Sweep</strong> algorithm for garbage collection. The engine roots itself at the global object (e.g., window) and traverses the entire reference graph. If an object is no longer reachable from the root, it is marked for collection.</p><p>A memory leak occurs when a piece of data is no longer needed by the application logic, but a rogue reference still connects it back to the root graph. The V8 engine assumes you still want it, and the heap grows indefinitely.</p><p>In Single Page Applications (SPAs), these rogue references typically manifest in three architectural blind spots.</p><h3>2. Blind Spot 1: Detached DOM Trees</h3><p>A detached DOM element is an element that has been removed from the visible page layout but is still held in memory by a JavaScript reference. Because the JS object points to the DOM node, the browser cannot garbage collect either the node itself or any of its children.</p><p>This is highly common when integrating third-party charting libraries (ECharts, Chart.js) or heavy maps (Leaflet, Mapbox) into framework lifecycles.</p><h4>The Anti-Pattern: The Immortal Chart Instance</h4><pre>// Components/AnalyticsChart.vue<br>import * as echarts from &#39;echarts&#39;;<br>import { onMounted, ref } from &#39;vue&#39;;<br>import { useGlobalRegistry } from &#39;@/composables/useGlobalRegistry&#39;;<br><br>export default {<br>  setup() {<br>    const chartRef = ref&lt;HTMLElement | null&gt;(null);<br>    const registry = useGlobalRegistry(); // Long-lived global state/service<br><br>    onMounted(() =&gt; {<br>      if (chartRef.value) {<br>        const myChart = echarts.init(chartRef.value);<br>        myChart.setOption({ /* Heavy chart config with data arrays */ });<br><br>        // THE LEAK: Registering the instance to a global array for cross-component access.<br>        // When this component unmounts, the registry still holds &#39;myChart&#39;.<br>        // &#39;myChart&#39; holds a reference to chartRef.value (the DOM node).<br>        registry.trackInstance(&#39;analytics&#39;, myChart);<br>      }<br>    });<br><br>    return { chartRef };<br>  }<br>}</pre><h4>The Architecture Fix: Explicit Lifecycle Disposal</h4><p>To prevent detached DOM trees, you must break the reference chain entirely during the unmount phase.</p><pre>// Components/AnalyticsChart.vue (Optimized)<br>import * as echarts from &#39;echarts&#39;;<br>import { onMounted, onUnmounted, ref, shallowRef } from &#39;vue&#39;;<br>import { useGlobalRegistry } from &#39;@/composables/useGlobalRegistry&#39;;<br><br>export default {<br>  setup() {<br>    const chartRef = ref&lt;HTMLElement | null&gt;(null);<br>    // Use shallowRef to avoid proxying heavy third-party instances<br>    const chartInstance = shallowRef&lt;echarts.ECharts | null&gt;(null);<br>    const registry = useGlobalRegistry();<br><br>    onMounted(() =&gt; {<br>      if (chartRef.value) {<br>        chartInstance.value = echarts.init(chartRef.value);<br>        chartInstance.value.setOption({ /* ... */ });<br>        registry.trackInstance(&#39;analytics&#39;, chartInstance.value);<br>      }<br>    });<br><br>    onUnmounted(() =&gt; {<br>      if (chartInstance.value) {<br>        // 1. Remove from global registries to clear the root reference path<br>        registry.untrackInstance(&#39;analytics&#39;);<br><br>        // 2. Explicitly call the library&#39;s internal cleanup mechanism<br>        chartInstance.value.dispose();<br><br>        // 3. Nullify the reference in the JS runtime<br>        chartInstance.value = null;<br>      }<br>    });<br><br>    return { chartRef };<br>  }<br>}</pre><h3>3. Blind Spot 2: The Closure Trap</h3><p>Closures are a fundamental pillar of JavaScript, but they are also a primary source of memory leaks when combined with global event listeners or long-running timers. A closure retains references to <em>all</em> variables in its lexical scope, even if the closure’s execution body only references one of them.</p><pre>import { onMounted, onUnmounted, ref } from &#39;vue&#39;;<br><br>export default {<br>  setup() {<br>    const interfaceSettings = ref({ theme: &#39;dark&#39;, density: &#39;compact&#39; });<br>    const massivePayload = ref(new Array(1000000).fill({ data: &#39;heavy_blob&#39; })); // ~20MB<br><br>    const handleResize = () =&gt; {<br>      // THE TRAP: This function references &#39;interfaceSettings&#39;.<br>      // Because of how closures work, the entire lexical environment (including massivePayload)<br>      // is captured in memory by this event handler context.<br>      console.log(`Window resized. Active theme: ${interfaceSettings.value.theme}`);<br>    };<br><br>    onMounted(() =&gt; {<br>      window.addEventListener(&#39;resize&#39;, handleResize);<br>    });<br><br>    onUnmounted(() =&gt; {<br>      // If a developer forgets this, the event listener on &#39;window&#39; remains alive.<br>      // &#39;window&#39; keeps &#39;handleResize&#39; alive, which keeps &#39;massivePayload&#39; alive.<br>      window.removeEventListener(&#39;resize&#39;, handleResize);<br>    });<br>  }<br>}</pre><h4>The Architecture Fix: Decoupled Handlers or Scoped References</h4><p>Isolate variables that require long-lived listeners, or extract the event handler logic entirely out of the component setup closure to keep the lexical environment clean.</p><h3>4. Blind Spot 3: Event Buses and Subscriptions (Pinia / RXJS)</h3><p>Global state managers (like Pinia) or Reactive Streams (RxJS) operate outside the component rendering tree. If you subscribe to a store action, an event bus, or an observable stream inside a component, that subscription will outlive the component unless explicitly torn down.</p><pre>import { useAuthStore } from &#39;@/stores/auth&#39;;<br>import { eventBus } from &#39;@/utils/eventBus&#39;;<br>import { onMounted, onUnmounted } from &#39;vue&#39;;<br><br>export default {<br>  setup() {<br>    const authStore = useAuthStore();<br><br>    onMounted(() =&gt; {<br>      // 1. Unmanaged Custom Event Bus Subscription<br>      eventBus.on(&#39;user-logout&#39;, () =&gt; {<br>        clearLocalSession();<br>      });<br><br>      // 2. Unmanaged Pinia Action Subscription<br>      authStore.$onAction(({ name, onError }) =&gt; {<br>        onError((error) =&gt; console.error(`${name} failed:`, error));<br>      });<br>    });<br>    <br>    // Without an explicit off() or subscription unsubscribe, the component <br>    // instance remains bound to the global store/bus forever.<br>  }<br>}</pre><p><strong>The Senior Fix:</strong> Leverage built-in framework scope teardowns. In Vue 3, pinia.$onAction can accept a boolean flag (detached: false) or automatically scope itself to the current component instance so that it auto-destroys on unmount. For custom buses, always implement a matching off() call in onUnmounted.</p><h3>5. The Diagnostic Workflow: Profiling Like a Forensic Engineer</h3><p>You cannot fix what you cannot verify. To enforce memory performance budgets, you must build a testing methodology using Chrome DevTools.</p><h4>The Three-Snapshot Technique</h4><p>To isolate a route-based leak, use the <strong>Memory Tab</strong> in DevTools with the following protocol:</p><ol><li><strong>Snapshot 1 (Baseline):</strong> Open the application, navigate to a neutral page (e.g., a blank settings page), force Garbage Collection (click the trash can icon), and take a Heap Snapshot.</li><li><strong>Action Phase:</strong> Navigate to the suspected heavy route (e.g., the analytics dashboard). Interact with the application, trigger data reloads, and change tabs.</li><li><strong>Return Phase:</strong> Navigate back to the neutral page from step 1. Force Garbage Collection again to clear legitimate short-term allocations.</li><li><strong>Snapshot 2 (Comparison):</strong> Take a second Heap Snapshot.</li></ol><h4>Analyzing the Retainers</h4><p>Compare Snapshot 2 against Snapshot 1 by switching the view type from <strong>Summary</strong> to <strong>Comparison</strong>. Look for objects that have a positive Delta count.</p><p>Inspect the <strong>Retainers</strong> pane at the bottom. This displays the reference chain keeping the object alive. Look for yellow-highlighted variables or structures containing words like detached, bound, or references to event listeners. Trace the path up to find the root source holding onto your dead components.</p><h3>Conclusion: Performance is a Marathon, Not a Sprint</h3><p>True frontend optimization extends far beyond loading speed. A fast application that crashes your user’s browser after three hours is a failure of architecture. By enforcing strict unmounting patterns, managing closure scopes, and establishing a regular profiling routine in your CI/CD or development environments, you convert temporary speed into sustainable performance.</p><p>Keep your heaps lean, clean your listeners, and treat memory as a finite production resource.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=124dfedb291b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance-First Frontend: Architecting High-Performance Build Pipelines with Vite]]></title>
            <link>https://medium.com/@denizpeker/performance-first-frontend-architecting-high-performance-build-pipelines-with-vite-48058d3e4766?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/48058d3e4766</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[vitejs]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Mon, 11 May 2026 08:06:44 GMT</pubDate>
            <atom:updated>2026-05-11T08:06:44.444Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oQy5qk79pJ4jgfMfF0zZGw.png" /></figure><h3>Introduction: The Illusion of “Zero-Config” Speed</h3><p>Vite’s rise to dominance was fueled by its promise of “unbearable speed.” While it delivers this flawlessly in development via Native ESM and HMR, the production story is significantly more complex. For a Principal Engineer, a “successful build” isn’t one that just finishes without errors; it’s one that balances <strong>Bundle Granularity</strong>, <strong>Cache Hit Ratios</strong>, and <strong>Execution Cost</strong>.</p><p>In this article, I’ll dive into the advanced architectural patterns I use to move beyond Vite’s default settings and build production pipelines that truly scale.</p><h3>1. The Granularity Paradox: Rethinking Code Splitting</h3><p>The industry often swings between two extremes: a single monolithic vendor.js or hundreds of tiny &quot;micro-chunks.&quot; Both are detrimental at scale.</p><p><strong>The Problem:</strong> Large chunks ruin long-term caching (one line change = full redownload). Too many small chunks trigger a “Network Waterfall” where the overhead of HTTP/2–3 stream negotiation outweighs the transfer speed.</p><p><strong>The Solution:</strong> An <strong>Aggressive Manual Chunking</strong> strategy based on library volatility.</p><pre>// vite.config.ts - Advanced Rollup Configuration<br>export default defineConfig({<br>  build: {<br>    rollupOptions: {<br>      output: {<br>        manualChunks(id) {<br>          // Isolate UI Frameworks (Highly stable, large footprint)<br>          if (id.includes(&#39;node_modules/vue&#39;) || id.includes(&#39;pinia&#39;)) {<br>            return &#39;framework-core&#39;;<br>          }<br>          // Isolate Heavy Utilities (e.g., D3, Echarts, Lodash)<br>          if (id.includes(&#39;node_modules/echarts&#39;)) {<br>            return &#39;heavy-charts&#39;;<br>          }<br>          // Segment components by business domain for async loading<br>          if (id.includes(&#39;src/modules/admin&#39;)) {<br>            return &#39;module-admin&#39;;<br>          }<br>          // Everything else is handled by the default algorithm<br>        },<br>        // Optimizing the &quot;Chunk Limit&quot; warning - but actually solving it<br>        chunkSizeWarningLimit: 600, <br>      },<br>    },<br>  },<br>});</pre><p>Haklısın kanka, Principal seviyesi bir içerik için o ilk taslak biraz “tutorial” tadında kalmış olabilir. Gerçek bir mühendislik derinliği için işin sadece “nasıl yapıldığını” değil, <strong>“neden yapıldığını”</strong> ve <strong>“trade-off” (ödünleşim)</strong> noktalarını daha geniş bir perspektifle ele almalıyız.</p><p>Hemen vitesi yükseltiyoruz. İşte çok daha kapsamlı, teknik detayları bol ve “Masterclass” niteliğinde bir LinkedIn makalesi:</p><h3>The Architect’s Guide to Vite: Mastering Build Pipelines for Enterprise-Scale Applications</h3><h3>Introduction: The Illusion of “Zero-Config” Speed</h3><p>Vite’s rise to dominance was fueled by its promise of “unbearable speed.” While it delivers this flawlessly in development via Native ESM and HMR, the production story is significantly more complex. For a Principal Engineer, a “successful build” isn’t one that just finishes without errors; it’s one that balances <strong>Bundle Granularity</strong>, <strong>Cache Hit Ratios</strong>, and <strong>Execution Cost</strong>.</p><p>In this article, I’ll dive into the advanced architectural patterns I use to move beyond Vite’s default settings and build production pipelines that truly scale.</p><h3>1. The Granularity Paradox: Rethinking Code Splitting</h3><p>The industry often swings between two extremes: a single monolithic vendor.js or hundreds of tiny &quot;micro-chunks.&quot; Both are detrimental at scale.</p><p><strong>The Problem:</strong> Large chunks ruin long-term caching (one line change = full redownload). Too many small chunks trigger a “Network Waterfall” where the overhead of HTTP/2–3 stream negotiation outweighs the transfer speed.</p><p><strong>The Solution:</strong> An <strong>Aggressive Manual Chunking</strong> strategy based on library volatility.</p><pre>// vite.config.ts - Advanced Rollup Configuration<br>export default defineConfig({<br>  build: {<br>    rollupOptions: {<br>      output: {<br>        manualChunks(id) {<br>          // Isolate UI Frameworks (Highly stable, large footprint)<br>          if (id.includes(&#39;node_modules/vue&#39;) || id.includes(&#39;pinia&#39;)) {<br>            return &#39;framework-core&#39;;<br>          }<br>          // Isolate Heavy Utilities (e.g., D3, Echarts, Lodash)<br>          if (id.includes(&#39;node_modules/echarts&#39;)) {<br>            return &#39;heavy-charts&#39;;<br>          }<br>          // Segment components by business domain for async loading<br>          if (id.includes(&#39;src/modules/admin&#39;)) {<br>            return &#39;module-admin&#39;;<br>          }<br>          // Everything else is handled by the default algorithm<br>        },<br>        // Optimizing the &quot;Chunk Limit&quot; warning - but actually solving it<br>        chunkSizeWarningLimit: 600, <br>      },<br>    },<br>  },<br>});</pre><h3>2. Death by 1000 Exports: The “Barrel File” Bottleneck</h3><p>As a codebase grows, we often use index.ts (Barrel Files) to simplify imports. At a Principal level, you must recognize that these are <strong>Tree-Shaking Killers</strong>. When you import one function from a barrel file in Vite, Rollup often ends up pulling in the entire module graph linked to that file, bloating your bundle by 30-40%.</p><p><strong>Strategic Fix:</strong></p><ul><li><strong>Enforce Direct Imports:</strong> Use ESLint rules to prevent importing from barrels in critical paths.</li><li><strong>Vite Optimization:</strong> Use unplugin-auto-import to let the build tool handle the resolution of dependencies at the compiler level, ensuring only what is used is bundled.</li></ul><pre>import AutoImport from &#39;unplugin-auto-import/vite&#39;;<br><br>// Automatically injects imports only where they are used<br>AutoImport({<br>  imports: [&#39;vue&#39;, &#39;vue-router&#39;, &#39;@vueuse/core&#39;],<br>  dts: &#39;src/auto-imports.d.ts&#39;,<br>  // Direct import resolution to bypass barrel files<br>  resolvers: [ /* Custom Resolvers for UI Kits */ ],<br>});</pre><h3>3. Resource Prioritization: Preload vs. Prefetch</h3><p>Modern Vite applications utilize rel=&quot;modulepreload&quot;. While powerful, it can lead to &quot;Bandwidth Contention&quot; where the browser prioritizes non-critical JS over hero images (LCP).</p><p><strong>The Principal Approach:</strong> Fine-tune the <strong>Module Preload Polyfill</strong>. In large-scale apps, you may want to selectively disable preloading for non-immediate chunks to favor LCP (Largest Contentful Paint).</p><pre>// vite.config.ts<br>build: {<br>  modulePreload: {<br>    polyfill: true,<br>    resolveDependencies: (filename, deps, { renderBuiltUrl }) =&gt; {<br>      // Logic: Only preload dependencies for the &#39;Main&#39; landing page<br>      return deps.filter(dep =&gt; !dep.includes(&#39;heavy-chart-module&#39;));<br>    },<br>  },<br>}</pre><h3>4. Binary Efficiency and Predictive Compression</h3><p>Gzip is no longer the standard for high-performance apps. <strong>Brotli</strong> (level 11) is the requirement. However, performing this on-the-fly at the CDN level is CPU-intensive.</p><p><strong>Pipeline Optimization:</strong> Pre-compress assets during the build phase. This allows the server to serve .br files with a simple Content-Encoding: br header, bypassing runtime overhead.</p><pre>import viteCompression from &#39;vite-plugin-compression&#39;;<br><br>export default defineConfig({<br>  plugins: [<br>    // Brotli for modern browsers<br>    viteCompression({<br>      algorithm: &#39;brotliCompress&#39;,<br>      ext: &#39;.br&#39;,<br>      threshold: 512, // More aggressive than default<br>    }),<br>    // Fallback Gzip for legacy support<br>    viteCompression({<br>      algorithm: &#39;gzip&#39;,<br>      ext: &#39;.gz&#39;,<br>    }),<br>  ],<br>});</pre><h3>5. Managing the “Asset Graph” (SVG &amp; Images)</h3><p>Unoptimized SVGs and raw images are the silent killers of TTI (Time to Interactive). For a high-traffic dashboard, you should never import SVGs as raw strings if they are complex.</p><p><strong>The Strategy:</strong> Use a pipeline that converts SVGs into <strong>Symbol Sprites</strong> or optimized Vue components automatically.</p><pre>import { createSvgIconsPlugin } from &#39;vite-plugin-svg-icons&#39;;<br><br>plugins: [<br>  createSvgIconsPlugin({<br>    iconDirs: [path.resolve(process.cwd(), &#39;src/assets/icons&#39;)],<br>    symbolId: &#39;icon-[dir]-[name]&#39;,<br>    // Ensures SVGs are stripped of unnecessary metadata (XMLNS, comments)<br>    svgoOptions: true, <br>  }),<br>];</pre><h3>6. The “Observability” Loop: Performance Budgets</h3><p>Optimization is a cycle, not a task. I recommend integrating rollup-plugin-visualizer into the local development workflow, but more importantly, setting <strong>Performance Budgets</strong> in CI/CD.</p><p>If a PR increases the framework-core chunk by more than 5%, the build should fail. This is how you maintain a high-performance culture in a large team.</p><h3>Conclusion: Engineering Beyond the Framework</h3><p>Vite provides the engine, but you are the mechanic. Transitioning from a Senior to a Principal mindset involves looking past the “it works” stage and into the <strong>Telemetry</strong> of the build. By taking control of the Rollup output, managing import graphs, and enforcing rigorous compression, we deliver more than just code — we deliver an experience that scales.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48058d3e4766" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance-First Frontend: Optimizing High Traffic Applications in Vue]]></title>
            <link>https://medium.com/@denizpeker/performance-first-frontend-optimizing-high-traffic-applications-in-vue-f32a825b9841?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f32a825b9841</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Mon, 04 May 2026 10:48:17 GMT</pubDate>
            <atom:updated>2026-05-04T10:48:17.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LFBY9HhOdW9mDxwfj2lXLQ.png" /></figure><h3>Introduction: The Real-Time Challenge</h3><p>In the modern web ecosystem, “real-time data” is no longer a luxury — it’s the baseline expectation. We are increasingly tasked with building complex dashboards that consume high-frequency data streams via WebSockets, often receiving dozens of updates per second.</p><p>Whether it’s financial tickers, live system telemetry, or large-scale operational trackers, rendering thousands of data points dynamically pushes the browser to its limits. While modern frameworks like Vue.js provide an exceptional Developer Experience (DX) out-of the-box, their default reactivity models can quickly become a silent performance killer in high-load scenarios.</p><p>In this article, I want to share my engineering journey and the architectural trade-offs I’ve made to optimize high-traffic Vue applications, keeping the main thread idle and the UI rendering at a buttery-smooth 60 FPS.</p><h3>The Bottleneck: The Hidden Cost of Deep Reactivity</h3><p>To solve a performance issue, you first need to understand the underlying engine. Vue 3 utilizes ES6 Proxies (and Vue 2 relies on Object.defineProperty) to create its reactive magic. When you pass a massive array of objects into a ref() or reactive(), Vue doesn&#39;t just track the array itself; it recursively walks through every nested object, array, and property to establish reactive &quot;traps&quot; (getters and setters).</p><p><strong>The Trap:</strong> Imagine injecting a payload of 5,000 complex objects from a WebSocket every second. If you use deep reactivity, the framework tries to recursively proxy tens of thousands of properties on the fly.</p><p>This creates a massive CPU overhead. If you profile this in Chrome DevTools, you will see a horrifying wall of yellow blocks in the Performance tab. The <strong>Scripting Time</strong> skyrockets, blocking the Main Thread, delaying garbage collection, and ultimately causing the UI to freeze (jank).</p><h3>Strategy 1: Opting Out with shallowRef and Object.freeze</h3><p>The first question a senior engineer must ask is: <em>“Does the framework actually need to track every single property mutation here?”</em> In most high-traffic dashboards, the answer is <strong>no</strong>. Often, data is read-only from the client’s perspective. You are simply displaying incoming state, not mutating individual nested properties via two-way binding.</p><p>By opting out of deep reactivity, we can reclaim immense amounts of CPU cycles.</p><h3>Using shallowRef</h3><p>Unlike ref(), which deeply proxies its inner values, shallowRef() only tracks mutations to the .value property itself. It completely ignores nested changes.</p><pre>import { shallowRef, triggerRef } from &#39;vue&#39;;<br><br>// The framework only watches &#39;telemetryData.value&#39; for reassignment<br>const telemetryData = shallowRef([]);<br><br>// WebSocket listener<br>socket.on(&#39;bulk-update&#39;, (incomingPayload) =&gt; {<br>  // We completely replace the reference. <br>  // Vue triggers a single render cycle, skipping the deep proxy traversal.<br>  telemetryData.value = incomingPayload; <br>});</pre><h3>The Legacy Savior: Object.freeze()</h3><p>If you are working with Vue 2 (or dealing with specific state management setups like Vuex), Object.freeze() is your best friend. By freezing the incoming data payload before assigning it to the state, you explicitly tell the JavaScript engine to make the object immutable. When Vue encounters a frozen object, it gracefully skips the reactivity conversion process entirely.</p><pre>socket.on(&#39;data-sync&#39;, (payload) =&gt; {<br>  // Vue attempts to walk the object, sees it is frozen, and skips reactivity traps.<br>  state.dashboardItems = Object.freeze(payload);<br>});</pre><p><em>Architectural Note:</em> The trade-off here is manual state management. If you need to update a single nested property inside a shallowRef, you must either replace the entire object reference or manually call triggerRef() to notify Vue of the mutation.</p><h3>Strategy 2: Offloading the “Heavy Lifting” to Web Workers</h3><p>A fundamental law of frontend performance is: <strong>Keep the Main Thread for the UI.</strong></p><p>When a WebSocket pushes a massive JSON payload, parsing that data, merging it with the existing state, sorting it by specific algorithms, and normalizing it takes time. If you do this synchronous work on the main thread, the browser cannot paint the next frame, causing the user experience to degrade.</p><p><strong>The Solution: Web Workers.</strong> By delegating the data transformation logic to a separate background thread, we can ensure the UI remains entirely responsive regardless of the data volume.</p><pre>// worker.js - Running in a separate thread<br>self.onmessage = (event) =&gt; {<br>  const { rawData, sortCriteria } = event.data;<br>  <br>  // Heavy computation: sorting 10,000 items, merging dictionaries, etc.<br>  const processedData = performHeavyNormalization(rawData, sortCriteria);<br>  <br>  // Send the &quot;ready-to-render&quot; data back to the main thread<br>  self.postMessage(processedData);<br>};</pre><p><strong>The Trade-off: Serialization Cost.</strong> Communication between the main thread and a Web Worker relies on the Structured Clone Algorithm, which serializes and deserializes the data. If you pass 50MB of data back and forth every second, the serialization cost might outweigh the benefits of threading. To counter this, send only “diffs” (deltas) or utilize <strong>Transferable Objects</strong> (like ArrayBuffer) for zero-copy memory transfers when dealing with binary streams.</p><h3>Strategy 3: Render Scoping and Atomic Updates</h3><p>Even if your JavaScript execution is fully optimized, updating the DOM is inherently expensive. Forcing the Virtual DOM to diff a table with 5,000 rows on every minor update is inefficient.</p><h3>Granular Reactivity and v-memo</h3><p>Instead of triggering a global re-render of the entire list, scope your updates. Vue 3.2 introduced the v-memo directive, which is a game-changer for massive lists. It acts similarly to React&#39;s useMemo or shouldComponentUpdate, allowing you to explicitly tell Vue to skip rendering a sub-tree unless specific dependencies change.</p><pre>&lt;template&gt;<br>  &lt;div class=&quot;dashboard-grid&quot;&gt;<br>    &lt;div <br>      v-for=&quot;item in telemetryData&quot; <br>      :key=&quot;item.id&quot;<br>      v-memo=&quot;[item.status, item.lastUpdated]&quot;<br>      class=&quot;data-row&quot;<br>    &gt;<br>      &lt;DataCell :value=&quot;item.metrics&quot; /&gt;<br>      &lt;StatusBadge :status=&quot;item.status&quot; /&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;</pre><p>Combined with techniques like <strong>Virtual Scrolling</strong> (rendering only the DOM nodes visible in the viewport), you can maintain a constant DOM size regardless of whether you have 100 or 100,000 records in memory.</p><h3>Conclusion: Engineering is About Trade-offs</h3><p>Out-of-the-box framework features are designed for the 90% use case. As a Senior Engineer, your job is to recognize when you fall into the remaining 10%.</p><p>Optimizing high-traffic dashboards isn’t about finding a magic library; it’s about understanding the limits of the browser engine, controlling the Virtual DOM lifecycle, and making deliberate architectural trade-offs. By swapping deep reactivity for shallowRef, moving heavy calculations to Web Workers, and strictly scoping our renders, we can build enterprise-grade applications that scale effortlessly.</p><p>Don’t let the framework dictate your application’s boundaries. Master the tools, understand the engine, and engineer the performance your users deserve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f32a825b9841" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding MCP (Model Context Protocol): The Missing Bridge Between AI Models and Real…]]></title>
            <link>https://medium.com/@denizpeker/understanding-mcp-model-context-protocol-the-missing-bridge-between-ai-models-and-real-7b5d6a014a6b?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b5d6a014a6b</guid>
            <category><![CDATA[cursor]]></category>
            <category><![CDATA[mcp-client]]></category>
            <category><![CDATA[mcp-protocol]]></category>
            <category><![CDATA[mcps]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 13:49:54 GMT</pubDate>
            <atom:updated>2025-11-24T13:53:51.463Z</atom:updated>
            <content:encoded><![CDATA[<h3>Understanding MCP (Model Context Protocol): The Missing Bridge Between AI Models and Real Development Environments</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*21Ek4oqRJk7UJ19596MKYg.png" /></figure><p>AI models are evolving incredibly fast — but when it comes to interacting with real software projects, they’ve traditionally been <em>blind</em>. A model can suggest improvements, refactor code, or generate entire modules, but it cannot:</p><ul><li>Read your project structure</li><li>Understand module dependencies</li><li>Access configuration files</li><li>Inspect real logs or errors</li><li>Call CLI tools</li><li>Interact with APIs or databases in a safe way</li></ul><p>This disconnect makes AI feel like a “smart advisor” rather than a <strong>real pair programmer</strong>.</p><p><strong>Model Context Protocol (MCP)</strong> is the specification that finally closes this gap.</p><p>MCP gives LLMs a <strong>secure, standardized, controllable</strong> way to interact with tools, APIs, and files — turning an AI assistant into a first-class developer in your environment.</p><p>In this article, we’ll explore:</p><ul><li>What MCP is</li><li>How it works under the hood</li><li>Why it matters for developers</li><li>How <strong>Context7 MCP Server</strong> provides deep, scalable context</li><li>How to use MCP locally inside <strong>Cursor IDE</strong></li><li>Installation examples with <strong>npm</strong>, diagrams, and real usage scenarios</li></ul><p>Let’s dive in.</p><h3>1. What Is MCP (Model Context Protocol)?</h3><p>MCP is a protocol that defines how an AI model can safely interact with <em>external capabilities</em> such as:</p><ul><li>Local files</li><li>Tools/commands</li><li>APIs</li><li>Databases</li><li>Version control systems</li><li>Project-wide context</li></ul><p>Instead of building custom wrappers for every integration, MCP creates a unified architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwGImCYsDUUtNsqf8G87Rg.jpeg" /></figure><h3>2. Why MCP Matters (Technically)</h3><p>MCP solves three painful problems developer tools have had for years:</p><h4>1. Standardization</h4><p>Every MCP server exposes the same core concepts:</p><ul><li><strong>resources</strong> (things to read)</li><li><strong>tools</strong> (things to execute)</li><li><strong>prompts</strong> (instructions or templates)</li><li><strong>capabilities</strong> (permissions)</li></ul><p>This means models instantly understand how to interact.</p><h4>2. Security</h4><p>Before running a command or reading a file, the model must request it through MCP.<br> The server enforces:</p><ul><li>Which directories are accessible</li><li>Which commands can run</li><li>What arguments are allowed</li><li>Which APIs can be called</li></ul><p>This eliminates the risks of free-form model actions.</p><h4>3. Extensibility</h4><p>MCP servers stack together like plugins:</p><ul><li>Filesystem MCP</li><li>Git MCP</li><li>HTTP/API MCP</li><li>SQLite MCP</li><li>Context7 MCP (for deep project context)</li><li>Custom MCP servers</li></ul><p>Your model becomes more capable as you add more servers.</p><h3>4. What Makes Context7 Special? (Deep Context Server)</h3><p>Most MCP servers expose a simple capability (e.g., file access).<br> <strong>Context7</strong> is different.</p><p>Context7 is designed to give the LLM <em>scalable, multi-file, project-wide understanding</em>.</p><h4>Project-wide code analysis</h4><p>Context7 provides recursive, structured access to:</p><ul><li>Entire directory trees</li><li>Code modules</li><li>Dependencies across files</li><li>Imports, exports, relationships</li></ul><h4>Progressive Context Expansion</h4><p>The model can say:</p><blockquote><em>“Show me the components that import this file.”</em></blockquote><p>Then:</p><blockquote><em>“Now load those components’ dependencies.”</em></blockquote><p>Then:</p><blockquote><em>“Now fetch the related service layer.”</em></blockquote><p>This is impossible in standard AI chat — but natural with Context7.</p><h4>Ideal for debugging + refactoring</h4><p>Context7 allows LLMs to:</p><ul><li>Find circular dependencies</li><li>Map architecture flows</li><li>Trace routing</li><li>Investigate performance bottlenecks</li><li>Interpret stack traces within context</li></ul><h3>5. Installing Context7 MCP Locally (npm)</h3><p>You can install Context7 MCP server either globally or inside a project.</p><pre>npm install -g @context7/mcp-server</pre><p>Afterwards you should run it manually:</p><pre>npx @context7/mcp-server --port 7777</pre><p>You can customize port that suits your setup. It is not a required parameter.</p><h3>6. Using MCP Inside Cursor IDE</h3><p>There is a gear button in the upper right corner of the Cursor IDE. After clicking this button, open the tab shown in the screenshot. Here, click the “Add Custom MCP” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*BsMDTeW8-izmMRR68gal0w.png" /></figure><p>After that, a file named mcp.json will open. This file will contain the configurations of all MCPs that we can install on the cursor.</p><p>Create the following configurations specifically for Context7:</p><pre>{<br>  &quot;servers&quot;: {<br>    &quot;context7&quot;: {<br>      &quot;command&quot;: &quot;npx&quot;,<br>      &quot;args&quot;: [&quot;@context7/mcp-server&quot;]<br>    }<br>  }<br>}</pre><p>Then restart the cursor. If you still don’t see any warnings in the mcp tab, congratulations. You can use Context7.</p><p>All you need to do now is add “use context7.” to the end of any prompt.</p><p>The necessary connections will be established between our models, and the Model Context Protocol will be used during this process. With this system, you can use LLMs much more efficiently and quick.</p><h3>7. Final Thoughts</h3><p>MCP is one of the most important tools in the evolution of AI-assisted software development.<br> It provides:</p><ul><li>Safety</li><li>Structure</li><li>Capability layers</li><li>True development context</li></ul><p>Context7 builds on these foundations to deliver scalable multi-file context, enabling LLMs to collaboratively work on real-world software architectures.</p><p>Cursor then ties everything together, giving developers a seamless way to bring AI into their workflows.</p><p>In practice, the outcome is a mixed but promising experience. AI provides substantial assistance — it speeds up analysis, helps structure workflows, and even detects patterns that would normally take hours to uncover. But it doesn’t quite behave like a fully autonomous engineer. Instead of taking full ownership of a problem, it often waits for direction, asking for clarification, context, or explicit guidance.</p><p>This makes it feel less like a senior engineer making confident architectural decisions, and more like a highly capable assistant who needs clear instructions to operate effectively. In other words, AI shines when it works <strong>with you</strong>, not <strong>instead of you</strong>. By steering it with the right context and constraints, you can achieve high-quality results — but the initiative still has to come from the human.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b5d6a014a6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Vue and TypeScript: Setting Up Your First Application]]></title>
            <link>https://medium.com/tav-technologies/introduction-to-vue-and-typescript-setting-up-your-first-application-9c18f6c4de3e?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c18f6c4de3e</guid>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 08:22:19 GMT</pubDate>
            <atom:updated>2024-11-21T08:23:22.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pwS4cUm9Wl3tFlcFJhV8sQ.jpeg" /></figure><h3>Introduction</h3><p>Vue.js is a progressive JavaScript framework that excels in building user interfaces. It offers simplicity and flexibility, making it an excellent choice for both small and large-scale applications. When combined with TypeScript, Vue becomes even more powerful, providing strong typing, enhanced developer experience, and improved maintainability. This guide will help you set up a new Vue 3 project with TypeScript, covering both Vue CLI and Vite as project initialization tools.</p><h3>Prerequisites</h3><p>Before diving into the steps, ensure you have the following installed on your system:</p><ul><li><strong>Node.js</strong> (LTS version recommended)</li><li><strong>npm</strong> or <strong>yarn</strong> for package management</li><li><strong>Visual Studio Code</strong> or a similar code editor</li></ul><h3>Setting Up a Vue Project with TypeScript</h3><h3>Option 1: Using Vue CLI</h3><p>Vue CLI is a comprehensive solution for scaffolding Vue projects with a user-friendly interface and customizable configurations.</p><h4>Step 1: Install Vue CLI</h4><p>Open your terminal and run:</p><pre>npm install -g @vue/cli</pre><h4>Step 2: Create a New Project</h4><p>Run the following command to create a new project:</p><pre>vue create vue-ts-app</pre><p>When prompted, choose <strong>Manually select features</strong>. Select the following options:</p><ul><li>TypeScript</li><li>Babel</li><li>Linter/Formatter</li></ul><p>You can configure other options (e.g., linting rules or whether to save preferences) as needed.</p><h4>Step 3: Navigate to the Project Directory</h4><pre>cd vue-ts-app</pre><h4>Step 4: Start the Development Server</h4><pre>npm run serve</pre><p>Open your browser and navigate to http://localhost:8080. You should see the default Vue welcome page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLKIlr7I4WjvL_aeGQ94VQ.png" /></figure><h3>Option 2: Using Vite</h3><p>Vite is a modern build tool that offers a faster and leaner development experience. It is particularly well-suited for Vue 3 projects.</p><h4>Step 1: Create a New Vite Project</h4><p>Run the following command:</p><pre>npm create vite@latest</pre><p>Select a project name (e.g., vite-vue-ts-app) and choose <strong>Vue</strong> as the framework, followed by <strong>TypeScript</strong> as the variant.</p><h4>Step 2: Navigate to the Project Directory</h4><pre>cd vite-vue-ts-app</pre><h4>Step 3: Install Dependencies</h4><pre>npm install</pre><h4>Step 4: Start the Development Server</h4><pre>npm run dev</pre><p>Open your browser and navigate to the URL displayed in the terminal (e.g., <a href="http://localhost:5173).">http://localhost:5173).</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FreR5zd4gV-ufux_wDLp9w.png" /></figure><h3>Exploring the File Structure</h3><p>All Vue projects come with a predefined structure. Here’s an overview:</p><pre>src/<br> ├── assets/        # Static assets like images<br> ├── components/    # Reusable Vue components<br> ├── App.vue        # Root Vue component<br> ├── main.ts        # Entry point for the application<br> └── env.d.ts       # TypeScript declarations for Vite</pre><p>The main.ts file initializes the Vue app:</p><pre>import { createApp } from &#39;vue&#39;;<br>import App from &#39;./App.vue&#39;;<br><br>createApp(App).mount(&#39;#app&#39;);</pre><h3>Adding a TypeScript Component</h3><p>To demonstrate the integration of TypeScript, let’s create a simple “HelloWorld” component.</p><h3>Step 1: Create the Component</h3><p>Inside the src/components folder, create a file named HelloWorld.vue and add the following:</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;h1&gt;{{ message }}&lt;/h1&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import { defineComponent } from &#39;vue&#39;;<br><br>export default defineComponent({<br>  name: &#39;HelloWorld&#39;,<br>  props: {<br>    message: {<br>      type: String,<br>      required: true,<br>    },<br>  },<br>});<br>&lt;/script&gt;<br><br>&lt;style scoped&gt;<br>h1 {<br>  color: #42b983;<br>}<br>&lt;/style&gt;</pre><h3>Step 2: Use the Component</h3><p>Open App.vue and update it as follows:</p><pre>&lt;template&gt;<br>  &lt;HelloWorld message=&quot;Welcome to Vue with TypeScript!&quot; /&gt;<br>&lt;/template&gt;<br><br>&lt;script lang=&quot;ts&quot;&gt;<br>import { defineComponent } from &#39;vue&#39;;<br>import HelloWorld from &#39;./components/HelloWorld.vue&#39;;<br><br>export default defineComponent({<br>  name: &#39;App&#39;,<br>  components: {<br>    HelloWorld,<br>  },<br>});<br>&lt;/script&gt;<br><br>&lt;style&gt;<br>/* Global styles */<br>&lt;/style&gt;</pre><h3>Running the Application</h3><p>After saving the changes, the development server will automatically reload. Open your browser, and you should see the “Welcome to Vue with TypeScript!” message displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oq2LHyUZoblerTSqJBYw_Q.png" /></figure><h3>Conclusion</h3><p>Vue combined with TypeScript offers a robust foundation for modern web applications. Whether using Vue CLI for a full-featured setup or Vite for a faster build process, you can leverage the strengths of both tools to streamline development.</p><p>By following this guide, you’ve created a basic Vue 3 application with TypeScript and built a custom component. From here, you can explore more advanced features such as state management with Vuex or Pinia, routing with Vue Router, and integrations with backend services.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c18f6c4de3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tav-technologies/introduction-to-vue-and-typescript-setting-up-your-first-application-9c18f6c4de3e">Introduction to Vue and TypeScript: Setting Up Your First Application</a> was originally published in <a href="https://medium.com/tav-technologies">TAV Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dealing With Large Data In Javascript]]></title>
            <link>https://medium.com/@denizpeker/dealing-with-large-data-in-javascript-2fa0dd1daf9b?source=rss-81c8110db18d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fa0dd1daf9b</guid>
            <category><![CDATA[javascript-map]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-web-worker]]></category>
            <category><![CDATA[javascript-performance]]></category>
            <category><![CDATA[webworker]]></category>
            <dc:creator><![CDATA[Deniz Peker]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 07:44:55 GMT</pubDate>
            <atom:updated>2023-11-23T12:58:40.319Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WiCh8MLsOkwr8nqhjaJn5g.jpeg" /></figure><p>In current software development processes, we may have to perform issues such as filtering large amounts of data and processing data. Especially when enterprise level data needs to be processed, the data size to be analysed can be quite high. As the size of the data increases, the duration of the operations performed on this data increases and this can cause long waiting times for the end user.</p><p>There are some methods we can apply to avoid these problems. The main purpose of these methods is to reduce the complexity of the code and reduce the time of the operations. The biggest feature that increases complexity in large data sets is the use of Array in every scenario. While arrays solve many of our problems, the cost they bring with them sometimes goes beyond being removable. In order to reduce these costs, we can use functions that terminate iteration.</p><pre>const myArray = [&quot;dealing&quot;, &quot;with&quot;, &quot;large&quot;, &quot;data&quot;, &quot;in&quot;, &quot;javascript&quot;]<br><br>const filteredArray = myArray.filter(item =&gt; item === &#39;with&#39;)<br>const findedItem = myArray.find(item =&gt; item === &#39;with&#39;)<br><br>console.log(&#39;filteredArray = &#39;,filteredArray[0])<br>console.log(&#39;findedItem = &#39;, findedItem)</pre><p>Although the above code block gives us exactly the same output, when we use filter to find only one element, we check all array elements. If we perform the same operation with find, when the first element is found, it stops checking the array elements and exits the loop. This is a plus that has the potential to save us a lot of time in large data sets.</p><p>Some methods that leave the loop on the array after performing the necessary operations such as find are findIndex, includes and some. However, the negative side of such methods is that if the element we are looking for in the array does not exist at all, it provides a return that the value we are looking for is not in the array after checking all array elements. This indicates that they have the same time complexity in the worst case scenario.</p><p>In order to prevent these scenarios, we come across objects that we can use with vanilla javascript. While these objects greatly increase the access speed, when we want to make a search or add a value, it allows us to access the relevant field or value directly and perform search, addition and processing functions. These structures appear as Set and Map.</p><h4>Set</h4><p>Set objects are actually objects that hold unique values. What we need to create a set object is an iterable structure. This structure can be a string or an array. Let’s examine this with the following example.</p><pre>const mySet = new Set([5,6,7,8,10,22,5,7,8,26])<br><br>console.log(&#39;mySet = &#39;,mySet) // mySet =  Set(7) { 5, 6, 7, 8, 10, 22, 26 }<br><br>const hasSeven = mySet.has(7)<br>const hasTwo = mySet.has(2)<br><br>console.log(hasSeven) // true<br>console.log(hasTwo) // false</pre><p>I have an array of number type values as above. There are some repeating values in this array. I defined a set with my array consisting of 10 elements in total. Since this set only holds unique values, it did not include repeated values in the structure.</p><p>In the example above, I used the has function to check whether there is a value in an array. In addition to being able to check whether there is an element with this function, it has a serious impact on our access speed and code complexity because it provides direct access and does not do it with an iteration.</p><pre>const dummyArray = [39907, 59487, 89128, 85457, 38042, ... , 38870, 57651, 75189, 72262, 3507, 49215, 99226, 19405, 35836, 45697, 10400, 65208, 4361, 93443, 47838, 29989, 39743, 61968, 38587, 49233, 3926, 28875, 42617, 8205, 94138, 43415, 29863, 71553, 12330, 19033, 50915, 13137, 27207, 80083, 43525, 40826, 92680, 7012, 19813, 42230, 16588, 44430, 98737, 23867, 73804, 41246, 78021, 21804, 88510, 55771, 39780, 90581, 51568, 229, 90316, 46290, 67001, 71806, 51019, 78873, 40999, 1374, 31074, 13441, 29249, 45899, 7825, 62477, 75783, 20204, 9283, 3660, 57214, 37757, 1140, 50665, 46506, 30429, 76942, 76156, 91193, 30673, 20138, 56797, 63033, 49897, 81288, 33538, 85675, 68971, 33297, 15136, 23001, 46849, 12829, 54653, 56489, 51550, 88607, 72890, 15516, 22203, 66145, 49412, 61590, 47774, 84997, 39078, 50242, 92598, 3509, 44058, 7573, 54427, 54184, 62564, 63831, 65601, 94762, 52474, 19344, 61981, 97833, 24345, 61975, 31235, 33238, 12760, 29623, 14913, 44225, 40600, 91920, 30067, 32175, 4287, 36702, 5427, 54014, 85017, 23816, 74288, 78443, 32084, 34529, 71160, 14593, 13391, 96826, 13914, 89625, 16845, 37735, 41260, 41583, 31077, 8716, 49843, 78770]<br><br>const mySet = new Set(dummyArray)<br><br>console.time(&#39;array&#39;)<br>console.log(dummyArray.includes(59487)) // true<br>console.timeEnd(&#39;array&#39;) // 3.758ms<br><br>console.time(&#39;set&#39;)<br>console.log(mySet.has(59487)) // true<br>console.timeEnd(&#39;set&#39;) // 0.086ms</pre><p>I checked whether there is a ‘58487’ value on an array with 10,000 numbers in it. I checked this with set in the same way. While it takes 3.758 ms in an array with 10,000 numbers, it takes 0.086ms when I perform it with set. This difference shows that we can control a value we want to control with set by accessing it much faster.</p><h4>Map</h4><p>Map, another one of the structures that vanilla javascript offers us, is a structure that holds values in the form of key =&gt; value. These keys must be unique values, but values do not have to be unique. It is very similar to set in that it can contain complex structures as value. It can hold types defined in vanilla javascript such as an object, string, number, boolean against a key.</p><pre>const myMap = new Map()<br><br>myMap.set(1,{a:&#39;test&#39;,b:1,c:true})<br>myMap.set(2,{a:&#39;test&#39;,b:2,c:false})<br><br>console.log(myMap)<br><br>/* Map(2) {<br>  1 =&gt; { a: &#39;test&#39;, b: 1, c: true },<br>  2 =&gt; { a: &#39;test&#39;, b: 2, c: false }<br>} */<br><br>console.log(myMap.get(1)) // { a: &#39;test&#39;, b: 1, c: true }</pre><p>After defining the map object as above, we can access it with the get method. In this way, since our access speed is directly through the key, it occurs at high speeds compared to accessing a value in the array.</p><h4>Webworker</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*saxjCa7a6TeZQfrNSm8sxg.jpeg" /></figure><p>Webworkers are similar to threads. It is used to execute multiple operations at the same time. For example, let’s want to find the sum of numbers up to 50.000.000. We can find this by adding all the numbers directly from the array. However, if we add each 10 million simultaneously within itself and then add the results, we get a faster result. By increasing the load on the processor, we save time. Webworkers allow us to do this. We can perform multiple operations at the same time.</p><pre>const NUMBERS = 50000000;<br><br>const numbers = new Int8Array(NUMBERS);<br><br>for(let i = 0; i &lt; NUMBERS; i++){<br> numbers[i] = Math.floor(Math.random() * 100);<br>}<br><br>const t0 = performance.now();<br>let total = 0;<br>for(var i = 0; i &lt; numbers.length; i++){<br> total += numbers[i];<br>}<br><br>const t1 = performance.now();<br>console.log(`Total time ${t1-t0}ms`) //&quot;Total time 503.5ms”</pre><p>When we create a structure like this, we get a value of approximately 503ms. Although this is affected by situations such as the power of the processor, the amount of available ram, we can see that we do not reach very distant values in different tests.</p><p>In the structure we created in the following example, we send webworkers as a blob because we need to get them from a file.</p><pre>const NUMBERS = 50000000;<br>const WORKERS = 5;<br><br><br>let workers = [];<br><br>const source = `<br>onmessage = function(e) {<br>  var array = new Int8Array(e.data.buffer);<br>  var total = 0;<br> for(var i = 0; i &lt; array.length; i++){<br>   total += array[i];<br>  }<br>  postMessage(total);<br>}`<br><br>for(let i = 0; i &lt; WORKERS; i++){<br>  const blob = new Blob([source]);<br>  const blobURL = window.URL.createObjectURL(blob);<br>  let worker = new Worker(blobURL);<br>  <br>  worker.onmessage = function(e){<br>    total += e.data;<br>    worker.terminate();<br>    if(++finished == workers.length) done();<br>  }<br>  <br>  workers.push(worker);<br>}<br><br>let finished = 0;<br>let chunk = Math.floor(NUMBERS / WORKERS);<br><br>let sliced = [];<br>for(let i = 0; i &lt; workers.length; i++){<br> sliced.push(numbers.slice(i*chunk,i*chunk+chunk));<br>}<br><br>const t0 = performance.now();<br>let total = 0;<br>for(let i = 0; i &lt; workers.length; i++){<br>  const data = {buffer: sliced[i].buffer};<br>  workers[i].postMessage(data, [data.buffer]);<br>}<br> <br>const done = () =&gt; {<br> var t1 = performance.now();<br>  console.log(`Total time with workers ${t1-t0}ms`) //&quot;Total time with workers 35.59999990463257ms&quot;<br>}</pre><p>As we can see in the above structure, we see a faster structure with 35.59 ms with a serious performance increase with workers.</p><p>If we use all the structures we mentioned together, we process the data that is large in size and that we need to process with higher performance on the javascript side. We save both resources and time. These savings become observable on the end user side and contribute to the development of a smoother, faster running application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fa0dd1daf9b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>