<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Yubraj Ghimire</title>
    <description>The latest articles on Forem by Yubraj Ghimire (@uvdepanda).</description>
    <link>https://forem.com/uvdepanda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F335912%2Fd071df8f-1f6c-4f4a-9901-048c3b03ba1a.jpg</url>
      <title>Forem: Yubraj Ghimire</title>
      <link>https://forem.com/uvdepanda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/uvdepanda"/>
    <language>en</language>
    <item>
      <title>E-day: A festival of knowledge sharing &amp; caring</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Thu, 24 Sep 2020 15:33:27 +0000</pubDate>
      <link>https://forem.com/etribes/e-day-a-festival-of-knowledge-sharing-caring-4cfg</link>
      <guid>https://forem.com/etribes/e-day-a-festival-of-knowledge-sharing-caring-4cfg</guid>
      <description>&lt;p&gt;In our daily 9-6 jobs, we hardly get a chance to pop out of our regular duties and spread our wings into something interesting to expand our knowledge spectrum, not getting a chance to try out some silly crazy things might also lead to experience monotonous feeling from the work. I think it is important to try out new things from time to time to get energize and live up to the spirit. &lt;strong&gt;E-day came to us to kill our boredom if there is any, to spread the knowledge, to build up the bonding, to grow the network, and of course to enjoy a fine day with great people.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E-day is a festival which occurs every last Friday of a month here at Etribes&lt;/strong&gt;, it is a day where members of Etribes can leverage their knowledge by actively participating in different workshops, every speaker prepares something on some concrete topic with defined agenda and conducts the workshop, this way, the speaker can also build up their presenting skills. &lt;strong&gt;This day is solely supported by Etribes to develop one's skills and polish the rough edges&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Apart from developing the skills, E-day being a platform, gives an opportunity to build up team spirit, to open up an idea, and to be bold. &lt;strong&gt;I usually compare E-day with Christmas&lt;/strong&gt; 🎅 It is very common here at Etribes that we don't see our colleagues on a regular basis since we are highly client-centric and we do find ourselves at the client's station more often. But E-day is a day where all Etribes family members come back to Office and celebrate it together just like at Christmas.&lt;/p&gt;

&lt;p&gt;It is a tradition at Etribes that E-day always ends up with some surprises, &lt;strong&gt;a big shout-out to our&lt;/strong&gt; &lt;strong&gt;E-day Squad Team&lt;/strong&gt;, they always find a way to surprise the members; Ballon Football, Bowling, Beer &amp;amp; Barbecue, Beach Volleyball (lots of B... 🤩). As I am writing this article, our E-day Squad Team is on preparation to execute a very fine &lt;strong&gt;E-day #20 tomorrow&lt;/strong&gt;, since it's the last Friday of the month Septemeber 😁. &lt;/p&gt;

&lt;p&gt;During this E-day journey, &lt;strong&gt;lots of interesting workshops took place on a series of different issues and themes&lt;/strong&gt;. The participants got a very fantastic opportunity to collect vast varieties of knowledge &amp;amp; experiences. As I recall, I am seriously impressed by the following sessions which I have found very much interesting and had lots of things to offer as a takeaway. &lt;/p&gt;

&lt;h4&gt;
  
  
  # How to: Personal Branding by &lt;a href="https://www.linkedin.com/in/nilsseebach/?originalSubdomain=de"&gt;Nils&lt;/a&gt; &amp;amp; &lt;a href="https://www.linkedin.com/in/michel-believes-work-rules/"&gt;Michel&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The biggest takeaway I had from this session is that &lt;strong&gt;no matter how deep is your message, it doesn't get spread far away if you don't have a proper mass of audience&lt;/strong&gt;. After getting some inspiration, I also started expanding my connections pretty seriously especially on LinkedIn so that I would have much more interactions with the people and much more exchange of ideas and opinions. I couldn't attend this session personally since all seats were already taken before I could register 🙈 but still, I was able to watch it in our &lt;strong&gt;Knowledge Base&lt;/strong&gt;. We try to record the session so that interested people can always get benefited from it anytime anywhere.&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kon2LC_F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8x02r1uupw9axv4oh91e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kon2LC_F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8x02r1uupw9axv4oh91e.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  # Open Fuck up Session by &lt;a href="https://www.linkedin.com/in/rogerhp/"&gt;Roger&lt;/a&gt; &amp;amp; &lt;a href="https://www.linkedin.com/in/david-schroeder-05643a30/"&gt;David&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;The biggest highlight of this session was that &lt;strong&gt;it conveyed the message that it's all right to talk about your mistakes, your failures, the wrong turn you took, and its consequences&lt;/strong&gt;. There is no shame in sharing the experiences of bad moments because every single bad moment teaches us something to do in the right way next time. I recall the line by Thomas A. Edison - "I have not failed. I've just found 10,000 ways that won't work."&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zKuyekne--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5120hnvlmzlzsvh4gufe.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zKuyekne--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5120hnvlmzlzsvh4gufe.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  # Healthy Meal Prep by &lt;a href="https://www.linkedin.com/in/melanie-moske/"&gt;Melanie&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This session was a very good example that how vibrant the E-day is, it doesn't always have to be techy or business-oriented, it also can be something which is directly affecting our living style. &lt;strong&gt;A truly simplest session, at the same time, conveying a great message, with a tiny bit of effort you definitely can save your health as well as money.&lt;/strong&gt; &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kXhbnYV6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q1rplgt9xjdh6tpr02ay.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kXhbnYV6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q1rplgt9xjdh6tpr02ay.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  # Buzzword Clean Up by &lt;a href="https://www.linkedin.com/in/b3nnu3/"&gt;Benny&lt;/a&gt;
