<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eren Yatkin on Medium]]></title>
        <description><![CDATA[Stories by Eren Yatkin on Medium]]></description>
        <link>https://medium.com/@yatkineren?source=rss-e31dd5463c11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*IFFOeCBysU6R6xmD9z9vRQ.png</url>
            <title>Stories by Eren Yatkin on Medium</title>
            <link>https://medium.com/@yatkineren?source=rss-e31dd5463c11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 22:08:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yatkineren/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AI — Catching Up]]></title>
            <link>https://medium.com/teknasyon-engineering/ai-catching-up-2ecef1d1ddde?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ecef1d1ddde</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[history-of-technology]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 10:43:16 GMT</pubDate>
            <atom:updated>2025-03-17T13:35:17.217Z</atom:updated>
            <content:encoded><![CDATA[<h3>AI — Catching Up</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n2kkjmspOCOd9nqO.jpg" /></figure><p>Hello everyone! It’s been a long time since I’ve published a new article. <br>While artificial intelligence is on the agenda, I couldn’t help but join the <br>conversation.</p><p>Will artificial intelligence take our jobs away from us? Can it code? How <br>advanced is the Cursor? What are the differences between Windsurf and Cursor? Which is better: DeepSeek, Chatgpt, or Claude? You will not get answers to any of these questions in this article. I will try to discuss artificial intelligence from a different perspective.</p><p>The development of the models that were created and presented to the end <br>user as tools, the development of these tools that we use in our daily lives <br>without realizing it, was not something that was done in the last few years <br>as it was presented to us.</p><p>In this article, I will try to explain to you the stages of development, what has been done over the years, what the important developments have been, and what are the studies and approaches that have brought us here.</p><blockquote>Don’t worry, we will not go back to BC</blockquote><h3>1950–1970</h3><p>Alan Turing, who laid the foundations of artificial intelligence, introduced <br>the concept of artificial intelligence into our lives with his work on <br>decryption and computational theories. During this period, the first <br>examples of artificial intelligence appeared in the field of <strong>machine <br>translation</strong>. A joint effort with <strong>IBM</strong>, known as the “<strong>Georgetown</strong> <br><strong>Experiment</strong>,” aimed to translate a series of Russian sentences into English.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*5CMnpDWFaVTC8Vei02VZTQ.png" /></figure><blockquote><strong>Georgetown — IBM Experiment</strong></blockquote><blockquote>Although the project managers predicted that this problem would be solved <br>in about 5 years, this experiment, which started in 1954, was not finalized <br>until 1966 and failed.</blockquote><p>In the same years, <strong>Terry Winograd</strong> developed a primitive model that could <br>move and manipulate objects with written commands and called it <strong>SHRDLU</strong>. Around the same time, <strong>Joseph Weizenbaum</strong> published a model <br>called <strong>ELIZA</strong> for use in psychotherapy. <strong>ELIZA</strong> was considered one of the <br>first models to work in a chatbot structure. It was an artificial intelligence <br>system that could give simple answers to patients’ reactions.</p><h3>1970–1990</h3><p>The studies in this period were mostly on data sets, but the most important <br>development was the introduction of the concept of Machine Learning. With the increase in processing power, which is insufficient even today, <br>algorithms such as Decision Trees and K-Nearest Neighbors were <br>developed. The foundations of artificial neural networks were laid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XtyXehhCrc1PPXETGs349w.png" /></figure><h4>Machine Learning</h4><p>Machine learning is a branch of artificial intelligence that basically involves feeding sample data to computers, allowing them to make decisions, inferences, and predictions based on this data. The models created in the initial phase were usually based on statistical foundations. For example, the models used to predict stock prices were among the first applications of machine learning.</p><h3>1990–2000s</h3><p>With the increasing processing power of computers, “<strong>Bayesian Networks</strong>” <br>emerged, modeling probability relationships between events. As data has <br>become increasingly important, artificial neural networks have been developed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*CRB4vYXNlmZoQvuIhGUSdQ.png" /></figure><h4>Artificial Neural Networks</h4><p>Artificial neural networks are machine learning algorithms that mimic how the human brain works. It can predict and classify by learning complex connections between data. Artificial neural networks consist of three basic layers:</p><ol><li><strong>Input Layer</strong></li><li><strong>Hidden Layer</strong></li><li><strong>Output Layer</strong></li></ol><p>The progression of data through these layers is called “feed forward.” Each <br>node has its own regression model and calculates the relationship of the <br>data to the next node. Artificial neural networks are usually trained by <br>supervised learning and there are different types such as <strong>ANN, CNN, and <br>RNN.</strong></p><h4>2010s</h4><p>As we get closer to the present day, many things that used to be just dreams<br>and theories on paper have become possible. The most important developments were made in the field of <strong>Machine Learning and Neural Networks and Deep Learn</strong> entered our lives.</p><p>The most important step in the field of NLP was Apple’s release of Siri. Siri was considered the first successful example of NLP. This breakthrough has led to NLP applications based on voice recognition and visual processing.</p><h4>Natural Language Processing — NLP</h4><p>NLP is an approach to artificial intelligence that enables computers to <br>understand and respond to human language; rather than being a model or <br>algorithm, NLP is a toolkit. In simple terms, it can be defined as teaching <br>grammar rules to a computer and teaching language to the computer in this way</p><p>This process is achieved with the following tools;</p><ol><li><strong>Tokenization:</strong> Sentences are split at the word or character level and <br>unnecessary words are removed</li><li><strong>Stemming ve Lemmatization:</strong> Words are reduced to their roots. <br>Stemming only takes the root form of the word, while lemmatization <br>preserves the context and meaning of the word.</li><li><strong>Part-of-Speech (POS) Tagging:</strong> Words are classified according to <br>grammar rules.</li><li><strong>Named Entity Recognition (NER):</strong> Real-world meanings of words <br>are determined (e.g. names of people, cities, brands, etc.).</li></ol><p>NLP can be supported by machine learning algorithms (e.g. Naive Bayes) to<br>achieve improved results and outputs.</p><h4>Deep Learning</h4><p>Deep learning is a sub-branch of machine learning based on artificial neural networks. By working on large data sets, it can learn complex relationships and patterns. It is used in many areas such as image processing, voice recognition, and natural language processing.</p><h4>Naive Bayes</h4><p>This is a machine learning algorithm based on Bayes’ theorem and is widely used for problems such as text classification, spam filtering, and sentiment analysis. It is called “Naive” because the model assumes that each feature is independent of the others. While in reality, this assumption is not always true, Naive Bayes performs well in most practical applications</p><h3>Today</h3><p>Today, we can say that artificial intelligence has started to play an active <br>role in most of our lives. I liken this period to the introduction of microservice architecture in the 2010s. Every day, a new tool, a new model, a new approach is introduced and we need to find our way through this <br>cloud of dust.</p><p>When we clear this dust cloud a little bit, we come across the concepts of <br>LLM and AI Agents. We can say that these concepts will keep us busy for a<br>long time.</p><p>With the development process that started in the 1950s and the use of the <br>tools created together, the fruits of this labor began to be reaped. We are <br>now seeing models that are closer to human language, that can work <br>intertwined with the internet, that can use social media, and we are <br>witnessing their rapid development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*CkD8lFciklwOoxTHZCMK9A.jpeg" /></figure><h4>LLM (Large Language Model)</h4><p>These are artificial intelligence models that have been trained with large <br>amounts of text data and can understand and produce natural language. Using machine learning and deep learning techniques, these models can<br>analyze and respond to texts and generate creative content. It has billions <br>of parameters, these parameters are transferred to LLM from books, articles, and online information. They are models that emerged by using many approaches that have been put forward in the past periods together.</p><p>We can take a broad look at LLMs under 3 topics</p><ul><li><strong>Data</strong>: Texts, books, blogs, forums, open-source code, dialogues, <br>academic content, web, etc. are data for LLM. Here, steps such as <br>filtering poor-quality content and inconsistent information, and <br>cleaning spam content are important.</li><li><strong>Architecture</strong>: Tokenizer (breaking the text into small pieces), <br>embedding layer (converting tokens into numeric vectors), <br>transformers (self-attention and feedforward), position encoding <br>(model understanding the order of words), decoder (producing output by word prediction). Models change their working principles using <br>different approaches</li><li><strong>Learning</strong>: Pretraining (learning the language rules), Fine Tuning <br>(customizing the model for a specific topic), Alignment &amp; RLHF <br>(tuning the model for safe and ethical guidance)</li></ul><p>Today, although models such as ChatGpt, DeepSeek, and Claude apply <br>different approaches, they are models that have LLM at their core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkues6h8Osdya58tOIUdKw.jpeg" /></figure><h4>AI Agents</h4><p>AI Agents can be simply defined as tools that help LLMs interact with the <br>outside world. In this way, LLM gains different capabilities. On the other <br>hand, since LLMs are taught with a fixed data set, they produce outputs by <br>utilizing the data up to that day, but life does not stop, and we are <br>constantly moving forward.</p><p>The capabilities that LLM brings to adapt to this progress can be a service layer in your project, or it can be web or location search. We can say that only your dreams are your limits.</p><h3>Final</h3><p>Now we know what the concepts we are exposed to in daily life are and <br>where artificial intelligence technology has come from.</p><p>We see many breakthroughs such as automating processes and reducing <br>human intervention, and this shows that we are in a transition period.</p><p>I think it would be more beneficial to be a part of this transition period and to seek answers to the question of how well-grounded tools, models, and <br>approaches can be incorporated into our daily lives, business processes, and even our projects, rather than looking for answers to questions like “Will it take our jobs away?” that haunt everyone’s minds.</p><p>Thank you for reading and I hope to see you in the next article.</p><p>Stay safe!</p><p>PS: This technology will retire me, but I can’t say the same for the next <br>generation :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ecef1d1ddde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/teknasyon-engineering/ai-catching-up-2ecef1d1ddde">AI — Catching Up</a> was originally published in <a href="https://medium.com/teknasyon-engineering">Teknasyon Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proper Way To Add Graceful Shutdown — NodeJs]]></title>
            <link>https://medium.com/bitsrc/proper-way-to-add-graceful-shutdown-nodejs-6c7b35c047aa?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c7b35c047aa</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Sun, 26 Mar 2023 19:17:12 GMT</pubDate>
            <atom:updated>2025-03-06T07:56:46.017Z</atom:updated>
            <content:encoded><![CDATA[<h3>Proper Way to Add Graceful Shutdown — Node.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wD7_rubFTjle5v9YuOWdhg.jpeg" /><figcaption>Image by brgfx on Freepik</figcaption></figure><p>Hi, internet! I know you are trying to do your best to improve your skills in software development and I am here to give you a niche subject. If you are a backend developer this post is just for you!</p><p>When we are developing our projects, micro startups or the next big FAANG, we need to do this the right way. It does not matter which design system you chose microservice, SOA or monolithic you should always add a graceful shutdown procedure in your application because data loss is not a thing we can afford. Besides that, the service you provide will be interrupted.</p><p>In today&#39;s circumstances, projects are at least updated once a day and this can cause service interruption which can in turn cause data inconsistency. To prevent this we have a simple solution that will be worth developing.</p><figure><a href="https://bit.cloud/"><img alt="Build in AI speed — Compose enterprise-grade applications, features, and components" src="https://cdn-images-1.medium.com/max/1024/1*yX0vq3scSudyT61IuWFuEg.png" /></a><figcaption>Build in AI speed — Compose enterprise-grade applications, features, and components</figcaption></figure><h3><strong>What is Graceful Shutdown?</strong></h3><p>Graceful shutdown is essential for server applications because it ensures that a service can be shut down in a controlled manner without disrupting other services that depend on it. Microservice architectures typically involve breaking down a large application into smaller, independent services that communicate with each other over the network or are complete applications themselves, working on their own. Each service is responsible for a specific task and can be developed, deployed, and scaled independently.</p><p>When an application needs to be shut down, it is important to do so in a way that does not cause any disruption to the overall system. A graceful shutdown allows the service to complete any in-progress tasks, clean up any resources it is using, and notify other services that it is going offline. This can help prevent data loss, reduce downtime, and avoid cascading failures that could affect other services.</p><p>Here are some key reasons why graceful shutdown is important for microservices:</p><ol><li><strong>Prevent data loss:</strong> If a service is shut down abruptly, any in-progress transactions or requests may be lost, leading to data corruption or data loss. A graceful shutdown ensures that all data is saved and any pending requests are processed before shutting down.</li><li><strong>Avoid cascading failures:</strong> When a service goes offline, it can trigger a cascade of failures in other services that depend on it. A graceful shutdown allows dependent services to prepare for the outage and gracefully handle the failure.</li><li><strong>Reduce downtime:</strong> By shutting down in a controlled manner, you can minimize the amount of downtime required for maintenance or updates. This helps keep the system up and running and reduces the impact on users.</li><li><strong>Clean up resources:</strong> A service may be using resources such as file handles, database connections, or network sockets. A graceful shutdown allows the service to release these resources in a controlled manner, reducing the risk of resource leaks or conflicts with other services.</li></ol><p>Overall, graceful shutdown is an important part of microservices development and deployment. It helps ensure that each service can be managed independently and that the overall system remains stable and reliable. As a developer, it is important to design services with graceful shutdown in mind and to test this functionality thoroughly to ensure that it works as expected.</p><p>In Node.js, shutdown signals are signals sent to a Node.js process that notify it to gracefully shut down. These signals allow a Node.js process to perform any necessary cleanup tasks before exiting, such as closing open connections or releasing resources.</p><p>Here are the most common shutdown signals in Node.js:</p><ol><li>SIGINT: The SIGINT signal is generated when the user presses CTRL+C on the terminal. This signal is often used to gracefully terminate a Node.js process.</li><li>SIGTERM: The SIGTERM signal is used to request a graceful termination of a Node.js process. This signal can be sent by a process manager or other external tool to gracefully shut down the Node.js process.</li><li>SIGHUP: The SIGHUP signal is generated when a process is disconnected from the terminal or when the terminal session ends. This signal is often used to request a reload or restart of a Node.js process.</li></ol><p>When a Node.js process receives a shutdown signal, it can use the process.on() method to register a handler function to perform any necessary cleanup tasks. For example, the handler function can close open connections, release resources, and gracefully terminate the process.</p><p><strong>The Example</strong></p><p>In this example, we will use plain Express to demonstrate. I assume that you are capable of creating a Node.js project and adding some packages.</p><pre>const express = require(&#39;express&#39;);<br><br><br>const app = express();<br>let appStatus = 1;<br><br>app.use((req, res, next) =&gt; {<br>    if (appStatus) {<br>        return next();<br>    }<br>    throw new Error(&#39;App is closing&#39;);<br>})<br><br>app.get(&#39;/&#39;, (req, res, next) =&gt; {<br>    res.send(&#39;*** Server is working ***&#39;)<br>});<br><br><br>app.listen(3000, () =&gt; {<br>    console.log(&#39;App is now running on: http://localhost:3000&#39;)<br>});<br><br>process.on(&#39;SIGINT&#39;, (signal) =&gt; {<br>    appStatus = 0;<br>    console.log(&#39;*** Signal received ****&#39;);<br>    console.log(&#39;*** App will be closed in 10 sec ****&#39;);<br>    setTimeout(shutdownProcedure, 10000);<br>})<br><br>function shutdownProcedure() {<br>    console.log(&#39;*** App is now closing ***&#39;);<br>    process.exit(0);<br>}</pre><p>Let’s break it down:</p><ul><li>We defined Express to create a server.</li><li>Created a variable called app and this will be our server application.</li><li>Defined a variable called appStatus to allow requests to be processed.</li><li>Added middleware to check app status to allow requests to be processed or not.</li><li>Added a route to handle incoming requests.</li><li>Started to listen port on 3000 and output a message.</li><li>Also, we started to list incoming signals with process.on(&#39;SIGINT&#39;) this will be fired when you kill the app with ctrl + c.</li><li>We set appStatus = 0 to block incoming requests then started a timer.</li><li>When the timer goes off shutdown procedure will be complete and we can close our application.</li></ul><h3>Conclusion</h3><p>As a developer, it’s important to design services with graceful shutdown in mind and to test this functionality thoroughly to ensure that it works as expected. By doing so, you can ensure that your microservices architecture is flexible, scalable, and resilient and that your Node.js applications are able to handle any situation that arises.</p><blockquote><em>💡 </em>By using an open-source toolchain like <a href="https://bit.cloud/"><strong>Bit</strong></a>, you can further ensure felixibility, scalability, and resilience in a microservice architecture by making sure your components are made independent, then versioned, tested, and shared across different microservices, with automatic semver and a dependency graph for each. This reduces the risk of failures caused by inconsistent dependencies or code duplication.</blockquote><h4>Learn more here:</h4><p><a href="https://bit.dev/blog/component-driven-microservices-with-nodejs-and-bit-l64shurc/">Component-Driven Microservices with NodeJS and Bit</a></p><p>Thank you all for reading through here, I much appreciate your time. See you all on another blog post!</p><h4>From monolithic to composable software with Bit</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*mV1ODyKj-dO4k5QM.png" /></figure><p><a href="https://bit.cloud/"><strong>Bit</strong></a><strong>’s open-source tool </strong>help 250,000+ devs to build apps with components.</p><p>Turn any UI, feature, or page into a <strong>reusable component</strong> — and share it across your applications. It’s easier to collaborate and build faster.</p><p><strong>→ </strong><a href="https://bit.dev/"><strong>Learn more</strong></a></p><p>Split apps into components to make app development easier, and enjoy the best experience for the workflows you want:</p><h4>→ <a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">Micro-Frontends</a></h4><h4>→ <a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">Design System</a></h4><h4>→ <a href="https://bit.cloud/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4">Code-Sharing and reuse</a></h4><h4>→ <a href="https://www.youtube.com/watch?v=5wxyDLXRho4&amp;t=2041s">Monorepo</a></h4><h4>Learn more</h4><ul><li><a href="https://blog.bitsrc.io/creating-a-developer-website-with-bit-components-3f4083a7f050">Creating a Developer Website with Bit components</a></li><li><a href="https://blog.bitsrc.io/how-we-build-micro-front-ends-d3eeeac0acfc">How We Build Micro Frontends</a></li><li><a href="https://blog.bitsrc.io/how-we-build-our-design-system-15713a1f1833">How we Build a Component Design System</a></li><li><a href="https://bit.dev/blog/how-to-reuse-react-components-across-your-projects-l4pz83f4/">How to reuse React components across your projects</a></li><li><a href="https://blog.bitsrc.io/5-ways-to-build-a-react-monorepo-a294b6c5b0ac">5 Ways to Build a React Monorepo</a></li><li><a href="https://bit.dev/blog/how-to-create-a-composable-react-app-with-bit-l7ejpfhc/">How to Create a Composable React App with Bit</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c7b35c047aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bitsrc/proper-way-to-add-graceful-shutdown-nodejs-6c7b35c047aa">Proper Way To Add Graceful Shutdown — NodeJs</a> was originally published in <a href="https://medium.com/bitsrc">Bits and Pieces</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Subject: Time Management]]></title>
            <link>https://yatkineren.medium.com/subject-time-management-fad5c319d5ad?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/fad5c319d5ad</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[time-management]]></category>
            <category><![CDATA[behavior]]></category>
            <category><![CDATA[personal-growth]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 16:38:26 GMT</pubDate>
            <atom:updated>2023-03-25T16:47:00.157Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi internet! Another topic to work on because we as developers need to improve our soft skills. This one is very crucial. Time is the key of everything. We often hear from our managers that they do not have time or they are so busy, well here is a blog post to not become one of them!</p><p>Time management is a crucial aspect of the software industry. Software developers need to effectively manage their time to complete projects on time, increase productivity, and ensure that all the necessary processes are completed for a project to be successful. In this blog post, we will explore what time management is and how it can benefit software developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-g61OpcOwLMYdeQeTEJySQ.jpeg" /><figcaption>Image by pch.vector</figcaption></figure><p><strong>TL;DR:</strong> Time management is a crucial aspect of the software industry. It involves creating a specific timeline, determining work priorities, tracking and communicating work, managing deadlines, and utilizing other management techniques to complete projects. Effective time management allows software developers to increase productivity, improve the quality of work, reduce stress, and enhance collaboration. By using project management software and other management techniques, software developers can manage their time effectively and ensure that each project is completed within the given timeline and budget.</p><h3>What is Time Management?</h3><p>Time management is a strategy that a software developer uses to organize their daily workflow, optimize their time and increase work productivity. It involves creating a specific timeline using project management software, determining work priorities, tracking and communicating work, managing deadlines for timely delivery, and utilizing other management techniques to complete projects. By effectively managing their time, software developers can increase their efficiency and complete projects on time and within budget.</p><h3>Why is Time Management Important in the Software Industry?</h3><p>In the software industry, there are often multiple projects going on at the same time. Effective time management is crucial to ensure that each project is completed within the given timeline and budget. With proper time management strategies in place, software developers can prioritize their tasks, complete their work on time, and avoid delays or missing deadlines. Time management also helps team leaders manage their team members, track their work, and ensure that they are working on the right tasks at the right time.</p><h3>Benefits of Time Management for Software Developers</h3><p>There are many benefits of time management for software developers. Here are some of the key benefits:</p><ol><li>Increased Productivity: With effective time management, software developers can focus on their work without distractions and complete their tasks on time. This helps to increase productivity and efficiency.</li><li>Improved Quality of Work: Proper time management allows software developers to take their time with each task and ensure that they are delivering quality work. This results in better software products that meet the needs of the end-users.</li><li>Reduced Stress: Effective time management helps software developers avoid working overtime or missing deadlines. This reduces stress and allows them to maintain a good work-life balance.</li><li>Better Collaboration: Time management strategies help team leaders manage their team members effectively and improve collaboration between team members. This helps to ensure that everyone is working towards the same goals and that the project is completed on time.</li></ol><p><strong>Here are some tools to help you to plan your day;</strong></p><ol><li><a href="https://trello.com/">Trello</a> is a project management tool that allows software developers to create boards, lists, and cards to manage their work. Developers can prioritize their tasks, assign them to team members, and track their progress using Trello.</li><li><a href="https://www.rescuetime.com/">RescueTime</a> is a time tracking tool that helps software developers understand how they spend their time. It tracks the time spent on various applications, websites, and tasks, and provides reports on productivity and focus.</li><li><a href="https://www.toptal.com/project-managers/tomato-timer">Pomodoro Timer</a> is a time management method that involves working in 25-minute increments with short breaks in between. Pomodoro timers, such as Focus@Will and TomatoTimer, can help software developers stay focused and manage their time effectively.</li><li>Jira: Jira is a popular project management tool that allows software developers to track their work and manage their projects. They can create tasks, assign them to team members, and track their progress using Jira.</li></ol><p><strong>Honorable mentions</strong></p><ol><li><a href="https://everhour.com/">https://everhour.com/</a></li><li><a href="https://www.google.com/calendar/">https://www.google.com/calendar/</a></li><li><a href="https://www.atlassian.com/software/jira">https://www.atlassian.com/software/jira</a></li></ol><p>These are just a few of the many time management tools available for software developers. By using these tools, developers can manage their time effectively, increase productivity, and deliver high-quality work on time.</p><h3>Conclusion</h3><p>In conclusion, time management is an essential aspect of the software industry. Effective time management allows software developers to prioritize their tasks, complete their work on time, and increase their productivity. By using project management software and other management techniques, software developers can manage their time effectively and ensure that each project is completed within the given timeline and budget. This results in better software products, improved collaboration, and reduced stress for software developers.</p><p>Thank you all for reading through here, see you all on a another post soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fad5c319d5ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Good Communication Skills — In depth explanation]]></title>
            <link>https://yatkineren.medium.com/good-communication-skills-in-depth-explanation-557dfee9bf36?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/557dfee9bf36</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Thu, 09 Mar 2023 11:00:00 GMT</pubDate>
            <atom:updated>2023-03-09T11:00:00.391Z</atom:updated>
            <content:encoded><![CDATA[<h3>Good Communication Skills — In depth explanation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q2LtDpUaYEslkvfAdLTwbg.jpeg" /><figcaption>Image by storyset on Freepik</figcaption></figure><p>Hi all! This is the second part of blog post which is key things to become a good software developer and you can read it by <a href="https://yatkineren.medium.com/key-things-to-have-to-be-a-good-sofware-engineer-96bffc1e1b1b">clicking this link</a>.</p><p>Often we are confusing that “good software developer/ engineer” is the person who writes the best code for that situation. By the way this is true but not all the way.</p><p>When you wiret quality and performant code but can not explain it or express yourself it cloud not be accepted as a solution.</p><p>Do not get wrong I would choose your solution because I am like you! I am just like you, I do not have good communication skills but I found my way around and kept myself improving. Shout out the jr. developers who are trying to do their bests!</p><p>I have 7 years of experience as software developer here are key subjects of good communication skills.</p><blockquote>TL;DR: Good communication skills are essential for software developers because we need to collaborate with others, understand requirements, write technical documentation, communicate with clients, and resolve conflicts. By developing strong communication skills, we can improve our effectiveness and contribute to the success of the projects.</blockquote><ol><li><strong>Collaboration</strong>: Software development is a team effort. Developers need to work closely with other developers, designers, project managers, and stakeholders to create software that meets the needs of the business or end-users. Good communication skills enable developers to work more effectively with others, share ideas, and provide feedback in a constructive and respectful manner. When you start understand what your collegue says and transfer what is in your mind, working to together becomes fun and you will make your tasks done quickly.</li><li><strong>Understanding requirements</strong>: To build effective software, we need a clear understanding of the requirements. Communication skills are essential to gather and clarify requirements from stakeholders, ask questions to ensure that all details are captured, and make sure that everyone is on the same page. This is crucial because we are the ones who will create the page, component, function or whatever we are working on. To not to spend more time on doing the task or starting zero for every time listen carefully, put more time to understand whats required and ask every detail.</li><li>Technical documentation: Technical documentation is a critical part of the software development process. Developers need to be able to write clear, concise, and accurate technical documentation to ensure that other developers, testers, and future maintainers can understand how the software works. Ah-a I wish you all do not skip this part and if you did you are missing so much. <strong>Let me give you a quick tip; </strong>there is a big difference between 1 and 2 beacause requirements changed for multiple person. For example you need a source control manager like github to maintain the code but you could do that without it if you are solo developer. Then there is bigger difference between 2 and 5. People come and go, you came and you could go anytime and the project is getting bigger and bigger. Adapting new comers to project is easy if you have good documentation and also it is easy to comeback to older part of the or you never touch. Write comments, add jira task ids, create wikis etc.<strong> Do not skip this part!</strong></li><li><strong>Client communication</strong>: In many cases, we developers work directly with clients. Good communication skills are essential to understand the client’s needs, explain technical concepts in plain language, and provide updates on progress or any issues that arise. Because our clients or your clients do not understand any technical words. When you say “cloud” they think Dropbox not AWS or Google Cloud. Express yourself as much as plain english to others.</li><li><strong>Conflict resolution</strong>: Conflicts can arise in any project, and good communication skills are essential to resolve them in a constructive and respectful manner. By listening to different viewpoints, providing feedback, and finding common ground, developers can ensure that conflicts are resolved quickly and effectively.</li></ol><p>In summary, good communication skills are essential for software developers to work effectively with others, understand requirements, write technical documentation, communicate with clients, and resolve conflicts. By developing strong communication skills, developers can improve their effectiveness and contribute to the success of their projects.</p><p>Thank you all for reading, from Istanbul with love…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=557dfee9bf36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Key Things To Have To Be A Good Sofware Engineer]]></title>
            <link>https://yatkineren.medium.com/key-things-to-have-to-be-a-good-sofware-engineer-96bffc1e1b1b?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/96bffc1e1b1b</guid>
            <category><![CDATA[senior-software-engineer]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[personal-growth]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Mon, 06 Mar 2023 07:54:59 GMT</pubDate>
            <atom:updated>2023-03-06T07:56:43.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5MCHZaZrVXTH46e5TEKNbA.jpeg" /><figcaption>Image by studio4rton Freepik</figcaption></figure><p>Long time no see folks, but I was quite busy. I changed job and tried to create micro start up. You know these things takes a lot of time but here we are with another post. In this post I listed 7 key skills to become a good software engineer. Most important ones are flagged and you cloud read them carefully. Shall we start?</p><blockquote><em>TL;DR: To become a good software engineer, you need to develop strong programming skills, pay attention to detail, be creative, have good communication skills, continuously learn, manage your time effectively, and collaborate well with others. These skills and qualities will help you excel in your career and create software that meets the needs of your clients and users.</em></blockquote><p>In today’s digital age, software engineering has become a critical skill for businesses and organizations across all industries. As a software engineer, you are responsible for designing, developing, and maintaining software applications that power our modern world. To become a good software engineer, you need to develop a specific set of skills and qualities that will help you excel in your career. Here are the seven key things to become a good software engineer:</p><ol><li><strong>Strong programming skills</strong></li></ol><p>The cornerstone of software engineering is programming. You should have a strong grasp of programming concepts, data structures, algorithms, and problem-solving skills. You should also be proficient in at least one programming language, such as Java, Python, or JavaScript.</p><p>2. <strong>Attention to detail</strong></p><p>As a software engineer, you need to pay close attention to detail. Writing software requires accuracy and correctness, and even a small error in your code can cause significant problems. You should be diligent in checking your work for accuracy and correctness.</p><p>3. <strong>Creativity</strong></p><p>Software engineering often requires creative solutions to complex problems. You should be able to think outside the box and come up with innovative solutions to challenging problems. Creativity will help you design and implement software that meets the needs of your clients and users.</p><p>4. <strong>Good communication skills *</strong></p><p>Software engineering is often a team effort, and good communication skills are essential. You should be able to communicate effectively with your colleagues, stakeholders, and clients. You should also be able to explain technical concepts in a way that is understandable to non-technical people.</p><p>5. <strong>Continuous learning</strong></p><p>Technology is constantly evolving, and as a software engineer, you need to keep up with the latest developments in your field. Continuous learning is essential to stay current and remain relevant in the industry. You should be open to learning new programming languages, frameworks, and tools.</p><p>6. <strong>Time management *</strong></p><p>As a software engineer, you will often be working on multiple projects simultaneously. Effective time management skills are crucial to ensure that you meet your deadlines and deliver quality work. You should be able to prioritize your work and manage your time effectively.</p><p>7. <strong>Collaboration *</strong></p><p>Software engineering is often a collaborative effort, and you should be able to work well with others in a team setting. You should be open to feedback and able to contribute to a team’s success. Collaboration will help you create software that meets the needs of your clients and users.</p><p>In conclusion, becoming a good software engineer requires a combination of technical skills, creativity, communication skills, continuous learning, time management, and collaboration. By developing these skills and qualities, you can become a successful software engineer and excel in your career.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96bffc1e1b1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Properly Use AWS To Develop Locally]]></title>
            <link>https://codeburst.io/properly-use-aws-to-develop-locally-4205d148ef5?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/4205d148ef5</guid>
            <category><![CDATA[aws-local-development]]></category>
            <category><![CDATA[localstack]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Tue, 28 Dec 2021 10:41:10 GMT</pubDate>
            <atom:updated>2022-09-13T20:53:14.598Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9MFQUNXa7ehN1YIHs_3I7w.jpeg" /></figure><p>Hi internet.</p><p>The header says it all. Today I will do my best to explain my current discovery. I know I know, some of you already know that but I also do know that there are a lot of developers who are using real AWS products for test and local development purposes. So let’ s start!</p><h3>Localstack</h3><p>is a fully functional local cloud stack, in short we can call it local aws. Localstack provides mock AWS products to do tests or local development with ease. From now on you do not have to constantly ask for permission to create simple S3 bucket.</p><p><a href="http://localstack.cloud/">Localstack</a> says and it is true!</p><blockquote>Yes, that’s true — you can run your Lambda functions, store data to DynamoDB tables, feed events through Kinesis streams, put your application behind an API Gateway, and much more. And all this happens on your local machine, without ever talking to the cloud.</blockquote><p>Localstack provides three version of their product. As a developer using free tier covers most of the stack. I’ m a simple developer and I did not use more than five services. You can check the table for more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VhhLEQxezNvMB6AhZsd7MA.png" /></figure><p>I will not share the prices because they could change in the future. Instead, check yourself — &gt; <a href="https://localstack.cloud/pricing/">pricing</a></p><p>Localstack docs are saying that there are three possible ways to run Localstack and we are going to use the Docker way today.</p><p>You can check the other ways by going — &gt; <a href="https://docs.localstack.cloud/get-started/">Get Started</a></p><p><a href="https://faun.pub/the-best-docker-introduction-8b518b6f0b05"><strong>Docker Introduction — Another one | by Eren Yatkin | FAUN Publication</strong></a></p><pre>docker run --rm -it -p 4566:4566 -p 4571:4571 localstack/localstack</pre><p>Yes! As you can see so simple to run AWS locally. By this command you will run all the services. If you just want to use S3 for example or both Dynamodb and S3 you can pass environment variables to specify which services you want to run.</p><pre>-e &quot;Services=s3,dynamodb&quot;</pre><p>Now, let’ s look at the Docker Compose configuration and then we will configure it all.</p><p><strong>Example:</strong></p><pre>version<strong>:</strong> <strong>&quot;</strong>3<strong>&quot;<br></strong>services<strong>:<br>  </strong>localstack<strong>:<br>    </strong>container_name<strong>:</strong> localstack<br>    platform<strong>:</strong> linux/arm64<br>    image<strong>:</strong> localstack/localstack<br>    ports<strong>:<br>      -</strong> <strong>&quot;</strong>127.0.0.1:53:53<strong>&quot;<br>      -</strong> <strong>&quot;</strong>127.0.0.1:53:53/udp<strong>&quot;<br>      -</strong> <strong>&quot;</strong>127.0.0.1:443:443<strong>&quot;<br>      -</strong> <strong>&quot;</strong>127.0.0.1:4566:4566<strong>&quot;<br>      -</strong> <strong>&quot;</strong>127.0.0.1:4571:4571<strong>&quot;<br>   </strong>environment<strong>:<br>      -</strong> SERVICES=s3<br>      <strong>-</strong> DEBUG=1<br>      <strong>-</strong> DATA_DIR=/tmp/localstack/data<br>      <strong>-</strong> DOCKER_HOST=unix:///var/run/docker.sock<br>      <strong>-</strong> AWS_AWS_ACCESS_KEY_ID=test<br>      <strong>-</strong> AWS_AWS_SECRET_ACCESS_KEY=test<br>   networks<strong>:<br>      -</strong> my-nw<br>   volumes<strong>:<br>      -</strong> <strong>&quot;</strong>./.localstack:/tmp/localstack<strong>&quot;<br>      -</strong> <strong>&quot;</strong>/var/run/docker.sock:/var/run/docker.sock<strong>&quot;<br></strong>networks<strong>:<br>   </strong>my-nw<strong>:</strong></pre><p>I will not explain all the commands because our main focus is not Docker itself. Istead I will explain the odd things.</p><p>First of all if you are using M1 Macs you should specify the</p><p>platform: linux/arm64</p><p>In evironment we passed SERVICES=s3 as I said before default configuration will run all of the mock AWS products provided by Localstack and that can be power hungry. Instead we specified what we need.</p><p><strong>Now let’s configure the AWS-CLI</strong></p><ul><li>Go to the <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-version.html">AWS-CLI</a> and download the aws-cli for your OS.</li><li>Go to the <a href="https://www.python.org/downloads/">Python</a> and download the latest stable version of Python3.</li><li>After the installations done let’s be sure.</li><li>python3 — version → 3.x.x</li><li>aws — version → aws-cli 2.x</li><li>Now we should install awslocal , run the command below.</li></ul><pre>pip install awscli-local</pre><ul><li>Let’ s be sure awslocal — version → aws-cli 2.x</li></ul><p><strong>Now we will specify the Access keys and regions.</strong></p><pre>aws configure</pre><pre>---------------------<br>     AWS Access Key ID:<br>     AWS Secret Access Key:<br>     Default Region Name:<br>----------------------</pre><p>The three value is important and the rest can be default. Enter theese by your preferences I simply add test for all the values except region. The region I speficied was eu-central-1 .</p><p><strong>Now let’ s try localstack services.</strong></p><p>Run awslocal s3api create-bucket --bucket my-bucket to create a bucket named my-bucket</p><pre>{<br>    &quot;Location&quot;: &quot;/my-bucket&quot;<br>}</pre><p>If you see this, you created a bucket locally!</p><p>As you can see we can use all of them locally. From now on you won’ t be asking permissions to create buckets, tables, CI/CD pipelines or EC2s.</p><p><strong>Thank you all for reading and supporting.</strong></p><p><strong>You can follow me </strong><a href="https://twitter.com/_developr"><strong>Eren (@_developr) / Twitter</strong></a></p><h3>Tips</h3><p>** Do not forget to add theese two options when deal with aws-sdk in any programming language for <strong>S3</strong>.</p><pre>s3Options<strong>.</strong>endpoint = &#39;http://host.docker.internal:4566&#39;<strong><br></strong>s3Options<strong>.</strong>s3ForcePathStyle = <strong><em>true</em>;</strong></pre><pre><strong>-</strong> SERVICES=s3</pre><pre><strong>-</strong> DEBUG=1</pre><pre><strong>-</strong> DATA_DIR=/tmp/localstack/data</pre><pre><strong>-</strong> DOCKER_HOST=unix:///var/run/docker.sock</pre><pre><strong>-</strong> AWS_AWS_ACCESS_KEY_ID=test</pre><pre><strong>-</strong> AWS_AWS_SECRET_ACCESS_KEY=test</pre><pre>networks<strong>:</strong></pre><pre><strong>-</strong> my-nw</pre><pre>volumes<strong>:</strong></pre><pre><strong>-</strong> <strong>&quot;</strong>./.localstack:/tmp/localstack<strong>&quot;</strong></pre><pre><strong>-</strong> <strong>&quot;</strong>/var/run/docker.sock:/var/run/docker.sock<strong>&quot;</strong></pre><pre>networks<strong>:</strong></pre><pre>my-nw<strong>:</strong></pre><p>Now, let’ s look at the Docker Compose configuration and then we will configure it all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4205d148ef5" width="1" height="1" alt=""><hr><p><a href="https://codeburst.io/properly-use-aws-to-develop-locally-4205d148ef5">Properly Use AWS To Develop Locally</a> was originally published in <a href="https://codeburst.io/">codeburst</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Proper Way To Send Email — NodeJs & AWS]]></title>
            <link>https://yatkineren.medium.com/the-proper-way-to-send-email-nodejs-aws-c04f0a44c0e4?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/c04f0a44c0e4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[nodemailer]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[email-marketing]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Thu, 04 Feb 2021 08:34:31 GMT</pubDate>
            <atom:updated>2021-02-04T08:34:31.379Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Proper Way To Send Email — NodeJs &amp; AWS</h3><p>Hi internet, I hope you are having a wonderful day. Today is a beautiful day in Istanbul. Sun is up and brightens our hearts. Lately I have been stopped to being productive because current lockdown affected me in the worst way.</p><p>But today all of a sudden, sun dropped the will of helping others into my heart again and I decided to write about recent feature that I added into <a href="https://github.com/ErenYatkin/microservice-base">the boilerplate</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pCYdO9y2Ki3M1g0WVv3YwA.jpeg" /><figcaption><a href="https://www.freepik.com/free-photo/email-network-communication-perforated-paper-letter_3216861.htm">https://www.freepik.com/free-photo/email-network-communication-perforated-paper-letter_3216861.htm</a></figcaption></figure><p><a href="http://astronied.com/"><strong>Astronied.com The Gamification API</strong></a><strong> uses the boilerplate to provide seamless service and would be appreciated if you support it!</strong></p><p>At some point we are all encounter that the same problem which is sending e-mail. There tons of 3rd party tools that does this for you but today we are going to implement our solution.</p><h3><strong>Let’s see what we need!</strong></h3><ul><li>AWS Account</li><li>NodeJs 12.0.0^</li><li>E-mail Account</li><li>Nodemailer</li><li>Aws-Sdk</li></ul><p>If you have prepared everything above, we can start right away!</p><p><strong>Do not forget to join my journey and follow me on;</strong></p><p><a href="https://www.twitch.tv/decodedae"><strong>Twitch</strong></a><strong> — Solo entrepreneur, building Astronied.com</strong></p><p><a href="https://twitter.com/decodedAE"><strong>Twitter</strong></a><strong> — Solo entrepreneur, building Astronied.com</strong></p><p>First thing is first; let’s create a NodeJs application. If you pass -y Npm will skip the form things and create package.json for us.</p><p>npm init -y</p><p>Then we need to install packages. Do not forget to pass --save otherwise packages will not be saved in package.json</p><p>npm install --save nodemailer aws-sdk</p><p>Let’s create a file called mailer.js and add some basics like below.</p><p>touch mailer.js</p><pre>const awsSdk = require(&#39;aws-sdk&#39;);<br>const nodeMailer = require(&#39;nodemailer&#39;);</pre><pre>let mailClient;</pre><pre>module.exports.init = () =&gt; {};<br>module.exports.getClient = () =&gt; {};</pre><p>Okay, init() will there to help us to create an nodemailer instance and getClient() will help us to use that instance whenever we want.</p><p>With this design I would like to use different providers or platforms to send e-mails. I have Yandex Enterprise and AWS SeS. Dynamically switching back and froth between them would be really nice feature. To do so;</p><p>I have created two function to create an nodemailer instance with different options. initMailer() will create a SMTP transport with given server configuration and initSes() will create a AWS SeS transport, therefore we updated the configuration and created an SeS() instance via Aws-Sdk then pass it to the Nodemailer.</p><pre>function initSes() {</pre><pre>    awsSdk.config.update({<br>        accessKeyId: &#39;**************&#39;,                   <br>        secretAccessKey: &#39;************&#39;,        <br>        region: &#39;***************&#39;,<br>        ses: {<br>            apiVersion: &#39;2010-12-01&#39;,<br>        },<br>    });</pre><pre>    mailClient = nodeMailer.createTransport({<br>        ses: new awsSdk.SES(),<br>    });</pre><pre>}</pre><pre>function initMailer() {</pre><pre>    mailClient = nodeMailer.createTransport({<br>        host: &#39;smtp.yandex.ru&#39;,<br>        port: 465,<br>        auth: {<br>            user: &#39;************&#39;,<br>            pass: &#39;**************&#39;,<br>        },<br>        dkim: {<br>            domainName: &quot;example.com&quot;,<br>            keySelector: &quot;2017&quot;,<br>            privateKey: &quot;***************&quot;,<br>        },<br>        tls: {<br>            // do not fail on invalid certs<br>            rejectUnauthorized: false,<br>        },</pre><pre>    });<br>}</pre><pre><br>module.exports.init = () =&gt; {<br>    if (process.env.USE_SES) {<br>        initSes();<br>    } else {<br>        initMailer();    <br>    }<br>};</pre><p>Well here we have fully working e-mail client for our backend project. Simple steps to take but creates strong foundation.</p><p>Let’s make sure it’ s working properly.</p><p>touch index.js</p><pre>const { getClient } = require(&#39;./mailer&#39;);</pre><pre>module.exports.sendEmail = ({ subject, emailBody, receiver }) =&gt; mailerLoader.getClient()<br>.sendMail({<br>    from: `&quot;Boilerplate 🚀&quot; &lt;${example@mail.com}&gt;`,<br>    to: receiver,<br>    subject,<br>    // html: emailBody,<br>    // text: emailBody,</pre><pre>});</pre><p>As you see we can send create content like HTML or plain text and send them via e-mail from our backend.</p><h3><strong>So we reach to the end and to sum up.</strong></h3><p>This configuration opens up plenty of use cases, you can switch between transports or you can use both of them at the same time. Well of course you can always add new transports and easily send e-mails.</p><p>If you have any questions or recommendations let me know in the comments. Your feedbacks are so important and priceless so feel free to share!</p><h3>Bonus</h3><p>I would like to add a nice to have for our use! You can easily verify the intance with the configuration you provided. Just call the verify and see what’s going on.</p><pre>mailClient.verify((error, success) =&gt; {<br>        if (error) {<br>            logger.error(&#39;SMTP Mail transport is failed&#39;, {<br> error });<br>        } else {<br>            logger.info(&#39;SMTP Mail transport is verified&#39;, { success });<br>        }<br>    });</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c04f0a44c0e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Publish Your Startup Cheap — Nginx]]></title>
            <link>https://yatkineren.medium.com/publish-your-startup-cheap-nginx-cdd2904f0d43?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdd2904f0d43</guid>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[lets-encrypt]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 11:51:38 GMT</pubDate>
            <atom:updated>2021-01-19T18:42:57.291Z</atom:updated>
            <content:encoded><![CDATA[<h3>Publish Your Startup Cheap — Nginx</h3><p>Hello folks, couple of days ago I published my portfolio online. During that time I realised that guides out there are outdated. So I decided to create one for myself and thought sharing with you would be nice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*U3MVjuBS8Rod31d1jpYrww.png" /></figure><p>So let’s get you up and running!</p><p>You can follow me on <a href="https://twitter.com/erenyatkin">Twitter </a>and <a href="https://www.linkedin.com/in/ahmet-eren-yatk%C4%B1n-a52bba119/">Linkedin</a> for more content like this.</p><h3>What are we going to do?</h3><p>Well, we will install Nginx on a Ubuntu 20.04 server then configure it. Also will secure our web site by using Letsencrypt. Now we need;</p><ul><li>Ubuntu 20.04 Server, I rented one from <a href="https://m.do.co/c/4eca5475a4e8">Digital Ocean</a> they offer free credits, also you can find tons of coupon codes online to minimize your costs,</li><li>A domain,</li><li>Visual Studio Code, we will use it to connect remotely our server but you need to install <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh">SSH Extension</a>.</li></ul><p>So if you have all of the above,</p><h3>Let’ start</h3><p>Connect to the remote server</p><pre># if you have pem or any certificate<br>ssh -i &quot;pathOfCert.pem&quot; user@xx.xx.xx</pre><pre># if you have credentials<br>ssh user@xx.xx.xx</pre><p>Update the package installer and install Nginx</p><pre>sudo apt-get update &amp;&amp; sudo apt-get install nginx</pre><p>Create a directory in the following path and move your website files into</p><pre># change erenyatkin.com with your domain<br>/var/www/erenyatkin.com</pre><h3>Configuring Nginx</h3><p>etc/nginx/sites-available contains individual configuration files for all of your possible websites. You can create configuration files for static websites and applications.</p><p>etc/nginx/sites-enabled contains links to the configuration files that NGINX will actually read and run.</p><p>Create a file called your plain domain such as erenyatkin.com in sites-available and add the following configuration.</p><pre>server {   <br>  listen 80;   <br>  listen [::]:80;   <br>  root /var/www/erenyatkin.com;   <br>  index index.html;   <br>  server_name erenyatkin.com www.erenyatkin.com;   <br>  location / {     <br>    try_files $uri $uri/ =404;   <br>  } <br>}</pre><p>Then we need to link that configuration file to sites-enabled so NGINX can enable it and serve.</p><pre>ln -s /etc/nginx/sites-available/erenyatkin.com /etc/nginx/sites-enabled/erenyatkin.com</pre><p>After all that, NGINX needs to be restarted so it can apply changes and new configurations. To do that;</p><pre>sudo systemctl restart nginx</pre><p>If it restarted without an error that means everything is Ok. Next step is to make our website secure with free tools which is Letsencrypt.</p><p>So let’s give it a shot;</p><h3>Securing The Website</h3><p>First thing first, we need to remove anything related to Certbot and install a clean copy of it.</p><pre>sudo apt-add-repository -r ppa:certbot/certbot<br>sudo apt-get remove certbot</pre><pre>sudo apt-get install software-properties-common<br></pre><p>Install snapd to install certbot</p><pre># Install sanpd for certbot<br>sudo apt install snapd <br>sudo snap install hello-world # to test the snap<br># Install certbot <br>sudo snap install --classic certbot</pre><p>Install the script which works with nginx (python-certbot-nginx is removed use below instead)</p><pre>sudo apt-get install python3-certbot-nginx</pre><p>Let’s create a certification. Run the following command, it will ask you to choose for which names you would like to enable HTTPS. Press Enter to select them all</p><pre>sudo certbot --nginx certonly<br>--------------------------------------------------------------------Saving debug log to /var/log/letsencrypt/letsencrypt.log <br>Plugins selected: Authenticator nginx, Installer nginx  <br>Which names would you like to activate HTTPS for? </pre><pre>1: erenyatkin.com <br>2: <a href="http://www.erenyatkin.com/">www.erenyatkin.com</a><br><br>Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter &#39;c&#39; to cancel)</pre><p>So, we are almost done. We need to add one more thing. We created ourselves a SSL and we need to tell NGINX to use it. Let’s go back and change the configuration file in sites-available and new configuration should look like below. Do not forget to change erenyatkin.com with your own domain.</p><pre>server {   <br>  listen 443;<br>  listen [::]:443;<br>  ssl on;<br>  ssl_certificate /etc/letsencrypt/live/erenyatkin.com/fullchain.pem;   ssl_certificate_key /etc/letsencrypt/live/erenyatkin.com/privkey.pem;<br>  root /var/www/erenyatkin.com;<br>  index index.html;<br>  server_name erenyatkin.com <a href="http://www.erenyatkin.com;/">www.erenyatkin.com;</a><br>  location / {<br>    try_files $uri $uri/ =404;<br>  }<br>}<br>server {<br>   listen 0.0.0.0:80;<br>   server_name erenyatkin.com <a href="http://www.erenyatkin.com;/">www.erenyatkin.com;</a><br>   rewrite ^ https://$host$request_uri? permanent;<br>}</pre><p>Restart NGINX again.</p><pre>sudo systemctl restart nginx</pre><p>Let’s check that out,</p><p><a href="https://erenyatkin.com/">Eren Yatkin — Fullstack Software Developer</a></p><h3>The End</h3><p>So we reach to the end. Now we can publish our portfolios, startups, chatbots with SSL. Even we can install Redis or MongoDb in this server. If you encounter any problem you can ask me in the comments. Also if you have any questions or recommendations do not hesitate to share. Like if you liked it and share if you loved it. I wish you all a nice day.</p><h3>Bonus</h3><p>The SSL Certificate will expire after a while, so you need to re-create it. Create a cron job to do it for you. That way it can be renewed automatically.</p><p>Edit the crontab and create a CRON job to run the renewal command:</p><pre>sudo crontab -e</pre><p>Add the following line:</p><pre>17 7 * * * certbot renew --post-hook &quot;systemctl reload nginx&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdd2904f0d43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Log Like A Boss With Node.js]]></title>
            <link>https://javascript.plainenglish.io/log-like-a-boss-nodejs-a10f57a8e3fc?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/a10f57a8e3fc</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Thu, 12 Nov 2020 06:00:16 GMT</pubDate>
            <atom:updated>2020-11-12T10:00:37.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cALRwr7nBjGsuj5d5_6jsA.jpeg" /><figcaption>Credits <a href="https://www.baileyjavinscarter.com/wp-content/uploads/2019/08/logging-accident-1030x429.jpg">https://www.baileyjavinscarter.com/wp-content/uploads/2019/08/logging-accident-1030x429.jpg</a></figcaption></figure><p>Last couple weeks were tough for me. The reason behind the challenging and long working hours for weeks was launching the new version of a backend which had been developed for seven years. From day to day until this September, the codebase got bigger and bigger with every new features and their bug fixes. I joined this journey at July 2019 and put so much effort with my colleagues.</p><p>First, we split the application into two logical partition. One for customers and one for service providers. Then we decided to start this overhauling on “service providers” because business logic were heavy at this side. Then we split the codebase into microservices. More pressure, more things to ignore.</p><p>When they put more pressure C-level decided to ignore things. At the end of the day we had a monolithic backend with some of the features and bunch of microservices. As you can imagine things became complicated. But we had one thing to hold on to! That was our logging strategy. We logged every step. When a bug occurred, we just opened up CloudWatch logs and queried, believe me after five minutes or little less, the problem was right in your eyes.</p><h3>How we did it</h3><p>We are using Node.js as backend. When it comes to logging we have plenty options. They are all good but one of them is a masterpiece and that is Winston. I love Winston because it is easily configurable and community is good. It has nice documentation. You can log wherever you want with the transporters. Also you can create your custom transport. You can configure Winston individually for all the log levels from where and how to log.</p><p>But the best practice is decoupling data source from the code. We configured Winston to log nicely to console and we grabbed the whole outs with fluentd then populated the CloudWatch.</p><p>CloudWatch Log Insights is not a budget friendly service at all but it enables you to interactively search and analyze your log data. You can perform queries to help you more efficiently and effectively respond to operational issues. Queries can be saved and used to create a dashboard for your needs.</p><h3>What do we need?</h3><ul><li>NodeJs^ 10.xx.x</li><li>Code editor, I choose VS Code,</li><li>One Dark, perfect theme, I choose One Dark, why not ?</li><li>Fluentd</li></ul><p>I added Fluentd as a requirement but I will not cover how to install it or run it. Docs on AWS about FluentD and logging to CloudWatch is very good. Please follow <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-setup-logs.html">this link for fluentd</a>.</p><h3>Let’s begin!</h3><p>First, we need to create Node.js project and install the packages.</p><pre>mkdir winston-logger &amp;&amp; cd winston-logger <br>npm init -y #this will skip prompts<br>npm install --save winston winston-cloudwatch winston-slack-webhook-transport <br>touch logger.js<br>touch index.js</pre><p>We are ready to log! Winston provides levelled logs such as error, verbose, silly, info, debug. You can configure Winston individually for all the log levels from where and how to log. I just simply used info for test purposes but I will configure levels later on.</p><p><strong>logger.js</strong></p><pre>const winston = require(&#39;winston&#39;);</pre><pre>module.exports = winston;</pre><p><strong>index.js</strong></p><pre>const logger = require(&#39;./logger&#39;);<br>logger.info(&#39;Test Log&#39;, {});</pre><p>If you run with node index.js you will get:</p><pre>[winston] Attempt to write logs with no transports {&quot;message&quot;:&quot;Test Log&quot;,&quot;level&quot;:&quot;info&quot;}</pre><p>Because we have not configured it. I added a variable called logger and created an instance. By default, Winston can log data into <strong>Console, File, Http</strong>. I choose <strong>File </strong>for now and will look into other transport options later on. You need to provide log level and file name. Verbose logging will log every level. If you want to log specific level, change the level to info, error or warn.</p><p><strong>logger.js</strong></p><pre>const winston = require(&#39;winston&#39;);</pre><pre>const logger = winston.createLogger({<br>        new winston.transports.File({ level: &#39;verbose&#39;, filename: &#39;log.out&#39; }),<br>    ],<br>});</pre><pre>module.exports = logger;</pre><p>Let’s run our application. As you can see, there is a file called <strong>log.out</strong> in our project directory. Well we did it.</p><p><strong>log.out</strong></p><pre>{&quot;message&quot;: &quot;Test Log&quot;,&quot;level&quot;: &quot;info&quot;}</pre><p>Let’s make it more readable with just providing format. Also I added transport strategies for different log levels. As you can see, from now on we will log everything into console but only errors into file.</p><p><strong>logger.js</strong></p><pre>const winston = require(&#39;winston&#39;);</pre><pre>const logger = winston.createLogger({<br>    format: winston.format.printf((info) =&gt; JSON.stringify(info, null, 2)),<br>    transports: [<br>        new winston.transports.File({ level: &#39;error&#39;, filename: &#39;log.out&#39; }),<br>        new winston.transports.Console({ level: &#39;verbose&#39; }),<br>    ],<br>});</pre><pre>module.exports = logger;</pre><p>Let’s run it, just as I said right? Now, I will add some default values and combine formats.</p><p><strong>logger.js</strong></p><pre>const winston = require(&#39;winston&#39;);</pre><pre>const logger = winston.createLogger({<br>    format: winston.format.combine(<br>        winston.format.timestamp({<br>            format: &#39;YYYY-MM-DD HH:mm:ss&#39;,<br>        }),<br>        winston.format.printf((info) =&gt; {<br>            let logData = { ...info };</pre><pre>            if (info.error instanceof Error) {<br>                logData.error = {<br>                    message: info.error.message,<br>                    stack: info.error.stack,<br>                };<br>            }</pre><pre>            return JSON.stringify(logData, null, 2);<br>        }),<br>    ),<br>    transports: [<br>        new winston.transports.File({ level: &#39;error&#39;, filename: &#39;log.out&#39; }),<br>        new winston.transports.Console({ level: &#39;verbose&#39; }),<br>    ],<br>});</pre><pre>module.exports = logger;</pre><p><strong>index.js</strong></p><pre>const logger = require(&#39;./logger&#39;);<br>logger.info(&#39;Test Log info&#39;, { error: new Error(&#39;test&#39;) });</pre><p>Let’s break it down, I combined the formats together using winston.format.combine. This functions take format options as arguments, you can use default functions such as <strong>timestamp(), printf(), simple(), colorize()</strong>. We can pass optional object to log but passing an Error will be empty. Because Error object doesn’t have its enumerable properties, that’s why it prints an empty object.</p><p>So, I checked the parameter type and changed it with stack of the error. When you run the code, output will be like below.</p><pre>{<br>  &quot;error&quot;: {<br>    &quot;message&quot;: &quot;test&quot;,<br>    &quot;stack&quot;: &quot;Error: test\\n    at Object.&lt;anonymous&gt; (C:\\\\Users\\\\Eren\\\\Desktop\\\\winston-logger\\\\index.js:114:39)\\n    at Module._compile (internal/modules/cjs/loader.js:1137:30)\\n   <br> at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)\\n    at Module.load (internal/modules/cjs/loader.js:985:32)\\n    at Function.Module._load (internal/modules/cjs/loader.js:878:14)\\n    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)\\n    at internal/main/run_main_module.js:17:47&quot;<br>  },<br>  &quot;level&quot;: &quot;info&quot;,<br>  &quot;message&quot;: &quot;Test Log info&quot;,<br>  &quot;timestamp&quot;: &quot;2020-11-10 23:03:29&quot;<br>}</pre><p><strong>Bonus</strong></p><p>Also the final version of the<strong> logger.js</strong>. Do not forget to provide the keys for Slack and CloudWatch.</p><p><strong>logger.js</strong></p><pre>const winston = require(&#39;winston&#39;);<br>const SlackHook = require(&#39;winston-slack-webhook-transport&#39;);<br>const WinstonCloudWatch = require(&#39;winston-cloudwatch&#39;);</pre><pre>const logger = winston.createLogger({<br>    format: winston.format.combine(<br>        winston.format.timestamp({<br>            format: &#39;YYYY-MM-DD HH:mm:ss&#39;,<br>        }),<br>        winston.format.printf((info) =&gt; {<br>            let logData = { ...info };</pre><pre>            if (info.error instanceof Error) {<br>                logData.error = {<br>                    message: info.error.message,<br>                    stack: info.error.stack,<br>                };<br>            }</pre><pre>            return JSON.stringify(logData, null, 2);<br>        }),<br>    ),<br>    transports: [<br>        new winston.transports.File({ level: &#39;error&#39;, filename: &#39;log.out&#39; }),<br>        new winston.transports.Console({ level: &#39;verbose&#39; }),<br>    ],<br>});</pre><pre>logger.add(<br>    new SlackHook({<br>        webhookUrl: &#39;SLACK.WEBHOOK_URL&#39;,<br>        channel: &#39;#SLACK.CHANNEL&#39;,<br>        username: &#39;SLACK.USERNAME&#39;,<br>        iconEmoji: &#39;:warning:&#39;,<br>        formatter: (info) =&gt; ({<br>            text: `_${info.timestamp}_\\n*${info.level.toUpperCase()}:*\\n&gt;${info.message}`,<br>            attachments: [<br>                {<br>                    text: `\\`\\`\\`${JSON.stringify(logData, null, 2)}\\`\\`\\``,<br>                },<br>            ],<br>        }),<br>        level: &#39;error&#39;,<br>    }),<br>);</pre><pre>logger.add(<br>    new WinstonCloudWatch({<br>        logGroupName: &#39;CLOUD_WATCH_LOG_GROUP&#39;,<br>        logStreamName: &#39;CLOUD_WATCH_STREAM_NAME&#39;,<br>        level: &#39;verbose&#39;,<br>        messageFormatter: (info) =&gt; JSON.stringify(logData, null, 2),<br>    }),<br>);</pre><pre>module.exports = logger;</pre><p>So we reached at the end, you can now log like a boss. Having ability to log is always good when it comes to hunting bug. I hope this configuration helps you. Let me know if you have any questions or recommendations in the comments. You can follow me for more contents like this.</p><p><strong>Stay tuned!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a10f57a8e3fc" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/log-like-a-boss-nodejs-a10f57a8e3fc">How To Log Like A Boss With Node.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Proper Way To Connect Redis and Node.js]]></title>
            <link>https://javascript.plainenglish.io/proper-way-to-connect-redis-nodejs-80023fb033db?source=rss-e31dd5463c11------2</link>
            <guid isPermaLink="false">https://medium.com/p/80023fb033db</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[Eren Yatkin]]></dc:creator>
            <pubDate>Mon, 19 Oct 2020 19:30:11 GMT</pubDate>
            <atom:updated>2022-04-12T12:55:54.982Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Proper Way To Connect Redis — Node.js</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*RvO-Dixmbq49R6BP-Retlg.png" /></figure><p>Are your clients seeing loading screens for long time? You did everything right but are you still getting high response times and even timeouts? Do you want your app 10x, 100x, 10000x faster? Redis is here to solve all your problems.</p><p>This reminds me 90s tv ads. Anyway, all the things I asked above are real questions. If you want your application to be fast, adding a in memory cache solution can fit your needs. There a lot of options to choose, for example you can use In-memory MongoDb, Ignite, Redis, Mem-cache etc. all these technologies built to make your application fast.</p><p>I use Redis &amp; MongoDb combination in NodeJs all the time but this article is not aiming to navigate you to find perfect caching strategy. That’s another topic by itself.</p><h3>What is Redis?</h3><p>Redis is a key-value data structure store, used as database, cache and message broker. Redis comes from Remote Dictionary Server. It uses ram to store the data, therefore it serves data blazingly fast. Also it supports cluster, streams, TTL, geographical query, pub/ sub and much more. Find more about Redis <a href="https://redis.io/">checkout this link</a>.</p><p>Okay let’s move on, we need to setup our environment,</p><h3>What do we need?</h3><ul><li>NodeJs LTS — 10^</li><li>Redis Server</li><li>Docker</li><li>Visual Studio Code</li></ul><h3>Getting Ready To Start</h3><p>At this point we need to install the dependencies. First I will install Redis on my machine, by the way we have plenty options to choose but we are developers right? Let’s run install it with Docker</p><p>Also, I wrote about introduction to Docker, you can always have a look if you want by <a href="https://medium.com/faun/the-best-docker-introduction-8b518b6f0b05">clicking this link</a>.</p><p>If you have already installed Docker, just execute command below to run a Redis server instance.</p><pre>docker run -d  --name redis_srv -p 6379:6379 redis</pre><p>If you do not want to install Docker, we can simply use Redis Labs. Open <a href="https://redislabs.com/try-free/">this link</a> to create an account.</p><h3>Alright, we are ready to go!</h3><p>Follow these steps to create an environment:</p><ul><li>Create an empty folder to work in:</li></ul><pre>mkdir connect-redis&amp;&amp; cd connect-redis</pre><ul><li>Init a Node.js project, -y will skip the form:</li></ul><pre>npm init -y</pre><ul><li>Create <strong>index.js</strong>:</li></ul><pre>touch index.js</pre><ul><li>Edit <strong>package.json</strong> as shown:</li></ul><pre>{<br>  &quot;name&quot;: &quot;connect-redis&quot;,<br>  &quot;version&quot;: &quot;0.0.0&quot;,<br>  &quot;private&quot;: true,<br>  &quot;scripts&quot;: {<br>    &quot;start&quot;: &quot;node index&quot;,<br>  },<br>  &quot;dependencies&quot;: {},<br>  &quot;devDependencies&quot;: {}<br>}</pre><ul><li>Install dependencies:</li></ul><pre>npm install --save redis lodash</pre><ul><li>Open up<strong> index.js</strong>, lets define dependencies and our functions:</li></ul><pre>const redis = require(&#39;redis&#39;);<br>const _ = require(&#39;lodash&#39;);</pre><pre>const clients = {};<br>let connectionTimeout;</pre><pre>module.exports.init = () =&gt; {};</pre><pre>module.exports.getClients = () =&gt; {};</pre><pre>module.exports.closeConnections = () =&gt; {};</pre><p>Well, we defined the functions, let’s fill them up. First we need to create a connection instance. We do this because in the future we may need to make second or third connection to another Redis database. Do not ask why, one Redis is not enough and do not forget to replace connection string with yours!</p><pre>module.exports.init = () =&gt; {<br>    const cacheInstance = redis.createClient(&#39;redis://connection-string&#39;);<br>    clients.cacheInstance = cacheInstance;<br>};</pre><p>We created our Redis connection with Redis package and we saved that connection in an object to import and use later.</p><p>Some events will be fired according to the state of the connection. It’ s better to listen them to take actions. Because this module will manage the entire connection flow. We need to know any interruptions or connection losses.</p><p>Let’s see what these events are:</p><ul><li>Connect: fired after successful connection</li><li>End: fired if the connection drops</li><li>Reconnecting: fired when Redis is trying to connect</li><li>Error: fired when any error occurs</li></ul><p>Now let’s add an event listener, I changed the init() function like below and added the handler. I prefer RO-RO (receive object — return object) approach when developing an NodeJs application. Because it improves your code’s readability.</p><pre>function instanceEventListeners({ conn }) {<br>    conn.on(&#39;connect&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: connected&#39;);<br>    });</pre><pre>    conn.on(&#39;end&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: disconnected&#39;);<br>    });</pre><pre>    conn.on(&#39;reconnecting&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: reconnecting&#39;);<br>    });</pre><pre>    conn.on(&#39;error&#39;, (err) =&gt; {<br>        console.log(&#39;CacheStore - Connection status: error &#39;, { err });<br>    });<br>}</pre><pre>module.exports.init = () =&gt; {<br>    const cacheInstance = redis.createClient(&#39;redis://connection-string&#39;);<br>    clients.cacheInstance = cacheInstance;<br>    instanceEventListeners({ conn: cacheInstance });<br>};</pre><p>Now what? As I said above, we will handle the reconnection procedure by ourselves. Follow the code below, I just simply added a timeout(). In my case I can live with few connection drops. I mean is it ok to lose connection as long as it reconnects in certain amount of time.</p><p>Let’s add that timeout() to see how it goes,</p><pre>function throwTimeoutError() {<br>    connectionTimeout = setTimeout(() =&gt; {<br>        throw new Error(&#39;Redis connection failed&#39;);<br>    }, 10000);<br>}</pre><pre>function instanceEventListeners({ conn }) {<br>    conn.on(&#39;connect&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: connected&#39;);<br>        clearTimeout(connectionTimeout);<br>    });</pre><pre>    conn.on(&#39;end&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: disconnected&#39;);<br>        throwTimeoutError();<br>    });</pre><pre>    conn.on(&#39;reconnecting&#39;, () =&gt; {<br>        console.log(&#39;CacheStore - Connection status: reconnecting&#39;);<br>        clearTimeout(connectionTimeout);<br>    });</pre><pre>    conn.on(&#39;error&#39;, (err) =&gt; {<br>        console.log(&#39;CacheStore - Connection status: error &#39;, { err });<br>        throwTimeoutError();<br>    });<br>}</pre><pre>module.exports.init = () =&gt; {<br>    const cacheInstance = redis.createClient(&#39;redis://connection-string&#39;);<br>    clients.cacheInstance = cacheInstance;<br>    instanceEventListeners({ conn: cacheInstance });<br>};</pre><p>We did it! What we have now? Let’s break it down,</p><ul><li>We defined connectionTimeout null because we want to start the timeout when specific event which is end fired,</li><li>When we get an end event, timeout will start, then Redis will try to reconnect. We will wait until the timeout. setTimeout() will track of the time while Redis tries to connect. If the connection establishes again we need to clear the timeout, because we do not want to throw an error after that. By the way clearTimeout will not affect anything when connectionTimeout set to null or undefined.</li></ul><p>We left some nice to haves, let’s fill them. I would like to manage the flow of closing the connection how I manage the opening. Because if you run your application in Kubernetes shutting down an application gracefully is always the best practice.</p><pre>module.exports.closeConnections = () =&gt; _.forOwn(clients, (conn) =&gt; conn.quit());</pre><ul><li>forOwn() will loop the object keys, and every connection we just simply called quit()</li></ul><p>What about using the connection? Let’s add it and we are done!</p><pre>module.exports.getClients = () =&gt; clients;</pre><p>With piece of function you can import and use the connections you created.</p><h3>Finally</h3><p>We reached the end and created ourselves a beautiful Redis connection handler. This is the most suitable way we found for our microservices.</p><p>Handling the connection state and knowing whats going on will improve the quality of your services. I always welcome your thoughts, if you have any questions or any recommendations let know in the comments.</p><p>For full code checkout this <a href="https://github.com/irnmon/microservice-base/">link</a>,</p><p>For<a href="https://medium.com/faun/the-best-docker-introduction-8b518b6f0b05"> introduction to Docker checkout this link</a>,</p><p>For <a href="https://www.freecodecamp.org/news/elegant-patterns-in-modern-javascript-roro-be01e7669cbd/">Ro-Ro approach checkout this link</a>,</p><p><a href="https://github.com/irnmon/microservice-base/blob/master/lib/loaders/cacheStore.js"><strong>TL;DR;</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80023fb033db" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/proper-way-to-connect-redis-nodejs-80023fb033db">The Proper Way To Connect Redis and Node.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>