<?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 Mayur Kale on Medium]]></title>
        <description><![CDATA[Stories by Mayur Kale on Medium]]></description>
        <link>https://medium.com/@kalemayur8?source=rss-f6fd62f518f4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5Wiuq0FuMmxFiVBf8APeog.jpeg</url>
            <title>Stories by Mayur Kale on Medium</title>
            <link>https://medium.com/@kalemayur8?source=rss-f6fd62f518f4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:24:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kalemayur8/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[Runtime Environment Variables in Containerized React Applications:]]></title>
            <link>https://medium.com/@kalemayur8/runtime-environment-variables-in-containerized-react-applications-be42c402ead5?source=rss-f6fd62f518f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/be42c402ead5</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Mayur Kale]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 18:16:15 GMT</pubDate>
            <atom:updated>2026-04-30T18:16:15.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z15ms1jHWmRT2_dB" /><figcaption>Photo by <a href="https://unsplash.com/@stoman?utm_source=medium&amp;utm_medium=referral">Nangialai Stoman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>A Production-Ready Solution</h3><p>If you’ve ever containerized a React application, you’ve likely encountered a frustrating paradox: <strong>Docker promotes the “build once, deploy anywhere” philosophy, but React applications bake environment variables at build time.</strong></p><p>This creates a significant operational challenge:</p><pre># During build, environment variables are embedded into the bundle<br>VITE_API_URL=https://api.example.com npm run build# The built JavaScript now contains:<br>// bundle.js (simplified)<br>const API_URL = &quot;https://api.example.com&quot;; // Hard-coded!</pre><p><strong>Why This Is Problematic:</strong></p><ol><li><strong>Multiple Container Images</strong>: You need separate Docker images for development, staging, and production — violating the “build once” principle.</li><li><strong>Security Risks</strong>: Sensitive values might be embedded in images and accidentally exposed.</li><li><strong>Deployment Friction</strong>: Changing a configuration requires rebuilding the entire application.</li><li><strong>CI/CD Complexity</strong>: Your pipeline must manage environment-specific builds and images.</li></ol><p>Imagine deploying to Kubernetes where you want to use ConfigMaps and Secrets to inject configuration at runtime — except your React app can’t access them because everything was decided at build time.</p><h3>The Solution: Dynamic Runtime Configuration</h3><p>The key insight is to <strong>separate build-time code from runtime configuration</strong>. Instead of embedding variables during build, we inject them when the container starts.</p><h3>Architecture Overview</h3><ol><li>Build the React app <strong>once</strong> with no environment-specific values</li><li>Serve a dynamic configuration file from the backend at runtime</li><li>Load this configuration <strong>before</strong> the React app initializes</li><li>Access configuration through a global object</li></ol><p>Let’s implement this step by step.</p><h3>Implementation Guide</h3><h3>Step 1: Prepare Your React Application</h3><p>First, create a configuration accessor in your React app:</p><pre>// src/config.js<br>export const getConfig = () =&gt; {<br>  return {<br>    apiUrl: window.APP_CONFIG?.API_URL || &#39;&#39;,<br>    apiKey: window.APP_CONFIG?.API_KEY || &#39;&#39;,<br>    environment: window.APP_CONFIG?.ENVIRONMENT || &#39;development&#39;,<br>  };<br>};</pre><p>Use this configuration throughout your app:</p><pre>// src/services/apiService.js<br>import { getConfig } from &#39;../config&#39;;<br>const { apiUrl, apiKey } = getConfig();<br>export const fetchData = async () =&gt; {<br>  const response = await fetch(`${apiUrl}/data`, {<br>    headers: { &#39;X-API-Key&#39;: apiKey }<br>  });<br>  return response.json();<br>};</pre><h3>Step 2: Update Your HTML Entry Point</h3><p>Modify your index.html to load the configuration <strong>before</strong> your application bundle:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot; /&gt;<br>  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;<br>  &lt;title&gt;My App&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>  &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>  <br>  &lt;!-- Load runtime config BEFORE the app --&gt;<br>  &lt;script src=&quot;/config.js&quot;&gt;&lt;/script&gt;<br>  <br>  &lt;!-- Then load your app --&gt;<br>  &lt;script type=&quot;module&quot; src=&quot;/src/main.jsx&quot;&gt;&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>Step 3: Create an Express Server</h3><p>Create a lightweight Express server that serves your static build and provides dynamic configuration:</p><pre>// server.js<br>const express = require(&#39;express&#39;);<br>const path = require(&#39;path&#39;);<br>const app = express();<br>const PORT = process.env.PORT || 3000;<br>// Serve static files from the build directory<br>app.use(express.static(path.join(__dirname, &#39;dist&#39;)));<br>// Dynamic configuration endpoint<br>app.get(&#39;/config.js&#39;, (req, res) =&gt; {<br>  res.setHeader(&#39;Content-Type&#39;, &#39;application/javascript&#39;);<br>  res.send(`<br>    window.APP_CONFIG = {<br>      API_URL: &quot;${process.env.API_URL || &#39;http://localhost:4000&#39;}&quot;,<br>      API_KEY: &quot;${process.env.API_KEY || &#39;&#39;}&quot;,<br>      ENVIRONMENT: &quot;${process.env.ENVIRONMENT || &#39;development&#39;}&quot;,<br>      FEATURE_FLAGS: ${JSON.stringify(process.env.FEATURE_FLAGS || &#39;{}&#39;)},<br>    };<br>  `);<br>});<br>// SPA fallback - serve index.html for all routes<br>app.get(&#39;*&#39;, (req, res) =&gt; {<br>  res.sendFile(path.join(__dirname, &#39;dist&#39;, &#39;index.html&#39;));<br>});<br>app.listen(PORT, () =&gt; {<br>  console.log(`Server running on http://localhost:${PORT}`);<br>});</pre><p><strong>Key Points:</strong></p><ul><li>The /config.js endpoint reads environment variables at <strong>runtime</strong></li><li>Each request generates fresh configuration (helpful for debugging)</li><li>The server handles SPA routing with the catch-all route</li></ul><h3>Step 4: Create Your Dockerfile</h3><p>Build a production-ready Docker image:</p><pre># Dockerfile<br>FROM node:20-alpine AS builder<br>WORKDIR /app<br># Install dependencies<br>COPY package*.json ./<br>RUN npm ci<br># Build the application<br>COPY . .<br>RUN npm run build<br># Production stage<br>FROM node:20-alpine<br>WORKDIR /app<br># Copy only production dependencies<br>COPY package*.json ./<br>RUN npm ci --omit=dev<br># Copy built assets and server<br>COPY --from=builder /app/dist ./dist<br>COPY server.js ./<br># Run as non-root user<br>RUN addgroup -g 1001 -S nodejs &amp;&amp; \<br>    adduser -S nodejs -u 1001 &amp;&amp; \<br>    chown -R nodejs:nodejs /app<br>USER nodejs<br>EXPOSE 3000<br># Environment variables are injected here at runtime<br>CMD [&quot;node&quot;, &quot;server.js&quot;]</pre><h3>Step 5: Update package.json</h3><p>Add the server dependencies and scripts:</p><pre>{<br>  &quot;name&quot;: &quot;my-app&quot;,<br>  &quot;version&quot;: &quot;1.0.0&quot;,<br>  &quot;scripts&quot;: {<br>    &quot;dev&quot;: &quot;vite&quot;,<br>    &quot;build&quot;: &quot;vite build&quot;,<br>    &quot;preview&quot;: &quot;node server.js&quot;<br>  },<br>  &quot;dependencies&quot;: {<br>    &quot;react&quot;: &quot;^18.2.0&quot;,<br>    &quot;react-dom&quot;: &quot;^18.2.0&quot;,<br>    &quot;express&quot;: &quot;^4.18.2&quot;<br>  },<br>  &quot;devDependencies&quot;: {<br>    &quot;vite&quot;: &quot;^5.0.0&quot;,<br>    &quot;@vitejs/plugin-react&quot;: &quot;^4.2.0&quot;<br>  }<br>}</pre><h3>Deployment Examples</h3><h3>Docker Compose</h3><pre>version: &#39;3.8&#39;<br>services:<br>  app:<br>    build: .<br>    ports:<br>      - &quot;3000:3000&quot;<br>    environment:<br>      - API_URL=https://api.production.com<br>      - API_KEY=${API_KEY}<br>      - ENVIRONMENT=production</pre><h3>Kubernetes</h3><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: my-app<br>spec:<br>  replicas: 3<br>  template:<br>    spec:<br>      containers:<br>      - name: app<br>        image: my-app:1.0.0<br>        ports:<br>        - containerPort: 3000<br>        env:<br>        - name: API_URL<br>          valueFrom:<br>            configMapKeyRef:<br>              name: app-config<br>              key: api-url<br>        - name: API_KEY<br>          valueFrom:<br>            secretKeyRef:<br>              name: app-secrets<br>              key: api-key<br>        - name: ENVIRONMENT<br>          value: &quot;production&quot;</pre><h3>AWS ECS / Cloud Run</h3><pre># Pass environment variables at container runtime<br>docker run -p 3000:3000 \<br>  -e API_URL=https://api.example.com \<br>  -e API_KEY=secret123 \<br>  -e ENVIRONMENT=production \<br>  my-app:1.0.0</pre><h3>Advanced Patterns</h3><h4>1. TypeScript Support</h4><p>Add type safety to your configuration:</p><pre>// src/config.ts<br>interface AppConfig {<br>  apiUrl: string;<br>  apiKey: string;<br>  environment: &#39;development&#39; | &#39;staging&#39; | &#39;production&#39;;<br>  featureFlags: Record&lt;string, boolean&gt;;<br>}<br>declare global {<br>  interface Window {<br>    APP_CONFIG?: AppConfig;<br>  }<br>}<br>export const getConfig = (): AppConfig =&gt; {<br>  if (!window.APP_CONFIG) {<br>    throw new Error(&#39;Configuration not loaded. Ensure config.js loads before the app.&#39;);<br>  }<br>  return window.APP_CONFIG;<br>};</pre><h4>2. Configuration Validation</h4><p>Validate required configuration on app startup:</p><pre>// src/validateConfig.js<br>export const validateConfig = () =&gt; {<br>  const config = window.APP_CONFIG;<br>  <br>  const required = [&#39;API_URL&#39;, &#39;ENVIRONMENT&#39;];<br>  const missing = required.filter(key =&gt; !config?.[key]);<br>  <br>  if (missing.length &gt; 0) {<br>    throw new Error(`Missing required configuration: ${missing.join(&#39;, &#39;)}`);<br>  }<br>  <br>  return true;<br>};<br>// In your main.jsx<br>import { validateConfig } from &#39;./validateConfig&#39;;<br>validateConfig();<br>ReactDOM.createRoot(document.getElementById(&#39;root&#39;)).render(<br>  &lt;App /&gt;<br>);</pre><h4>3. Caching Strategy</h4><p>For better performance, add cache headers:</p><pre>app.get(&#39;/config.js&#39;, (req, res) =&gt; {<br>  res.setHeader(&#39;Content-Type&#39;, &#39;application/javascript&#39;);<br>  res.setHeader(&#39;Cache-Control&#39;, &#39;no-cache, no-store, must-revalidate&#39;);<br>  res.setHeader(&#39;Pragma&#39;, &#39;no-cache&#39;);<br>  res.setHeader(&#39;Expires&#39;, &#39;0&#39;);<br>  <br>  res.send(`window.APP_CONFIG = { /* ... */ };`);<br>});</pre><h4>4. Multi-Environment Support</h4><p>Handle base paths for different deployment contexts:</p><pre>// server.js with base path support<br>const BASE_PATH = process.env.BASE_PATH || &#39;&#39;;<br>app.use(BASE_PATH, express.static(path.join(__dirname, &#39;dist&#39;)));<br>app.get(`${BASE_PATH}/config.js`, (req, res) =&gt; {<br>  res.setHeader(&#39;Content-Type&#39;, &#39;application/javascript&#39;);<br>  res.send(`<br>    window.APP_CONFIG = {<br>      BASE_PATH: &quot;${BASE_PATH}&quot;,<br>      API_URL: &quot;${process.env.API_URL || &#39;&#39;}&quot;,<br>      // ... other config<br>    };<br>  `);<br>});<br>app.get(`${BASE_PATH}/*`, (req, res) =&gt; {<br>  res.sendFile(path.join(__dirname, &#39;dist&#39;, &#39;index.html&#39;));<br>});</pre><h4>Benefits of This Approach</h4><ul><li><strong>True “Build Once, Deploy Anywhere”</strong>: Single Docker image for all environments</li><li><strong>Kubernetes-Native</strong>: Works seamlessly with ConfigMaps and Secrets</li><li><strong>Security</strong>: Sensitive values never embedded in the bundle</li><li><strong>Flexibility</strong>: Change configuration without rebuilding</li><li><strong>Simplicity</strong>: No complex build-time variable replacement</li><li><strong>Debugging</strong>: Easy to verify configuration in production</li></ul><h3>Testing Your Implementation</h3><h3>1. Build and Test Locally</h3><pre># Build the app<br>npm run build<br># Test with different configurations<br>API_URL=https://test.com API_KEY=test123 node server.js<br># Open browser and check console<br># window.APP_CONFIG should show your runtime values</pre><h3>2. Test in Docker</h3><pre># Build image<br>docker build -t my-app:test .<br># Run with dev configuration<br>docker run -p 3000:3000 \<br>  -e API_URL=https://dev.api.com \<br>  -e ENVIRONMENT=development \<br>  my-app:test<br># Run with production configuration (same image!)<br>docker run -p 3000:3000 \<br>  -e API_URL=https://prod.api.com \<br>  -e ENVIRONMENT=production \<br>  my-app:test</pre><h3>3. Verify Configuration Loading</h3><p>Add this to your browser console:</p><pre>// Check if config loaded before React<br>console.log(&#39;Config loaded:&#39;, window.APP_CONFIG);<br>// Verify all required values<br>console.table(window.APP_CONFIG);</pre><h3>Common Pitfalls and Solutions</h3><ul><li><strong>Config not loaded in time</strong> — Ensure config.js loads <strong>before</strong> your app bundle in index.html.</li><li><strong>Environment variables empty in production — </strong>Verify your container orchestrator passes environment variables correctly.</li><li><strong>CORS issues with config endpoint — </strong>Serve config.js from the same domain as your app.</li><li><strong>TypeScript errors with window.APP_CONFIG — </strong>Add proper type declarations (see TypeScript section above).</li></ul><h3>Conclusion</h3><p>Runtime environment variable injection solves a fundamental challenge in containerized React applications. By separating build-time code from runtime configuration, you gain the flexibility and operational benefits that modern deployment platforms demand.</p><p>This pattern is:</p><ul><li><strong>Production-tested</strong> across various platforms (Kubernetes, ECS, Cloud Run)</li><li><strong>Framework-agnostic</strong> (works with React, Vue, Angular, Svelte)</li><li><strong>Simple to implement</strong> with minimal dependencies</li></ul><p>The next time you containerize a single-page application, skip the build-time variable headaches and embrace runtime configuration injection. Your DevOps team will thank you.</p><h3>Additional Resources</h3><ul><li><a href="https://docs.docker.com/build/building/multi-stage/">Docker Multi-Stage Builds</a></li><li><a href="https://dev.to/okrahul/injecting-environment-variables-in-a-deployed-react-app-without-rebuilding-1524">React JS Env Injection</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be42c402ead5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Created a Creative Presentation Using Canva & Voice Tools — Without Being a Pro]]></title>
            <link>https://medium.com/@kalemayur8/how-i-created-a-creative-presentation-using-canva-voice-tools-without-being-a-pro-11f065791703?source=rss-f6fd62f518f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/11f065791703</guid>
            <category><![CDATA[présentation]]></category>
            <dc:creator><![CDATA[Mayur Kale]]></dc:creator>
            <pubDate>Mon, 07 Jul 2025 10:50:31 GMT</pubDate>
            <atom:updated>2025-07-07T18:56:59.199Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Created a Creative Presentation Using Canva &amp; Voice Tools — Without Being a Pro</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FVV1PiLuS6xc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DVV1PiLuS6xc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FVV1PiLuS6xc%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c047a0952bef93a83273b7f09dd39640/href">https://medium.com/media/c047a0952bef93a83273b7f09dd39640/href</a></iframe><p>As part of my recent learning journey, I explored how to create engaging and professional presentations using free and easy-to-learn tools.</p><p><strong>I’m not a pro designer or voice artist</strong>. But with just a bit of time and curiosity, I picked up a few creative techniques that helped me deliver better presentations. I’m sharing this to help anyone who’s short on time but wants to step up their presentation game.</p><h3>🧩 Step 1: Prepare the Data</h3><p>If it’s a regular team or stakeholder meeting, chances are you already know what data you’re going to present.</p><p>Start by:</p><ul><li>Structuring your content.</li><li>Defining key messages per slide.</li><li>Keeping it clean and focused.</li></ul><h3>Step 2: Design Slides Using Canva</h3><p>I used <a href="https://www.canva.com/"><strong>Canva</strong></a> — a design platform with ready-made, stunning templates for presentations.</p><p>Here’s why it worked so well for me:</p><ul><li>You can <strong>choose templates</strong> that fit your topic and mood.</li><li>You can <strong>combine elements from multiple templates</strong> — copy animations, images, layouts — all via simple copy-paste.</li><li>Uploading local images? Just <strong>CTRL + V</strong>, and it’s there instantly.</li><li>Super <strong>easy UI</strong> to modify slides, add transitions, or apply animated effects.</li></ul><p>I was surprised at how fast I could build something visually polished without needing any prior design experience.</p><h3>🗣️ Step 3: Add Your Voice (Two Options)</h3><p>Once the visuals are ready, you have two ways to pitch:</p><ol><li><strong>Record yourself</strong> presenting (ideal if you want it personal and real).</li><li><strong>Use text-to-speech (TTS)</strong> to create voiceovers — great if you’re short on time or want multilingual output.</li></ol><p>I tried the second option, and here’s what I found helpful 👇</p><h3>🧰 Tools I Tried for Voice Generation</h3><h3>✅ <a href="https://odia.io/">ODIA.IO</a></h3><ul><li>Realistic voices with multi-language support.</li><li>Limited to <strong>2000 characters</strong> per request (free version).</li><li>⚠️ Hack: Connect Canva with multiple Gmail accounts to bypass this 😉</li></ul><h3>✅ <a href="https://ttsfree.com/">TTSFree</a></h3><ul><li>No character limits.</li><li>Simple UI and fast output.</li><li>Great for long-form narration.</li></ul><h3>✅ <a href="https://platform.hume.ai/">Hume AI</a></h3><ul><li>Emotion-rich TTS voices (adds human-like tone).</li><li><strong>10,000 character limit</strong> per account.</li><li>More expressive than most tools.</li></ul><h3>✅ <a href="https://elevenlabs.io/">11Labs</a></h3><ul><li><strong>Studio-quality voice synthesis</strong> with near-human expression.</li><li>Supports <strong>voice cloning</strong>, multilingual narration, and emotion control.</li><li>Great for creating personalized or professional voiceovers.</li><li>Free tier allows limited usage; paid plans unlock full control and longer outputs.</li></ul><blockquote><em>Personally, I found </em><strong><em>11Labs</em></strong><em> to be the most </em><strong><em>lifelike and polished</em></strong><em> in terms of output. If you’re creating customer-facing or high-stakes content, it’s worth exploring.</em></blockquote><h3>🎛️ Step 4: Merge and Sync Audio</h3><p>If you’ve created multiple audio clips, you can stitch or sync them using either of these tools:</p><h3>✅ <a href="https://www.veed.io/">VEED.IO</a></h3><ul><li>Web-based editor for audio/video merging.</li><li>Simple drag-and-drop timeline.</li><li>Great for merging multiple clips or syncing voice to slides.</li></ul><h3>✅ <a href="https://www.clipchamp.com/">Clipchamp</a></h3><ul><li>Microsoft-owned video editor with a very friendly interface.</li><li>Perfect for <strong>merging audio with existing video</strong>, or creating a full narrated slideshow.</li><li>Offers export in various formats and resolutions.</li><li>Free plan works well for basic projects.</li></ul><blockquote><em>If you want more timeline control or are used to desktop editing tools, </em><strong><em>Clipchamp</em></strong><em> feels closer to a full video editor with fewer limits.</em></blockquote><p>Once your audio is ready:</p><ul><li>Upload it to Canva.</li><li>Sync it with your slides (as background or slide-by-slide narration).</li></ul><p><strong>Note : </strong><em>Sample peresentation created using Canva templates. The slide text was generated using Canva’s AI tools, and the voice-over audio was created using 11Labs</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11f065791703" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up AppDynamics Monitoring with React.js (Origin location)]]></title>
            <link>https://medium.com/@kalemayur8/setting-up-appdynamics-monitoring-with-react-js-origin-location-04c086a5703b?source=rss-f6fd62f518f4------2</link>
            <guid isPermaLink="false">https://medium.com/p/04c086a5703b</guid>
            <category><![CDATA[typscript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[appdupe-client-review]]></category>
            <category><![CDATA[application-monitoring]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Mayur Kale]]></dc:creator>
            <pubDate>Thu, 04 Jan 2024 08:04:15 GMT</pubDate>
            <atom:updated>2024-01-05T07:56:31.041Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>AppDynamics provides robust monitoring solutions for applications, allowing you to gain insights into performance and user experience. In this guide, I’ll walk through the step-by-step process of configuring AppDynamics with a React.js application. I’ll cover adrum-config setup for origin location, handle enterprise environment access scenarios, and guide on common issues.</p><h3>Prerequisites</h3><ul><li>AppDynamics account (Enterprise edition).</li><li>React.js application.</li></ul><h3>Step 1: Obtain AppDynamics JavaScript Agent (adrum.js)</h3><p>Download the adrum.js file from your AppDynamics Enterprise edition portal or obtain it from an intranet source within your enterprise network.</p><h3>Step 2: Create adrum-config.js for origin location</h3><p>Create an adrum-config.js file to include IP, city, region, and country information. For enterprise environments, fetch this data from origin client locally.</p><pre>// adrum-config.js<br><br>(function (config) {<br>  // Fetch IP, city, region, and country from local machine config<br>  const ip = &quot;0.0.0.0&quot;; // Replace with actual local IP<br>  const city = &quot;YourCity&quot;; // Replace with actual city<br>  const region = &quot;YourRegion&quot;; // Replace with actual region<br>  const country = &quot;YourCountry&quot;; // Replace with actual country<br><br>  config.geo = {<br>    ip: ip,<br>    city: city,<br>    region: region,<br>    country: country<br>  };<br><br>  // Additional AppDynamics configuration details<br>  config.appKey = &quot;YourAppKey&quot;; // Replace with actual AppDynamics App Key<br>  config.adrumExtUrlHttp = &#39;.&#39;;<br>  config.adrumExtUrlHttps = &#39;.&#39;;<br>  config.beaconUrlHttp = `http://YourBeaconHost`; // Replace with actual Beacon Host<br>  config.beaconUrlHttps = `https://YourBeaconHost`; // Replace with actual Beacon Host<br>  config.xd = { enable: false };<br>  config.useHTTPSAlways = true;<br>  config.spa = {<br>    spa2: true<br>  };<br>})(window[&#39;adrum-config&#39;] || (window[&#39;adrum-config&#39;] = {}));</pre><p>Replace placeholders with actual IP, city, region, and country information, you can read it dynamically from each client and replace it.</p><p>We can control and pass transaction-related data also through this file.</p><h3>Step 3: Configure AppDynamicsInitializerComponent</h3><p>Create an AppDynamicsInitializerComponent in your React application to load adrum-config.js and adrum.js in the desired order.</p><pre>// AppDynamicsInitializerComponent.js<br><br>import React, { useEffect } from &#39;react&#39;;<br><br>const AppDynamicsInitializerComponent = () =&gt; {<br>  useEffect(() =&gt; {<br>    // Load adrum-config.js<br>    const adrumConfigScript = document.createElement(&#39;script&#39;);<br>    adrumConfigScript.src = &#39;path-to-adrum-config/adrum-config.js&#39;; // Replace with actual path<br>    document.head.appendChild(adrumConfigScript);<br><br>    adrumConfigScript.onload = () =&gt; {<br>      // Load adrum.js after adrum-config.js<br>      const adrumScript = document.createElement(&#39;script&#39;);<br>      adrumScript.src = &#39;path-to-adrum/adrum.js&#39;; // Replace with actual path<br>      document.head.appendChild(adrumScript);<br>    };<br>  }, []);<br><br>  return null; // This component doesn&#39;t render anything<br>};<br><br>export default AppDynamicsInitializerComponent;</pre><p>Replace placeholder paths with the actual paths to adrum-config.js and adrum.js.</p><h3>Step 4: Integrate AppDynamicsInitializerComponent in React index.js</h3><p>In your index.js file, integrate AppDynamicsInitializerComponent in the appropriate place, considering multiple config providers.</p><pre>// index.js<br><br>import React from &#39;react&#39;;<br>import ReactDOM from &#39;react-dom&#39;;<br>import AppDynamicsInitializerComponent from &#39;./AppDynamicsInitializerComponent&#39;;<br>import { ConfigProvider1, ConfigProvider2 } from &#39;./configProviders&#39;; // Import your config providers<br>import App from &#39;./App&#39;;<br><br>ReactDOM.render(<br>  &lt;React.StrictMode&gt;<br>    &lt;ConfigProvider1&gt;<br>      &lt;ConfigProvider2&gt;<br>        &lt;AppDynamicsInitializerComponent /&gt;<br>        &lt;App/&gt;<br>      &lt;/ConfigProvider2&gt;<br>    &lt;/ConfigProvider1&gt;<br>  &lt;/React.StrictMode&gt;,<br>  document.getElementById(&#39;root&#39;)<br>);</pre><p>Ensure AppDynamicsInitializerComponent is placed appropriately to meet your configuration needs.</p><h3>Step 5: Handle Possible Errors</h3><h3>Issue: Script Loading Order</h3><p>Resolution: Ensure that adrum-config.js is loaded before adrum.js. Use the onload event as demonstrated in AppDynamicsInitializerComponent.js.</p><h3>Issue: CORS Errors</h3><p>Resolution: If encountering CORS errors when fetching resources, ensure that intranet URLs are whitelisted in AppDynamics and configure your server to handle CORS headers.</p><h3>Conclusion: Importance of Monitoring</h3><p>Setting up AppDynamics monitoring for your React.js application is crucial for:</p><ul><li>Identifying and resolving performance bottlenecks.</li><li>Enhancing user experience based on geolocation data.</li><li>Proactively addressing issues before they impact users.</li><li>Improving overall application reliability and performance.</li></ul><p>By investing in a robust monitoring solution, you ensure the long-term success and health of your application.</p><h3>Result :</h3><p>In the network, /adrum call should show the below details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*a7hASYfTwV9D63UaHsdrQA.png" /></figure><p><strong>Appdynamics portal map :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jScYnu_4vRx_7Rkq-s6_g.png" /></figure><h3>References</h3><ol><li><a href="https://www.appdynamics.com/">AppDynamics</a></li><li>MaxMind GeoIP2 JavaScript Library</li><li><a href="https://docs.appdynamics.com/appd/4.5.x/en/end-user-monitoring/browser-monitoring/browser-real-user-monitoring/configure-the-javascript-agent/set-the-origin-location-of-the-request">Origin location Appdynamics</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04c086a5703b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>