&lt;/h4&gt;

&lt;p&gt;This session was one of the most interactive sessions I have ever had in this E-day Journey. &lt;strong&gt;It was truly successful in bringing tech-oriented as well as business-oriented people together and helping them interacting and exchanging the knowledge&lt;/strong&gt; with the help of the Buzzword Jeopardy game. It was really fun playing this game and gaining some knowledge of various random buzzwords. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RsUY_N_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bfuayv6j6p13zj81ac8i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RsUY_N_N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bfuayv6j6p13zj81ac8i.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;E-day being a part of Etribes, it is also growing as we are growing&lt;/strong&gt;, the level of interactions and the intensity of message is increasing as the family member of Etribes is increasing. I sincerely would like to thank &lt;a href="https://www.linkedin.com/company/etribes-connect-gmbh/"&gt;Etribes&lt;/a&gt; for bringing this culture and keeping it alive no matter what.&lt;/p&gt;

&lt;p&gt;I would be glad to know if you folks also have this kind of culture or knowledge sharing program at your working station, please do share. Cheers.&lt;/p&gt;

</description>
      <category>knowledgesharing</category>
      <category>teambonding</category>
      <category>beingpositive</category>
      <category>workingtogether</category>
    </item>
    <item>
      <title>What's up with Monolithic and Microservices Architecture</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Tue, 25 Aug 2020 20:41:51 +0000</pubDate>
      <link>https://forem.com/etribes/what-s-up-with-monolithic-and-microservices-architecture-4d6o</link>
      <guid>https://forem.com/etribes/what-s-up-with-monolithic-and-microservices-architecture-4d6o</guid>
      <description>&lt;h2&gt;
  
  
  Monolithic Architecture
&lt;/h2&gt;

&lt;p&gt;The literal meaning of &lt;strong&gt;Monolith&lt;/strong&gt; is something huge, like a &lt;strong&gt;single giant stone&lt;/strong&gt;. In the same way, the Monolithic architecture is the traditional unified model for the software development where the application is &lt;strong&gt;single-tiered&lt;/strong&gt; in which the user interface and data access code are combined into a single program from a single platform. &lt;/p&gt;

&lt;p&gt;The monolithic application can be also comprised of a series of components within a single platform such as User Authorization, Presentation View, Business Module, Persistence Layer, Integration Layer, etc. This application is designed to be self-contained and the modules are highly &lt;strong&gt;interconnected&lt;/strong&gt; and &lt;strong&gt;interdependent&lt;/strong&gt;, since the existence of &lt;strong&gt;tightly coupled&lt;/strong&gt; components, it also requires all the components functioning for the whole program to be executed properly. &lt;/p&gt;

&lt;h3&gt;
  
  
  Monolithic Approach for E-Commerce Application (for checkout service)
&lt;/h3&gt;

&lt;p&gt;The diagram below shows a very simple monolithic architecture for the E-Commerce application where &lt;strong&gt;Application UI&lt;/strong&gt; represents the store web view. Similarly, it also consists of few services such as &lt;strong&gt;Address&lt;/strong&gt;, &lt;strong&gt;Payment&lt;/strong&gt;, and &lt;strong&gt;Order&lt;/strong&gt; serving for the &lt;strong&gt;checkout process&lt;/strong&gt; by using the same database. It might be possible that the services are modular and independent from each other but still, they must work together to fulfill the complete checkout process. And if something goes wrong with any of those single modules it might be possible that the whole system goes down.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o2ILLNsS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/53m2yivk3iqde3hecdyw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o2ILLNsS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/53m2yivk3iqde3hecdyw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When does Monolithic Architecture make sense?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simple to build&lt;/strong&gt; - If the application you are building is simple, and everything is in the same language and framework.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple to test&lt;/strong&gt; - If you want to test your application quickly without any hassles just by launching some testing tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple to deploy&lt;/strong&gt; - If you have seldomly new features which will require to trigger the release of the whole application.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When does Monolithic Architecture pain?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Difficult to maintain&lt;/strong&gt; - If the Application gets too large and takes a long time to make changes or to understand the flow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Less reliable&lt;/strong&gt; - If the release of new features gets increases, most likely the occurrence of the bugs also increases which could also bring down the whole application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge to scale&lt;/strong&gt; - If the system reaches a certain size, compiling, testing, deploying, etc. gets too expensive to maintain a decent uptime. And even scaling from the manpower point of view is difficult since it arises lots of conflicts while working together because of tightly coupled software architecture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No partial deployment&lt;/strong&gt; - If you have frequent feature update then it leads to redeploy the entire application since the partial deployment of the module is not possible in this architecture.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Microservices Architecture
&lt;/h2&gt;

