<?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[Learn With Rahul - Medium]]></title>
        <description><![CDATA[A collaborative initiative of two people who not only have the same name but also have the same interest and passion towards technology and programming. We love to learn new things &amp; use to share with each other. Many times we found ourselves debating &amp; eventually understanding - Medium]]></description>
        <link>https://medium.com/learnwithrahul?source=rss----7f5bb9648126---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Learn With Rahul - Medium</title>
            <link>https://medium.com/learnwithrahul?source=rss----7f5bb9648126---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 10:23:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/learnwithrahul" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Re-Teaching Your AI Agent Every Session: A Scalable System for Convention-Aware Code…]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/learnwithrahul/stop-re-teaching-your-ai-agent-every-session-a-scalable-system-for-convention-aware-code-33aa83f246fb?source=rss----7f5bb9648126---4"><img src="https://cdn-images-1.medium.com/max/1024/1*-FLooE6WejxlsBN9iymAbA.png" width="1024"></a></p><p class="medium-feed-snippet">Every time you start a new session with an AI coding agent, it walks into your codebase cold. Tools like Claude Code, Cursor, Kiro, and&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/learnwithrahul/stop-re-teaching-your-ai-agent-every-session-a-scalable-system-for-convention-aware-code-33aa83f246fb?source=rss----7f5bb9648126---4">Continue reading on Learn With Rahul »</a></p></div>]]></description>
            <link>https://medium.com/learnwithrahul/stop-re-teaching-your-ai-agent-every-session-a-scalable-system-for-convention-aware-code-33aa83f246fb?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/33aa83f246fb</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Bhammarker Rahul]]></dc:creator>
            <pubDate>Mon, 22 Jun 2026 00:24:20 GMT</pubDate>
            <atom:updated>2026-06-22T00:24:58.020Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Running Ollama Remotely in a Secure Way ]]></title>
            <link>https://medium.com/learnwithrahul/running-ollama-remotely-in-a-secure-way-d14ba13c8d77?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/d14ba13c8d77</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cloud-gpu]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Sat, 28 Jun 2025 15:27:32 GMT</pubDate>
            <atom:updated>2025-06-28T15:19:43.668Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Practical Guide for Using Cloud GPU While Developing Locally</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nTc6lr4-PieJsEZ1k8g0kA.jpeg" /><figcaption><a href="https://www.flaticon.com/free-icons">https://www.flaticon.com/free-icons</a></figcaption></figure><h3>What is Ollama, Quickly?</h3><p><a href="https://ollama.com/"><strong>Ollama</strong></a> is a <strong>lightweight local LLM server</strong> allowing you to run models like LLaMA, Mistral, Gemma, etc., on your machine using GPU/CPU and interact via a simple HTTP API (localhost:11434). It is popular among developers building AI workflows locally due to:</p><ul><li>Simplicity (no big infra setup)</li><li>Running fully offline</li><li>Familiar REST-like API</li><li>Fast prototyping with LangChain and other orchestration frameworks</li></ul><h3>Why Run Ollama Remotely?</h3><p>Sometimes:</p><p>✅ You <strong>need GPU power in the cloud (</strong>AWS, Lambda Labs, Vast.ai, MassedCompute, etc<strong>.)</strong><br> ✅ But your <strong>code, dev workflow, or even your production app runs on your local server, private network, or </strong>your laptop (development)<br> ✅ You want to <strong>use Ollama remotely while developing locally</strong> to avoid large model downloads and GPU limitations</p><p><strong><em>Example practical scenario:</em></strong></p><blockquote>You have a <strong>LangChain app</strong> running locally but want to <strong>offload LLM calls to a cloud GPU Ollama instance</strong>.</blockquote><h3>The Problem: Ollama Lacks Built-in Authentication</h3><p>If you simply expose 0.0.0.0:11434 on your cloud GPU server, <strong>anyone can hit your Ollama endpoint</strong>.<br> There is:<br> ❌ No built-in API key authentication<br> ❌ No user management<br> ❌ No rate limiting</p><p>So, <strong>how can you securely use Ollama remotely?</strong></p><h3>Solution 1: Secure Ollama with NGINX + Basic Auth</h3><p>1️⃣ <strong>Keep Ollama bound to </strong><strong>localhost:11434 on the cloud GPU server.</strong></p><p>2️⃣ Install and configure <strong>NGINX as a reverse proxy</strong>, exposing your desired public IP or domain.</p><p>3️⃣ Add <strong>HTTP Basic Authentication</strong> to NGINX to gate your Ollama server.</p><p>4️⃣ Use your <strong>credentials in your LangChain app or other HTTP clients</strong> when calling the API remotely.</p><p>🛠️ Example NGINX Config Snippet:</p><pre>server {<br>    listen 80;<br>    server_name your-cloud-server.com;<br><br>    location / {<br>        auth_basic &quot;Protected Ollama&quot;;<br>        auth_basic_user_file /etc/nginx/.htpasswd;<br><br>        proxy_pass http://127.0.0.1:11434;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br><br>    # if you wish a specific end point instead of the default &quot;/&quot;<br>    location /ollama/ {<br>        auth_basic &quot;Protected Ollama&quot;;<br>        auth_basic_user_file /etc/nginx/.htpasswd;<br><br>        proxy_pass http://localhost:11434/;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>    }<br>}</pre><p>Generate your password:</p><pre>sudo apt install apache2-utils<br>htpasswd -c /etc/nginx/.htpasswd your_username</pre><p>Reload NGINX:</p><pre>sudo systemctl reload nginx</pre><p><strong>🧩 Using With LangChain:</strong></p><pre>from langchain_ollama import ChatOllama<br>from langchain_core.messages import HumanMessage<br>import os<br>from dotenv import load_dotenv<br><br># Load environment variables from .env file<br>load_dotenv()<br><br>OLLAMA_HOST = os.environ.get(&quot;OLLAMA_HOST&quot;) # This should use proxy endpoint you exposed<br>OLLAMA_USER = os.environ.get(&quot;OLLAMA_USER&quot;) # basic auth user you setup on remote server<br>OLLAMA_PASS = os.environ.get(&quot;OLLAMA_PASS&quot;) # your basic auth password <br><br># Create ChatOllama with the base_url &amp; client_kwargs<br>chat = ChatOllama(<br>    base_url=OLLAMA_HOST,<br>    client_kwargs={<br>        &quot;auth&quot;: (OLLAMA_USER, OLLAMA_PASS)<br>    },<br>    model=&quot;llama3.2:latest&quot;<br>)<br><br>response = chat.invoke([<br>    HumanMessage(content=&quot;Who won 1983 cricket world cup?&quot;)<br>])<br><br>print(response.content)</pre><h3>Solution 2: SSH Port Forwarding (No Public Exposure via Proxy)</h3><p>If you <strong>do not want to expose any ports publicly</strong>:</p><ul><li>Keep Ollama running on localhost:11434 on your cloud GPU server.</li><li>From your local system, forward your local localhost:11434 to the remote server&#39;s localhost:11434 using SSH.</li></ul><p><strong>🛠️ Example SSH Tunnel Command:</strong></p><pre>ssh -f -N -i ~/.ssh/your_ssh_key_for_login -L 11434:localhost:11434 your-user@your-cloud-server-ip-or-dns-name</pre><p><em>If you use password-based SSH login on the remote server, omit the ssh key, it will ask for the password.</em></p><pre>ssh -f -N -L 11434:localhost:11434 your-user@your-cloud-server-ip-or-dns-name</pre><p>Now, on your local machine:</p><ul><li>Open http://localhost:11434 to access the remote Ollama.</li><li>Your local applications (LangChain, scripts, Postman) will <strong>think Ollama is local</strong>.</li></ul><p><strong>🧩 Using With LangChain:</strong></p><pre>from langchain_ollama import ChatOllama<br>from langchain_core.messages import HumanMessage<br><br><br># Create ChatOllama with default options<br>chat = ChatOllama(<br>    model=&quot;llama3.2:latest&quot;<br>)<br><br>response = chat.invoke([<br>    HumanMessage(content=&quot;Who won 1983 cricket world cup?&quot;)<br>])<br><br>print(response.content)</pre><blockquote>✨ <strong><em>No special configuration is required (just like the local Ollama server); it just works.</em></strong></blockquote><h3>Should You Use Ollama Remotely in Production?</h3><p>Ollama is fantastic for <strong>local development, experimentation, and low-scale internal workflows</strong>.</p><p>However, <strong>for production use cases</strong>:</p><p>⚠️ It lacks:</p><ul><li>Fine-grained user management</li><li>Rate limiting</li><li>Logging, metrics, tracing</li><li>Robust security features</li></ul><p>❌ It is <strong>not designed for multi-user high-scale workloads</strong>.</p><h4>Alternatives for Production:</h4><p>✅ <a href="https://huggingface.co/docs/text-generation-inference/index"><strong>Hugging Face TGI</strong> </a>(Text Generation Inference)</p><ul><li>Production-grade LLM inference server</li><li>Supports <strong>token-based authentication and multi-user scenarios</strong></li><li>Optimized GPU utilization</li><li>Integrates with LangChain</li></ul><p>✅ <strong>OpenAI API</strong> / <strong>Groq</strong> / <strong>AWS Bedrock</strong></p><ul><li>Managed, scalable, secure</li><li>Pay-per-use but no maintenance overhead</li></ul><p>✅ <strong>vLLM</strong> for open-weight model serving with better performance for production use.</p><h3>Final Thoughts</h3><p>Using <strong>cloud GPU for Ollama while developing locally</strong> is a highly practical approach for indie developers and small teams to <strong>get the best of both worlds</strong>.</p><p>If you:</p><p>✅ Need GPU power<br> ✅ Want to avoid local GPU/VRAM limitations<br> ✅ Want to keep your dev environment untouched</p><p>… then either:</p><ul><li><strong>NGINX + Basic Auth</strong> for securely exposing Ollama remotely, or</li><li><strong>SSH Port Forwarding</strong> for zero public exposure</li></ul><p>… will help you <strong>build faster without compromising your setup.</strong></p><blockquote>I will be back with more such learnings. Till then, <strong>Keep Learning, Keep Sharing &amp; Keep Rocking….</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d14ba13c8d77" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/running-ollama-remotely-in-a-secure-way-d14ba13c8d77">Running Ollama Remotely in a Secure Way 🚀</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TanStack Start: A New Framework Revolutionizing React Development]]></title>
            <link>https://medium.com/learnwithrahul/tanstack-start-a-new-framework-revolutionizing-react-development-4143de93fc7e?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/4143de93fc7e</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 18:47:53 GMT</pubDate>
            <atom:updated>2025-02-10T19:03:03.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M1pF2WquQXgw82L6_2Ag-g.jpeg" /></figure><p>In the ever-evolving world of web development, staying ahead means embracing tools that redefine possibilities. <a href="https://tanstack.com/"><strong>TanStack</strong></a>, known for its exceptional utilities like <em>React Table, Query, and Router</em>, has unveiled <a href="https://tanstack.com/start/latest"><strong>TanStack Start</strong></a> — a meta-framework addressing real-world performance and development challenges in <strong>Fullstack React apps</strong>. If you’re familiar with <strong>Next.js</strong>, you’ll find <strong>TanStack Start’s</strong> fresh take on these challenges intriguing.</p><h3>What is TanStack Start?</h3><p>TanStack Start is a React meta-framework built on <strong>TanStack Router</strong>, enhanced with server-side rendering (SSR) and “isomorphic loaders.” It simplifies data fetching and rendering while maintaining client-side routing power. Its standout features include <strong>streaming SSR</strong>, delivering fast and seamless user experiences. Unlike traditional frameworks, it’s lean, efficient, and purpose-driven.</p><h3>CSR vs. SSR: A Quick Overview</h3><h4>Client-Side Rendering (CSR)</h4><ul><li>Renders the app entirely in the browser.</li><li>Ideal for interactive apps like dashboards or SPAs.</li><li>Slower initial load due to large JavaScript bundles.</li></ul><h4>Server-Side Rendering (SSR)</h4><ul><li>Renders the app on the server, sending fully rendered HTML to the client.</li><li>Great for SEO-heavy and content-rich apps like blogs or e-commerce sites.</li><li>Increases server load but offers faster initial content display.</li></ul><p><em>Modern frameworks like </em><strong><em>TanStack Start</em></strong><em> and </em><strong><em>Next.js</em></strong><em> allow you to mix CSR and SSR for flexibility.</em></p><h3>What Are Isomorphic Loaders?</h3><p>One of TanStack Start’s standout features is <strong>isomorphic loaders</strong>. These loaders allow data fetching logic to run on both the server and the client, reducing code duplication and making applications more efficient. Unlike Next.js’s getServerSideProps or getStaticProps, which separate server and client logic, isomorphic loaders unify this process, leading to:</p><ul><li><strong>Better Maintainability</strong>: Less duplicate code across environments.</li><li><strong>Improved Performance</strong>: Data is available wherever it is needed without unnecessary re-fetching.</li><li><strong>More Flexibility</strong>: Works seamlessly with streaming SSR, reducing blocking render times.</li></ul><h3>What is <strong>Streaming SSR?</strong></h3><p><strong>Streaming SSR</strong> (Server-Side Rendering) is a technique that allows web pages to be rendered and delivered to the client in chunks rather than waiting for the entire page to be ready before sending it. This means that critical parts of the page can be displayed immediately while the rest of the content loads progressively.</p><h3>What Makes TanStack Router Special?</h3><p>At TanStack Start’s core is <a href="https://tanstack.com/router/latest"><strong>TanStack Router</strong></a>, a robust, flexible React router. Key features include:</p><ul><li>Declarative, type-safe APIs.</li><li>Advanced route matching.</li><li><strong>File-based routing</strong> for intuitive organization.</li></ul><p><em>This </em><strong><em>client-first</em></strong><em> router prioritizes local rendering and navigation, with SSR as an optional add-on for flexibility.</em></p><h3>Why a Client-First Approach Matters?</h3><p>A <strong>client-first</strong> approach means prioritizing rendering and interactions in the browser rather than relying heavily on the server. This brings several advantages:</p><ul><li><strong>Reduced Server Dependency</strong>: Less reliance on expensive backend computations.</li><li><strong>Improved Performance</strong>: Faster interactions, especially for real-time applications.</li><li><strong>Better Offline Support</strong>: Enables progressive loading and caching for seamless user experiences.</li></ul><p><em>This approach benefits apps with dynamic content, frequent user interactions, and real-time updates, such as dashboards, collaboration tools, and messaging apps.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*liwmwRPTNj4WHbNIp0avjw.jpeg" /></figure><h3>How is TanStack Start Different from Next.js?</h3><h4>1. Streaming SSR</h4><p>Unlike Next.js, which can block rendering while waiting for data, TanStack Start streams critical content immediately, loading slower data incrementally. This results in faster page interactivity.</p><h4>2. Isomorphic Loaders</h4><p>TanStack Start’s loaders work seamlessly on both the server and client, reducing code duplication compared to Next.js’s getServerSideProps or getStaticProps.</p><h4>3. Client-First Philosophy</h4><p>TanStack Start excels in dynamic, real-time apps with offline capabilities, such as dashboards or collaboration tools. While Next.js focuses on SSR and SEO, TanStack Start prioritizes responsiveness and interactivity.</p><h4>4. Flexibility Over Convention</h4><p>Next.js is great for rapid prototyping with its conventions but can feel restrictive in complex projects. TanStack Start provides granular control, suiting projects requiring customization.</p><h3>Deployment and Lock-In Considerations</h3><h4>TanStack Start</h4><ul><li><strong>Flexible Deployment</strong>: Deploy anywhere compatible with Node.js, including serverless functions.</li><li><strong>No Vendor Lock-In</strong>: Maintain control over your infrastructure.</li><li><strong>Out-of-the-box preset</strong> support for various popular platforms to run your application — <a href="https://tanstack.com/start/latest/docs/framework/react/hosting/#netlify">Netlify</a> , <a href="https://tanstack.com/start/latest/docs/framework/react/hosting/#vercel">Vercel</a>, <a href="https://tanstack.com/start/latest/docs/framework/react/hosting/#cloudflare-pages">Cloudflare-pages</a>, <a href="https://tanstack.com/start/latest/docs/framework/react/hosting/#nodejs">Node JS server</a> or a <a href="https://tanstack.com/start/latest/docs/framework/react/hosting/#bun">Bun Server</a></li></ul><h4>Next.js</h4><ul><li><strong>Optimized for Vercel</strong>: This offers additional features like Edge Functions, but relying on them could lead to vendor lock-in.</li><li><strong>Cost Considerations</strong>: Unnecessary SSR can <strong>increase costs on serverless</strong> platforms like Vercel.</li></ul><p><em>TanStack Start’s flexibility makes it ideal for teams wanting independence.</em></p><h3>What About Caching &amp; Rendering Strategies?</h3><p><strong>Next.js</strong> provides various rendering options like:</p><ul><li><strong>SSR (Server-Side Rendering)</strong>: Dynamic content fetched per request.</li><li><strong>ISR (Incremental Static Regeneration)</strong>: Static content updated periodically.</li><li><strong>SSG (Static Site Generation)</strong>: Content pre-built at deployment.</li><li><strong>Edge Functions</strong>: Execution at global edge locations for lower latency.</li></ul><blockquote>TanStack Start, with <strong>streaming SSR and isomorphic loaders</strong>, ensures data remains fresh without unnecessary re-renders. While it <strong>lacks built-in ISR</strong>, its flexible architecture allows developers to implement caching strategies as needed.</blockquote><h3>What to Expect from TanStack Start</h3><ol><li><strong>Blazing-Fast Performance</strong>: Critical content loads instantly with streaming SSR.</li><li><strong>Simplified Data Management</strong>: Isomorphic loaders streamline code.</li><li><strong>Advanced Routing</strong>: Built on the robust TanStack Router.</li><li><strong>Lightweight and Modern</strong>: Avoids bloat, prioritizing efficiency.</li><li><strong>Future-Proof</strong>: Continuously evolving with TanStack’s innovative tools.</li></ol><h3>Conclusion</h3><p><strong>TanStack Start</strong> is a compelling alternative to frameworks like Next.js, offering a fresh approach to SSR, routing, and data management. Its performance-first, client-driven philosophy makes it ideal for dynamic applications requiring speed, flexibility, and control.</p><p>If you’re looking for a framework that emphasizes efficiency and future-readiness, dive into <a href="https://tanstack.com/start/latest">TanStack Start</a> today.</p><blockquote>Currently TanStack Start is in <strong>Beta</strong>, but the community is already very excited and hopeful about this.</blockquote><blockquote>TanStack Team has already confirmed that there will not be any major breaking changes till it comes out of beta.</blockquote><blockquote>To <a href="https://tanstack.com/start/latest/docs/framework/react/getting-started">get started</a> Use the <a href="https://tanstack.com/start/latest/docs/framework/react/quick-start">Quick Start Examples</a> or <a href="https://tanstack.com/start/latest/docs/framework/react/build-from-scratch">Build a project from scratch</a>.<br>I have personally asked the question about TanStack CLI, &amp; the great @tannerlinsley himself confirmed that they are already working on the CLI.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ctFm-g_pKu8ldbKQKWD8w.png" /></figure><h4><a href="https://tanstack.com/">Don’t forget to checkout the full collection of amazing open source libraries built by TanStack Team today.</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thirbMdRpOlKXv5r9Ciy5Q.png" /><figcaption>TanStack Libraries</figcaption></figure><p>I will be back with more such exciting stuff, till then, <strong><em>Keep Learning, Keep Sharing &amp; Keep Rocking</em></strong>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4143de93fc7e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/tanstack-start-a-new-framework-revolutionizing-react-development-4143de93fc7e">TanStack Start: A New Framework Revolutionizing React Development</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securely using NPM credentials with Docker]]></title>
            <link>https://medium.com/learnwithrahul/securely-using-npm-credentials-with-docker-f38b43bdb7c1?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/f38b43bdb7c1</guid>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Mon, 25 Apr 2022 14:13:36 GMT</pubDate>
            <atom:updated>2022-04-25T14:12:52.107Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eYzmfYHnZAJVXDnrTH1GMA.jpeg" /></figure><p><em>Are you working on a </em><strong><em>NodeJS Application with Docker</em></strong><em> ? Do you use </em><strong><em>private NPM modules</em></strong><em> (registry.npmjs.org or your own module artifactory)? Most importantly, </em><strong><em>are you using NPM credentials securely while building your Docker images?</em></strong></p><p>If your answer to last question is “<strong>Not Sure</strong>” or “<strong>No</strong>”<strong>, </strong>following<strong> </strong>guide is worth reading and implementing ultimately.</p><p><strong><em>NOTE: this post assumes you have basic understanding around NodeJS, NPM &amp; Docker.</em></strong></p><h3>When do you need NPM credentials ?</h3><p>Most of the time you might be using <strong><em>public npm modules </em></strong>which can be installed without no extra setup, but if you are using some <strong>private npm modules</strong>, you will need to provide NPM credentials via <strong>.npmrc file. </strong>These credentials can be either single <em>Access Token or username, password, CA certs etc. </em>For simplicity, we will consider Token as access credential.</p><h3>Easy &amp; insecure approaches for providing <strong>.npmrc file </strong>to <strong>Docker Build</strong></h3><ul><li><strong>Copy .npmrc file</strong> with credentials to Docker Image during build</li><li><strong>Copy .npmrc file</strong> with placeholders (credential variables) to Docker Image, pass build arguments during build, embed build arguments as env values to .npmrc (automatically during <em>npm install</em>)</li></ul><h3>Why the above approaches are insecure?</h3><p><em>.npmrc files or npm credentials can be compromised if Docker image, image builder host, or the running container is compromised to theft!</em></p><p>Following are different places from where credentials can be leaked during a security incident:</p><ul><li>Stealing .npmrc file from running containers or image (if you leave it in image after build)</li><li>Stealing .npmrc file from intermediate images (layers): even if you delete .npmrc after npm install, it <strong>will leave traces in intermediate layers</strong> of Docker images</li><li>Leaking npm tokens in the image commit history — if you pass credentials as build args to Docker image build, it will again <strong>leave traces </strong>&amp; credentials can be easily recovered from image commit history</li><li>Leaking tokens in Docker container env values : if you used the second approach described in previous section, your credentials will live in Docker containers environment &amp; are subject to theft when Container is compromised</li></ul><h3>Using .npmrc securely</h3><p>There are 2 ways we can use .npmrc file to avoid above vulnerabilities:</p><ul><li>Use multi-stage docker builds</li><li>Use Docker build secrets</li></ul><p>Multi stage Docker build serves different purpose but was being used as a workaround (prior to build secrets) for securely passing npm credentials to Docker build.</p><p>As we already have <strong><em>build secrets </em></strong>support in Docker now, it is the <strong>recommended way </strong>for passing npm credentials.<br>To keep this post focused, we are only going to talk about <strong>using Docker build secrets</strong>.</p><h3><strong>Docker build secrets to rescue</strong></h3><p>You can easily configure your Dockerfile to receive .npmrc file <strong>via build secrets</strong>, that will not leave any trace after npm dependency installation is done. This is a 2 step process:</p><ul><li>Tweak <strong>Dockerfile to use .npmrc </strong>from build secrets</li><li>Pass <strong>.npmrc as build secret</strong> at the time of building the Docker image</li></ul><h4>Tweak <strong>Dockerfile to use .npmrc </strong>from build secrets</h4><figure><img alt="Using docker build secrets in Dockerfile with npm installation" src="https://cdn-images-1.medium.com/max/1024/1*ffjYLUmj-BsAYiZPCHnyGg.png" /><figcaption>Dockerfile with .npmrc as build secret for npm install</figcaption></figure><h4>Pass <strong>.npmrc as build secret</strong> at the time of building the Docker image</h4><figure><img alt="Passing .npmrc as build secret to Docker build command" src="https://cdn-images-1.medium.com/max/1024/1*NvPQhtOQPSemhgd3M--NQg.png" /><figcaption>Passing .npmrc as Docker build secrets during build phase</figcaption></figure><p>NOTE :<em> if you are building your Docker images in a CI/CD environment (Jenkins, Circle CI), you will need to provision the .npmrc file at some secure location on the builder host machine.</em></p><p><strong>This is it ! Your .npmrc credentials are now secure. It is just being used at the time of build &amp; not getting embed in Docker image and not leaving any traces in build history.</strong></p><p>Special Thanks to <strong>Alexandra Ulsh </strong>for 2 amazing posts that covered this stuff in details :</p><p><a href="https://www.alexandraulsh.com/2018/06/25/docker-npmrc-security/">https://www.alexandraulsh.com/2018/06/25/docker-npmrc-security/</a><br><a href="https://www.alexandraulsh.com/2019/02/24/docker-build-secrets-and-npmrc/">https://www.alexandraulsh.com/2019/02/24/docker-build-secrets-and-npmrc/</a><br> <br>I will be back with some more learnings, till then …</p><p><strong>Keep Learning, Keep Sharing &amp; Keep Rocking !</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f38b43bdb7c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/securely-using-npm-credentials-with-docker-f38b43bdb7c1">Securely using NPM credentials with Docker</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zero downtime deployments with PM2]]></title>
            <link>https://medium.com/learnwithrahul/zero-downtime-deployments-with-pm2-93013713df15?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/93013713df15</guid>
            <category><![CDATA[pm2]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[express]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Thu, 08 Apr 2021 05:47:07 GMT</pubDate>
            <atom:updated>2021-04-08T05:43:21.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*iRVZdUtpz0Um_lMumhsTLA.png" /></figure><blockquote>PM2 is the most popular process management tool for Node/Express apps in production. It allows us to run Node/Express application as background process. Multiple running applications on a single machine can be managed with ease using PM2. If you wish to explore all the offerings from PM2 in detail you can <a href="https://pm2.keymetrics.io/docs/usage/quick-start/">read more here</a>.</blockquote><h4>Objective</h4><p>We are going to focus mainly around the process of achieving <strong>Zero downtime deployments with PM2. </strong>If you are not familiar with the basics of PM2, please read this <a href="https://pm2.keymetrics.io/docs/usage/quick-start/">Quick Start Guide</a> &amp; explore various possibilities with PM2.</p><h3>Zero Downtime Deployments</h3><h4>What &amp; Why?</h4><p><strong>Zero downtime deployments </strong>allows us to deploy new changes to already running application without impacting the application users. It is most likely that when we are doing deployment, some or many of our users are using the application. Pushing the new changes to a running Node/Express application <strong>requires application server restart .</strong> Most of the times Node/Express server requires some time after restart to be ready to accept requests from consumers due to various factors like <em>Database Connection(s), Logger setup, Web Socket setup, cron job schedules &amp; many more application specific needs</em>.</p><p>In order to ensure minimum business impact (downtime) due to the deployments, we should always ensure <strong>Zero downtime deployments.</strong></p><h4>How?</h4><p>We can utilise various PM2 parameters to achieve zero downtime deployment. We need to configure our restart command with various options (as per our requirements) &amp; minimal change in our code for this to work properly.</p><h4>Concepts</h4><p>Before we start, we need to explore a few terminologies in terms of PM2 to completely understand the whole configuration.</p><h4>Cluster Mode</h4><p>PM2 offers to run any Node/Express application in cluster mode.</p><p>The <strong>cluster mode</strong> allows networked Node. js applications (http(s)/tcp/udp server) to be scaled across all CPUs available, without any code modifications. This greatly increases the performance and reliability of your applications, depending on the number of CPUs available. <a href="https://pm2.keymetrics.io/docs/usage/cluster-mode/">Read More &gt;&gt;</a></p><p>So, basically we can run multiple instances of our application listening on same port &amp; these instances are automatically load balanced by PM2 in round robin fashion.<br>If we deploy our application in cluster mode &amp; use <strong>pm2 reload </strong>instead of<strong> pm2 restart, </strong>PM2 will restart these multiple instances one by one, so that we don’t have a downtime (as other worker processes are already running).</p><h4>wait-ready</h4><p>If we run our application with PM2 along with <strong>wait-ready</strong> configuration, during next redeployment (i.e. pm2 reload), it will <strong>wait for one instance to become ready to accept requests</strong> before moving to next instance for a restart. <br>This very common that Node/Express applications takes some time to be ready for serving user requests after a restart due to various factors like <em>Database Connection(s), Logger setup, Web Socket setup, cron job schedules &amp; many more application specific needs</em>.<br>This configuration requires one line of code in our application to signal that server is ready. This is done by running following line of code after we are done with all initialisation stuff mentioned above (DB setup etc.):</p><p>process.send(&#39;ready&#39;);</p><h4>listen-timeout</h4><p>By default, PM2 waits for 3s for an instance to signal “ready” (if we use wait-ready option mentioned above). If our server takes more than 3s, it will move to next instance restart without waiting further.<br>In order to fix the same, we need to specify <strong>listen-timeout </strong>with our start configuration. Suppose generally our server takes 5-8 seconds to be ready, we can specify a <strong>listen-timeout </strong>of 10000 (10s) to be on safer side. Now PM2 will wait for maximum of 10 seconds to get &quot;ready&quot; signal from an instance. If it gets ready signal before 1listen-timeout, it will move to next instance immediately for next instance restart.</p><h3>Configuring the startup command</h3><p>The above mentioned configuration can be achieved using following <strong>startup command</strong> &amp; above specified 1 liner code change.</p><p>pm2 start <strong>your_startup_file.js</strong> --name YOUR_APP_NAME -i 2 --wait-ready --listen-timeout 10000</p><p>Replace your_startup_file.js with your actual startup file (<strong><em>app.js, server.js, index.js</em> </strong>etc.). Apart from this, you can also change the listen-timeout value &amp; number of instances (-i) as per your need.</p><h3>Redeploying the changes</h3><ul><li>Pull the changes (git/zip download &amp; extract)</li><li>Run command <strong>pm2 reload </strong><em>YOUR_APP_NAME</em></li></ul><h3>A better way to manage startup configurations</h3><p>As we can see, now we have more flags with our startup commands &amp; it is more prone to mistakes while executing the startup command.<br>We can save this configuration to<strong> json/js</strong> file &amp; then use that file to execute startup command.<br>Create a file with a <strong>name of your choice </strong>(e.g. pm2.json, pm2.stage.json, pm2.prod.json etc.) in your project root (keep <strong>cwd</strong> in mind) &amp; add following configuration (modify as per your needs).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbXCP3hY4jXCEr-gW-zsAA.png" /><figcaption>PM2 app startup configuration</figcaption></figure><h3>Special Notes</h3><ul><li><strong>instance_var</strong> : This key is used to specify env var name for instance identifier. here we provided it as <strong>APP_INSTANCE_SEQ</strong>, but you can specify any string here. inside your code you can get value of instance identifier as <strong>process.env.APP_INSTANCE_SEQ (</strong>or whatever string you provided with instance_var). Instance identifier is helpful in identifying specific application instance to perform specific task on a single instance instead of all application instances, e.g. Cron job schedules - <strong>we don&#39;t want to do duplicate task execution while running multi instance setup.</strong></li><li><strong>restart_delay : </strong>If our application instances go down due to some unusual reason, PM2 will try to restart application instances automatically. In such cases, we don&#39;t want to bombard our resources (like DBs) continuously for startup connections. We can use this value to specify a <strong>delay for automatic restarts in case of failures</strong>.</li><li><strong>cwd: </strong>This is the working directory, relative to which PM2 looks for &quot;script&quot; (startup file). If you specify it as &quot;.&quot; (or keep unspecified), PM2 will look for startup file relative to directory from where startup command was executed.</li><li><strong>env</strong>: This can be used for injecting environment variables for our application instances. PM2 supports <a href="https://pm2.keymetrics.io/docs/usage/environment/">multi environment configuration setup</a> as well, but generally we do environment related stuff using system env vars or a .env files.</li><li><strong>RECOMMENDATION</strong> : PM2 supports <a href="https://pm2.keymetrics.io/docs/usage/application-declaration/#cli"><strong>multi-app configuration in a single file</strong></a> but it is better to use separate files for managing different configurations for <strong>prod, stage, dev</strong> &amp; so on - <strong><em>pm2.&lt;YOUR_ENV&gt;.json,</em></strong></li></ul><h3>Executing tasks on single instance</h3><p>As we will be running our application in cluster mode, every instance will be identical &amp; everything will be performed on all instances. But many times we need to do special things that should not be duplicated.<br>For example we have a <strong>cron job schedule, </strong>that runs every 12 hours.<br>If we have 3 instances of our application, every 12 hours our cron job will be executed 3 times but we don’t want to do that !!<br>In order to avoid such situation, we need to identify primary instance &amp; do those specific actions on that instance only. This can be easily done by <strong>APP_INSTANCE_SEQ</strong> env variable that we configured earlier.</p><p>so, suppose at the application startup, we are <strong>registering cron job schedule, </strong>we can check following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gnn54By0m3Sz9iFsOAQFhw.png" /><figcaption>Performing specific task on specific instance</figcaption></figure><p>I hope this comprehensive guide to setup your PM2 deployment will help you achieve zero downtime deployments for your next/existing project(s).</p><p>I will be back with more exciting content from my day to day technical learnings. So, stay tuned &amp;</p><h4>Keep Learning, Keep Sharing and Keep Rocking …. <strong>🔥🔥</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93013713df15" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/zero-downtime-deployments-with-pm2-93013713df15">Zero downtime deployments with PM2</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Environment Variables with StencilJS]]></title>
            <link>https://medium.com/learnwithrahul/using-environment-variables-with-stenciljs-d3425592fa18?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/d3425592fa18</guid>
            <category><![CDATA[stencil]]></category>
            <category><![CDATA[stenciljs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Fri, 14 Jun 2019 19:30:26 GMT</pubDate>
            <atom:updated>2019-06-20T01:55:15.507Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Duxh3-NEIMzfEI48OpGzGQ.jpeg" /></figure><blockquote>Are you using or planning to use StencilJS for web component/application development? Have you ever required something that is environment specific &amp; needs to be replaced in your final build (at compile time)?</blockquote><p>So without any further delay let’s begin:</p><h3><strong>How Environment Variables are useful?</strong></h3><ul><li>We can have something that is specific to some particular environment build(dev/stage/prod), e.g. API host, hosted Style URLs, log levels (debug, error, trace, all)</li><li>Easy to manage configuration values using system/user variables or file</li></ul><h3>What do we want to achieve?</h3><ul><li>Read values from <strong><em>Operating System’s Environment Variables </em></strong>or a <strong>.env</strong> <strong>File</strong></li><li>Replace some keys with these values in our source code before building</li></ul><h3>Integrating Environment Variable read &amp; replace process</h3><blockquote>I suppose you have already created a Stencil project using <strong>npm init stencil</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*z3fdEl_gJ-Qh1tTdvuwIKA.png" /><figcaption>A sample stencil component project</figcaption></figure><p>1. Go to the project root &amp;<strong> install </strong><a href="https://www.npmjs.com/package/rollup-plugin-dotenv"><strong>rollup-plugin-dotenv</strong></a><strong> </strong>as dev dependency</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*-sKf5wKKlAUgsQFlMg_8sA.png" /><figcaption>npm i rollup-plugin-dotenv @types/node -D</figcaption></figure><blockquote>or if you use <strong><em>yarn</em></strong></blockquote><blockquote>yarn add <strong>rollup-plugin-dotenv @types/node</strong> -D</blockquote><p>2. Open <strong><em>stencil.config.ts</em></strong> file in your preferred code editor</p><p>Import <strong>rollup-plugin-dotenv</strong> &amp; use it under <strong>plugins </strong>as shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*Yj6Fr_MgUWf9GHCxYpoDlA.png" /><figcaption>Using <strong>rollup-plugin-dotenv</strong></figcaption></figure><p>3. You are all set to use Environment variables now</p><h4>Creating Environment Variables</h4><ul><li>You can either put your environment variables in OS’s system/user variables</li><li>or can <strong><em>create .env file at project root &amp; put the environment specific values</em></strong> in it</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*1cj7srhRIXTFwFq1HPFDWQ.png" /><figcaption>sample .env file</figcaption></figure><h4><strong>Using Environment Variables inside the component</strong></h4><p>It is pretty straight forward: access any value using <strong>process.env.SOMETHING</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g6uBSKdFOBmUhU-ZxEBdsQ.png" /><figcaption>Using env values inside the component</figcaption></figure><blockquote>Hurray, we have used environment driven values in our Stencil Component</blockquote><h3>Things to remember</h3><ul><li><strong>@types/node</strong> typing must be installed (mentioned earlier) to avoid IDE/compilation error report on <strong><em>process.env </em></strong>thing as it is unknown to stencil &amp; typescript syntax!</li><li>Whenever you<strong> add/modify some env variable</strong> you will need to rebuild or <strong>restart your development server</strong></li><li><strong>.env</strong> file values <strong>take precedence</strong> over OS system/user variables. So if some variable is present at both the places, one that is contained inside<strong> .env</strong> file will be used</li><li>plugin first looks for a variable in .env file placed in project root &amp; if not found looks in systems environment variables</li><li><strong><em>Never commit </em></strong><em>.env file, as it is environment specific thing &amp; should be created as per the requirement. You can commit a sample .env.example file to guide anyone who needs to create .env file or system variables</em></li></ul><p><strong>I hope you enjoyed this story. If you liked it, please show your love with some claps. Stay tuned for some more exciting stuff containing my latest learnings.</strong></p><p><strong>Till then,</strong></p><blockquote>😊 Keep Learning, Keep Sharing, &amp; Keep Rocking 😊</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3425592fa18" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/using-environment-variables-with-stenciljs-d3425592fa18">Using Environment Variables with StencilJS</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[April Fool !!! :P]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/learnwithrahul/april-fool-p-5f80844b69cb?source=rss----7f5bb9648126---4"><img src="https://cdn-images-1.medium.com/max/1905/1*bI61UNCRkIMT1hvtXysE9A.jpeg" width="1905"></a></p><p class="medium-feed-snippet">Today if you have googled something and landed to StackOverflow and juggled by the look and feel of it then congratulations you have been&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/learnwithrahul/april-fool-p-5f80844b69cb?source=rss----7f5bb9648126---4">Continue reading on Learn With Rahul »</a></p></div>]]></description>
            <link>https://medium.com/learnwithrahul/april-fool-p-5f80844b69cb?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/5f80844b69cb</guid>
            <category><![CDATA[stackoverflow]]></category>
            <category><![CDATA[glitter]]></category>
            <category><![CDATA[april-fool-pranks]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[unicorns]]></category>
            <dc:creator><![CDATA[Bhammarker Rahul]]></dc:creator>
            <pubDate>Mon, 01 Apr 2019 11:02:22 GMT</pubDate>
            <atom:updated>2019-04-01T11:00:34.966Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[All about the stealing of Cryptocurrency by a node module]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/learnwithrahul/all-about-the-stealing-of-cryptocurrency-by-a-node-module-8793dd0e9e60?source=rss----7f5bb9648126---4"><img src="https://cdn-images-1.medium.com/max/1200/0*a6A5qKRkP-nbCyUK.jpg" width="1200"></a></p><p class="medium-feed-snippet">If you are not surprised by the title that means you are already aware of the security threat by a node module called event-stream, but if&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/learnwithrahul/all-about-the-stealing-of-cryptocurrency-by-a-node-module-8793dd0e9e60?source=rss----7f5bb9648126---4">Continue reading on Learn With Rahul »</a></p></div>]]></description>
            <link>https://medium.com/learnwithrahul/all-about-the-stealing-of-cryptocurrency-by-a-node-module-8793dd0e9e60?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/8793dd0e9e60</guid>
            <category><![CDATA[cryptocurrency-news]]></category>
            <category><![CDATA[threat]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Bhammarker Rahul]]></dc:creator>
            <pubDate>Fri, 30 Nov 2018 16:04:32 GMT</pubDate>
            <atom:updated>2018-11-30T15:44:09.692Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Ways of Bootstrapping Angular Applications]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/learnwithrahul/ways-of-bootstrapping-angular-applications-d379f594f604?source=rss----7f5bb9648126---4"><img src="https://cdn-images-1.medium.com/max/1337/1*5UaDBPUmDQGMFnFE_-QvZg.png" width="1337"></a></p><p class="medium-feed-snippet">Have you ever wondered about how the angular application bootstraps or in easy words how the application starts behind the scene and comes&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/learnwithrahul/ways-of-bootstrapping-angular-applications-d379f594f604?source=rss----7f5bb9648126---4">Continue reading on Learn With Rahul »</a></p></div>]]></description>
            <link>https://medium.com/learnwithrahul/ways-of-bootstrapping-angular-applications-d379f594f604?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/d379f594f604</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[bootstrapping]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[angularjs]]></category>
            <dc:creator><![CDATA[Bhammarker Rahul]]></dc:creator>
            <pubDate>Sun, 03 Jun 2018 18:56:32 GMT</pubDate>
            <atom:updated>2018-06-03T20:41:21.560Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Angular 6: It is almost there…]]></title>
            <link>https://medium.com/learnwithrahul/angular-6-it-is-almost-there-29adcc530933?source=rss----7f5bb9648126---4</link>
            <guid isPermaLink="false">https://medium.com/p/29adcc530933</guid>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[angular2]]></category>
            <category><![CDATA[angular-cli]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[angular-4]]></category>
            <dc:creator><![CDATA[Rahul Bhooteshwar]]></dc:creator>
            <pubDate>Thu, 03 May 2018 07:27:03 GMT</pubDate>
            <atom:updated>2018-05-03T07:25:41.181Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*IDvB6l7iifLNV3Z585qv2Q.png" /></figure><blockquote>So, <a href="https://www.ng-conf.org/">ng-conf-2018</a> is over and it is everywhere… a feature loaded, enhanced and super heroic version of Angular Framework is on its way. Fasten your seatbelts and be prepared for an exciting journey ahead.</blockquote><p>If you are worried about the fact “one more upgrade! more backward compatibility issues, more problems and more effort!!”, so let me tell you it will not be like that. Most of the upgrade stuff should be smooth and it is worth upgrading to Angular 6.</p><p>Following are the key take aways from ng-conf-2018:</p><h3>Long Term Support for Angular</h3><p>Each major Angular version will be supported for atleast 12 months by Angular team. What is there for you? It means Angular team will release fixes/patches for the major version for 12 months and it will allow you to upgrade your application at your own pace.</p><h3>Version Alignment for library releases</h3><p>Currently Angular’s major libraries are not aligned with versioning strategy. From v6 those will be aligned with same version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*WJd-5y7wjuQI9U5_l3z0sQ.jpeg" /></figure><h3>New Angular Renderer “Ivy”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ZonDPQEIyupGMfnFGSgzxw.jpeg" /></figure><p>Not sure, if this will be part of first release of Angular 6 but this is really awesome thing that is going to happen behind the scenes of Angular framework. It is going to change the whole way of rendering Angular application. Don’t worry you need not to change anything to leverage it with V6. The way of writing angular templates will be same but behind the scene it will be a completely different process that will take Angular’s performance to a new level. It will also reduce the build size to a great extent. It will be really a jackpot for next generation Angular apps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*6k84ueWHoiXNJOHtK0GSoQ.jpeg" /><figcaption>Build size comparision with new renderer</figcaption></figure><h3>Providers with tree shakable capabilities</h3><p>Angular v6 will allow you to use a new API that will tree shake away the piece of code that is not required at the moment. That means, the initial bundle that user loads, will no require to pull out all the providers that your application needs. Ultimately further reducing the bundle size.</p><h3>Angular Elements: The long awaited feature is on its way…</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*xbLiVHML2NMn5t0pdFmNkw.jpeg" /></figure><p>So, with Angular v6 you will be able to develop your components in Angular and bundle it within a single script, so that it can be used anywhere in any web application irrespective of the web technology.</p><p>Suppose you have developed an Angular component “World Clock widget”, that you want to include in a site that is using <strong>Adobe Experience Manager </strong>(AEM), or <strong>React</strong> or <strong>Vue</strong> or whatever!</p><p>You will be able to generate a bundle script for that component that you can include in your site and mention the component selector wherever required.</p><p>Isn’t it great? So now you will be able to use Angular in legacy projects that are not SPA but want to leverage features of Angular. It will also facilitate web transformation of legacy websites at your own pace.</p><h3>Angular CLI Features</h3><p>We all know that Angular CLI is a boon for the developers to automate some redundant tasks and generate code scafolding. It helped a lot to save project setup time and maintain code/directory structure consistency thoroughout the project.</p><h4>Extending the CLI with Schematics</h4><p>You might not be aware of Schematics, but you are already using it as a way to create, easily and fast, some type of files, like components, directives, pipes, services… but this is more than that. If you want to know more about schematics you can go <a href="https://blog.angular.io/schematics-an-introduction-dc1dfbc2a2b2">check this out here</a>.</p><blockquote>With V6, New types of schematics will be available, that will be able to ease the integration of new libraries, add capabilities, and <strong>update your </strong><strong>npm dependencies automatically (framework &amp; libraries), update your code and libraries too (RxJS + Material) inside your current Angular project.</strong></blockquote><p>This will ease the upgrade process to future Angular version as it will automatically update the dependencies as well as your code wherever possible. It will also provide suggestions to change code as per the upgrade requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*o8eod8_rxK4FD0RauM9Bxw.jpeg" /></figure><p>Basically, using the new schematic ng add will looks like this:</p><pre>&gt; ng add @angular/pwa</pre><pre>&gt; ng add @angular/elements</pre><pre>&gt; ng add @angular/material</pre><pre>&gt; ng add @ng-bootstrap/schematics</pre><pre>&gt; ng add @clr/angular</pre><pre>&gt; ng add @nativescript/schematics</pre><h4>Generating library scaffolding</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WG6Yxbz_1FKJ0AO4vjBvQg.jpeg" /></figure><p>This was also a long awaited feature. If you want to build a component library which can be published (private or public) for reuse, it is really a headache as of now. A lot of setup and scafolding effort is required. The Angular CLI can now be used to generate your Angular Library. This is something that the community wanted for a long time, and is finally here. Generating the library’s project scaffolding with all the basic features you will need to directly start coding. It will add test infrastructure and a build system too.</p><p>So, that was it as of now. Hope this will excite you for the upcoming superheroic features in Angular framework. Stay tuned for the details of the features, as I will be coming up with some more articles about these new features in depth.</p><p>Keep Learning..Keep Sharing..</p><h3>References</h3><ul><li><a href="https://medium.com/@bencabanes/what-is-coming-with-angular-6-4b059ecabb1">What is coming with Angular 6</a></li><li><a href="https://www.ng-conf.org/">ng-conf April 18-20th 2018 - The World&#39;s Original Angular Conference</a></li><li><a href="http://blog.rangle.io/dangerously-close-to-release-what-to-expect-in-angular-6-and-beyond/">What to Expect in Angular 6 and Beyond</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdIxknqPOWms&amp;src_secure=1&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdIxknqPOWms&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FdIxknqPOWms%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/9c8a205cc7416c3a04a5041d508b8145/href">https://medium.com/media/9c8a205cc7416c3a04a5041d508b8145/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29adcc530933" width="1" height="1" alt=""><hr><p><a href="https://medium.com/learnwithrahul/angular-6-it-is-almost-there-29adcc530933">Angular 6: It is almost there…</a> was originally published in <a href="https://medium.com/learnwithrahul">Learn With Rahul</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>