<?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[infraspeak - Medium]]></title>
        <description><![CDATA[Infraspeak produces a maintenance management software, this publication is about our journey from a Startup to a scale-up - Medium]]></description>
        <link>https://medium.com/infraspeak?source=rss----efb658d61e1b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>infraspeak - Medium</title>
            <link>https://medium.com/infraspeak?source=rss----efb658d61e1b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 21:15:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/infraspeak" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Infraspeak’s Engineering Cultural Manifesto]]></title>
            <link>https://medium.com/infraspeak/infraspeaks-engineering-cultural-manifest-cc59a85ab585?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/cc59a85ab585</guid>
            <category><![CDATA[culture]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[people]]></category>
            <dc:creator><![CDATA[Fábio Martins]]></dc:creator>
            <pubDate>Fri, 18 Oct 2024 10:25:53 GMT</pubDate>
            <atom:updated>2024-10-18T16:40:10.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bYwq2LAgAk-3cGuj602neA.jpeg" /></figure><p>At Infraspeak, our culture and the people who embody it are our most valuable assets. Culture isn’t defined by parties or cool office perks but by how we interact with each other, create impact, and deliver value. It is built by the very people who live it, making it difficult to maintain because it is constantly changing and evolving. People grow and change, new team members join, others move on, and the context around us evolves as well. However, there is a set of values that should remain constant — guiding principles that ensure our culture evolves in the right direction.</p><p>As our team has grown and scaled, we have occasionally felt that we were diverging from some of these core values and found ourselves frequently talking about them. In the end, we decided to materialize and document the values that define our Engineering culture, which has developed over the years. While we never intended to share these publicly, we’ve recently received emotional feedback about it that encouraged us to share it with the world. So here we are, presenting our Engineering Cultural Manifesto and the principles we strive to live by.</p><p>As members of the engineering team, we are committed to creating a positive, collaborative, and inclusive work environment where everyone can thrive and contribute to the success of our projects and the organization. We value the diversity of our team and respect each other’s perspectives, backgrounds, and experiences. We adhere to the following principles and expectations in our daily work:</p><h3>➕ Positivity as a Foundation</h3><ul><li>We embrace a positive mindset as the cornerstone of our culture by approaching challenges with optimism and encouraging each other to find solutions rather than dwelling on problems.</li><li>We discourage negativity, criticism, and complaints that are not constructive or helpful. Because negativity moves exponentially faster than positivity, and such energy has a deeply negative impact on the quality of our personal and professional lives.</li><li>We celebrate our achievements and express gratitude for the opportunities and support we receive.</li></ul><h3>🗣️ Open and Honest Communication</h3><ul><li>We foster an environment where transparent communication is valued. Team members should express their ideas, concerns, and feedback openly and actively listen to understand each other.</li><li>We communicate clearly, respectfully, and professionally, using appropriate channels and tools while respecting each other’s time and attention and avoiding unnecessary interruptions or distractions.</li><li>We should feel comfortable asking questions or giving feedback to anyone in the company, regardless of their role or seniority, from recent hires to C-Level positions.</li></ul><h3>👥 Collaboration Over Competition</h3><ul><li>We promote a collaborative spirit where the team’s success is celebrated over individual achievements. Individual success is boosted by everyone’s success.</li><li>We encourage knowledge sharing, cross-functional collaboration, and a collective commitment to common goals.</li><li>We support each other, offer help when needed, and seek help when needed. We acknowledge and appreciate each other’s contributions and efforts.</li><li>We discourage comparison or conflict that undermines the team’s cohesion and performance.</li><li>We understand that healthy conflict is a natural part of finding the best solutions. Different opinions should be viewed as “perspectives,” not “personal attacks.” Sometimes, decisions may not align with our expectations. Thus, we need to learn to disagree yet fully commit.</li></ul><h3>❤️ Good Intentions Guide Actions</h3><ul><li>We should assume positive intent in all interactions. We encourage team members to approach each other with kindness, empathy, and the belief that everyone is working towards the collective success of the team and the organization.</li><li>We respect each other’s privacy, boundaries, and preferences and do not make assumptions or judgments about each other.</li><li>We do not engage in any form of harassment, discrimination, or bullying and report any such incidents to the appropriate authorities.</li></ul><h3>👌 Commitment to Quality</h3><ul><li>We uphold a commitment to delivering high-quality work by striving for excellence in every aspect of our projects, from code and design to communication and customer interactions.</li><li>We try to follow our work’s best practices, standards, and guidelines and ensure that it is well documented, tested, and reviewed. We are building a software for the next decade, not for the next year.</li><li>We understand that quality is not only represented by the code we write but also by how we interact and deliver. Our “Culture” is measured by the quality of our interactions, and for this reason, good communication is key in any form.</li><li>We take pride and responsibility for the quality and impact of our work.</li></ul><h3>📚 Continuous Learning Culture</h3><ul><li>We cultivate a culture of continuous learning and improvement by encouraging team members to explore new technologies, share knowledge, and invest time in professional development.</li><li>We collect KPIs to learn, not to evaluate or judge.</li><li>We embrace challenges as opportunities to learn and grow.</li><li>We seek and provide constructive feedback and use it to improve our work and skills.</li><li>We are curious; therefore, we thrive.</li></ul><h3>🎉 Learn and celebrate from failure</h3><ul><li>We celebrate achievements and milestones collectively by acknowledging and appreciating the hard work and dedication that went into achieving our goals.</li><li>We acknowledge and learn from setbacks, with a focus on improvement rather than blame.</li><li>We use both successes and failures as opportunities for shared growth.</li><li>We do not let setbacks discourage us and maintain a positive and resilient attitude.</li><li>We learn from our mistakes and do not repeat them.</li></ul><h3>🎨 Innovation and Creativity</h3><ul><li>We foster an environment that values creativity and innovation by encouraging team members to think outside the box, explore new ideas, share constructive feedback, and take calculated risks to drive continuous improvement.</li><li>We do not limit ourselves to the status quo and challenge ourselves to find better ways of doing things. However, we must respect and protect our application’s stability, compatibility, and maintainability.</li><li>We understand that too much complexity, bureaucracy, processes, and standardization undermine our organization’s diversity, efficiency, autonomy, creativity, and innovation.</li><li>We believe innovation comes from the simplest solutions. There’s beauty in simplicity; learn to fall in love with simple things.</li></ul><h3>💪 Empowerment</h3><ul><li>We empower teams to take ownership of their work by encouraging autonomy, responsibility, and accountability, fostering an environment where individuals feel empowered to make decisions that contribute to the overall success of the team.</li><li>We trust each other by default and do not micromanage or interfere with each other’s work, unless upon request.</li><li>We align our work with the vision, mission, and values of the organization and ensure that our work adds value to our customers and stakeholders.</li><li>We don’t believe in the “it’s not my call” attitude. We trust our team members will always seek an answer to the problems they find. If we don’t feel we should make the decision, we should involve whoever can make that decision.</li></ul><h3>🧠 Agile Mindset</h3><ul><li>We welcome and embrace change and adapt to changing requirements and situations because “change” is the only constant.</li><li>We value adaptability and fast delivery. We encourage iterative progress, quick feedback loops, good trade-offs, and a commitment to delivering value to our customers consistently.</li><li>We plan, prioritize, and execute our work efficiently and effectively to meet our deadlines and expectations.</li><li>We understand that good prioritization and work decomposition are more important than precise estimation.</li><li>We communicate and collaborate regularly with our customers and stakeholders and ensure that our work meets their needs and requirements.</li></ul><blockquote>We take our motto <strong>#besourceofgoodlife</strong> seriously. For this reason, the principles mentioned above are crucial for fostering a healthy and high-performing environment in which we can take pride and thrive. It’s our responsibility to respect and promote these principles among current and future team members.</blockquote><blockquote><strong>Culture is everyone’s responsibility; if we don’t nurture it, we risk losing it.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc59a85ab585" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/infraspeaks-engineering-cultural-manifest-cc59a85ab585">Infraspeak’s Engineering Cultural Manifesto</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using hygen.io (a code generator) at Infraspeak]]></title>
            <link>https://medium.com/infraspeak/using-hygen-io-a-code-generator-at-infraspeak-e47a05215b95?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/e47a05215b95</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[code-generation]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ana Basílio]]></dc:creator>
            <pubDate>Tue, 11 Oct 2022 16:31:56 GMT</pubDate>
            <atom:updated>2022-10-19T07:37:08.218Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*AoGRRPtkaI-93757ZJKKKg.jpeg" /></figure><h3><strong>Why use a code generator?</strong></h3><p>As <a href="https://pages.infraspeak.com/pt-general?utm_campaign=%5BPT%5D+BOFU+(Sep+2020)+-+Brand+Search&amp;utm_source=adwords&amp;utm_term=infraspeak&amp;utm_medium=ppc&amp;hsa_ad=462587947127&amp;hsa_grp=109492035838&amp;hsa_kw=infraspeak&amp;hsa_ver=3&amp;hsa_net=adwords&amp;hsa_acc=8604410300&amp;hsa_src=g&amp;hsa_cam=11064866149&amp;hsa_mt=b&amp;hsa_tgt=kwd-470935179568&amp;gclid=CjwKCAjwgr6TBhAGEiwA3aVuIdlB5N4HbZi34MfTrdY9Rn8WTEDQ0ai2V2lIB-Yc9--6BxY8qR5kqRoClq0QAvD_BwE"><strong>Infraspeak’s</strong></a> engineering team grew exponentially, some issues started to emerge. We needed to set rigid guidelines on how we should build components, write functions and organize file logic so that our codebase could grow sustainably with the team. Whilst guideline documentation was good, it was very easy to enter “development mode” and forget to apply them. Only later in the code review phase would we spot and fix problems. Equally, repetitive tasks which had to be done were also a major pain point.</p><p>We needed a solution that could add automation to some of these processes. After some digging around, we discovered <strong>code generators</strong>.</p><p>Code generators focus on automating repetitive tasks by creating structured templates with standard code that can be repeated in your codebase. This works because when a page, component, or utility function needs to be built, there’s usually something similar already implemented.</p><p>At Infraspeak<strong> </strong>we use a code generator named<a href="http://hygen.io/"> hygen.io</a>. This library allows us to add multiple template files, inject code into existing ones, get prompts for user activity, and more. With these new features our developers could:</p><ul><li>Exponentially reduce the need for copy and paste;</li><li>Ensure that everyone is doing things “the right way”;</li><li>Facilitate code review;</li><li>Simplify the onboarding of new developers;</li><li>Speed up the development process.</li></ul><p>The above points are very important when working in a large team, where everyone has their own coding style; new members keep joining your team, and technology specs continuously grow.</p><p>Now that we’ve had a glimpse at what code generators can do for us, let’s understand how hygen works.</p><h3><strong>Code generation path (with Vue)</strong></h3><p>In this section, we’ll provide a step-by-step analysis of how you can use the<a href="http://hygen.io/"> </a>hygen library to generate a premeditated Vue file. At Infraspeak, we work with<a href="https://vuejs.org/"> Vue</a> and<a href="https://www.typescriptlang.org/"> TypeScript</a>. Any generated file must therefore be built according to this framework and typed programming language (learn more about why<a href="https://medium.com/infraspeak/vue-js-2-typescript-at-infraspeak-f5522b724d96"> Infraspeak chose to use TypeScript</a>). We use this code generator library for a large number of specifications and features, but we will focus only on some of the most used ones at Infraspeak.</p><p>This example will consist of two parts: first, the construction of a hygen template (implementing the logic), and after this step follows the generation of the result (creating the Vue.js file)</p><p>As a prerequisite, you need the<a href="http://www.hygen.io/docs/quick-start"> hygen generator running on your project.</a></p><h3>The construction</h3><h4>Hygen extensibility</h4><p>In the setup phase, it’s important to know that the code generator library provides a configuration file named<a href="https://www.hygen.io/docs/extensibility"> hygen.js</a> whose function is to allow the creation of an extensibility point. This is a special file searched and loaded by a bubbling engine implemented by hygen. The search process runs when the command is triggered and stops at the first file found.</p><p>File traits:</p><ul><li>Helper functions in templates;</li><li>Customizing logger, template location, and shell executor.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cD4OMhFf6AOmz54w" /></figure><p>The previous image represents the extensibility we intend to give to our templates for this example. The first <strong>templates section</strong> defines the location where the hygen templates are created and the <strong>helper’s section</strong> defines the root path which shows where to generate the new file. The hygen search engine will now run your templates using the path defined in the <strong>templates section</strong> and the root path is now the one defined in the <strong>helper’s section.</strong></p><h4>Hygen template</h4><p>Hygen templates are created with the help of an<a href="https://ejs.co/"> EJS</a> (Embedded JavaScript) engine, which allows you to embed JavaScript within the HTML code. An EJS template normally contains mostly static elements that are responsible for giving a file a certain structure.</p><p><strong>You can also add dynamic elements that can be settled with data from an external source, such as prompts which will be analyzed later.</strong></p><p>This type of template is defined by a header using a markdown<a href="https://www.hygen.io/docs/templates/#all-frontmatter-properties"> Front-matter</a> and a body using an EJS templating engine.</p><ul><li><strong>Header:</strong> The header section is used to guide the code generator on what should happen and how it will be done;</li><li><strong>Template body:</strong> The template body defines what the generated file will contain.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L-P6aHH2Lv5iGwSz" /></figure><h4>Prompt definition</h4><p>The hygen library makes it possible to build a<a href="http://www.hygen.io/docs/generators#interactive-prompt"> CLI wizard</a> which is essential for customizing the logic added to the templates. You can apply user-defined variables, add conditions, and also implement dynamic naming. With these prompt specifications, you can create an interactive code-generation experience.</p><p>The image below shows the prompt that will be executed in this example. As represented in the image, an input interaction is implemented in the prompt, where the intervener must enter a message of his choice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nx3Tce7xCe2ricfx" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NrGUExhx_OGyzmDO" /></figure><p>Note that the template file uses the inserted message as a local variable to add a comment. That’s possible because any CLI argument or prompt parameter automatically becomes a local variable in your templates.</p><p>Conditioning the template with some logic that is only implemented when a certain conditional statement verifies can also be useful. As represented in the previous image, the comment message is only implemented if the message to be commented on is defined.</p><p>It’s also important to highlight that when executing the hygen code generation command, you will need to define a name for the generating file. This name is also included in the header and body sections of the template logic. Also, the file and class names are defined according to that command parameter.</p><h4>Code injections</h4><p>On some occasions, you might want to add code snippets to an existing file. For that, the hygen library has something called<a href="http://www.hygen.io/docs/templates#injection"> injections</a>. To implement an injection you need to add the inject property to the template and specify the file where you want to implement that code. Keep in mind that the position specification (after: “//Inject console log”) needs to match with the one defined on the receiving file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jy5FTIHYJLgxZnXr" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Oqc_yv9eV_msa-7n" /></figure><h3>Generating Results</h3><h4>How it works</h4><p>The purpose of these configurations is to generate a file that will be built according to the EJS template logic. With this automation, we will be able to create a Vue.js file not from scratch, but with the logic already built-in on the defined template itself.</p><p>Let’s jump to the final steps of our Vue.js file generation and run the command that will make our code generator work.</p><p>To understand how the generating command is built, it’s necessary to look at the hygen templates directory tree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/0*CvpSEkZ36ol2I2fX" /></figure><p>Note that the files should be sorted correctly. Looking at this injection case example, if you place your injection file before your component file the injection wouldn’t work. You can use numbers in your filenames or order them the way you want hygen to process your logic.</p><p>Moving on to the command to generate the Vue.js file, it will consist of three main parameters:</p><ul><li><strong>demo: </strong>Hygen root directory name;</li><li><strong>hygen-test: </strong>The directory that contains the templates to run;</li><li><strong>Example: </strong>The name of the file to be generated.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/0*GhkStqBLqtw2HvvP" /></figure><p>When running the command, the prompt steps in and requests the comment message. After the message input is inserted, the console logs information stating that it created a new file named Example.vue and also that some code was injected into that file.</p><p>Now let’s finish this example with a review of the successful content generated following the execution of this command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JMtpAazHYF6beRpG" /></figure><p>As you can see above, a new file has been generated and follows the implemented EJS logic.</p><p>With the help of the defined prompt, it was possible to insert <strong>the file name to be generated</strong>, which <strong>comment</strong> to write, and dynamically <strong>inject the console log message</strong>. The header section of the EJS template was also responsible for managing the <strong>path where the new Vue.js file would be generated.</strong></p><h3><strong>Conclusion and thoughts</strong></h3><p>This code generator library can provide your codebase with a more controlled development environment and also helps us to follow the DRY (<strong>D</strong>on’t <strong>R</strong>epeat <strong>Y</strong>ourself) principle smartly. There are, of course, some unavoidable, repetitive steps and processes in our workflow that need manual solutions. However, there’s no need for developers to have to write everything<em> </em>over and over again. This is the main purpose of code generators.</p><p>As well to the previously discussed advantages, a code generator can also:</p><ul><li>Help to flatten the learning curve of a big project;</li><li>Bring more independence to developers;</li><li>Make use of these hygen templates in a very easy way;</li><li>Comment-oriented templates can lead to a more documented code;</li><li>Generating tests automatically with some built-in logic already integrated can be the right trigger to encourage test implementation.</li></ul><p><em>It’s also worth considering the other side of the coin.</em></p><p>When analyzing any type of library, it’s important to understand the challenges you might face when integrating the tool into your codebase. Here are some downsides related to the usage of this code generator:</p><ul><li>The language used to build the logic of the templates is hard to understand at first;</li><li>As you build more extended templates, hygen will become more complex;</li><li>When working on a project where updates and changes are constant, it’s normal for the templates to be outdated. The downside comes when updating templates requires manual intervention and is not an automated process.</li></ul><p>As illustrated, code generators can have a positive impact on your development process when used and maintained correctly.<strong> It’s an investment your team should consider when you find yourself repeating the same scaffolding procedures over and over again.</strong> Have you given it some thought? Which code generator did you go for?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*OmMoJuKUPFrhNk4URk6XLA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e47a05215b95" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/using-hygen-io-a-code-generator-at-infraspeak-e47a05215b95">Using hygen.io (a code generator) at Infraspeak</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue.js (2) + Typescript at Infraspeak]]></title>
            <link>https://medium.com/infraspeak/vue-js-2-typescript-at-infraspeak-f5522b724d96?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/f5522b724d96</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Filipa Simão]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 16:33:49 GMT</pubDate>
            <atom:updated>2021-09-28T16:33:47.797Z</atom:updated>
            <content:encoded><![CDATA[<h3>How we integrated Typescript with Vue.js (2) at Infraspeak</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nFqFLdbttAgBJKvfFYmGow.png" /></figure><p>Infraspeak decided to migrate the application to improve code maintainability, performance, and UI/UX (learn more about it by reading “<a href="https://medium.com/infraspeak/incrementally-migrating-a-legacy-jquery-web-application-to-a-vue-js-spa-ecbd6671beee">Incrementally migrating a legacy jQuery web application to a Vue.js SPA</a>”, if you haven’t yet).</p><p>At that moment, we also made an important decision: to use <strong>Typescript</strong>. The main reason was that since our codebase uses Javascript, it’s harder to maintain. Without knowing the parameters and types of any object, the code is harder to understand and more error-prone.</p><p>After this decision, we needed to understand the best approach for us to integrate Typescript with Vue.js, since this framework offers us two big approaches to do it. That’s why I decided to wrote this article.</p><p>But first, let’s talk a little bit about Typescript.</p><h3>What is Typescript?</h3><p>Typescript, created by Microsoft, is an object-oriented programming language that extends from Javascript. This adds some new features to Javascript, like <strong>static typing, type annotations, and interfaces</strong>.</p><p>One advantage of using Typescript, as said before, is the type annotation. This means that we can add types into variables, function parameters, return values, and so on, using the:&lt;type&gt; keyword.</p><p>Sometimes it’s not necessary to specify a type, because Typescript can infer them automatically. For example, if we have a variable with an assigned value, the variable type will be the type of the assigned value.</p><p>Typescript provides us some default types like:string, number, boolean, Array, etc… but developers are free to extend and create new types.</p><p>Let’s take a look at how Typescript infers types:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fCSXpuq_ROdVl7oiKaayzw.png" /></figure><p>If we reassigned the variable name to another type, an error is displayed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h2mbmfrxtA9IY86WS38gtA.png" /></figure><p>It&#39;s also possible to add more than one type to a variable. This should be explicitly declared and cannot be inferred. This is called <strong>Union Type</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1sQRYgrktadLbvfXQTVgQQ.png" /></figure><p>All the new functionalities that Typescript brings help us prevent some coding errors, because it gives us warnings before runtime (during development).</p><p>For example, if you have this code in Javascript:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u068J85cH5DXBHUkqnPzgQ.png" /></figure><p>This can be a problem because someone can add a string somewhere in the code.</p><p>With Typescript:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vP7ZnB4sbY2pTcMtrRAVWw.png" /></figure><p><strong>Note</strong>: It’s important to mention that browsers and <a href="https://nodejs.org/en/about/">node.js</a> cannot execute Typescript, so it needs to be transpiled (converted) into Javascript.</p><h3>Use Vue.js with Typescript</h3><p>Vue.js supports Typescript so, as I said previously, we focused our decision on one of the two approaches we had for Vue.js:</p><ol><li>Use Vue.extend</li><li>Use Class-based API</li></ol><h3>Vue.extend</h3><p>This approach is the basic usage of Typescript. The Vue.extend allows the developers to have type annotation and inference. From both approaches this is the <strong>most similar to the Javascript version</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8erTYGFJrbMGo1j9Id6yLw.png" /></figure><p>A disadvantage of this approach is the prop type. As you can see in the example above, we define the prop type this way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*khjG5tJHSSBl0sftC9a8rQ.png" /></figure><p>Because, if we declare this way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*DeI9nrG6r6fEQzFCih87nw.png" /></figure><p>We will have an error ‘User’ only refers to a type, but is being used as a value here..</p><p>This happens because this definition will run during runtime execution, and this type does not exist when we transpile it to Javascript, unless it’s a primitive type. To avoid this, we must use PropType.</p><p>By using PropType, we send the Object type and declare it as the interface that we need.</p><h3>Class-based API</h3><p>This approach allows us to have a class-style syntax in our Vue Components. To work with this approach, the <a href="https://class-component.vuejs.org/">Vue Class Component</a> package is mandatory.</p><p>It’s the approach that takes advantage of more features, such as:</p><ul><li>Allows us to use ECMAScript features, like class inheritance, decorators, and other features in our Vue components.</li><li>Provides us decorators and custom decorators.</li><li>Allows us to add additional hooks for <a href="https://router.vuejs.org/">Vue Router</a>.</li><li>We can also extend a Vue component class and use mixins.</li></ul><p>These features make the <strong>components more maintainable and clear</strong>.</p><p>To get the most from using decorators - because Vue Class Component does not support all decorators by default - the <a href="https://github.com/kaorun343/vue-property-decorator">Vue Property Decorators</a> package is a good option, although it is not developed by the official Vue developers. This package adds more decorators like @Prop, @Watch, @Emit,and much more to our Vue component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u5Ki7cHhqNs6r0a1sEcmRQ.png" /></figure><p>As we saw in the example above, we have:</p><ul><li>readonly keyword in the user property: this means that this prop cannot be changed on this class or an error is triggered. <br>Vue.js will also complain in runtime when trying to change a prop.</li><li>exclamation mark after user property: this means that Vue will initialise this property and is a non-null value because, in this case, it&#39;s required. If the prop was not required and does not have a default value, we need to use a question mark instead of the exclamation mark</li></ul><p>Also, we did not have a problem assigning a type to props because the @Prop decorator already uses the PropType behind-the-scenes.</p><h4>Decorators</h4><p>Maybe for some people, decorators are an unknown term. The reason can be because in Javascript this feature is still a <a href="https://github.com/tc39/proposal-decorators">proposal</a>, but in Typescript it’s already available. It’s not available by default, so it’s necessary to add &quot;experimentalDecorators&quot;: true in tsconfig.json.</p><p>In Typescript, a decorator allows us to include the functionality of a function in the class declaration, class method, class accessor, class property, or class method parameter. They are identified for the prefixed at-sign (@) symbol.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8-sm7lx1uBIPr2sLCUqdAQ.png" /></figure><p>In this example, we have two decorators: @Component and @Prop that are imported from Vue Property Decorators.</p><p>The@Component decorator, provided by Vue Class Component to Vue Property Decorators, is <strong>mandatory</strong> for building a component in Vue with the Class-based API approach <strong>because this decorator indicates the class is a Vue component</strong>.</p><p>If it’s necessary to import and register another’s components, we use that decorator:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AsgO2LRQJYjsy3VNSkVEQ.png" /></figure><p>The advantage of using <strong>decorators</strong> is that it allows us to <strong>have a cleaner code</strong> and <strong>reuse the same decorator as many times as we want</strong>.</p><p>Is also possible to use Typescript and decorators in Vuex. One way is using the package <a href="https://github.com/gertqin/vuex-class-modules">Vuex Class Modules</a>. This allows us to use @Module, @Mutation, and @Action decorators.</p><p>This is the approach that we use at <a href="https://infraspeak.com/"><strong>Infraspeak</strong></a>.</p><h3>Conclusion</h3><p>The decision to use Vue.js and Typescript with decorators is definitively responding to our main needs at Infraspeak<strong>.</strong> Fortunately, some of our colleagues were already familiarised with using class API and decorators, which helped us integrate this new approach faster, resulting in a much cleaner and readable codebase.</p><p>Using Typescript in large codebases, or even in small projects, can be a powerful tool, since it can be extra helpful for developers to create maintainable and scalable projects, with a stronger architecture and patterns.</p><p>We have a plan in our roadmap to migrate our current architecture from Vue 2 to Vue 3, <strong>which has built-in Typescript</strong>. But first, we need to be sure that Vue 3 fully supports the packages that we are currently using and plan to make a refactor to split our project into smaller packages to have a smooth integration and validation of Vue 3.</p><p>For more information and details, please visit <a href="https://www.typescriptlang.org/docs/">Typescript</a> and <a href="https://vuejs.org/v2/guide/typescript.html">Vue</a> Docs… and stay tuned on our blog posts!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5522b724d96" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/vue-js-2-typescript-at-infraspeak-f5522b724d96">Vue.js (2) + Typescript at Infraspeak</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2021: Daring to dream and grow]]></title>
            <link>https://medium.com/infraspeak/2021-daring-to-dream-and-grow-1a47bdd1183?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/1a47bdd1183</guid>
            <dc:creator><![CDATA[Gonçalo Queirós]]></dc:creator>
            <pubDate>Thu, 11 Feb 2021 12:00:19 GMT</pubDate>
            <atom:updated>2021-02-14T16:22:21.392Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GcLMV-RWqylDfnOxePmWtw.png" /></figure><p>If you already explored what we have done in 2020 (<a href="https://medium.com/infraspeak/2020-the-best-year-for-our-engineering-team-so-far-89d5c7694b4e">here</a>), you already know that we achieved way more than we planned for and that we evolved a lot as a team, and as a “working machine”.</p><p>Planning the future is not an easy task. There are lots of unknowns (looking at you, 2020) and uncertainty, lots of trade-offs between being nimble and deliver what’s expected, and way more questions than answers.</p><p>However, I’ve always heard that the future belongs to those who dare to dream it so if you dare, join us in this adventure! Together, we’ll crack the challenges that 2021 will throw at us.</p><h3>The challenges of growing</h3><p>One of the things we validated during 2020 is that multi-disciplinary teams achieve a greater level of autonomy. When they are not distracted by an extra scope, they are a force of nature when it comes to delivering. When we talk about multi-disciplinary, we are not only referring to Backend and Frontend, but also to Quality Assurance and Product, at least. For that reason, we now know that the recipe to scale our teams is to replicate the successful model we have today. However, that replication alone is not a guarantee of success.</p><blockquote>The reason we want to grow our team is that we want to deliver more, with (at least) the same pace we were delivering before. Many times, more people doesn’t mean more work delivered. There are different challenges when scaling from 12 to 30 or from 30 to 60, and so on. That said, in order to keep the pace, we need to be aware of some challenges that we are already foreseeing.</blockquote><h3>#1 Preserve the social side</h3><p>We can’t grow the team if we don’t take care of the team we already have. We try our best to keep everyone engaged, but 2020 was a challenging year when it comes to social events. We know already that this challenge won’t disappear so easily in 2021, but at least we are aware of it. We will keep creating more opportunities and events like the Hacktoberfest 2020 to allow everyone to have fun together, learn and discuss topics that aren’t work-exclusive.</p><h3>#2 Pipelines run time</h3><p>In 2020, we introduced pipelines, which was a major achievement for the whole team. Now, we rely heavily on them every day. Lately, we have seen that pipelines run time is getting longer and longer, as more tests are added to it. With the team growing, we expect the rate of tests added to grow significantly as well, making it worse.</p><p>There are some things we can do to improve the pipeline speed:</p><ul><li>More parallelism for running each pipeline, which means that we will be throwing money into the problem;</li><li>Move towards unit testing instead of integration testing;</li><li>Use an in-memory database (SQLite) to run integration tests instead of Postgresql;</li><li>Break the monolith. That doesn’t mean microservices! It means that we should move our code to a more Domain Driven Design architecture, in order to run only the relevant test suites.</li></ul><h3>#3 The culture of learning</h3><p>For us, learning is the backbone of every team. There is nothing more powerful than a team of restless people, eager to learn new things and share them with others. But you can’t enforce the culture of learning on people, you have to feed it in order to make it grow, which is a challenge by itself.</p><p>When we started our “Internal Learnings” back in 2019, we were 8 people. At that time, these sessions were a “safe space” for anyone to present a topic to others. Currently, with a team of 30 people, that “safe space” might start to seem a bit daunting to some. It is probably time to rethink a new version of our internal learnings. Moving it to a more “area focused” approach (the Mobile team is already doing it), and then launching an internal cross-functional conference once in a while might actually be a good solution!</p><p>We also learned that giving visibility to people on what’s happening is a good approach to increase response. Having a well-organized calendar with possible events for the team to participate in might help raise awareness for the topic. Pet projects, engineering roadmaps…. although it’s still not clear exactly what and how to do these kind of initiatives, we do believe that creating the space for it is going to be a huge motivational boost to keep everyone on the learning path.</p><h3>#4 Monitoring</h3><p>Monitoring was the area we lacked the most in 2020. We had some tools implemented, but we didn’t push for the ownership of those tools. We tried to implement Prometheus, and we ended up abandoning it. We finally settled with Elastic at the end of the year.</p><p>If we want to shift our mindset from reactive to pro-active, keeping our system and application under the team’s responsibility is key. We need to start by implementing processes so that our SRE team is on top of system health, and our functional teams gain ownership of the application metrics.</p><p>Having monitoring tools alone won’t fix the issue. Defining specific goals is a great way to steer the team towards the direction that we, as a company, want to follow. Each team should have its own key metrics to focus on. And while these are not yet defined, one thing is certain: our clients will always be a priority to all of us.</p><h3>#5 Infraspeak Network</h3><blockquote>This has been a dream of ours for a long time, now. 2021 will be the year that will take us where no one has gone before. We will connect the maintenance world, and it’s going to be huge (stay tuned!).</blockquote><p>Past experiences showed us that this won’t be a ride in the park, but we also learned where the problems lie. The first thing we need to do for a project like this is to lay down exactly what needs to be done, to identify the problems we had in the past, and to create a team to start brainstorming about solutions.</p><p>Along the way, we will probably need to rethink our permissions system, and how we output data based on the user requesting it. We will have to create/adapt our infrastructure to accommodate this idea of connected entities, and we will have to make important changes in all our clients, web and mobile.</p><p>Lots of work to be done! However, in the end, we’re pretty sure that we will have something unique, from which our clients will surely get a lot of value from. In the meantime, we will learn a ton and have loads of fun doing it!</p><h3>#6 Documentation</h3><p>“Lack of documentation” was the most common complaint among our team, when we got together to review the year. And although this is true, we actually got better at it during 2020. We started producing our first ADR’s, RFC’s, workflow diagrams, process documentation, etc... and the standardization we introduced into the codebase also helped new team members to have an easier onboarding, even remotely.</p><p>Although the lack of documentation is, indeed, a reality, (and that is not, unfortunately, something new), it will only get worse if we don’t tackle it asap. On the other hand, “lack of documentation” is very vague. It can have different meanings for different people: Is it business logic? System architecture? API documentation? All of them?</p><p>The plan is to start by defining exactly what do we mean by “lack of documentation” based on one question: “What kind of documentation will be useful to us, at this point?”. After identifying what we need, we will have to change the processes in order to incorporate documentation, since it should not be any different from writing a test or creating a pull request.</p><h3>#7 Modularized codebase</h3><p>Our current API architecture (monolith) has served us well so far, and we hope it continues to do so while we keep refactoring it to a more Domain Driven Desing approach. Having code separate into Domains have many advantages:</p><ul><li>Clearer code base, easier to understand by new team members, even with poor documentation;</li><li>Easier to see boundaries and connections between domains. This will open the door to thinking in a different architecture in the future;</li><li>Fewer conflicts;</li><li>Faster pipeline if domain is self contained.</li></ul><p>In regards to our web client, its architecture is already way closer to a component system, but it’s not there just yet. We should start our first POC during the first quarter, to learn if our idea of creating separate repositories for each layer of the application is actually good in the long run.</p><p>Having independent frontend components will allow its reuse in other web applications, like Infraspeak Direct and Infraspeak Operations, which is great for maintainability and evolvability.</p><p>With respect to the legacy codebase, the Android team is the one having the hardest time for now, but they are moving towards a completely decoupled architecture. It will not only make it way simpler to implement new features, as what happened with Gatekeeper, but will also open a huge door: having modules that could be used by both Android and iOS devices!</p><h3>#8 Quality</h3><p>In 2020 we got to confirm another important thing: quality is also speed. We speed up because we have fewer bugs. The teams are less distracted, allowing them to focus on the current scope. And we get to speed up because we have dedicated team members just to assess the quality of what’s being produced.</p><p>We learned a lot about our QA team, processes, and objectives during 2020, and we now have a clear path for 2021. We will mainly focus on developing our E2E tests on Web and Mobile. We should start with our most common use cases (our “Golden Paths”), and once the framework is set in place, we should expand to new and existing features. With the growth of the functional team and implementation of X-Ray, we will also focus on test case creation.</p><p>Our QA team has ambitious goals for 2021, and spreading knowledge about automation should be a great challenge to everyone. We are very curious to see everyone’s evolution!</p><h3>#9 KPIs</h3><p>Another great learning is that giving visibility over our KPIs to everyone helps ensure that everyone is aligned and and aware of our top priorities. In order to improve that visibility, we launched our Engineering Dashboard. It served us well for some months but, due to process changes, it is now obsolete. This means that we will need to create a new one in 2021.</p><p>In terms of KPIs, 2021 will be very similar to 2020, with some refinements and additions. We will start the year with 3 main KPIs</p><ul><li>Lead Time for Stories and Tasks (refined)</li><li>Lead Time for Critical+ bugs</li><li>Operational Costs (refined)</li></ul><p>and 4 secondary</p><ul><li>Total Costs</li><li>Pipeline Run Time (new)</li><li>Change Failure Rate (new)</li><li>Open bugs (Major+)</li></ul><p>These 7 KPIs focus on 3 different areas: Quality, Speed and Costs.</p><p>It’s never enough to remember that KPIs are used to collect insights, make changes, and measure the impact of those changes. They are a powerful learning tool and they allowed us to learn a lot about our teams and processes during 2020.</p><h3>Moving forward together</h3><blockquote>Wrapping up, these are our challenges and dreams for 2021. As it is normal when we’re daydreaming, some details are foggy and incomplete, but that’s OK. The main purpose of each dream is to inspire us, to make us believe that anything is possible.</blockquote><p>We know that 2021 will be challenging, but we also know that we have a great team, that will surely enjoy dealing with all the challenges that this new year will bring us. In 2020, we proved we are capable of a world-class execution. In 2021, we’ll keep rising the level, while we create room for learning and tackling down big Engineering challenges.</p><p>Last but not least, let me tell you that everything we did so far was built on top of a culture of feedback and transparency. We believe that everyone has the responsibility of building and shaping the company’s future, and we are opened to different ideas, bolder inputs, and unpopular opinions. That said: we are much pleased to hear all your thoughts and feelings about what’s coming ahead!</p><p>— If you wish to be part of this great team and help us fulfill this vision, we have 20+ openings at the moment for the <a href="https://careers.infraspeak.com/jobs?department=Engineering">Engineering &amp; Product Team</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a47bdd1183" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/2021-daring-to-dream-and-grow-1a47bdd1183">2021: Daring to dream and grow</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2020: The best year for our Engineering team so far]]></title>
            <link>https://medium.com/infraspeak/2020-the-best-year-for-our-engineering-team-so-far-89d5c7694b4e?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/89d5c7694b4e</guid>
            <dc:creator><![CDATA[Fábio Martins]]></dc:creator>
            <pubDate>Thu, 11 Feb 2021 11:57:40 GMT</pubDate>
            <atom:updated>2021-02-11T12:01:35.375Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1D4XmRccv4V1gtH1zLaswA.jpeg" /></figure><p>Yes, this post was meant to be shared right at the beginning of 2021, but time runs fast and we have decided to start the year thinking, planning, and executing our vision for 2021. Now, while our team is already going full speed towards our goals, I can share with you what we’ve achieved so far and all the challenges that our Engineering Team will be facing in 2021.</p><p>2020 was one of the hardest years we have ever faced. It was hard for our team, our clients, our family, and friends… it was hard for the World. It was even harder for the ones who lost someone close or had to rollback their entire life.</p><p>However, we stood together, we faced all the challenges with bravery, compassion, resilience, and intelligence. Despite all the problems, we have some good news: <strong>2020 was by far the best year for the Engineering Department at Infraspeak.</strong></p><h3>Kick-off: Recovering from 2019</h3><p>2019 had been a tough year. We had to onboard a lot of new people and we had been redefining processes, refactoring, and redesigning a large portion of our frontend and backend codebase, in order to make it simpler and easier to maintain.</p><p>We’ve also spent a huge amount of time rebuilding our mobile app to support offline mode and began to make some bold steps towards a more intelligent application using some AI-backed features. We dealt with a lot of performance issues at the Infrastructure level, which caused a lot of stress and <em>firefighting</em>.</p><p>In 2019, we were mainly investing in building the foundations of the Engineering Team and that caused a huge feature debt to our clients and business, and a big pile of bugs to be fixed.</p><blockquote>2020 had to be the year in which we would prove the investment was worth it. We needed to show we had a world-class team capable of a world-class execution.</blockquote><p>We started 2020 with a team of 12 people and a huge and challenging product roadmap, competing with a huge and challenging engineering roadmap. <strong>We wanted to focus on 5 major areas: culture, delivery, performance, monitoring, and quality.</strong></p><p>We started by doing a few things that we were convinced would help us work smarter:</p><ol><li>Creating cross-functional teams that could work independently from each other;</li><li>Measuring our process looking at the flow of delivery instead of the amount of output;</li><li>Raising the visibility of our metrics by creating an Engineering Dashboard;</li><li>Heavily investing in tests and quality assurance;</li><li>Implementing Feature Toggles to help continuous integrations, ease out the product deployment, and cadence;</li><li>Keep re-enforcing a culture of continuous feedback and learning.</li></ol><p>In February, we’ve launched the public beta version of our brand new redesigned Web App build on top of Vue.js and served by a Laravel API. We also reinforced our Mobile Team and hired someone to take care of our Infrastructure. Both were great choices and proved to be the right people for the job.</p><h3>And suddenly, the pandemic</h3><p>Well, you know the story. In March, we all started working from home even though we just moved into a brand new office.</p><p>Since we had just hired someone to join the Integrations Team, we were forced to do our first onboarding remotely, and I believe we did good (at this point, we’re pros!). We also had to deal with a lot of uncertainty, since nobody knew exactly what was going to happen or what to do at this point. I bet you know the feeling!</p><p>At Infraspeak, the team came together and began to brainstorm ideas, helping each other to overcome the challenges we were all facing with transparency and resilience. Out of this, we launched two new products: <a href="https://placecheckup.com/pt-pt">Place Checkup</a> and the platform for <a href="https://portugalcleanandsafe.com/pt-pt">Clean &amp; Safe by Turismo de Portugal</a>. Overall, both projects were designed to help business owners to follow and communicate all the cleaning and safety procedures they had in place. It was a tremendous effort to launch a brand new product in just a few weeks, and we definitely felt the impact of allocating people from the Engineering Team to these projects... but it was totally worth it.</p><p>At this point, we also lost our only QA Engineer, who had been a great contribution to the team, and a source of great learning for us all.</p><h3>Investing in the team &amp; product</h3><p>We understood that we needed to start investing in reinforcing the Engineering team. Things were getting better, so this was a great opportunity for us to focus again on the product.</p><p>Super bright and talented frontend, backend, and QA engineers joined the team in batch and the onboarding process was great, given the circumstances.</p><blockquote>As a plus, we also increased the number of female colleagues! Before this new hiring round we had zero female engineers, now we have 7 and counting… we couldn’t be prouder!</blockquote><p>With so many people coming in, we needed more than ever to automate and refine processes, so we took the summertime to work together and leverage our tools:</p><ul><li>We’ve abandoned Bitbucket in favor of Gitlab;</li><li>Gitlab enabled us to automate all integration and deployment pipelines from development, staging, and production;</li><li>All Infrastructure was versioned as code using Terraform and Ansible;</li><li>Web, Mobile, and Integration Team had most of their processes automated, which was a big milestone for us;</li><li>We decided to migrate some of our asynchronous tasks to a Queuing System using Laravel Horizon;</li><li>We’ve updated several core technologies in our stack to the most recent version like our Postgres databases and our Laravel API in order to provide better performance and usage of more recent functionalities.</li></ul><p>Last but not least, we needed to test the security of all applications, so we’ve hired an external company to audit us. Their findings were a great help to build a better product, so we’ve spent a great amount of time dealing with all problems found.</p><p>In the meantime, performance issues at the application level were back. In response, we created a Performance Team dedicated not only to fix them, but also to help us become more proactive (and less reactive) to these kinds of issues.</p><p>October was a good month: we decided to do another mythic <a href="https://medium.com/infraspeak/the-first-hacktoberfest-1bf892b67b46">Hackthoberfest</a>! The team dedicated an entire day to build a project on their own, for the open-source community. We were able to try out an application build on top of Kubernetes and a Service Oriented Architecture build on top of Node.js and Laravel.</p><h3>World-class execution &amp; team</h3><p>By the end of 2020, the dominant feeling was that we had done a lot of stuff!</p><p>Not only we’ve leveraged the Engineering Team by automating most of the processes, but we’ve also created a robust Infrastructure<em> and away more performant applications.</em></p><p>We’ve built quality processes far better than we expected and our delivery rate skyrocketed comparing with other years. We fixed hundreds of bugs and improved a lot in their volume and response time.</p><p>We’ve turned Infraspeak into <a href="https://infraspeak.com/integrations/">the most integrated platform around</a>, and we’ve launched a bunch of new and highly requested native apps, features and improvements, such as the <a href="https://infraspeak.com/hub/">Infraspeak Hub</a>™, the Gatekeeper, the Sales App, the Quotes feature, the Dashboard, the Offline Mode, the WebHooks, the Location Awareness… to name a few. And did I mentioned the new products Place Checkup and Clean &amp; Safe?.</p><p>Besides this, we redesigned a few more modules; refactored a lot of our mobile codebase to follow clean architecture guidelines; moved our backend codebase to a more domain-driven architecture; added a bunch of unit, integration, and e2e tests to our backend, frontend, and mobile codebases; leveraged our written documentation by creating ADRs, RFCs, trying out Stoplight for API docs using OpenApi Spec 3; and soo many other small but important things that happened along the year.</p><blockquote>Our metrics were better than never, and they continue to guide us along the way. I don’t think I need to say that we definitely proved that the investment was worth it.</blockquote><p>Currenly, we’re a team of 30 engineers (we had a few more onboardings) and we’re still hiring a few more. If you’re interested, take a look at our <a href="https://careers.infraspeak.com/jobs">open positions, here</a>.</p><p>Of course, none of this would be possible without our people. They work their asses off to make this happen, to overcome the challenges and constraints we faced. We are very proud of this team and of what we achieved together.</p><h3>What comes next?</h3><p>Now, we are looking at 2021 with hope and energy. This will be a year of accelerated growth, that will test the limits of our processes, architecture, and people. A year to think about how to scale our systems and our team; and to invest in people’s growth more than ever. We’ll keep feeding a never-ending culture of continuous learning.</p><p>It will also be a year where we will keep investing a lot in quality and in proving that we have a rock-solid platform, ready to face the scaling challenges.</p><blockquote>Exciting engineering challenges are ahead (some of them new to most of us!), and we are about to get out of our comfort zone… but let’s face it: it’s the best zone to be! It is where the magic happens, where we push our limits forward, where we learn and grow together, where we give the steps that nobody has given before.</blockquote><p>And if we may fearsome of the unknowns, this last year proved us that we have a resilient team, who fails fast but learns even faster; who knows how to support each member. And let me tell you: as long as we believe in what we are doing, and that we are truly a source of good life to our clients, our families and ourselves, we are headed to success.</p><p>If you want to know more about our plans for 2021, check <a href="https://medium.com/infraspeak/2021-daring-to-dream-and-grow-1a47bdd1183">this post→ 2021: Daring to dream and grow</a>.</p><p>— If you wish to be part of this great team and help us fulfill our vision, we have 20+ openings at the moment for the <a href="https://careers.infraspeak.com/jobs?department=Engineering">Engineering &amp; Product Team</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89d5c7694b4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/2020-the-best-year-for-our-engineering-team-so-far-89d5c7694b4e">2020: The best year for our Engineering team so far</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrating Infraspeak’s API authentication on first-party clients]]></title>
            <link>https://medium.com/infraspeak/integrating-infraspeaks-api-authentication-on-first-party-clients-bb5be026fa5d?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/bb5be026fa5d</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[José Postiga]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 08:01:02 GMT</pubDate>
            <atom:updated>2020-06-19T08:01:02.258Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we leveraged Laravel’s custom Guards and Providers on Place Checkup to authenticate users against our existent API service.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lv0-JB-_jCw3Wvw2gV234w.png" /></figure><p>We’ve recently launched <a href="https://placecheckup.com/">Place Checkup</a>, a web application that allows users to check if a given place follows the WHO recommended safety and prevention measures against COVID-19. Business owners, which are not yet <a href="https://infraspeak.com/">Infraspeak</a>’s customers, can register through this website, claim their places and register how and what measures they’re actually following. In the end, they get an A, B, or C badge qualifying their places.</p><p>Since Infraspeak’s core software business is directly related to infrastructure maintenance management, and since we develop with an API-first approach, we already had the core functionalities available to easily use on Place Checkup. Besides that, and to avoid having multiple accounts spread over different projects, we defined that we’d leverage our existent API authentication, and centralize all the accounts there.</p><p>Our API uses Passport, an oAuth2 server implementation for Laravel projects, so by sending a user’s credentials to the API service, if they are valid, it returns an encoded JWT with the user information we’d need. To keep things simple, and to avoid having to implement a Machine-to-Machine authentication, we wanted to simply store the generated JWT in session, on Place Checkup, for further usage on subsequent calls to the API.</p><p>Laravel has a very good, and extendable, authentication system, referenced throughout the documentation as Guards. Their job is to know how an authentication request gets processed and how to communicate with a Provider, whose responsibility is to know how to get the requested data from whatever persistent layer it handles.</p><p>If correctly implemented, a custom Guard would allow us to tap into middlewares, facades, and helper methods commonly used within Laravel to handle authentication, like the Auth facade, or getting the currently authenticated user via $request-&gt;user(), or even use the auth middleware to secure access to private routes. That looked exactly what we needed for this project!</p><p>But adding a custom Guard and Provider proved to be a little more difficult than what the documentation shows to be. Reading through the sections that describe how Guards and Providers work, I could only see how to register the custom classes to the Container, which interfaces to implement, and which type of classes it needs to return. I couldn’t quite get a clear picture of how the flow was, so I realized I’d need to dive deep into the authentication system and try to map it from within.</p><h4>Understanding Guards</h4><p>Laravel’s documentation describes Guards as the following:</p><blockquote><em>Guards define how users are authenticated for each request.</em></blockquote><p>But, what does that really mean? That was the question I had on my head while deep on the SessionGuard class - a preexistent Guard shipped by default with the framework - trying to understand what&#39;s going on under the hood. I figured that a Guard has the sole responsibility of receiving requests to authenticate a user and to call the configured Provider to fetch that user on the persistent layer.</p><p>This means that, for example, when we call Auth::attempt() to attempt a login action, Laravel will defer that call to the same method on the configured Guard. This Guard will, in turn, prepare all it needs to send that request through the related Provider, which may (or may not) return an instance of the Authenticatable interface, the object that represents the authenticated user.</p><p>I’ve also found that we actually have two interfaces for Guards:</p><ul><li>The Guard interface, referenced in the docs, aimed to a stateless authentication, like APIs;</li><li>The StatefulGuard interface, that extends the previous Guard interface but also defines how to persist the authentication information in the configured session storage.</li></ul><p>The fundamental difference between them: state management. The knowledge of the existence of this StatefulGuard interface pointed me to a good direction of how I could develop a Guard that would persist the JWT in the session that integrates perfectly with the expectations of Laravel itself. I was finally in a good place on understanding the key concepts of the whole authentication system.</p><h4>Understanding Providers</h4><p>Laravel’s documentation describes Providers as the following:</p><blockquote><em>Providers define how users are retrieved from your persistent storage.</em></blockquote><p>Looking at the two default providers that Laravel supports, EloquentUserProvider and DatabaseUserProvider, I noticed that first returns an instance of Model (an Eloquent model class) and the other handles direct calls to a database table and returns an instance of GenericUser (a slight variation of a Value Object). Both follow the same UserProvider interface.</p><p>I concluded that Providers are an implementation of the Repository pattern, and exist only to abstract away how you validate the user’s credentials and fetch their data on whatever persistent layer it’s stored in.</p><p>Actually, that’s probably why the user’s credentials are passed on inside an array structure: because Laravel doesn’t want to be opinionated towards how you authenticate your users. You can use a combination of e-mail and password, or a one-time hash (like magic links sent to an e-mail), or whatever you want to use. It’s pretty clever, actually!</p><p>But it’s basically this… It’s inside a Provider that you actually define what data you need to authenticate a user (the credentials) and how you communicate with the persistent layer to get the relevant data. No matter how that’s done, a Provider must return an object that implements the Authenticatable interface. This is to ensure that Laravel uses the correct methods when working with that object, directly, like when calling Auth::id().</p><h4>Making all parts work together nicely</h4><p>I’m pretty sure that at this point you already have a clearer understanding of the role Guards and Providers take within the Laravel’s authentication workflow: Guards receive the request to authenticate a user and pass the credentials to the defined Provider. The Provider, in turn, queries the underlying persistent storage about the relevant user data associated with those credentials and returns it all the way back to the Guard, which makes that information available for usage.</p><p>But even if you create all the required classes, you still need to register them within Laravel’s Container, so that it knows how to call those classes:</p><ul><li>To register the Provider, we use the Auth::provider() method and define how the framework should instantiate the custom provider class;</li><li>To register the Guard, we use the Auth::extend() method and define how the framework should instantiate the custom Guard.</li></ul><p>Let me show you exactly what we’ve done to register the custom Guard and Provider used on the Place Checkup project:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a79fd5d7d23982767f5ef8999f2e9bec/href">https://medium.com/media/a79fd5d7d23982767f5ef8999f2e9bec/href</a></iframe><p>The InfraspeakUserProvider class has all the code to communicate with our API service and validate a user&#39;s credentials and returns an instance of the Authenticatable interface. The JwtSessionGuard class has the code that takes that object, from the Provider, and persists it to the session, avoiding new calls being dispatched to the API service while that session is active and valid, protecting our API service from being flooded with authentication requests every time a protected endpoint is being processed.</p><p>The very final step in all this work was to update the config/auth.php, and switch the default Guard and Provider used for the web routes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e6256ebb91954aa349f2b8198fb31a2/href">https://medium.com/media/4e6256ebb91954aa349f2b8198fb31a2/href</a></iframe><p>Now we could use Laravel’s native classes to authenticate a user and use our API service to serve as the data repository to get that information.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb5be026fa5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/integrating-infraspeaks-api-authentication-on-first-party-clients-bb5be026fa5d">Integrating Infraspeak’s API authentication on first-party clients</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Incrementally migrating a legacy jQuery web application to a Vue.js SPA]]></title>
            <link>https://medium.com/infraspeak/incrementally-migrating-a-legacy-jquery-web-application-to-a-vue-js-spa-ecbd6671beee?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/ecbd6671beee</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[Ricardo Ferreira]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 17:01:17 GMT</pubDate>
            <atom:updated>2020-03-31T17:01:17.643Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_zhL7d2lNRVyIT74JUtIQ.png" /></figure><p>Our engineering team had in the past years a huge challenge to maintain a more than 6 years old application, based on PHP templates/modules being loaded by jQuery into the DOM. Scaling the application was becoming a nightmare and we were having a hard time maintaining and adding more features to it. This was having an impact on the team’s productivity and the value delivered to the client. Also, we were in need to modernize the application in terms of architecture, visual style, and user experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MvoseWRfm5ZuNrI9ZBBUFg.png" /><figcaption>Several legacy application showing some disruption between styles</figcaption></figure><p>Infraspeak’s core application is business-critical and thousands of users rely on it for their daily operations. We required a solution to deliver faster and better, but at the same time, we could not stop delivering features and value to the client. There was a lot of business logic existing on the legacy jQuery application that would take a long time to replicate in a brand new application.</p><p>So, we needed a solution that allowed us to migrate the legacy jQuery application into a whole new development stack, incrementally. New modules should be developed on the new application and bug fixes on the legacy application. The idea is to incrementally migrate the legacy modules into the new stack, but still delivering customer value.</p><p>We should have both applications alive each with its URL to create a user experience that allows a seamless transition between both applications. It was also very important to keep IE11 compatibility as some of our users are still using it.</p><blockquote>The solution we found brought us the opportunity to create a whole new development stack built on top of Vue.js with a highly scalable architecture, unit/integration tests, storybooks for documenting components, new documentation, CI, etc. This was also a key factor for team motivation, output, creativity and hiring. Also, the Backend team took the opportunity to update our API’s to reflect new, more up-to-date standards which are consumed only by the new application.</blockquote><p>Our first solution seemed a bit awkward for us at first, but the more we talked about it, the more it made sense… the idea of using IFrames was a bit out-of-fashion and kind of odd but still came to our rescue. Using this approach we could split the migration into two phases.</p><p>In the first phase, the new application was rendered inside the legacy application. In the second phase, we render the legacy application inside the new application. This way we could test and refine the new application structure while validating the IFrame solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*TpWZB0DZlIPgD9GozFWlIg.png" /><figcaption>Main structure of our new web application (Second phase). IFrame is what makes possible to see legacy application inside the new application.</figcaption></figure><h3>First phase — implementation in legacy application</h3><p>The first phase consisted of adding an IFrame module to the legacy application to load modules from the new application. The main goal was to buy time to build the core modules of the new application while still delivering value to the client on the legacy application. With this in mind, it was possible to build all new features in the new application.</p><h4>Hands-on</h4><p>To accomplish this, we needed to:</p><ul><li>Create a new application with Vue.js.</li><li>Support a URL query parameter that hides all headers and menu components on the new application. This will allow us to show only the main content of the module to be rendered in the IFrame.</li></ul><blockquote>Note: We could have added routes on the new application that only render the module screen instead.</blockquote><ul><li>Develop the new modules in the new application.</li><li>Add a new PHP module on the legacy app which renders an IFrame. Inside the IFrame, we show the module previously developed using the URL query parameter to hide all headers and menu components.</li></ul><p>Here’s what the PHP module should render on the page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*2UL73ZETDZsoxbeNvOLEQA.png" /></figure><blockquote>Both apps should be on the same domain, otherwise you might have CORS errors.</blockquote><p>And this was the final result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gUlHz1_j9Vu9t_GdfzwNLw.png" /><figcaption>Legacy application rendering the new application inside an IFrame</figcaption></figure><h3>Second phase — implementation of the new application</h3><p>All the initial architecture of the new application took us a while to be built. It was required to have the three core modules completely migrated to the new application. The remaining ones should be loaded using an IFrame to the legacy application (the opposite of what was done in the first phase).</p><h4>Hands-on</h4><p>To achieve this, we had to:</p><ul><li>Add a unique URL to all legacy modules that should be rendered on the new application. This way, we could map the route on the new application to a distinct page on the legacy application.</li><li>Add the URL query parameter on the legacy application to hide its headers and menus to show only the main section of the page.</li><li>Include some styles when the URL query parameter is present to make the legacy application’s style to better match the new application’s style.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zh_Fg8rqAzruZahFc750mQ.png" /></figure><ul><li>Communicate to the new application that the legacy application was rendered and ready to be used.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rI2dxoVLC3mzd-Hp_JSEFg.png" /></figure><blockquote>Now, the legacy application is ready to be rendered inside the IFrame!</blockquote><ul><li>Map each route to the legacy application and render the component created in the next step:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HXMNHiWb4bN6H1JUGHi3HQ.png" /></figure><blockquote>We also added a feature toggle in the code above to activate/deactivate the legacy screen for each module of the new application.</blockquote><ul><li>Create inside new application a component to render the legacy application modules (ScreenLegacyApplication.vue).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*do6JxR_Lhtffwh08HkAuIw.png" /></figure><p>Looking at the code above, we have a loading div that, while legacy application is not ready, it shows a loading animation.</p><p>We have a switch case that allows us to map between the new application URL to the respective URL on the legacy application.</p><p>When we change between two routes that render the legacy screen component the Vue framework reuses the screen component. That caused an issue when switching between two legacy screens. The easy fix was to watch over $route and force a recalculation of the URL.</p><blockquote>We could have used <em>beforeRouteUpdate</em> method of vue-router to force recalculation of the URL.</blockquote><p>That brought us another issue because if the only thing changing on the IFrame URL is in front of the hashbang, then the IFrame does not re-render the legacy application. To fix this, we added a ‘counter’ variable that is incremented and appended to the URL of the legacy application before the hashbang.</p><p>This was the final result of the new application:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qk5c8xpVy-hnjqyP8tsTFA.png" /><figcaption>New application rendering a new module</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgvLh0VnRRJ_qrES4twxew.png" /><figcaption>New application rendering a legacy module with IFrame (with stylesheet updated)</figcaption></figure><h3>Conclusion</h3><p>Migrating a large-scale legacy application to a brand new one can be a very risky and time-consuming task. The approach we took allowed us to incrementally migrate our codebase to a brand-new application build on top of a very solid architecture that allowed us to deliver better and faster value to the client.</p><p>We still have a lot of legacy modules to be migrated, but we can now do it without affecting application stability or deployment cycles.</p><p>Also, having the legacy application alive, enabled us to have a quick rollback plan in case of disaster in the new application which is critical for applications that are used in people’s daily operations.</p><p>We never thought to ever say this before, but for us, “IFrame rules”!</p><h4>Related links</h4><p><a href="https://codecraft.tv/blog/2017/09/07/angularjs-to-angular-using-iframes/">https://codecraft.tv/blog/2017/09/07/angularjs-to-angular-using-iframes/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecbd6671beee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/incrementally-migrating-a-legacy-jquery-web-application-to-a-vue-js-spa-ecbd6671beee">Incrementally migrating a legacy jQuery web application to a Vue.js SPA</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git bisect: The unsung hero for hunting down bugs]]></title>
            <link>https://medium.com/infraspeak/git-bisect-the-unsung-hero-for-hunting-down-bugs-a4dbe3ca4c75?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a4dbe3ca4c75</guid>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[git-bisect]]></category>
            <dc:creator><![CDATA[Gonçalo Queirós]]></dc:creator>
            <pubDate>Tue, 28 Jan 2020 18:51:53 GMT</pubDate>
            <atom:updated>2020-01-29T19:09:55.702Z</atom:updated>
            <content:encoded><![CDATA[<h4>The best solution to quickly find that annoying bug among hundreds of commits</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_YVqRixI9CrHfh5VDMtEYg.png" /></figure><p>The year is 2010, a wild bug appears in a code base, but this is no common bug, this is one that likes to play hide and seek among the thousands of lines some feature introduced into the branch you are working on… The year is now 2020 and sadly, this wild bug still visits you from time to time, coming in many shapes and forms, but always using the same technique, hiding between large batches of commits.</p><p>We have all lived (and survived) stories like this, where a seamlessly commit introduces a bug that is hard to track down, and though we should deliver small batches of code, we don’t always live in that greenfield.</p><p>Back in 2010, I was introduced to one of the git “unsung heroes”: git bisect Since then, it has saved me lots of time hunting down bugs. This is not a tool that you will be using every day (or at least I hope you don’t have to), but when you do, you will really appreciate how a simple tool can accomplish so much.</p><h3>What does it do</h3><p>Plain and simple, git bisect allows you to interactively search through a batch of commits until you find the commit that introduced the bug or changes you are looking for. In order to do this, git bisect keeps jumping between commits, while asking you whether the commit you are currently on is working or not. Based on your response, git bisect decides what commit to analyze next, and this process goes on until it finds the commit you are looking for.</p><h3>How does it work</h3><p>How does that help me search a batch of 100 commits? The easiest way to answer that question, is to show you the tool in action.</p><p>Let’s start by creating an empty repository with 100 commits with each commit message being the commit number from 1 (oldest) to 100 (newest):</p><pre>mkdir /tmp/bisect-test<br>cd /tmp/bisect-test<br>git init<br># Create 100 fake commits. Commit messages will be its ordering number (greatest is newest)<br>for i in `seq 1 100`; do<br>    git commit --allow-empty -m &quot;$i&quot;<br>done</pre><p>If now we perform a git log we should see something similar to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*iidnQkbQRKTmXN3ZchQDxg.png" /></figure><p>In a real scenario the only thing that we’d know at this point is that our HEAD contains a bug that wasn’t there in the past. Our first mission is to find a commit where the bug we are searching for doesn’t exist.</p><p>To find that commit we can either go back in history to a specific tag where we know things were working, or we can try to go back in steps of 50 commits with git reset --hard HEAD~50 until we find one commit where the bug is not present.</p><p>In our scenario, let’s pick commit number 7 whose hash is 5f310beb96815 as the commit that we know things were working.</p><p>We kick off bisect with git bisect start and then we inform it about one good and one bad commit:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*5TZ8yhM9s7__CV4Mjs3DKQ.png" /></figure><p>From the image above we can see that I informed bisect that our good commit is 5f310beb96815 and our bad commit is HEADwhich is the current commit.<br>With that information, bisect performed a git checkout to a commit between those two (100 and 7). In this case, it is commit 53.</p><p>At this point, we have literally rolled back our commit history, and now we just have to check if this commit is exhibiting the bug we are looking for. For our scenario let’s imagine that it is. We need to tell bisect that the commit is bad, using git bisect bad</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*18vfh63JN6xLjzpdsHTiFA.png" /></figure><p>Since commit 7 was good and 53 was bad, it’s safe to assume that we are looking for a commit between commits 7 and 53, clearing all commits between 53 and 100. That’s exactly what bisect does, so it will move the history to a commit in between 7 and 53. In this case, commit 30.</p><p>On commit 30 we test again our code to see if the bug is there. Assuming that it’s not, we inform bisect about that with git bisect good</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*xNxuW6uLmUG2VzRDXXtOmw.png" /></figure><p>Having informed bisect that commit 53 is broken but 30 was not, bisect will once again checkout to a commit between these two. In this case, commit 41!</p><p>We would keep issuing git bisect good and git bisect bad commands until we find the culprit, in which case we get something similar to this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*lCrOPMsReHFoXLieFvV57Q.png" /></figure><h3>I found you, Pikachu!</h3><p>We found out that commit 42 is our culprit (but that should be <a href="https://en.wikipedia.org/wiki/Phrases_from_The_Hitchhiker%27s_Guide_to_the_Galaxy#Answer_to_the_Ultimate_Question_of_Life,_the_Universe,_and_Everything_(42)">no surprise</a> :-), so now we just need to inspect the code it introduced and our quest should be much easier.</p><p>The year is 2020, and you no longer fear large chunks of commits coming into your branch. With git bisect as your secret weapon, you know that finding those commits won’t take you much time and energy, and you will be able to use them to solve more interesting riddles.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4dbe3ca4c75" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/git-bisect-the-unsung-hero-for-hunting-down-bugs-a4dbe3ca4c75">Git bisect: The unsung hero for hunting down bugs</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The First Hacktoberfest]]></title>
            <link>https://medium.com/infraspeak/the-first-hacktoberfest-1bf892b67b46?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/1bf892b67b46</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <dc:creator><![CDATA[João Pedro Ribeiro]]></dc:creator>
            <pubDate>Wed, 06 Nov 2019 17:54:54 GMT</pubDate>
            <atom:updated>2019-11-06T17:59:38.271Z</atom:updated>
            <content:encoded><![CDATA[<h3>Our Experience with Hacktoberfest</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XLjo6MdjYbTMzlvo" /></figure><p>That’s right! We organized our 1st <a href="https://hacktoberfest.digitalocean.com/">Hacktoberfest</a> :)</p><p>We are still a relatively small team, around 11 engineers, but we are growing (and <a href="https://www.infraspeak.com/job-at-infraspeak/">hiring</a>) at a reasonable pace now. And, we all know that with “relatively big” teams comes “relatively big” responsibilities: <strong>Giving back to the community!</strong></p><p>Joking aside, this is something we have been wanting to do for some time and we finally have the manpower to put some of these projects in motion.</p><p>So, after dipping our toe into the open-source events by sponsoring and helping our team member <a href="https://medium.com/@josepostiga">@josepostiga</a> to organize the first <a href="https://medium.com/infraspeak/laravel-portugal-meetup-1st-edition-will-happen-in-porto-4c44661efdc0">Laravel Portugal meetup</a>, we gave it a shot and organized our first company-wide open source event.</p><p>The experience was really rewarding and everyone enjoyed a more relaxed day, away from sprints and deadlines, to do what every developer likes to do: solving problems and improving things.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsdPcZx0qiFk%3Ffeature%3Doembed&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsdPcZx0qiFk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsdPcZx0qiFk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fdc44b368a0105503cf3c78799d7dfc4/href">https://medium.com/media/fdc44b368a0105503cf3c78799d7dfc4/href</a></iframe><p>We started by creating a spreadsheet of all the improvements that we would like to do for Open Source projects. This also allowed people without any project to team up with someone.</p><p>This generated a lot of brainstorming, pair programming and, of course, a few beers. But at the end of the day, we were able to submit 4 pull requests and have another one under development. These contributions were distributed between the Laravel framework and some packages that we use on our backend and frontend.</p><p>Of course, we tracked our contributions using the good old fashion post-its.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/0*T9wc6XBEOzTy7muy" /></figure><p>Pull requests:</p><ul><li>laravel/framework — <a href="https://github.com/laravel/framework/pull/30201"><strong>[6.x] Simplify gatherKeysByType method</strong></a> — [Merged]</li><li>laravel/framework — <a href="https://github.com/laravel/laravel/pull/5127"><strong>[6.x] Add ValidateJson middleware #5127</strong></a> — [Rejected] (We will turn this into a package)</li><li>laravel-notification-channels/channels — <a href="https://github.com/laravel-notification-channels/channels/pull/66"><strong>First version of Workplace channel #66</strong></a> — [Open]</li><li>spatie/laravel-permission — <a href="https://github.com/spatie/laravel-permission/pull/1240"><strong>Add timestamps columns to pivot tables #1240</strong> </a>— [Open]</li></ul><p>Under development:</p><ul><li>storybookjs/storybook — <a href="https://github.com/storybookjs/storybook/issues/8247">CLI option to load stories from specified directories #8247</a></li></ul><p>Let’s now try to keep the momentum going and make the effort to do more contributions like this to the community.</p><p>My take on this, personally, is that contributing to open source takes some time and effort, and developers rarely think about it, although many of us depend on it. But it’s also really fun and by actively digging into it do we truly value its importance. So it’s something that every team should try to incorporate in their mindset as much as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1bf892b67b46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/the-first-hacktoberfest-1bf892b67b46">The First Hacktoberfest</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Messing With The Hosts File]]></title>
            <link>https://medium.com/infraspeak/stop-messing-with-the-hosts-file-a760aa660c20?source=rss----efb658d61e1b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a760aa660c20</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[dnsmasq]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[José Postiga]]></dc:creator>
            <pubDate>Mon, 09 Sep 2019 16:01:01 GMT</pubDate>
            <atom:updated>2019-09-09T16:51:20.584Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to leverage Dnsmasq to route all local development traffic to localhost.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0njlvkU2kNd0SPmt" /><figcaption>Photo by <a href="https://unsplash.com/@dnevozhai?utm_source=medium&amp;utm_medium=referral">Denys Nevozhai</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The hosts file is used by the system’s DNS resolver to map a fully qualified domain name (FQDN) to its related IP, without the need to query any of the Internet’s DNS servers. However, since updating this file, manually, by the common computer user would be impractical, its common use is to map the local IP 127.0.0.1 to localhost domain so that it resolves to the host machine.</p><p>So, since this file overrides the default behavior of querying the Internet’s DNS servers, and directly maps any string of characters to an IP, it’s frequently used by programmers to associate a development domain with the localhost IP address. This enables the use of a non-existent domain like, for example, my-secret-project.test as an FQDN on a browser, as you’d normally access a registered .com (or any other TLD) domain.</p><p>At Infraspeak, we have several projects that use personalized domain names in our development environment. This requires that each of those domain names have to be mapped in the hosts file of every developer’s computer. Every time we use a new, or change an existent, project domain name, we have to warn everybody about it, and each developer has to update the hosts file.</p><p>Since we’re investing a lot in hiring, it got me thinking about the tedious work of every new colleague editing the same file and paste the same mappings over and over again, and I decided to investigate a way of automating the process. I’ve come across several infrastructure-related projects, in my past, that does this. Valet, for example, which is a Laravel development environment, does this exact thing: it routes all requests for domains that use the .test TLD to a preconfigured folder with the same name of the domain requested. So, a request to my-secret-project.test would route to a project inside a my-secret-project folder.</p><p>I knew that Valet leveraged Dnsmasq to do that, so I went to read more about how that software works and how could I add it to my stack and route the development domains, without editing the hosts file. While following the documentation to install it in my machine, I got an error related to port 53 being already in use. While trying to find which service was using that port, I found that a package named dnsmasq-base was already installed on my Ubuntu machine.</p><p>I don’t really know what Ubuntu is using that package for, or if it was really used at all, but I guess that it could be that the NetworkManager was leveraging the capabilities of DNS caching that Dnsmasq has. Anyway, the fact that it was already installed saved me some steps on configuring the environment. Now, I just needed to find a way to configure the Ubuntu NetworkManager to use Dnsmasq instead of system-resolve.</p><p>A little more time investigating showed me that NetworkManager already supports Dnsmasq out-of-the-box and that to enable its use all that’s required is a single key in the [main] section of its configuration file. That’s simple enough, but I’ve been working with Linux for a lot of time now, to know that almost every system’s service has a conf.d folder that’s used to override the default configuration with the use of partial overriding of variables. Without any surprise, I found that the NetworkManager was no exception to this.</p><p>That meant I simply needed to add a file to the conf.d folder with only the configuration needed to activate the Dnsmasq support. I called the file dnsmasq.conf and put it inside the folder /etc/NetworkManager/dnsmasq.d, with the following content:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/847c3fd9ab1a88e959a948f40cd8ce57/href">https://medium.com/media/847c3fd9ab1a88e959a948f40cd8ce57/href</a></iframe><p>It was that simple! Now, the NetworkManager service was being instructed to use Dnsmasq to resolve all domains, instead of the native system-resolve service. However, this configuration alone was insufficient to route all local development domains to the localhost IP address. I still needed to add a specific Dnsmasq configuration file, to instruct it to not query the Internet’s DNS servers for requests of specific TLDs (our development TLDs).</p><p>The file that was missing needed to be inside the dnsmasq.d folder, which is very close to the previous folder: /etc/NetworkManager/dnsmasq.d. Creating a file there, with the name .development-tld.conf, and adding a single line with address=/development/127.0.0.1 is all that was missing. Now, Dnsmasq won’t query the Internet’s DNS servers to know what’s the IP for every domain that uses .development TLD.</p><blockquote>We use .development as a local development TLD, but we could use the exact same steps to use any other TLD, like .test Just take note that whatever you use, won’t reach the Internet. So, if you use .com, for example, all requests for domains with that TLD will try to be resolved to your machine. Stick with a TLD that you know it’s not a “valid” one on the Internet, to avoid such problems.</blockquote><p>Finally, I had everything properly configured. I only needed to disable the system-resolve service, permanently, and restart the NetworkManager service. The commands to do so were the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7235ed601cda25c4352d5963e7c7201c/href">https://medium.com/media/7235ed601cda25c4352d5963e7c7201c/href</a></iframe><p>The line sudo rm /etc/resolv.conf forces the O.S. to regenerate the file with the new, updated, configuration, and the last line forces NetworkManager to load the all-new configuration.</p><p>Now I had all my development domains auto-resolving to the localhost machine, even with domains that I never configured in the hosts file. Here’s an excerpt of what happens when pinging any domain with the configured .development TLD:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f8e4644df856cab6414cdc0c6fcbeb30/href">https://medium.com/media/f8e4644df856cab6414cdc0c6fcbeb30/href</a></iframe><p>Pretty sweet, right? No more messing around the hosts file!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a760aa660c20" width="1" height="1" alt=""><hr><p><a href="https://medium.com/infraspeak/stop-messing-with-the-hosts-file-a760aa660c20">Stop Messing With The Hosts File</a> was originally published in <a href="https://medium.com/infraspeak">infraspeak</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>