&lt;p&gt;A variant of &lt;strong&gt;service-oriented architecture&lt;/strong&gt; where the application is designed as a set of small services. It is composed of &lt;strong&gt;loosely coupled elements&lt;/strong&gt; that have dedicated and bounded contexts and also has a well-defined interface to communicate with other services. &lt;strong&gt;Flexibility, scalability, and simplicity&lt;/strong&gt; are few takeaways from this architecture which helps software developers to build complex applications. Netflix, eBay, Spotify, Amazon, Uber are some of the world-renowned companies that are truly benefiting from this architecture.  &lt;/p&gt;

&lt;p&gt;Unlike in the monolithic approach where the whole unit is connected with a single database, one can truly comfort from using a &lt;strong&gt;dedicated database for every single service&lt;/strong&gt; to make it independent in a microservices architecture. Having a database per service is essential to make sure that the service is loosely coupled. The &lt;strong&gt;Flexibility of choosing the right tech stack&lt;/strong&gt; as well as the right type of database for every single service is always there. &lt;/p&gt;

&lt;h3&gt;
  
  
  Microservices Approach for E-Commerce Application (for checkout service)
&lt;/h3&gt;

&lt;p&gt;The approach below shows the simple implementation of Microservices Architecture for the checkout process in the E-Commerce application. Each service responsible for checkout process are dependent and loosely coupled, have their database, and served the service to the Application whenever it is requested.  The failure of a single service will only stop serving the content from that service but it won't pull down the whole system to the ground and that's the key beauty of this architecture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_0Mv1cpD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqiblym8p7nl6dzo30ef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_0Mv1cpD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fqiblym8p7nl6dzo30ef.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What to gain from Microservices Architecture?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Highly scalable&lt;/strong&gt; - Every single service can be scaled separately as per the requirements. And also the resources can be used more wisely if the scaling of the service demands more manpower. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Productivity&lt;/strong&gt; -  This approach will allow the team members to work independently on the same project without much need of coordination and it is a better way for large teams. Decision making is quite easier for the team members since they are working decentralized based on the service and they could also choose the right tech stack for that service. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reliability&lt;/strong&gt; - The failure of one microservice affects only one part where the client is using it which means it won't affect the overall performance of the software. And this is not the case in the monolithic approach. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deployment&lt;/strong&gt; - This approach requires more effort for the deployment since one needs to deploys each service independently but the bright side is,  the development team can always deploy their service at their convenience without doing much coordination with other teams. And if something goes wrong, it is much easier to rollback one small microservice than the entire app in the monolithic approach. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agility&lt;/strong&gt; - Agility is a way to go. Microservices architecture allows a large team to get split into several smaller teams handling dedicated responsibilities for separate service which ultimately provides the possibility to work more efficiently by working in a short iterative development cycle. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What are the challenges with Microservices Architecture?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High complexity&lt;/strong&gt; - Being the existence of the several services that function independently requires the proper setup of communication channels that needed to be set to communicate between different modules and with the increment of services, this setup could get complicated to handle. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex testing&lt;/strong&gt; - Unlike, in the monolithic approach where all modules exist in the same unit, microservices have distributed applications where testing gets complicated since it requires lots of configurations to test between different modules. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More time &amp;amp; effort&lt;/strong&gt; - Since every single service is equipped with its database in microservices approach which requires better transaction management. Each independent unit has to be separately deployed and monitored which means the team has to put more time and effort into monitoring and preparing each service for the deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost&lt;/strong&gt; - Cost factor is tricky and difficult to compare but still microservices architecture doesn't come cheap since it requires dedicated resources for every single service. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  When to switch to Microservices Architecture?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;If you have a team with diverse knowledge of languages.&lt;/li&gt;
&lt;li&gt;If you want to tackle the scalability of every service independently.&lt;/li&gt;
&lt;li&gt;If your codebase is huge and difficult to maintain.&lt;/li&gt;
&lt;li&gt;If you see that the existing application could be chopped into several clusters to transform into service.&lt;/li&gt;
&lt;li&gt;If you have distributed teams in different countries.&lt;/li&gt;
&lt;li&gt;If you have some liberal timeline since transforming into microservices requires quite a bit of research and planning.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Are you really using Microservices?
&lt;/h2&gt;

