<?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 Dureksha Wasala on Medium]]></title>
        <description><![CDATA[Stories by Dureksha Wasala on Medium]]></description>
        <link>https://medium.com/@durekshawasala?source=rss-fbd27b82c1f9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*WzzcFLe9oqxclOG_B__n4w.jpeg</url>
            <title>Stories by Dureksha Wasala on Medium</title>
            <link>https://medium.com/@durekshawasala?source=rss-fbd27b82c1f9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 18:09:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@durekshawasala/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[How to Slash Through Node.js Date Comparison Pitfalls]]></title>
            <link>https://medium.com/bitsrc/how-to-slash-through-node-js-date-comparison-pitfalls-43d7939b0d06?source=rss-fbd27b82c1f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/43d7939b0d06</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[date]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <dc:creator><![CDATA[Dureksha Wasala]]></dc:creator>
            <pubDate>Tue, 12 Nov 2024 20:23:01 GMT</pubDate>
            <atom:updated>2024-11-12T20:34:39.052Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8CBpGNNEDcPw6K9V8SmHw.png" /></figure><p>Hi folks 👋 I have decided to share some of my personal experiences related to handling dates in Node.js. When it comes to handling date comparisons with Node.js, you might assume that going for an actual date is easier than this 😅. This post provides valuable tips and tricks for mastering date comparisons, enabling you to handle complex tasks such as calendar scheduling and filtering appointments with ease.</p><h4>Understanding JavaScript Dates in Node.js</h4><p>Understanding how Javascript represents dates is the first step to using them wisely. When you create a date, Javascript actually represents it as a timestamp (milliseconds from January 1, 1970). The issue arises when Node.js dates fail to handle the time zones and formats naturally.</p><h4>What is ISO 8601?</h4><p>If you ask me the best format for dates, I would say ISO 8601. It is both widely used and unambiguous. Using the ISO format (YYYY-MM-DDTHH:MM:SSZ) ensures consistency in the stored data, making it easier to compare across different systems. Having a consistent format helps the developers to avoid the pitfalls when it comes to local time conversions and date comparisons.</p><h4>Using Libraries to Simplify Date Handling</h4><p>Another approach to simplifying date handling is using a third-party library instead of the built-in JavaScript date methods. Following are some of the popular packages that you can use after carefully considering your project requirements and constraints.</p><blockquote><strong><em>Moment.js — </em></strong><a href="https://momentjs.com/"><strong><em>https://momentjs.com/</em></strong></a></blockquote><blockquote><strong><em>Date-fns — </em></strong><a href="https://date-fns.org/"><strong><em>https://date-fns.org/</em></strong></a></blockquote><blockquote><strong><em>Day.js — </em></strong><a href="https://day.js.org/"><strong><em>https://day.js.org/</em></strong></a></blockquote><blockquote><strong><em>Luxon — </em></strong><a href="https://github.com/moment/luxon"><strong><em>https://github.com/moment/luxon</em></strong></a></blockquote><p>Having a third-party library will ease out more complex implementations related to dates.</p><h4>Common Date Comparison Scenarios</h4><p>The first confusing situation that every developer encounters is the need to compare two dates for equality. Why I would say that is if you try to compare two dates as they are with the == operator, the output will be false 😵‍💫. Crazy, right?</p><pre>var date1 = new Date();<br>var date2 = new Date();<br><br>console.log(date1);<br>console.log(date2);<br>console.log(date1==date2?&quot;Two Dates Are Same&quot;:&quot;Two Dates Are Not Same&quot;);</pre><p>If you want to compare two dates in the correct way, what you have to do is use the getTime() method. The getTime() method will return the number of milliseconds since the Unix Epoch, and the comparison will be made between two numbers. Since the number is a primitive data type and the operator behaves as expected, the output is true.</p><pre>var date1 = new Date();<br>var date2 = new Date();<br><br>console.log(date1);<br>console.log(date2);<br>console.log(date1.getTime()==date2.getTime()?&quot;Two Dates Are Same&quot;:&quot;Two Dates Are Not Same&quot;);</pre><p>You’re probably wondering what would happen if we used other operators. With other operators, like less than (&lt;) and greater than (&gt;), it would evaluate and output whether a date comes before or after another date, respectively.</p><pre>var date1 = new Date(&#39;2024-11-13&#39;);<br>var date2 = new Date(&#39;2024-11-11&#39;);<br><br>console.log(date1);<br>console.log(date2);<br>console.log(date1 &gt; date2?&quot;Date 1 is after Date 2&quot;:&quot;Date 1 is before Date 2&quot;);<br><br>var date3 = new Date(&#39;2024-11-10&#39;);<br>var date4 = new Date(&#39;2024-11-11&#39;);<br><br>console.log(date1);<br>console.log(date2);<br>console.log(date3 &lt; date4?&quot;Date 3 is before Date 4&quot;:&quot;Date 3 is after Date 4&quot;);</pre><p>Alright, the next big reveal is about less than or equal to (≤) and greater than or equal to (≥). Despite the unexpected behavior of the equal operator, as you previously observed, it functions correctly in this particular case. When you apply these two operators to two date objects, Node.js uses the getTime() method to convert their values to numbers. You may wonder what on earth that is 😂. As you may already know, JavaScript is a dynamic and weakly typed programming language. So it assigns the types on our behalf, and that becomes useful in some use cases like this.</p><pre>var date1 = new Date(&#39;2024-11-11&#39;);<br>var date2 = new Date(&#39;2024-11-11&#39;);<br><br>console.log(date1);<br>console.log(date2);<br>console.log(date1 &gt;= date2?&quot;Date 1 is greater than or equal to Date 2&quot;:&quot;Date 1 is less than Date 2&quot;);</pre><h4>Handling Time Zones Like a Pro</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aARYG92Oswet3FAu" /><figcaption>Photo by <a href="https://unsplash.com/@luiscortestamez?utm_source=medium&amp;utm_medium=referral">Luis Cortes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The best way to handle time zones in your implementation is to store your dates in UTC format in the database. In this manner, we could say that all dates are in the same language, avoiding time zone conflicts. If you want time zone conversions, you could easily do that at the code level.</p><h4>Wrapping Up!</h4><p>On a final note, keep in mind that dates in Javascript are mutable. Therefore, you should refrain from altering or copying dates prior to any unexpected modifications. Hope you have learned something by spending time here. Stay safe until we meet again ❤️ and &lt;&gt; Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43d7939b0d06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/how-to-slash-through-node-js-date-comparison-pitfalls-43d7939b0d06">How to Slash Through Node.js Date Comparison Pitfalls</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservice Architecture Design Patterns: API Gateway Pattern]]></title>
            <link>https://medium.com/bitsrc/microservice-architecture-design-patterns-api-gateway-pattern-a8f742fe40d4?source=rss-fbd27b82c1f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8f742fe40d4</guid>
            <category><![CDATA[api-gateway-pattern]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Dureksha Wasala]]></dc:creator>
            <pubDate>Sun, 09 Jul 2023 16:57:32 GMT</pubDate>
            <atom:updated>2023-07-12T02:08:20.576Z</atom:updated>
            <content:encoded><![CDATA[<h4>A deep dive into the Microservices API Gateway pattern: explore its benefits, and learn how it can enhance the overall architecture of your application.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RFfmcAYIv_6QY_uc" /><figcaption>Photo by <a href="https://unsplash.com/@growtika?utm_source=medium&amp;utm_medium=referral">Growtika</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the world of modern software development, the microservices architecture has gained significant traction for its scalability, flexibility, and maintainability. As applications become more complex and distributed, managing the communication between various microservices can become a challenge. This is where the Microservices API Gateway pattern comes into play. In this blog post, we will dive into the Microservices API Gateway pattern, its benefits, and how it can enhance the overall architecture of your application.</p><h4>What is the Microservices API Gateway Pattern?</h4><p>The microservices API Gateway pattern acts as a single entry point for all client requests. The API Gateway pattern provides a consolidated interface, simplifies the overall architecture, enhances security, and promotes scalability and flexibility. The API Gateway is responsible for handling authentication, routing, load balancing, caching, etc. The main idea behind the API gateway pattern is to decouple the clients from all the microservices and provide a simplified common interface for communication.</p><blockquote><em>💡</em> If you’re doing all Node.js-based microservices, a good solution would be using <a href="https://bit.cloud/"><strong>Bit</strong></a>. You can set it up as your main package and dependencies manager and it will abstract you from all the tools on the workflow and they’d be able to compose and deploy different versions only using a single tool. The extra benefit is that you can share internal components (i.e. libraries and functions you create for your use case) with other microservices easily.</blockquote><h4>Learn more about building microservices with independent components:</h4><p><a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Component-Driven Microservices with NodeJS and Bit</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/1*RaEEtm0djZ0utvKNAZ_Egg.png" /></figure><h4>Why API Gateway instead of direct client-to-microservice communication?</h4><p>In microservice architectures, a client typically consumes more than one microservice. If there is no gateway, we have to expose microservices separately, and the client needs to handle communication with multiple microservices. This can become a nightmare in the long run. Direct client-to-microservice communication can raise issues like coupling, security issues, and multiple service calls to achieve a single task.</p><h4>Benefits of Using the Microservices API Gateway Pattern</h4><ol><li>Simple Client Interface</li></ol><p>The API gateway pattern simplifies client interaction with microservices. Clients can make requests at the single, unified entry point.</p><p>2. Load balancing and Scaling</p><p>API gateways can scale the underlying service layer dynamically based on the incoming traffic, which ensures optimal resource utilization and high availability.</p><p>3. Security and Authentication</p><p>The API Gateway can handle authentication and authorization for all incoming requests, enforcing security policies consistently across microservices. Gateways can validate access tokens, authenticate clients, set rate limits, and make sure that only authenticated requests are served by the underlying service layer. Another benefit of the gateway pattern is that you can do security implementation from a single point.</p><p>4. API Versioning and Aggregation</p><p>The API gateway pattern allows for the versioning of APIs, enabling graceful transitions and maintaining backward compatibility. Using a gateway, you can send aggregated responses to clients. For example, let’s say that you need to retrieve data from three microservices for a single client request. What will happen is that the gateway will handle the communication and aggregate all the data before sending a response to the client.</p><p>5. Caching</p><p>Implementing caching mechanisms within the API gateway can significantly improve performance and reduce the load on the microservices.</p><p>6. Translation and Transformation</p><p>Using an API gateway, you can perform request and response transformations. API Gateways support different communication protocols and manage protocols according to the specific needs of clients and microservices.</p><p>7. Logging and Monitoring</p><p>With an API Gateway, it becomes easier to capture and analyse logs and metrics related to incoming requests. This helps with better monitoring, debugging, and performance analysis of the entire microservices ecosystem.</p><h4>Drawbacks of Using the Microservices API Gateway Pattern</h4><p>The main drawback of the gateway pattern is a single-point failure. If the gateway fails due to some issue, the backend becomes unresponsive. As a remedy, you can use multiple fine-grained gateways for client requirements (BFF) or think of a scalable gateway solution. Another issue is additional development and maintenance costs. If the gateway is not scaled out properly, it may become a bottleneck for the system as well.</p><blockquote><em>💡</em> If you were using the BFF pattern, it would enable you to <a href="https://bit.dev/blog/sharing-types-between-your-frontend-and-backend-applications-l5qih48g/"><strong>share types between the frontend and the backend</strong></a>, making it possible to have true typesafety between the client and the server.</blockquote><p>With the utilization of best practices and leveraging the power of the API gateway pattern, developers can unlock the full potential of their microservice-based applications. Each and every application has different and unique requirements; it is better to evaluate them before deciding whether the API Gateway pattern is the ideal architecture design pattern for your microservice-based application.</p><p>To read more about API gateways, you can use the following reference:</p><p><a href="https://github.com/ThreeMammals/Ocelot">GitHub - ThreeMammals/Ocelot: dotnet 7.0 API Gateway</a></p><p>We will discuss more Microservice Architecture Design Patterns in the future. Until then, keep safe ❤️ and &lt;&gt; happy coding &lt;/&gt;.</p><p><a href="https://www.buymeacoffee.com/dcjc29">Dureksha Wasala is Posting</a></p><h3>Build microservices with independent Bit components</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*rk0VRo4IloPEG2TF.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong> </strong>is an open-source toolchain for the development of composable software.</p><p>With Bit, you can develop any piece of software — a modern web app, a UI component, a backend service or a CLI script — as an independent, reusable and composable unit of software. Share any component across your applications to make it easier to collaborate and faster to build.</p><p><strong>Join the 100,000+ developers building composable software together.</strong></p><p>Get started with these tutorials:</p><h3>→ Micro-Frontends: <a href="https://youtu.be/zBuBlExo3xA">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Guide</a></h3><h3>→ Code Sharing: <a href="https://youtu.be/9vS86xgG3ak">Video</a> // <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Guide</a></h3><h3>→ Modernization: <a href="https://www.youtube.com/watch?v=c4X1HkFfq1k">Video</a> // <a href="https://blog.bitsrc.io/modernizing-frontend-applications-a-guide-b0bac99be932">Guide</a></h3><h3>→ Monorepo: <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Video</a> // <a href="https://bit.dev/blog/painless-monorepo-dependency-management-with-bit-l4f9fzyw/">Guide</a></h3><h3>→ Microservices: <a href="https://youtu.be/5wxyDLXRho4">Video</a> // <a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Guide</a></h3><h3>→ Design System: <a href="https://youtu.be/YG4kpUXRlG4">Video</a> // <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Guide</a></h3><h3>Learn more:</h3><ul><li><a href="https://bit.dev/blog/mastering-micro-frontends-with-module-federation-and-bit-ljn4ruah/">Mastering Micro Frontends with Module Federation and Bit</a></li><li><a href="https://bit.dev/blog/how-to-integrate-bit-into-your-existing-project-the-basics-lg0tpse5/">How to Integrate Bit into your Existing Project: The Basics</a></li><li><a href="https://blog.bitsrc.io/from-monolith-to-microservices-using-tactical-forking-d3fdd169475e">From Monolith to Microservices Using Tactical Forking</a></li><li><a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Component-Driven Microservices with NodeJS and Bit</a></li><li><a href="https://blog.bitsrc.io/building-microservices-with-confidence-key-strategies-and-techniques-dcc83b452172">Building Microservices with Confidence: Key Strategies and Techniques</a></li><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://bit.dev/blog/how-to-create-a-composable-react-app-with-bit-l7ejpfhc/">How to Create a Composable React App with Bit</a></li><li><a href="https://blog.bitsrc.io/different-protocols-for-microservice-communication-34ab733d4191">Different Protocols for Microservice Communication</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8f742fe40d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/microservice-architecture-design-patterns-api-gateway-pattern-a8f742fe40d4">Microservice Architecture Design Patterns: API Gateway Pattern</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS EC2 Instance Life Cycle — Part 1]]></title>
            <link>https://medium.com/@durekshawasala/aws-ec2-instance-life-cycle-part-1-421d73a94f62?source=rss-fbd27b82c1f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/421d73a94f62</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[lifecycle]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Dureksha Wasala]]></dc:creator>
            <pubDate>Mon, 27 Feb 2023 15:05:23 GMT</pubDate>
            <atom:updated>2023-02-27T15:05:23.147Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS EC2 Instance Life Cycle — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_GQqKm1vrjvjDrLGTAFqA.png" /></figure><p>Elastic Compute Cloud (EC2) is one of AWS’s most popular computing solutions, and we’ll go over the instance life cycle. I’m planning to separate the content into two posts to make it easier to grasp the EC2 lifecycle. The current article discusses instance behaviors, and the following article discusses the stages of the instance life cycle. It is important to understand what happens at various stages when deploying workloads into EC2, as well as to save money by cost optimization.</p><h4>Launch</h4><p>You can launch an instance by using an Amazon Machine Image (AMI), which is the instance’s blueprint. This process is similar to the process of initializing an object from the class. There are various types of AMIs and methods for launching an instance. I won’t go into detail about how to spin up an EC2 instance because this isn’t a post about it, and you can find that information in the AWS official documentation. When you launch an instance, AWS will copy the AMI’s content to the root device and assign necessary network components to the instance.</p><h4>Stop (EBS Backed Instances Only)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PR3NbvskjENn-bDS" /><figcaption>Photo by <a href="https://unsplash.com/@mrthetrain?utm_source=medium&amp;utm_medium=referral">Joshua Hoehne</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Any EBS-backed operating instances can be stopped via the Console or the CLI. When an instance is stopped, its usage is not billed, however its storage (EBS Volume) is. After stopping the instance, you can perform actions such as changing the instance type. When the instance is stopped, the private IPv4 address is retained, but the public IPv4 address is released unless you have attached an Elastic IP to the instance. The data on the root volume is preserved while both the instance store volumes and RAM are erased.</p><h4>Start (EBS Backed Instances Only)</h4><p>Any EBS-backed stopped or stop-hibernated instance can be started again, and the instance will become operational once AWS has provisioned the required resources. Most of the time the host machine gets changed from the previous one.</p><h4>Hibernate (EBS Backed Instances Only)</h4><p>When you start the hibernation process, all processes are frozen and the content in Memory is copied to the EBS root volume. After that, the instance will be stopped and will not be usable until it is restarted. When an instance is hibernated, the instance store volume is erased, but the root volume data is preserved. Only the private IPv4 address will be kept, while the public IPv4 address will be released. If you have an Elastic IP address assigned to the instance, it will be retained and charged by AWS.</p><h4>Reboot</h4><p>Rebooting the instance is the same as restarting your operating system (OS). When an instance is restarted, the data on the instance store volume, the data on the EBS root volume, the public DNS, and the private IP address are all preserved. This does not create a new instance and maintains the instance on the same host machine.</p><h4>Retire</h4><p>When AWS identifies irreversible failures on the instance host hardware, AWS schedules the instance for retirement. AWS terminates or stops the instance on the scheduled date, depending on the type of instance root device. If the instance root device is an EBS volume, the instance is stopped; if it is an instance store volume, the instance is terminated.</p><h4>Terminate</h4><h4>Recover</h4><p>If an instance becomes unreachable due to a hardware failure or an issue that requires AWS assistance to resolve, it will be automatically recovered. This recovered instance will be identical to the original instance, and data saved to memory will be removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VM-iASih04Gcu5nc" /><figcaption>Photo by <a href="https://unsplash.com/@craft_ear?utm_source=medium&amp;utm_medium=referral">Jan Tinneberg</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the following article, we will cover the stages of the instance life cycle and how these behaviors act as triggers for transitions.Until then keep safe ❤️ and &lt;&gt; happy coding &lt;/&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=421d73a94f62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implementing Clean Architecture With Node.js — Part 1]]></title>
            <link>https://medium.com/@durekshawasala/implementing-node-js-clean-architecture-part-1-bfecf11f2313?source=rss-fbd27b82c1f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfecf11f2313</guid>
            <category><![CDATA[layered-architecture]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[hexagonal-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Dureksha Wasala]]></dc:creator>
            <pubDate>Fri, 27 Jan 2023 18:29:56 GMT</pubDate>
            <atom:updated>2023-01-27T18:36:05.595Z</atom:updated>
            <content:encoded><![CDATA[<h3>Implementing Clean Architecture With Node.js — Part 1</h3><h3>What is Clean Architecture ?</h3><p>Clean architecture is a software design philosophy that separates code into different layers according to their responsibilities. Clean architecture makes code more maintainable and scalable in the long run. I hope to write a series of blog posts related to implementing a clean architecture using Node.js. We will discuss the layers of clean architecture and their functions in this article.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_aJn2FBXIKdvgxrE" /><figcaption>Photo by <a href="https://unsplash.com/@cgower?utm_source=medium&amp;utm_medium=referral">Christopher Gower</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Rules In Clean Architecture ?</h3><p>The main rule in clean architecture is related to code dependencies. The code dependencies can only move from the outer layers toward the inner layers. In simple terms, that means that the inner layers do not know what happens in the outer layers. Any implementations done in the outer layers cannot be used within the inner layers. It is recommended only to use imports of the external libraries within the inner layers or the implementations done within the same layer.</p><h3>Layers Of Clean Architecture ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*HUv2Ct0gD_-mmc_qEaBt4w.png" /></figure><p>The layers explained within this section are some simple layers defined in order to keep it simpler without over-engineering. There can be more complex and abstract layer definitions as well.</p><ol><li>Entities Layer / Domain Layer — This layer contains all the business entities we need for our implementation.</li><li>Use Cases Layer / Application Layer — This layer contains all the business scenarios we are implementing.</li><li>Adapter Layer — This layer acts as the entry points and the exit points for our use case implementations. So this layer can have all the controllers, gateways etc.</li><li>Infra Layer / Frameworks — This layer has all the implementations like database definitions, error handling and any other frameworks which can be changed without any affecting business logics of the application.</li></ol><h3>Why Clean Architecture?</h3><p>As stated in the beginning, clean architecture makes code more maintainable, testable, and scalable. Since these layers have distinct responsibilities, we can modify one layer without affecting other layers of clean architecture. This concept makes it easy to adapt the changes done for an application over time. We can focus more on our business logic as layers of clean architecture separate business logic implementation from the utilized data sources or frameworks.</p><p>We will discuss about each and every layer in separate articles in future and we will build up our clean architecture step by step in this <a href="https://github.com/dcjc29/Node.js-Clean-Architecture-Sample">repository</a> as well. Until then keep safe ❤️ and &lt;&gt; happy coding &lt;/&gt; .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfecf11f2313" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Dive Into Azure Global Infrastructure]]></title>
            <link>https://medium.com/@durekshawasala/deep-dive-into-azure-global-infrastructure-c5f84224f67c?source=rss-fbd27b82c1f9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5f84224f67c</guid>
            <category><![CDATA[azure-region]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[global-infrastructure]]></category>
            <category><![CDATA[availability-zone]]></category>
            <category><![CDATA[data-center]]></category>
            <dc:creator><![CDATA[Dureksha Wasala]]></dc:creator>
            <pubDate>Tue, 22 Mar 2022 18:16:51 GMT</pubDate>
            <atom:updated>2022-03-22T18:16:51.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIIy8M4-Ls2ZNpRN2us5yA.jpeg" /></figure><p>Have you ever wonder when you deploy an app into cloud how exactly it is hosted in cloud? Or maybe is it safe to host an app in cloud and how they maintain high availability?This post will clear all your doubts and free your mind.</p><h3>What is a Datacenter?</h3><p>Azure <strong>Datacenter</strong> is the smallest node or the exact physical location where our resources reside.But datacenters are not exposed to end users.These datacenters act exactly as the on premises servers.But since these datacenters are cloud datacenters you have extra capabilities which will help you grow with the customer base (Scale Up) or vice versa (Scale Down) for a lower cost than creating and maintaining own servers.</p><h3>Curious about Azure Regions ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*2yzgJ6z21GRGiIXn5BMYVA.png" /></figure><p>Azure has more <strong>Regions</strong> than any other cloud provider.If you want the exact numbers there are 58 global regions and a region is a set of datacenters inside a latency defined perimeter.Most of the time we deal with these region when we deploy resources.That is why I mentioned that datacenters are not exposed to consumers.Since there are number of regions it has given the opportunity to us as developers to deploy our resources closer to our clients or the users of our application.There are few special regions which cannot be accessed by us like US Gov Virginia,China East etc.Datacenters within these regions are not directly maintained by Microsoft.Other than these information there is an important fact I have to mention.It is <strong>Regional Pairs. </strong>Regional Pair is a relationship defined between two regions that can be located inside the same Geography for disaster recovery purpose.</p><h3>What is the impact of so called Availability Zones ?</h3><p>When we group few datacenters (It may have a single datacenter as well) which are inside a region it is know as a <strong>Availability Zone</strong>.Each and every availability zone has it’s own power source, cooling mechanism and network.Availability zones are important for mission critical systems to maintain its availability and low latency.These availability zones are connected using high speed private fibre optic networks.If one of the availability zone goes other zone will try to cope up with the workload.We can keep a replica of our application in two or more availability zones but it will charge an extra fee for the service.Azure services which support availability zone can be divide in to two groups.</p><ol><li>Zonal Services</li><li>Zonal Redundant Services</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*C46PZD-XmE6UU8A8RQE8nA.png" /></figure><p>Zonal Services have only a single exact location provided or given.For an example we can take virtual machines.Zonal Redundant Services serve across multiple zones.SQL Database is a great example for Zonal Redundant Services.</p><h3>Did you think that was the end ?</h3><p><strong>Geography</strong> is a collection of two or more regions.These regions are interconnected through high speed internet cables and it helps to increase the availability of our application.I know now you wonder about what I said.Imagine the region your app is deployed is not available for a period of 30 minutes and it is the peek time of your business.With Azure it is not a matter to worry anymore.With the high capacity network infrastructure our app will be deployed in a another region which resides in the same geography.</p><p>These azure regions, availability zones, geographies lay the foundation of azure global infrastructure and provide higher availability, low latency, disaster recovery as well as backup for azure consumers.If you want to learn more you can refer the official website.</p><p><a href="https://azure.microsoft.com/en-us/global-infrastructure/">https://azure.microsoft.com/en-us/global-infrastructure/</a></p><h3>Wrapping Up!</h3><p>Hope you got something by spending time here.Stay safe until we meet again.If you want to learn more about Azure Global Infrastructure visit below link.</p><p><a href="https://azure.microsoft.com/en-us/global-infrastructure/">https://azure.microsoft.com/en-us/global-infrastructure/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5f84224f67c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>