&lt;p&gt;If you think you are truly benefiting from microservices, perhaps the following questions make you think otherwise. 🙈&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Are you able to restart your services independently?&lt;/li&gt;
&lt;li&gt;Are you able to deploy your services independently?&lt;/li&gt;
&lt;li&gt;Does the modification on one service require synchronized modifications of others as well?&lt;/li&gt;
&lt;li&gt;Does the collapse of one database bring the whole system down?&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Additional resources:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://microtica.com/why-transition-from-monolith-to-microservices/"&gt;Why transition from monolith to microservices?&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/microtica/everything-you-need-to-know-to-get-started-with-microservices-5243"&gt;Everything you need to know to get started with microservices&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dzone.com/articles/are-you-sure-youre-using-microservices"&gt;Are you sure you are using microservices?&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Like the &lt;strong&gt;Yin and yang&lt;/strong&gt; ☯️, nothing in the world is perfect, everyone has their package to carry 😜. Choosing the right architecture for software development truly depends on the necessities and the circumstances. I hope with this article you got a bit about Monolithic Architecture and Microservices Architecture. &lt;/p&gt;

&lt;p&gt;If you have any remarks, please feel free to drop the comments, I will be happy to pick it up 😁&lt;/p&gt;

</description>
      <category>software</category>
      <category>architecture</category>
      <category>monolithic</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Some cool extensions with HTTP Basic Authentication</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Wed, 08 Jul 2020 16:03:57 +0000</pubDate>
      <link>https://forem.com/etribes/some-cool-extensions-with-basic-authentication-4l2j</link>
      <guid>https://forem.com/etribes/some-cool-extensions-with-basic-authentication-4l2j</guid>
      <description>&lt;p&gt;Earlier, I explained about &lt;a href="https://dev.to/etribes/restricting-access-with-http-basic-authentication-5ac0"&gt;username/password authentication&lt;/a&gt; to authenticate the users before serving the content. Let's check out few cool extensions on basic authentication together with IP address, specific URLs, and cookie handling this time. &lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The password file is already created (htpasswd)&lt;/li&gt;
&lt;li&gt;username/password authentication is already working&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Basic Authentication together with Access Restriction by IP address
&lt;/h3&gt;

&lt;p&gt;Restricting certain IP address together with HTTP basic authentication can be also achievable with few configurations. Let's see this implementation in the following two cases.&lt;/p&gt;

&lt;h5&gt;
  
  
  Case 1: Allowing access to the user with a &lt;strong&gt;valid username/password&lt;/strong&gt; as well as with a &lt;strong&gt;valid IP Address&lt;/strong&gt;
&lt;/h5&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    location / {
                # satisfy all conditions
                satisfy all;

                deny  192.168.1.2;
                allow 192.168.1.1/24;
                allow 127.0.0.1;
                deny  all;

                # add http basic authentication 
                auth_basic "Password Required";
                auth_basic_user_file /etc/nginx/.htpasswd;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This example shows a combo use case of HTTP basic authentication and IP restriction where &lt;strong&gt;satisfy all&lt;/strong&gt; denotes that the user has to satisfy both conditions to be able to pass the authentication. This example will grant access for the &lt;strong&gt;192.168.1.1/24&lt;/strong&gt; network excluding the &lt;strong&gt;192.168.1.1&lt;/strong&gt; address.&lt;/p&gt;

&lt;h5&gt;
  
  
  Case 2: Allowing access to the user either with a &lt;strong&gt;valid username/password&lt;/strong&gt; or with a &lt;strong&gt;valid IP address&lt;/strong&gt;
&lt;/h5&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    location / {
                # satisfy at least one condition
                satisfy any;

                deny  192.168.1.2;
                allow 192.168.1.1/24;
                allow 127.0.0.1;
                deny  all;

                # add http basic authentication 
                auth_basic "Password Required";
                auth_basic_user_file /etc/nginx/.htpasswd;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;satisfy any&lt;/strong&gt; denotes that the user has to satisfy at least one condition to pass the authentication.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;takeaway points&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;allow&lt;/strong&gt; and &lt;strong&gt;deny&lt;/strong&gt; directives will be applied in the order they are defined.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;satisfy all&lt;/strong&gt; denotes that the user has to satisfy all conditions whereas &lt;strong&gt;satisfy any&lt;/strong&gt; denotes that the access is granted if the user satisfies at least one condition.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Basic Authentication for specific URLs
&lt;/h3&gt;

&lt;p&gt;It is also possible to achieve authentication rules applied to a specific URL instead of applying to all.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
        location /api {
                # add http basic authentication 
                auth_basic "Password Required";
                auth_basic_user_file /etc/nginx/.htpasswd;
    }

    location / {
                auth_basic off;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This example shows that the basic authentication only applies to &lt;strong&gt;/api&lt;/strong&gt; and the rest of the URLs are freely accessible. &lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Authentication together with Cookie and IP address for specific URL (Final episode 😜)
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;map $cookie_bettercallsaul $cookie_bettercallsaul_exists {
  "hailSatanIsubmitToTheDarkSide" "true";
  default                         "false";
}

geo $valid_ip {
  192.168.1.1/24 "true";  #access granted 
  127.0.0.1      "true";  #access granted 
  192.168.1.2    "false"; #access not granted
  default        "false";
}


map $cookie_bettercallsaul_exists$valid_ip $cookie_ip_authentication {
  "truetrue"   "off";  #cookie and IP are valid
  "truefalse"  "off";  #cookie is valid but IP not
  "falsetrue"  "off";  #cookie is not valid but IP
  default      "Password Required"; 
}

server {
    location /api {
                auth_basic  $cookie_ip_authentication;
                auth_basic_user_file  /etc/nginx/.htpasswd;
                add_header Set-Cookie "bettercallsaul=hailSatanIsubmitToTheDarkSide;max-age=3153600000;path=/"; #setting the cookie if authentication is succeeded
                proxy_pass http://127.0.0.1:8000/;
                proxy_set_header Host $host;
                proxy_set_header X-Forwarded-For $remote_addr;
    }

    location / {
                auth_basic off;
    }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This example grants access to the users to &lt;strong&gt;/api&lt;/strong&gt; if they are coming from valid networks or they have specified cookie (bettercallsaul) set. It shows the basic authentication dialog if none of the conditions are satisfied and it will set the cookie once the user has access. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;takeaway points&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;map&lt;/strong&gt; is extremely flexible and powerful module in Nginx configuration. It allows creating variables whose values depend on the values of other variables.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;map &amp;lt;InputValue&amp;gt; &amp;lt;OutputValue&amp;gt; {
  &amp;lt;Match1&amp;gt; &amp;lt;Match1ReturnValue&amp;gt;;
  &amp;lt;Match2&amp;gt; &amp;lt;Match2ReturnValue&amp;gt;;
  default &amp;lt;DefaultReturnValue&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;geo&lt;/strong&gt; module also possesses the same behavior in terms of input and output variables but it is based on IP address.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;geo $geo{
  192.168.1.1/24 1;  
  default        0;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Last but not the least, don't forget to apply your configuration changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo service nginx reload
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt;
  
  
  Conclusion
&lt;/h4&gt;

&lt;p&gt;Well, that's it. That was a simple implementation of basic authentication together with IP restricting, cookie handling, and specific configuration for specific URLs with powerful commands like &lt;strong&gt;geo&lt;/strong&gt; and &lt;strong&gt;map&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I hope this post helped you! 👊&lt;/p&gt;

</description>
      <category>nginx</category>
      <category>authentication</category>
      <category>cookie</category>
      <category>ipaddress</category>
    </item>
    <item>
      <title>JavaScript Debugging in PhpStorm</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Wed, 03 Jun 2020 12:42:21 +0000</pubDate>
      <link>https://forem.com/etribes/javascript-debugging-in-phpstorm-43n0</link>
      <guid>https://forem.com/etribes/javascript-debugging-in-phpstorm-43n0</guid>
      <description>&lt;p&gt;Whenever we think of JavaScript debugging 🤔 &lt;strong&gt;console.log&lt;/strong&gt;, &lt;strong&gt;debugger&lt;/strong&gt;, &lt;strong&gt;browser dev tools&lt;/strong&gt; are some terms that come up in our mind but have you ever thought of debugging JavaScript with IDE? &lt;/p&gt;

&lt;p&gt;This post will guide you to integrate JavaScript debugging in PhpStorm in no time.&lt;/p&gt;

&lt;h4&gt;
  
  
  Lets get started...
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Step1 - Install JetBrains IDE Support extension
&lt;/h3&gt;

&lt;p&gt;First of all, you need to install &lt;a href="https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji?hl=en"&gt;JetBrains IDE Support&lt;/a&gt; extension for Google Chrome to debug client-side apps in any IDEs from JetBrains. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t2WG0ITG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q5gtxqw8hksh0i4zg5n0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t2WG0ITG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q5gtxqw8hksh0i4zg5n0.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After installing the extension, now you should see the JetBrains icon in your google chrome panel.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uYhD7JBD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8m93fa09w0007vrk1dc1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uYhD7JBD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8m93fa09w0007vrk1dc1.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step2 - Add JavaScript Debug configuration in PhpStorm
&lt;/h3&gt;

&lt;p&gt;Click &lt;strong&gt;Run|Edit Configurations...&lt;/strong&gt; from the menu which will open the dialog box and add configuration by clicking + icon and choose &lt;strong&gt;JavaScript Debug&lt;/strong&gt; as a new configuration. Provide your &lt;strong&gt;Name&lt;/strong&gt; for the configuration and &lt;strong&gt;URL&lt;/strong&gt; for the server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zx2AgeWr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i9mj5x44fx2y556mbq82.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zx2AgeWr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i9mj5x44fx2y556mbq82.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step3 - Start debugging
&lt;/h3&gt;

&lt;p&gt;Choose the right debugging configuration and start debugging by clicking on the debug icon.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TgNtPiGJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2j0gjoaeoufxcbebdkry.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TgNtPiGJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2j0gjoaeoufxcbebdkry.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will open your project in the new browser.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6bfv8zpf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eoymhc6etkzn3ik7feuv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6bfv8zpf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eoymhc6etkzn3ik7feuv.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you set the breakpoints, you would see the script stops at the breakpoints.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W5cYnEqi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndn0tn80xjaepo118ckz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W5cYnEqi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ndn0tn80xjaepo118ckz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Congratulations! 👏 You have just integrated JavaScript Debugging successfully!&lt;/p&gt;

&lt;p&gt;Keep on coding &amp;amp; keep on debugging 🐞&lt;/p&gt;

</description>
      <category>debugging</category>
      <category>javascript</category>
      <category>phpstorm</category>
      <category>jetbrains</category>
    </item>
    <item>
      <title>Restricting Access with HTTP Basic Authentication</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Wed, 27 May 2020 13:54:00 +0000</pubDate>
      <link>https://forem.com/etribes/restricting-access-with-http-basic-authentication-5ac0</link>
      <guid>https://forem.com/etribes/restricting-access-with-http-basic-authentication-5ac0</guid>
      <description>&lt;p&gt;It is very common practice to restrict your development environment with some sort of &lt;strong&gt;username/password&lt;/strong&gt; authentication so that the visitors has to authenticate first before landing into the website. For this purpose, HTTP basic authentication comes really handy, it is a simple response mechanism with which a server can request authentication information (userId and password) from a client, if the client provides correct credentials then the server serves the protected content otherwise sends authorization error with 401 status code. &lt;/p&gt;

&lt;h3&gt;
  
  
  Lets get started
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;NGINX &lt;/li&gt;
&lt;li&gt;apache2-utils as a password creation utility&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1 - Create a Password File
&lt;/h3&gt;

&lt;p&gt;Creating a password file with a first user &lt;strong&gt;user1&lt;/strong&gt;. Run the &lt;strong&gt;htpasswd&lt;/strong&gt; utility with the &lt;strong&gt;-c&lt;/strong&gt; flag to create a new file. The first argument contains the file path and second one holds the name of the user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo htpasswd -c /etc/nginx/.htpasswd user1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You will be asked to supply and confirm a password for the user.&lt;/p&gt;

&lt;p&gt;Leave out &lt;strong&gt;-c&lt;/strong&gt; flag incase you wish to add multiple users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo htpasswd /etc/nginx/.htpasswd user2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can confirm that the file contains paired username and encrypted passwords:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cat /etc/nginx/.htpasswd 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Output
user1:$apr1$PbDKFyTU$1mPXhE3Yjbygmg5AH5hNE.
user2:$apr1$u/3QM/YL$jVhMow7XyR.umwpRcNdKE0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2 - Configure NGINX HTTP Basic Authentication
&lt;/h3&gt;

&lt;p&gt;Now that you have a file with all users and passwords in an encrypted format that the server can read, the next step would be configuring the server to check this file before serving the protected content. &lt;/p&gt;

&lt;p&gt;To start configuring the server, you would like to find out where does the server configuration is located, this would help you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cat /etc/nginx/nginx.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    #...

    include /etc/nginx/conf.d/*.conf;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In above example, all the configurations are located inside &lt;strong&gt;/etc/nginx/conf.d/&lt;/strong&gt; directive.&lt;/p&gt;

&lt;p&gt;Lets check the configuration files inside this directive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ls /etc/nginx/conf.d/*.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;default.conf  my_proxy.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In above example, it shows that there are two configuration files inside &lt;strong&gt;/etc/nginx/conf.d/&lt;/strong&gt; directive, one is &lt;strong&gt;default.conf&lt;/strong&gt; and another is &lt;strong&gt;my_proxy.conf&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After finding out the correct configuration file, lets begin editing the server configuration and specifying the &lt;strong&gt;auth_basic&lt;/strong&gt; which is a name for the protected area and &lt;strong&gt;auth_basic_user_file&lt;/strong&gt; is a directive with a path to the &lt;strong&gt;.htpasswd&lt;/strong&gt; file that contains user/password pairs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo nano /etc/nginx/conf.d/default.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 80 default_server;
    server_name example.com;

        #....
        location / {

        }
}

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lets add basic authentication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 80 default_server;
    server_name example.com;

        #....
    location / {
                # add http basic authentication 
                auth_basic "Password Required";
                auth_basic_user_file /etc/nginx/.htpasswd;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3 - Testing the Setup
&lt;/h3&gt;

&lt;p&gt;This ends with your server configuration, restart your server to apply the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo service nginx reload
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When everything goes alright, your are prompted to log in when you load your site: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6FQ5J10P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/es3txxqylasvxw1rahnk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6FQ5J10P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/es3txxqylasvxw1rahnk.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the provided username and password do not match the password file, you get the &lt;strong&gt;401 Authorization Required&lt;/strong&gt; error.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Etyv5Qsn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qnb2ocet5gz46ag0gmit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Etyv5Qsn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qnb2ocet5gz46ag0gmit.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;You have just implemented HTTP basic authentication on NGINX. More detailed information about different means of access restrictions are available in &lt;a href="https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/"&gt;NGINX Documentation&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>nginx</category>
      <category>http</category>
      <category>authentication</category>
      <category>restriction</category>
    </item>
    <item>
      <title>Compiling Xdebug manually and integrating with PhpStorm on macOS Catalina 10.15.4</title>
      <dc:creator>Yubraj Ghimire</dc:creator>
      <pubDate>Sun, 17 May 2020 22:47:15 +0000</pubDate>
      <link>https://forem.com/etribes/compiling-xdebug-manually-and-integrating-with-phpstorm-on-macos-catalina-10-15-4-4d0n</link>
      <guid>https://forem.com/etribes/compiling-xdebug-manually-and-integrating-with-phpstorm-on-macos-catalina-10-15-4-4d0n</guid>
      <description>&lt;p&gt;Integrating Xdebug on PhpStorm has been always hectic, something always comes up which makes you to go through number of guides on the web and cost lot of time, if you are lucky you will somehow manage to integrate successfully otherwise keep on looking... &lt;/p&gt;

&lt;p&gt;I faced this kind of situations multiple times in past and one more recently with macOS Catalina. I managed to integrate successfully after spending quite bit of time but this time, I would like to share my findings with you so that you don't have to bang your head on the wall :) &lt;/p&gt;

&lt;p&gt;The problem with macOS Catalina is that, Apple decided to nuke &lt;strong&gt;/usr/include&lt;/strong&gt; which has been the default location for C header file in UNIX systems. I tried to install through &lt;strong&gt;pecl install xdebug&lt;/strong&gt; but got the error as the compiler was looking for necessary headers file in &lt;strong&gt;/usr/include&lt;/strong&gt;, so it didn't work out. Then, I end of compiling Xdebug manually by specifying the actual location of the header files which are provided by Xcode but in a different location. It went good and now working like a charm.&lt;/p&gt;

&lt;p&gt;Let's begin the chapter. &lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Xcode
&lt;/h3&gt;

&lt;p&gt;The first step is to get Xcode from the &lt;a href="https://apps.apple.com/ca/app/xcode/id497799835"&gt;App Store&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After installing Xcode, it is time to get the command line tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcode-select --install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If this command fails, you might need to open Xcode and accept the terms and conditions to finish the installation. I am using &lt;strong&gt;Xcode 11.5 beta&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Now, make sure that the path for SDK is found. It could be possible that your path does look a bit different than the one below. If so, then you might need to change the path accordingly later on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Getting source from GitHub
&lt;/h3&gt;

&lt;p&gt;I am using &lt;strong&gt;2.7.0&lt;/strong&gt; which is supported version for &lt;strong&gt;PHP 7.3&lt;/strong&gt; and &lt;strong&gt;PHP 7.4&lt;/strong&gt;. You can check the &lt;a href="https://xdebug.org/docs/compat"&gt;version compatibility&lt;/a&gt; to find the right one for your project.&lt;br&gt;
If you like checking out different versions of Xdebug, you could do it from &lt;a href="https://github.com/xdebug/xdebug"&gt;GitHub&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/xdebug/xdebug.git
cd xdebug
git checkout tags/2.7.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;While checking out if you get the following error then you need to exclude &lt;strong&gt;Users/&lt;/strong&gt; directory in the config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fatal: cannot use /Users/yourname/ as an exclude file
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h5&gt;
  
  
  Excluding &lt;strong&gt;Users/&lt;/strong&gt; directory in the config:
&lt;/h5&gt;

&lt;h5&gt;
  
  
  Path: xdebug/.git/config
&lt;/h5&gt;

&lt;p&gt;You might need to show hidden files by pressing &lt;strong&gt;shift+cmd+.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[core]
      excludesfile = Users/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  phpize
&lt;/h3&gt;

&lt;p&gt;Now, it is time to make a copy of &lt;strong&gt;phpize&lt;/strong&gt; and to edit the include path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cp /usr/bin/phpize .
nano ./phpize
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Find this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;includedir="`eval echo ${prefix}/include`/php"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and replace it with the line below if your SDK path is &lt;strong&gt;/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk&lt;/strong&gt; and if not then use your SDK path which you have already found previously and append &lt;strong&gt;/usr/include/php&lt;/strong&gt; in that path&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;includedir="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/php"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Run &lt;strong&gt;phpize&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./phpize
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You should now see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Configuring for:
PHP Api Version:         20180731
Zend Module Api No:      20180731
Zend Extension Api No:   320180731
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing autoconf
&lt;/h3&gt;

&lt;p&gt;Run following command for building and installing it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./configure --prefix=/usr/local
make
sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Configure and build Xdebug
&lt;/h3&gt;

&lt;p&gt;We can now configure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./configure    

#run following commands for specifying custom SDK location as compiler flags

SDK_PATH=$(xcrun --show-sdk-path)
make CPPFLAGS="-I${SDK_PATH}/usr/include/php -I${SDK_PATH}/usr/include/php/main -I${SDK_PATH}/usr/include/php/TSRM -I${SDK_PATH}/usr/include/php/Zend -I${SDK_PATH}/usr/include/php/ext -I${SDK_PATH}/usr/include/php/ext/date/lib"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You might see some warnings but can be ignored. Now, its time to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You might see the Error like below and which makes sense because it can't move the extension to the right place due to System Integrity Protocol (SIP) will not allow it. Therefore, we will take care of this manually at the next step. &lt;strong&gt;make install&lt;/strong&gt; is still required as it will sign the *.so file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20180731/
cp: /usr/lib/php/extensions/no-debug-non-zts-20180731/#INST@13740#: Operation not permitted
make: *** [install-modules] Error 1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Enabling Xdebug in PHP
&lt;/h3&gt;

&lt;p&gt;Lets move the executable to &lt;strong&gt;/usr/local/php/extensions&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mkdir -p /usr/local/php/extensions
sudo cp $(php-config --extension-dir)/xdebug.so /usr/local/php/extensions
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now, we enable Xdebug by editing the PHP configuration in &lt;strong&gt;php.ini&lt;/strong&gt;.&lt;br&gt;
Lets locate the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd /etc
tail php.ini
php.ini          php.ini.default

#If you don't find php.ini, then you can just copy the default one

cp php.ini.default php.ini
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Editing the configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo nano php.ini

#Add the following at the bottom and save it

[xdebug]
zend_extension=/usr/local/php/extensions/xdebug.so
xdebug.remote_enable=on
xdebug.remote_log="/var/log/xdebug.log"
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Restart build in server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apachectl restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here comes the moment of truth:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;php -i | grep "xdebug support"

#If the above command returns following outcome then you are set to go :)
xdebug support =&amp;gt; enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lets open the second chapter...&lt;/p&gt;

&lt;h3&gt;
  
  
  Configure Xdebug in PhpStorm
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;strong&gt;Settings/Preferences&lt;/strong&gt;, select &lt;strong&gt;Language &amp;amp; Frameworks|PHP&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On the &lt;strong&gt;PHP&lt;/strong&gt; page, choose the relevant PHP installation from the &lt;strong&gt;CLI Interpreter&lt;/strong&gt; list and click the browse button (...) next to the field.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bL5Bmto8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tnfe64n8c1l0yiu36p0z.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;The name and version of the debugging engine associated with the selected PHP installation shows up here. If debugger is properly configured, PhpStorm shows the message:
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Xgk34kY0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/pxk1yzywkyjiu2uq7pax.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Now, click &lt;strong&gt;Run|Edit Configurations...&lt;/strong&gt; from the menu which will open the dialog box&lt;/li&gt;
&lt;li&gt;Add server configuration by clicking &lt;strong&gt;+&lt;/strong&gt; icon and choose &lt;strong&gt;PHP Remote Debug&lt;/strong&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vwmSAVMz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e19bt3x8m2mxcshg7taf.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Name:&lt;/strong&gt; provide whatever name you like to call for your remote debug&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter debug connection by IDE key:&lt;/strong&gt; checked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Server:&lt;/strong&gt; click the browse button (...) next to the field to create one
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---8yWy2lM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9y4wu3ugzlejzu3w85b8.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Above example shows the localhost setup, you can use mappings if the server is remote or symlinks are used&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDE key(session id):&lt;/strong&gt; PHPSTORM&lt;/li&gt;
&lt;li&gt;Session id has to be exactly same with the one from the Xdebug browser extension, it will come up in next step&lt;/li&gt;
&lt;li&gt;Apply the configurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Lets test the configuration&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click &lt;strong&gt;Run|Web Server Debug Validation&lt;/strong&gt;, it will open the dialog box&lt;/li&gt;
&lt;li&gt;Provide path for the project and Url and click Validate, if you see something like this below then you are all set.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---1JB8MLl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ntiabi7c3uzvjonrlxt1.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;One last thing is left which is adding &lt;a href="https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en"&gt;Xdebug helper&lt;/a&gt; as an extension in google chrome.&lt;/li&gt;
&lt;li&gt;After adding it, right click on the Xdebug helper which will open the menu, you could find it on the top right section of the google chrome.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zMzo6txl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4oplsx5d3wwzcycwv7vr.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Click on &lt;strong&gt;Options&lt;/strong&gt; from the menu&lt;/li&gt;
&lt;li&gt;Select your IDE and provide the sessionkey, previously we have used &lt;strong&gt;PHPSTORM&lt;/strong&gt;, we will use the same one here
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KbP-P6IU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o8dbmah627n1ip8pbcln.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;li&gt;Don't forget to activate the Xdebug helper, just click on the icon and click &lt;strong&gt;Debug&lt;/strong&gt; from the menu, it will turns into green.&lt;/li&gt;
&lt;li&gt;Activate &lt;strong&gt;Start listening for PHP Debug Connections&lt;/strong&gt; by clicking on following icon in PhpStorm, when it is activated it turns into green.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PWmuXtvb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hhofbm9bduzavhxiczv6.png" alt="Alt Text"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thats it. &lt;/p&gt;

&lt;p&gt;Set some breakpoints, run the project and 💥&lt;/p&gt;

&lt;p&gt;Keep coding! Keep debugging! 👊&lt;/p&gt;

</description>
      <category>xdebug</category>
      <category>phpstorm</category>
      <category>macos</category>
      <category>catalina</category>
    </item>
  </channel>
</rss>
