<?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 Eason Chai on Medium]]></title>
        <description><![CDATA[Stories by Eason Chai on Medium]]></description>
        <link>https://medium.com/@easonchaijw?source=rss-58d574a5df8a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QJUjiLLyn90t9kKF0mEDeA.jpeg</url>
            <title>Stories by Eason Chai on Medium</title>
            <link>https://medium.com/@easonchaijw?source=rss-58d574a5df8a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 13:26:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@easonchaijw/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[What five years of using AI actually taught me]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://easonchaijw.medium.com/what-five-years-of-using-ai-actually-taught-me-e18a7ff40d1f?source=rss-58d574a5df8a------2"><img src="https://cdn-images-1.medium.com/max/1376/1*9D1BYxmeVMP2dJ0n9WVxTw.png" width="1376"></a></p><p class="medium-feed-snippet">For fifteen years I collected ideas faster than I could build them. About 130 of them piled up across old notebooks, sketches, a Notion&#x2026;</p><p class="medium-feed-link"><a href="https://easonchaijw.medium.com/what-five-years-of-using-ai-actually-taught-me-e18a7ff40d1f?source=rss-58d574a5df8a------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://easonchaijw.medium.com/what-five-years-of-using-ai-actually-taught-me-e18a7ff40d1f?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e18a7ff40d1f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[taste]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[judgement]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 15:31:58 GMT</pubDate>
            <atom:updated>2026-08-06T15:31:58.439Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[A Complete Guide to Hackathons (Abridged)]]></title>
            <link>https://medium.com/buidlbox/a-complete-guide-to-hackathons-abridged-0d5a3d219f4d?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d5a3d219f4d</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[hackathons]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[prizes]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 12:03:14 GMT</pubDate>
            <atom:updated>2024-09-27T12:03:14.624Z</atom:updated>
            <content:encoded><![CDATA[<p>On top of working at <strong>buidlbox</strong> as a DevOps engineer, I also consider myself a hackathon veteran. I have participated in quite a few hackathons, and I’ve won prizes from sponsors like ENS, WalletConnect, Optimism, and Worldcoin. From my experience, hackathons are way more than just a competition — they’re an opportunity to learn, network, and bring new ideas to life.</p><p>I’ve put together some of my top tips for getting the most out of a hackathon, whether it’s your first time or you’re already a hackathon pro. Perhaps you’re ready to jump into coding or maybe you want to take on a non-technical role, this can help you navigate the wild world of hackathons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XyT3_4XYJiEAdHUp" /></figure><h3>What is a hackathon?</h3><p>Let’s set the record straight: a hackathon has nothing to do with <em>hacking</em> into something or breaking into systems. Instead, it’s a creative marathon where people come together to build something amazing in a short period of time, typically ranging from 24 to 72 hours. These events are filled to the brim with innovation, collaboration, and often a <strong>lot</strong> of caffeine. Beyond the excitement within the event itself, there’s a world of opportunities waiting to be unlocked, even if you’re not a seasoned coder.</p><h3>Who can build in a hackathon?</h3><p>One of the most common misconceptions about hackathons is that you need to know how to code to participate. Hackathons aren’t just for coders! Having technical skills can be an advantage, but it’s far from a requirement in many hackathons. There are plenty of no-code and low-code tools out there that can help you bring your ideas to life. Whether you’re creating a simple app, a website, or even just a mockup, there’s a place for you in the hackathon ecosystem.</p><p>Technical roles like developers and engineers often team up to bring ideas to life, with backend and frontend devs building out the functionality and user interface. But they’re not alone — designers, product managers, and strategists are just as crucial. Designers craft the user experience, product managers keep everyone on track, and strategists help shape the project’s vision and pitch. The magic happens when everyone’s skills come together. Your unique perspective could be the key to turning a good project into a great one.</p><h3>Why should you join a hackathon?</h3><h4>Learn New Skills</h4><p>Hackathons are a pressure cooker for learning. In a very short period of time, you have the chance to explore new concepts, experiment with unfamiliar tools, and push yourself beyond your comfort zone.</p><h4>Meet Amazing People</h4><p>Hackathons are melting pots of talent. You’ll meet developers, designers, entrepreneurs, and even mentors who can provide valuable feedback and guidance.</p><h4>Open New Doors</h4><p>Whether you’re looking for your next job, a co-founder, or even just some good networking opportunities, hackathons can open doors that you didn’t even know existed.</p><h4>Prizes and Recognition</h4><p>And let’s not forget… <strong>prizes</strong>! Many hackathons offer cash prizes, mentorship opportunities, and even funding to continue your project post-event.</p><h3>Pre-Hackathon Prep</h3><p>Success at a hackathon often hinges on how well you prepare before the event even starts. The groundwork you lay beforehand can make all the difference between feeling overwhelmed and thriving under pressure. Here are some tips to get you started:</p><h4>Understand the Theme</h4><p>Make sure you know what the hackathon is all about. Read up on the theme and the topics covered. This will help you brainstorm relevant ideas.</p><h4>Learn What You Need</h4><p>If the hackathon is focused on a specific technology or topic, take some time to learn the basics. You may have access to developer documentation, and looking at this resource beforehand can get up to speed on the technology itself. Learning what you need can be the difference between frustration and flow.</p><h4>Join Communities</h4><p>Engage with hackathon communities, online forums, and social media groups. You’ll find inspiration, potential teammates, and maybe even some last-minute advice. With <strong>buidlbox</strong>, we have team formation channels where you can meet fellow builders and share excitement over upcoming events.</p><h4>Find a Team</h4><p>A well-rounded team can make all the difference. Look for people with complementary skills and make sure you’re all aligned on what you want to achieve.</p><h3>It’s Game Time: During a hackathon</h3><p>Once the hackathon begins, it’s all about execution. So what are the main things to think about <em>during</em> the hackathon?</p><h4>Find a Team (If You Haven’t Already)</h4><p>If you’re still solo, most hackathons have a team-forming phase at the start. Don’t be shy… put yourself out there!</p><h4>Look Out for Sponsor Prizes</h4><p>Many hackathons have sponsor-specific challenges and bounties. These can sometimes be easier to win and are a great way to get noticed.</p><h4>Set Achievable Goals</h4><p>Don’t try to build a complex, multi-featured product. Focus on something simple but impactful that you can realistically complete.</p><h4>BUIDL, BUIDL, BUIDL</h4><p>There’s no substitute for putting in the work. Keep your head down and build, but don’t forget to take breaks and stay hydrated.</p><h4>Network and Get Feedback</h4><p>Don’t isolate yourself in a coding bubble. Mingle with other participants, mentors, and sponsors. Get feedback, iterate, and pivot if necessary. You never know what might spark a breakthrough.</p><h3>Post-hackathon and continuing the journey</h3><p>Congratulations! You’ve made it through a hackathon! But this is just the beginning. Here’s what to do next:</p><h4>Keep Building</h4><p>If you’re passionate about your project, continue working on it. Even if you didn’t win a prize, many successful startups have emerged from hackathon projects.</p><h4>Explore Further Opportunities</h4><p>There are numerous avenues to take your project forward, such as finding funding, joining accelerators, or seeking mentorship.</p><h4>Nurture Your Network</h4><p>Stay in touch with the people you met. They could be future collaborators, investors, or even just good friends.</p><h4>Keep Learning</h4><p>Take the skills and lessons you learned during the hackathon and continue to build on them. The more you practice, the better you’ll become.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J6efOQ9IbPB7dodl" /></figure><p>Before you dive into your first hackathon, ask yourself: <strong>What’s your goal?</strong> Are you here to compete, to learn, or just to have fun? Knowing your objective will help you stay focused and make the most out of the experience.</p><p>Remember to target sponsor prizes and bounties that align with your project: stay realistic but optimistic, and don’t be afraid to seek help and learn together with your team. The best way to learn is through experience, and hackathons are the perfect playground for growth.</p><p>So, what are you waiting for? Dive into the world of hackathons and <a href="http://app.buidlbox.io/">start buidling</a>! Have fun, stay curious, and who knows — you might just surprise yourself with what you can achieve. Happy hacking!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d5a3d219f4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/buidlbox/a-complete-guide-to-hackathons-abridged-0d5a3d219f4d">A Complete Guide to Hackathons (Abridged)</a> was originally published in <a href="https://medium.com/buidlbox">buidlbox</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Future of Phygital Experiences: A Proof of Interaction]]></title>
            <link>https://easonchaijw.medium.com/the-future-of-phygital-experiences-a-proof-of-interaction-1a42d55b8da2?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a42d55b8da2</guid>
            <category><![CDATA[nfc]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[rwa]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[phygital]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Wed, 27 Dec 2023 14:47:45 GMT</pubDate>
            <atom:updated>2023-12-27T14:47:45.302Z</atom:updated>
            <content:encoded><![CDATA[<h4>Redefining Off Chain Verification in the Web3 Space</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Lv0O2Ueg9j01WuOXeJ0nYA.png" /></figure><p>Imagine walking into a bustling coffee shop in the heart of the city. You order your favorite latte, and with a simple tap of your smartphone on the NFC tag at the counter, not only is your purchase confirmed, but you also instantly receive a digital token — a special reward for your loyalty, seamlessly recorded on the blockchain. This isn’t a scene from a sci-fi movie; it’s the future made possible by Proof of Interaction (PoI) in the Web3 space.</p><p>In a world where the lines between physical and digital experiences are increasingly blurring, the Web3 space is on the brink of a revolutionary development. High yields in DeFi, the evolving role of NFTs in shaping identities and communities, and the rise of real-world assets tokenization are just the tip of the iceberg. However, a significant challenge remains: the absence of a standardized method to track and verify real-world interactions on chain. Current systems are built around outdated Web2 methodologies, struggling to ensure the genuineness of transactions, from transfers of ownership to claims of items.</p><h3><strong>Proof of Interaction</strong></h3><p>First, let’s start with what Proof of Interaction is, and what problem does it solve. PoI is a groundbreaking protocol that addresses the current constraints and limitations of bridging off chain interactions on chain by establishing a transparent, verifiable standard for real-world events &amp; interactions. Think of PoI as a digital handshake, seamlessly connecting actions in the physical world (like a handshake) with the digital realm (the blockchain).</p><p>Traditional methods fall short in ensuring the authenticity of such interactions, particularly in the realm of real-world asset applications, which largely rely on Web2 methodologies. Take for example a purchase of a <em>Phygital</em> good. Upon the purchase of the item, you would have to actually tap an NFC tag to claim the ownership of a digital double. However, this is done via a Web2 API which triggers a mint or transfer of an NFT to your wallet. Same thing applies when we want to verify that you attended an event, or in logistics &amp; supply chain, tracking if you or an item was at a specific place at a specific time. In fact, some of these aren’t even possible to be achieved in Web3 yet, until now. POAP (Proof of Attendance Protocol) NFTs are also prone to falsified interactions and no automation can be done when you “attend” an event, besides minting an NFT.</p><h4>Why Is Authenticity of Interactions So Important?</h4><p>Imagine if you want to return stake to users or even reward people who attended an event. How would you do it? Most likely you would be collecting your attendance using some Web2 app (or even an Excel sheet), then you would need to filter the attendees, get their emails, send it over to someone else to then perform some on chain transaction. Now, this is assuming that every user acted honestly and there was no fraud. But what if there is? How can you effectively identify and retain only honest &amp; unique interactions? Same goes when interacting with a phygital good. The moment the physical product is resold, how can we guarantee and ensure that the NFT will be transferred along with it and it wasn’t stolen or unintentionally transferred? How can we track and verify these interactions?</p><h4>How It Works</h4><p>PoI was built to work with any arbitrary interface. That means that it could work with QR codes, NFC tags, or anything built on top of these technologies like ticketing counters. Functionally, PoI is inspired by standards like Sign In With Ethereum (SIWE). It allows for any arbitrary data to be signed and stored on chain for verification purposes. Since we are using signatures, it provides a human readable interface so users are aware of what their actions perform. It also allows for the address to be recovered, providing verifiability when and if anyone seeks to challenge this proof. Signatures can also be delegated to another address to commit it on chain without sacrificing data integrity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s9DddrclkeuNWe_geST_1Q.png" /><figcaption>Sample high level flow of Proof of Interaction protocol</figcaption></figure><p>As you can see in the diagram above, users will interact with an arbitrary interface to receive some kind of data that can be used as a proof and sign it within the message. That message can then be committed on chain to be used as the proof of interaction and can also be retrieved and verified in the event that the interaction was challenged by someone else. In fact, the signatures doesn’t even need to be stored on chain if there is no need for these interactions to be retrieved and reverified. An example scenario would be if we use Zero Knowledge Proofs (ZKPs).</p><p>By using ZKPs, you could essentially create a circuit that verifies that arbitrary data, hence ensuring that smart contract code can only be executed if the proof meets the requirements. This also ensures that no private data is leaked on chain. Here’s how it might look like in another example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R8V0zfdHT9EEU_LUHFp0pQ.png" /><figcaption>Sample flow using ZK proofs &amp; circuits</figcaption></figure><p>Essentially, entities would be creating circuits that prove the arbitrary data comes from their system and is not fraudulent. However, this is an assumption that the data can be proved using circuits. Of course, if the data is ever changing and dynamic, it would be more challenging and may even rely on external APIs and data providers to prove the authenticity of that data.</p><h4>What Interactions Would Benefit Most From This?</h4><p>So as you can already tell, this isn’t meant to be a technical paper or article about how to implement Proof of Interaction. That is because there are still many things that we are ironing out to find the best implementation of this idea. However, we’ve already identified a few scenarios and use cases that would benefit most from this protocol. In fact, we’ve even ran pilots to test this protocol in action!</p><p>One use case is in a treasure hunt application. Imagine if you have a treasure hunt experience that requires users to look for “treasure” in a physical environment. Users who found those treasures would be instantly rewarded with tokens or NFTs on chain. So how does PoI provide verifiable interactions in this example? Each location is tagged with an NFC chip. When the user taps on the chip, it generates a dynamic cryptographic message that is signed and saved on chain. The data that is used to sign the message can be used to recreate the signature if challenged, and also passed through some functions to prove that the values match and the integrity of the data is retained. In fact, we decided to push it further and create a fully seamless and engaging user experience using account abstraction (AA) so that our users didn’t even need to know it was a Web3 game! 93% of our participants have never heard or even used Web3 and completely enjoyed the entire experience! In fact, here’s a testimonial from one of our users!</p><blockquote>The combination of physical and digital interaction through treasure hunt was really fun. I think we should do more event like this in the future! Thank you for organizing such a memorable and entertaining activity for us!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SE5lSo7AXHVfY8I48-gF6g.jpeg" /><figcaption>A user’s collection of NFTs earned through real-world interactions, demonstrating PoI’s seamless integration with everyday activities. PoI + AA = ✨ Magic 🪄</figcaption></figure><h4>The Impact on Web3 and Beyond</h4><p>Proof of Interaction stands as a testament to the evolving landscape of Web3 technologies. By providing a reliable and scalable standard for recording real-world interactions on the blockchain, PoI not only enhances the authenticity and trustworthiness of digital transactions but also paves the way for broader adoption of decentralized systems. Its ability to encode real-world events into the blockchain realm opens up a plethora of opportunities for smart contract automation and decentralized applications, making it a cornerstone in the advancement of Web3 technologies.</p><p>As we continue to explore the boundaries of blockchain capabilities, Proof of Interaction is poised to play a pivotal role in bridging the gap between the digital and physical worlds, marking a significant leap forward in the evolution of Web3. While PoI opens up a world of possibilities, it’s like navigating a new city — exciting but full of unknowns. We must consider privacy concerns, data security, and ensuring equitable access as we chart this new territory.</p><h4>What’s Next?</h4><p>The journey of PoI is as much yours as it is ours. Every comment, idea, and shared excitement brings us one step closer to redefining what’s possible at the intersection of the physical and digital worlds. Whether it’s a spark of inspiration, a curious inquiry, or a visionary partnership you seek, your contribution is the cornerstone of this new era.</p><p>So, I invite you to share your thoughts below: What does the future of PoI look like to you? Do you see an application that could revolutionize your field? Or perhaps you’re ready to embark on a collaborative venture that could shape the very fabric of Web3?</p><p>I’m personally excited to build the future of PoI and explore the opportunities and potential that it unlocks. Reach out to us at <a href="https://elvtd.io/contact-us">ELVTD.io</a> and let’s explore the boundless possibilities of PoI together!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a42d55b8da2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Deploy a Mixpanel Proxy on AWS]]></title>
            <link>https://aws.plainenglish.io/how-to-deploy-a-mixpanel-proxy-on-aws-611649d80453?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/611649d80453</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[proxy]]></category>
            <category><![CDATA[mixpanel]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Thu, 31 Aug 2023 04:19:22 GMT</pubDate>
            <atom:updated>2023-09-08T04:07:28.889Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating a robust, fault-tolerant, and production-ready proxy for Mixpanel tracking hosted on AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QuW2ghC8rrh5V6EO" /><figcaption>Photo by <a href="https://unsplash.com/@andersjilden?utm_source=medium&amp;utm_medium=referral">Anders Jildén</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><em>Note: This article assumes that you already have Mixpanel set up and you’re looking for a way to deploy a proxy with your own domain to prevent ad-blockers from impacting your tracking.</em></p><p>So you just started using <a href="https://mixpanel.com/">Mixpanel</a> to provide better user analytics for your application. You’ve tested it locally and everything seems fine. Production deployment goes live and suddenly, it’s not working! Your QA engineers are testing with browsers like Brave, one has a PiHole set up at home blocking tracking requests, everything is going downhill…</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQMHoU66sBXqqLqYvGO%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQMHoU66sBXqqLqYvGO%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExeHZ4NzZvYWg1Nzl6ajF5MnRzbXF4ZW54djI4OTMxN2h6ZmQ5YzNmOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FQMHoU66sBXqqLqYvGO%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e7e73d6a4f431aa1bae684ab66bc8a1/href">https://medium.com/media/9e7e73d6a4f431aa1bae684ab66bc8a1/href</a></iframe><h3><strong>A Quick Look Into Proxies</strong></h3><p>Think of proxies like middlemen. Imagine you and your partner have a disagreement, and the atmosphere is a bit frosty. You’re both hungry and neither of you wants to break the silence. You turn to your 7-year-old and ask, “Can you go ask Mom/Dad what they want for dinner?”. Your child runs to the other side of the room and after a brief whisper, your child shouts, “Mom/Dad says pizza!”. This is basically the concept of a proxy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KpIZrt7qSK0OVBTpqZPfMQ.png" /><figcaption>Proxy example in a “cold war”</figcaption></figure><p>In the digital world, proxies take requests from users, forward them to the destination (like a website), and then send the response back to the users. They can be used for privacy, security, or to control access to specific content. Think of them as gatekeepers or messengers in the online world!</p><p>Mixpanel has a <a href="https://docs.mixpanel.com/docs/tracking/how-tos/tracking-via-proxy">guide on how to setup a proxy server</a> in their docs, which points to a <a href="https://github.com/mixpanel/tracking-proxy">GitHub repo</a> that contains a very simple NGINX configuration and a Dockerfile, but there is a huge problem. <strong>The setup is definitely not production ready </strong>and minimal at best.</p><p>Their GitHub repo contains a few deployment options such as running on Google Cloud or DigitalOcean, but none for AWS. In fact, even if you use their other examples like building your own Docker image, it can get pretty daunting and confusing for someone who’s fairly new. Their documentation is also not comprehensive enough and misses out on any best practices. But what is the issue?</p><h3>The Challenges In Deploying The Proxy</h3><p>If you have a sharp eye, you can already tell that this proxy only runs on port 80, that means it is HTTP. This leads to the first problem — a HTTPS site cannot connect to HTTP. If you deployed your website to https://yoursite.com, you cannot connect to a page like http://proxy.yoursite.com, even if you have your own custom domain. Furthermore, if you’re a new dev or new to DevOps (or AWS), you might also wonder, what do I use to host the proxy? A more experienced dev would probably be wondering how to make the proxy more fault-tolerant and have a low latency.</p><p>So, we already have a few problems and questions right at the start:</p><ol><li>No HTTPS</li><li>Not fault-tolerant (if the server is down, your tracking is down)</li><li>How can I keep my proxy fast &amp; snappy?</li></ol><p>It would be natural for developers to try and do it in code, like modifying the NGINX config to handle HTTPS requests and route them to the port 80 config in the proxy, but it’s actually not a smart choice. Let me explain why:</p><p>Assuming you modified the NGINX config to handle HTTPS requests, you now need to import the SSL certificate &amp; private key into the server hosting your proxy. This is error prone, tedious, and time consuming. Not only that, it would require you to SSH back into the server to renew your certs &amp; if someone manages to get into your server, your certs are leaked too. You might think to add it in Docker, but don’t forget that it would be stored within the layers and accidentally pushing this to a public repo would mean your certs would be leaked too. Imagine now if you want to have two servers for better reliability, you would need to repeat this process twice (or however many times depending on the number of servers you wish to spin up). Doesn’t sound fun right?</p><h3>The Solution</h3><p>So what is the best way to do it? What services should we look at? An EC2 instance? Lambda functions? ECS? These are all valid questions, and to answer that, it’s actually quite simple. When it comes to something we want to use for production, it should always be something <strong>repeatable, deterministic, reliable &amp; fast</strong>.</p><h4>Lambda?</h4><p>Lambda functions are meant for event-driven workflows, not long running services like an NGINX proxy. Not only is it difficult to setup an NGINX container to run on Lambda, but even if you do, it’s way too slow in my opinion to be used as a proxy. The cold start problem means that your requests will achieve a high latency, leading to chances of the tracking request being dropped off completely since it has timed out. This would generally happen if there are not many requests to the Lambda function to keep it warm. On the other hand, if you have plenty of users connecting every second, that now means your AWS bill is going to skyrocket. Not a smart (and scalable) choice.</p><h4>EC2?</h4><p>Well yes, and no. EC2 instances alone aren’t gonna cut it. What happens if you hit millions of connections a day? Can your single instance handle all of that load? What happens if your instance goes down? Do you have a backup instance that can keep the connections going? This means that we are already going to fail on reliability. Not only that, going back to the initial setup challenges, it’s not really deterministic since you would have to do this setup process each time you spin up a new instance.</p><h4>ECS with Auto Scaling Groups &amp; Load Balancers</h4><p>This would be the best approach in my opinion to host the Mixpanel proxy on AWS. Let’s break down what’s happening in the graphic below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*_RkaHRK0ZYl98cTygVAmQw.png" /><figcaption>Infrastructure Setup On AWS</figcaption></figure><p>We can start with the smallest component in this infrastructure, which is the <strong>ECS Task</strong>. The reason why we are using ECS task definitions is because the Mixpanel proxy example already has a Docker configuration. That means all you need to do is just build &amp; tag the image and push it to your own private repository like AWS ECR. However, some slight modifications are needed, which is to add a health check route and I will explain why in a moment. I’ve created a <a href="https://github.com/easonchai/mixpanel-proxy-aws">GitHub repo</a> that includes it into the configuration, so you can just clone, build and push it to your container repository of choice!</p><p>After that’s done, in your AWS Console, look for Elastic Container Service and click on Task definitions. On the top right, click Create new task definition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upJnwOa6mGcocpwid79oWA.png" /><figcaption>Creating a new task definition on AWS Console</figcaption></figure><p>In this page, give it a name, select EC2 instances under Launch type. I turned off AWS Fargate since I will not be using it and it does get quite costly when scaling. Also set the Network mode to bridge. If you’re planning to host this on a t4g instance running ARM, make sure to build your Docker image for it and select a Linux/ARM64 architecture in this page. 1vCPU and 1GB of RAM should be more than enough for this task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*afOcqrHF91UqaGemJ-EBhw.png" /><figcaption>Task definition details</figcaption></figure><p>Then, fill in your container details with your ECR image URI and ensure that the container port is 80, and host port is empty or 0. This ensures that a dynamic port will be allocated for you, and that will be automatically mapped to the load balancer later!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTi5v_M0ki5Kj6Hq7HJfXQ.png" /><figcaption>Container details</figcaption></figure><p>Once the task definition is setup, we can move on to the cluster. Clusters are essentially how AWS groups your tasks &amp; services. Click on Create cluster, and fill in all your details. You most likely haven’t created an Auto Scaling Group (ASG), so make sure Create new ASG is selected. Also ensure that your instance type is the same architecture as your task definition, and has at least 2vCPU and 2GiB of RAM. Set your desired capacity to 2 or more to ensure that you have a backup in case one instance fails. This should automatically create everything for you, and that brings you to the final steps!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1urLyF1WfHzs2gkGC95ToA.png" /><figcaption>Cluster configuration</figcaption></figure><p>We can now move on to the final step which is to create our cluster services. Essentially, we are telling our cluster to start a service that runs a specific task, which is what we defined in our task definition. When creating a service, ensure that the capacity provider is your ASG that was created just now and not Fargate. Then, set the task definition to the one that we created just now and the desired tasks to 2. This is to serve as a fallback in case one fails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GN14AjIimD2cJ2BLo4PwA.png" /><figcaption>Cluster service deployment configuration</figcaption></figure><p>Before we click save and move on to the final configuration, I figured it’s good to take a moment to understand what happened so far and what’s next. It might seem like a lot is going on to get this whole thing set up, but trust me, it’s worth it. We’ve defined a task definition, which is a “template” of what your ECS task needs to run. This task definition is going to be used when we create an ECS service, which lives under the ECS cluster you just created. However, when we create an ECS service, we also need to setup a load balancer and a target group to go along with it. This is what’s going to make our proxy robust and fault-tolerant.</p><p>In AWS, a Target Group is essentially a group of resources that an Application Load Balancer (ALB) or Network Load Balancer (NLB) sends traffic to. Think of it as the destination for the incoming traffic that the load balancer receives. Each target group uses a specific port and protocol to route traffic and performs regular health checks on its registered targets to ensure they’re ready to receive traffic.</p><p>Now with that out of the way, we can finally move on to the last step of this guide! Under the Load balancing configuration tab, you’re going to need to create a new Application Load Balancer. Select your container, and create a new listener at port 443 (HTTPS). Then, choose your ACM certificate which you should already setup in Route53. When creating your new target group, make sure that the health check protocol is HTTP and the health check route is /health-check which we defined in our custom NGINX config. I’ve added 300 seconds of grace period to the health check just to give the task enough time to spin up if it needs to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jg4rjM57aDLKiI2axWR8zA.png" /><figcaption>Load balancing configuration for ECS service</figcaption></figure><p>This health check step is very important! Failure to configure the right path for your health check will actually cause your proxy to fail and not receive any user requests.</p><h4>Why is the Target Group open to HTTP while the Load Balancer uses HTTPS?</h4><p>This setup is commonly known as “SSL Termination.” Here’s a simple breakdown:</p><ol><li><strong>SSL Termination</strong>: This means that the secure HTTPS connection between the client (like a user’s browser) and the server is “terminated” or ended at the load balancer. The load balancer then communicates with the target instances using HTTP.</li><li><strong>Efficiency</strong>: Decrypting HTTPS traffic (from SSL/TLS) is computationally intensive. By handling this at the load balancer level, you offload this task from your backend servers, allowing them to process application requests more efficiently.</li><li><strong>Simplified Management</strong>: With SSL termination at the load balancer, you only need to manage SSL certificates at one place (the load balancer) rather than on each individual server in the target group.</li><li><strong>Internal Traffic</strong>: Once the traffic is inside your AWS environment (from the load balancer to the target group), it’s in a more controlled and secure network. This is why many consider it acceptable to use HTTP for this internal communication.</li></ol><p>Speaking of which, we actually need to hook it up to your domain now. Under Route53, create an A record that acts as an alias to your load balancer. Name it anything, but I would actually advise you to not use terms like “tracking”, “mixpanel”, “mp”, or any related keywords to prevent browsers from automatically blocking this domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t8My_66rik3Rldn0y_E2ZA.png" /><figcaption>Route53 configuration</figcaption></figure><p>If everything is running properly, you should see the service active in your ECS cluster and accessing the domain you just set should lead you to a misleading error (it’s not an error) by Mixpanel!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*04SyNSW3yYY-eigO_hrnzg.png" /><figcaption>Mixpanel proxy service being active</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GKkZICakjCAdL8ACYqZc5g.png" /><figcaption>Accessing your domain</figcaption></figure><p>And that’s it! You’ve successfully set up a robust, fault-tolerant and production-ready proxy for Mixpanel tracking on AWS. Although this setup may seem lengthy, it will last you for ages and will require barely any maintenance unless your health check pings you or the number of requests exceed what your servers can handle. Make sure to also update your Mixpanel configuration to point to your new domain!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FIs1O1TWV0LEJi%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fexcited-the-office-celebrate-Is1O1TWV0LEJi&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExcXh3MTBiZ3V6eWs3ZzJnZG5qaXhqemZzZmg0amg0aXF5MjdqbGFkeSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2FIs1O1TWV0LEJi%2Fgiphy_s.gif&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="248" frameborder="0" scrolling="no"><a href="https://medium.com/media/997df71a0ff65be1ff7bb211563fdc95/href">https://medium.com/media/997df71a0ff65be1ff7bb211563fdc95/href</a></iframe><p>Thank you all so much for reading through the entire article! I‘ve tried to condense as much information as I can within this guide to keep it short. I know there may be a few missing pieces like setting up Route53, but that is a whole separate guide and there are plenty of resources online on how to do so. Not to mention, it is actually pretty easy and intuitive! If you’ve enjoyed reading this article or learnt something new, it’s time to put it in practice!</p><h3>In Plain English</h3><p><em>Thank you for being a part of our community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer! 👏</em></li><li><em>You can find even more content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><strong><em> 🚀</em></strong></li><li><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. 🗞️</em></li><li><em>Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><strong><em>(X</em></strong>), <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a>, and <a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=611649d80453" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/how-to-deploy-a-mixpanel-proxy-on-aws-611649d80453">How to Deploy a Mixpanel Proxy on AWS</a> was originally published in <a href="https://aws.plainenglish.io/">AWS 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[Upload and Retrieve Images by Integrating MinIO With NestJS]]></title>
            <link>https://medium.com/better-programming/upload-and-retrieve-images-by-integrating-minio-with-nestjs-419e4e629b5d?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/419e4e629b5d</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Tue, 09 Feb 2021 17:04:20 GMT</pubDate>
            <atom:updated>2021-02-09T17:04:20.473Z</atom:updated>
            <content:encoded><![CDATA[<h4>A minimal setup for your web-based apps</h4><figure><img alt="Purple and yellow crayons resting on purple and yellow background" src="https://cdn-images-1.medium.com/max/1024/0*d8NgiSIGsXxV80Cb" /><figcaption>Photo by <a href="https://unsplash.com/@tamanna_rumee?utm_source=medium&amp;utm_medium=referral">Tamanna Rumee</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a>.</figcaption></figure><p><em>Note: This article assumes that you have Docker already set up on your local machine if you are planning to set up MinIO locally. If you are here just to learn how to integrate MinIO with NestJS or connect to an external MinIO server, you do not need Docker.</em></p><p>Before we get started with how to integrate MinIO with NestJS, let’s first answer the what and why for both MinIO and NestJS.</p><p>For those who are unfamiliar with MinIO and NestJS, below is a quick summary of what both of these tools are and why they are being used. Although it may be tempting to instantly jump ahead to the hands-on session, I recommend that you understand what you are working with first — especially if you are new to this. It is one thing to know how to use these tools, but it is way more valuable when you know when and how to apply them in the right situations.</p><p>However, if you are already familiar with what these tools are, feel free to skip ahead.</p><h3>What Is MinIO?</h3><p><a href="https://min.io/">MinIO</a> is an object storage server that implements the same public API as Amazon S3. It can also be seen as an open source, highly performant cloud alternative. It has a maximum single file upload size of 5TB, which is about the same as what other cloud services are offering, and is also built to be enterprise-ready.</p><h3>Why Use MinIO?</h3><p>Since we already have the cloud (e.g. AWS, GCP, Azure), why do we want to host our own cloud? It may seem quite redundant at first, but the reason is pretty straightforward. Remember that MinIO is built as an enterprise solution. Some companies already have existing infrastructure that they spent hundreds of thousands of dollars on, and migrating to the cloud is just not a smart idea. Instead of using third-party cloud services, they can instead use MinIO, which essentially allows them to have a self-hosted cloud platform. This means that they can reuse their existing infrastructure and give them cloud-like features.</p><p>Some companies also have government contracts, which means that they cannot simply use third-party cloud services, as they have specific requirements that they need to meet. That is where MinIO comes into play.</p><h3>What Is NestJS?</h3><p>On its <a href="https://nestjs.com/">official homepage</a>, the team describes NestJS as an open source, extensible, versatile, and progressive Node.js framework.</p><p>Their <a href="https://docs.nestjs.com/">official documentation</a> actually does a great job of explaining what NestJS is, but long story short, it provides a flexible and modular approach to creating your backend APIs — not to mention that it is built with and fully supports TypeScript.</p><h3>Why Use NestJS?</h3><p>Since NestJS is built with TypeScript, it’s becoming favored by a lot of companies — especially if they are building large-scale applications. NestJS also provides great documentation, which makes it really easy to learn. Another useful tool that NestJS offers is NestCLI, a command-line interface tool that allows you to quickly and intuitively scaffold and maintain your Nest applications. It also supports an extensive list of databases and modules like TypeORM, GraphQL, and OpenAPI.</p><p>If you need a reliable Node.js framework that supports a bunch of features, NestJS is it.</p><h3>Hands-On Session</h3><p>Now that you understand the what and why for both of these tools, it becomes apparent that they make a really good combo. Both are enterprise-ready solutions, so if you are a company planning to self-host some of your services, give these a shot.</p><h3>Initial Setup</h3><p>Before we get started, make sure to have both NestJS and MinIO configured. <br>I recommend setting up MinIO using Docker. However, if you are trying to integrate with an already existing MinIO instance (perhaps handled by a client you are working with), there is a section below specifically for that!</p><h3>Setting Up NestJS</h3><p>Follow the steps provided in the <a href="https://docs.nestjs.com/first-steps#setup">documentation</a> to get your Nest application running. Once installed, start the application using this command:</p><pre>npm run start:dev </pre><p>Navigate to <a href="http://localhost:3000/">http://localhost:3000/</a> and you should see the Hello World! message. If that works, NestJS is successfully set up on your system!</p><h3>Setting Up MinIO</h3><p>Using Docker is by far the easiest way to get MinIO up and running quickly. The <a href="https://docs.min.io/">documentation</a> guides us through a very simple setup process. In your project directory created by NestJS, run the command below:</p><pre>docker run -p 9000:9000 minio/minio server /data</pre><p>This will initialize MinIO with minioadmin as both the access and secret key. If you would like to change the default keys to your own, you can instead do something like this:</p><pre>docker run -p 9000:9000 \<br>  -e &quot;MINIO_ROOT_USER=AKIAIOSFODNN7EXAMPLE&quot; \<br>  -e &quot;MINIO_ROOT_PASSWORD=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY&quot; \<br>  minio/minio server /data</pre><p>MINIO_ROOT_USER is the access key, while MINIO_ROOT_PASSWORD is the secret key.</p><p>Once running, navigating to <a href="http://127.0.0.1:9000/">http://127.0.0.1:9000/</a> should present you with MinIO’s web-based object browser. This is basically a GUI to view, download, or delete your files.</p><h3>Integrating NestJS With MinIO</h3><p>With the initial setup done, we are going to install nestjs-minio-client, which is a <a href="https://github.com/djedlajn/nestjs-minio-client">MinIO client for NestJS</a> that is going to make connecting to MinIO way easier. Install it either with npm or yarn, as shown below:</p><pre>npm install nestjs-minio-client --save </pre><pre>yarn add nestjs-minio-client</pre><p>Once done, we need to create the modules for NestJS:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79f89c709c34dd1dac77b2dc82574e57/href">https://medium.com/media/79f89c709c34dd1dac77b2dc82574e57/href</a></iframe><p>After that, we can start by modifying our minio-client.module.ts file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4062f6c515834167affdd39dedc3c304/href">https://medium.com/media/4062f6c515834167affdd39dedc3c304/href</a></iframe><p>If you notice, we are using environment variables that look like configService.get(&#39;ENV_VARIABLE_NAME’). This might look different from your traditional process.env.ENV_VARIABLE for a few reasons. Firstly, NestJS recommends using the ConfigService module that allows us to easily switch between different .env files. It also allows us to configure the environment variables to be global so other modules can easily use them too.</p><p>Another reason why we took this approach is that the module actually gets registered before the environment variables are loaded. This could cause you to run into an error that looks like this:</p><pre>Invalid endPoint: undefined </pre><p>That is why we chose to call MinioModule.registerAsync() instead of MinioModule.register(). The registerAsync()function allows the environment variables to load first, then ConfigService can get them.</p><p>Now that we understand why we are using ConfigService, we first need to install the required dependency using:</p><pre>npm i --save @nestjs/config</pre><p>Then, we can import this module into app.module.ts. Passing in the isGlobal: true property allows it to be used in the other modules imported by AppModule:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2df7d6b30d44ab4ca9e9be2cf1d21d15/href">https://medium.com/media/2df7d6b30d44ab4ca9e9be2cf1d21d15/href</a></iframe><p>For additional context, in a proper project scenario, we would usually have a .env file where we keep keys and secrets secure. That is because it is never a good idea to directly hardcode your keys/passwords directly in the app. It can easily be scraped or accessed by inspecting your app’s code. Just remember to <em>not</em><strong> </strong>commit and push them to GitHub or any other public site! They can also be injected into Docker containers, which can be handy during deployment.</p><p>Let’s create our .env file now. Keep in mind that the environment variable names need to match what we wrote in our Nest application:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c7a14b71fe60290a254ee0bdbe5b89d/href">https://medium.com/media/7c7a14b71fe60290a254ee0bdbe5b89d/href</a></iframe><p>Once that is set up, we can create a file.model.ts under the minio-client folder that exports all the necessary interfaces we might use:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/31b65e93ba378809b56a33896c5e33ac/href">https://medium.com/media/31b65e93ba378809b56a33896c5e33ac/href</a></iframe><p>Moving on to our minio-client.service.ts file, this is where the logic that performs the saving and deleting of images:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9627007f8fb8a1e845d7dec57f808046/href">https://medium.com/media/9627007f8fb8a1e845d7dec57f808046/href</a></iframe><p>If you look carefully, we are hashing the date string and using that as the name of the file when saving it in the bucket. The reason for this is that we want to avoid repeating file names. Doing it this way also avoids the issue of a whitespace character in the file name that can cause an issue during file retrieval.</p><p>After the service file has been set up, it is now time to create our module that will actually receive and handle the API call. It is generally recommended to split your code up into modules, which is the whole point of NestJS. Therefore, we can create a new module called image-upload to handle the image uploads:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1a44461d985286f8b6cdad1df175cd2d/href">https://medium.com/media/1a44461d985286f8b6cdad1df175cd2d/href</a></iframe><p>We can now modify our image-upload.service.ts file. Here, we will use the upload function that we created in minio-client.service.ts. If you recall, it returns a url property that contains the full path to the uploaded image. That can be returned to the controller and then returned as a response when we make the API call:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/99d14fb876111d9ca7a59e7810723cca/href">https://medium.com/media/99d14fb876111d9ca7a59e7810723cca/href</a></iframe><p>Once handled, we can modify image-upload.controller.ts . We can use the FileInterceptor interceptor that handles data posted in multipart/form-data format:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab48a8d18244406a8db271bba2fe1691/href">https://medium.com/media/ab48a8d18244406a8db271bba2fe1691/href</a></iframe><p>Finally, we need to import MinioClientModule into image-upload.module.ts since we are using MinioClientService:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c1b986787b8d52c9d13529f99a8895e/href">https://medium.com/media/6c1b986787b8d52c9d13529f99a8895e/href</a></iframe><h3>Moment of Truth</h3><p>Phew, that was a whole lot of setup. Before we start posting data, let’s first restart NestJS since we added the new environment variables. We’ll also create our bucket through the MinIO Browser. Make sure the bucket name matches what you entered in the .env file. When restarting NestJS, make sure that there are no errors logged in the terminal.</p><p>We can use Postman to send our request since we do not have a frontend app set up in this tutorial. Your POST request should be directed to <a href="http://localhost:3000/image-upload">http://localhost:3000/image-upload</a> since that is the endpoint that we have set up under image-upload.controller.ts. Under the “Body” tab, be sure to select form-data and set the key to image and type to File. You can refer to the screenshot below:</p><figure><img alt="Body settings" src="https://cdn-images-1.medium.com/max/1024/1*8fIPsobgJVLeju9n0jrxWw.png" /></figure><p>If your request went through and NestJS did not report any errors, that means it worked! If you refresh the MinIO Browser, you should now see your file in there.</p><p>However, if you tried to navigate to the URL returned via the POST response, you will realize that you are asked to log in. You would expect it to just show the image, which is the expected behavior if you use third-party cloud services like AWS or GCP. So, what’s the deal here? You wouldn’t want to give other people your access and secret keys, right?</p><h3>Finishing Touches</h3><p>To ensure that we can retrieve the images directly via the URL, like what we normally do with AWS or GCP, we need to modify the bucket’s policy. We can use the setBucketPolicy function to modify the bucket’s policy and make it publicly accessible. Since we only need to call setBucketPolicy once, we can temporarily modify the code in minio-client.service.ts and use it to call that function in the constructor:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c51f5260e9f792ffda3d9a428acf3d2/href">https://medium.com/media/8c51f5260e9f792ffda3d9a428acf3d2/href</a></iframe><p>Once the file is saved, NestJS will automatically restart with the new changes (assuming you used npm run start:dev). If it does not, just stop and start NestJS again. You should see this in your output:</p><figure><img alt="Output" src="https://cdn-images-1.medium.com/max/1024/1*AUCM2TTQYRe_2mRTOXEeuw.png" /><figcaption>NestJS should log out “Bucket policy set”</figcaption></figure><p>If you see this output, you can now remove the changes we made since we only need it to be run once — not every time the app starts. If you now navigate to the URL, you should see our image load instantly without prompting for login credentials!</p><figure><img alt="Image in the browser" src="https://cdn-images-1.medium.com/max/1024/1*biCC9wOEaNMSN7esiLE5DA.png" /><figcaption>You should instantly see the image once the new policy is set.</figcaption></figure><p>There you go! We successfully set up and integrated MinIO with NestJS and got them to upload, store, and retrieve images! Give yourselves a pat on the back!</p><h3>Conclusion</h3><p>Using MinIO and NestJS together proved to be simpler than imagined. There was honestly minimal setup and we did not need to configure any instances or go through that many steps in the process.</p><p>Granted, this is running locally as opposed to having it publicly accessible anywhere in the world. However, if you already have the existing infrastructure or your clients want to know whether or not they should move to the cloud, you now know about a new alternative!</p><p>I would like to thank all of you for taking the time to read through and follow along with this article. I hope it has helped you learn something new or served as a guide if you are attempting something similar.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=419e4e629b5d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/better-programming/upload-and-retrieve-images-by-integrating-minio-with-nestjs-419e4e629b5d">Upload and Retrieve Images by Integrating MinIO With NestJS</a> was originally published in <a href="https://betterprogramming.pub/">Better Programming</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Helpful Tips To Improve Yourself As A Programmer]]></title>
            <link>https://easonchaijw.medium.com/3-helpful-tips-to-improve-yourself-as-a-programmer-7f9ac304c9ff?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f9ac304c9ff</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[tips]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Wed, 27 Jan 2021 13:12:47 GMT</pubDate>
            <atom:updated>2023-12-28T04:59:22.433Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhR0GNM_wrfEawQ4HfU2ZQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@clemhlrdt?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Clément Hélardot</a> on <a href="https://unsplash.com/s/photos/programming?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Over the past year, the pandemic has affected a large number of people. Many of us are out of jobs and are constantly finding new ways to help us navigate through the harsh conditions we now find as the <em>new normal</em>. A large number of us are getting into web development or programming, in general, because it’s free and relatively easy to learn. It’s also a pretty lucrative and in-demand job in this day and age, which as a result has brought a lot of fresh faces to this industry.</p><p>During my time conducting talks and teaching people about programming, I realized that the biggest question <em>(asides from which programming language to learn)</em> is “<strong>How do I improve myself?</strong>” or “<strong>How can I be a better programmer?</strong>”. Whether you are learning programming to land a job or just to future-proof yourself, <strong>listen up</strong>.</p><h3>Tip #1: Practice Solving A Need</h3><p>Constantly coding and churning out websites might be a great way to practice your skills. Over time, you might learn a few neat little tricks that can speed up the performance of your code, or reduce the number of lines you write. But if you do not practice solving a need, you are missing out on an opportunity to work on two very important skills as a programmer, <strong>creativity</strong> &amp; <strong>problem-solving</strong>.</p><p>Let’s start with <em>how</em> solving a need helps you improve both of these skills. Firstly, a need that remains unsolved can either be:</p><ol><li>New (people haven’t discovered it yet)</li><li>Challenging (it is difficult or tricky to solve)</li></ol><p>Assuming you are working on a new problem, you will most likely need to think about how you can solve this need. Just that alone teaches you how to <strong>think</strong> <strong>creatively</strong> &amp; how you should <strong>solve that problem</strong>. The same goes for a challenging problem. You still need to think of creative ways to solve that problem. If you are just starting as a programmer, this can seem really daunting. However, I encourage you to start picking up your own projects once you have gained a pretty good foundation in the language/framework you are using. Don’t just keep coding along to YouTube tutorials. I have seen many people get too comfortable with tutorials to a point where they do not know what to do once they are on their own. YouTube, and tutorials in general, are definitely great ways to learn new tools, languages, and frameworks quickly, but they should never be where you stop at. They are also a good source of information which you can use to keep yourself up to date since things move <em>really fast</em> in this industry. But keep in mind that past a certain point, you should try to use it to supplement your daily learning rather than making it your sole focus. In conclusion, the ability to think creatively and solve problems is crucial in any industry. These skills can really take you far and propel your career forward if possess them.</p><h3>Tip #2: Work With Other Programmers</h3><p>The best way to improve yourself is to learn from others. This doesn’t mean you learn how to copy and paste other people’s code. You need to learn and understand their thought process. Why did they implement it this way? Why are they using this instead of that? Joining talks or events such as hackathons can be a great way to meet new, and potentially more experienced developers that you can learn from. Plus, since all events are virtual now, there is no harm in trying. Learning how to <strong>work together</strong> is also an essential skill that you need to have. Unless if you are a freelancer, strong teamwork is a must. Working with others will also give you exposure to tools like <em>Git</em>, which surprisingly, a large number of programmers do not know how to use.</p><p>Meeting with other people also allows us to learn from their experiences. I believe that everyone has their own unique insight about a particular topic. Learning from that insight can be very valuable even if the topic does not directly relate to programming. This is because our brains are really good at integrating and associating information to generate new solutions, much like a neural network.</p><p>Even if you are new to this space, don’t be afraid to participate in events. There are plenty of developers in this community who are genuinely helpful and will take the time and patience to guide you. You might come across one or two bad apples, but don’t let that discourage you. Also, don’t be afraid to share your knowledge with others. Sharing knowledge can help solidify and deepen your understanding on that particular subject.</p><h3>Tip #3: Learn How To Shift Perspectives</h3><p>Some people think that the only way to get better at solving problems or bugs is to face them again and again. <em>Practice makes perfect, right?</em> Well first, if you are always writing code that causes the same bug every time, you should be concerned. I’m not saying it’s wrong to make mistakes, I’m saying that if you are running into the same mistake over and over again, you should try learning from your mistakes more effectively. Some also ask me about which algorithms are the most powerful, and which ones should they memorize? To that I will say, you <strong>shouldn’t memorize any of them</strong>. Unless if you are preparing for a technical interview, these algorithms won’t be of much use to you. In fact, most companies rarely test you on any algorithm at all, depending on the role you are applying for. But the reason why so many people ask this question is that they assume that you need strong technical skills to solve problems. The truth is, you don’t.</p><p>You don’t have to be the smartest guy in the room to solve any problem. Sometimes, all you need to do is just <strong>look at the problem in another way</strong>. During a <a href="https://www.youtube.com/watch?v=o8NPllzkFhE&amp;list=PL36C1819C2037D50F&amp;index=66">TED interview</a> with Linus Torvalds <em>(creator of Linux)</em>, there was a moment where he was explaining <em>good taste </em>in code, and there is one key point that I resonated with:</p><blockquote>… I want you to understand that sometimes you can see a problem in a different way and rewrite it so that a special case goes away and becomes the normal case, and that’s good code. — Linus Torvalds</blockquote><p>My tip here isn’t exactly about how shifting perspectives allows you to write good code, but more specifically, it allows you to approach the problem at a different angle, which can actually lead to a better, more efficient solution. This tip applies to everything in life, even outside of work. If you have been stuck on a problem for a few days, instead of attacking it repeatedly from the same point of view, try taking a step back and going at it a different way. If you are the type of person who jumps in and starts coding without a plan, perhaps you can try to draw a diagram that illustrates your program’s flow. Then, you can analyze the best course of action to take. It’s kind of like being stuck in a maze. If you could zoom out and get a bird’s eye view, you could easily figure out where to go.</p><h3>Bonus Tip: Communication Skills</h3><p>The reason why I kept this separate from other tips is that it doesn’t have a direct effect on your programming skills. However, <strong>communication is one of the biggest factors of success</strong> for any field out there. It is also often the most overlooked skill no matter what job you work. Although there are a bunch of memes and stereotypes about how programmers are huge introverts, I believe that if you are employed as a developer, you are almost instantly thrown into situations where you need to communicate what you are working on every day. These include daily stand-ups, presentations, and sometimes discussions with clients. If you can’t communicate effectively, you are at a huge disadvantage compared to your peers.</p><p>So there you go! Three tips and a bonus on how to improve yourself as a programmer. Below is a TLDR/recap of everything I just mentioned. If you instantly jumped to this section instead of reading through the whole article, <em>you owe me 5 claps</em>. If you found these tips insightful, show me some love!</p><p><em>TL;DR <br>1. Practice solving a need as it trains your creativity &amp; problem-solving skills.<br>2. Working with other programmers allows you to learn from them and improve your teamwork skills.<br>3. Learn how to shift perspectives. Not every problem needs the most technical solution.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f9ac304c9ff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Actual Sigmoid Function in Solidity]]></title>
            <link>https://easonchaijw.medium.com/an-actual-sigmoid-function-in-solidity-6b78d002d8be?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b78d002d8be</guid>
            <category><![CDATA[bonding-curves]]></category>
            <category><![CDATA[smart-contract-blockchain]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[sigmoid-function]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 07:14:13 GMT</pubDate>
            <atom:updated>2023-12-28T04:59:05.453Z</atom:updated>
            <content:encoded><![CDATA[<h4>Breaking past theories and creating an actual implementation in a smart contract</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0_v-dXvQyX7z0SWnpepXA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/s/photos/mathematics?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Token bonding curves have been a topic of interest lately within the crypto space, especially with the growth in DeFi &amp; NFTs. With more and more projects implementing some sort of price curve for Automated Market Makers (AMM) or ICOs, people are becoming more creative in the way they choose to price their tokens.</p><figure><img alt="Example of price functions" src="https://cdn-images-1.medium.com/max/1024/1*YAx8n5seLe1gp4Y6fKnZJg.png" /><figcaption>Courtesy of Veronica Coutts from her <a href="https://medium.com/linum-labs/intro-to-bonding-curves-and-shapes-bf326bc4e11a">Medium article</a></figcaption></figure><p>We’ve all heard about linear curves, power functions and inverse graphs, which some of the famous protocols like Uniswap and Bancor use. However, an interesting type of curve has also been discussed, the <em>Sigmoid function</em>. Although it has appeared in a few articles discussing its use case and practical applications, I have yet to discover any smart contract actually implementing it.</p><h4>What is a Sigmoid Function?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gf62ODbc18eVVtxohBAghQ.png" /><figcaption>A Sigmoid function curve</figcaption></figure><p>For those who are unaware, a Sigmoid function has a characteristic of an “S”-shaped curve, as shown above. The most common implementation uses a logistic function, which looks like this:</p><figure><img alt="Logistic function sigmoid curve" src="https://cdn-images-1.medium.com/max/204/1*uU_npOYbebMd4CkEqliP6g.jpeg" /><figcaption>Logistic function</figcaption></figure><p>However, I chose to go for the algebraic function, for a number of reasons:</p><figure><img alt="Algebraic function" src="https://cdn-images-1.medium.com/max/521/1*rl6-SC1jy9aUK9N0_0a20Q.png" /><figcaption>Algebraic function</figcaption></figure><pre>Where:<br>a = the height of the curve (or maximumPrice/2)<br>b = the token supply at the inflection point happens (aka midway point)<br>c = the steepness of the curve</pre><h4>The Benefits of an Algebraic Sigmoid Function</h4><p>First, this function is highly customizable. We can manipulate the values <em>a</em>, <em>b</em> and <em>c </em>to shape our Sigmoid function as we like. You can view an <a href="https://www.desmos.com/calculator/yp5lldd99v">interactive example here</a>! I am by no means a Math god, and this function was actually thanks to an <a href="https://blog.relevant.community/bonding-curves-in-depth-intuition-parametrization-d3905a681e0a">article </a>that I found, so all credit goes to <a href="https://medium.com/@balasan">Slava</a> for the materials!</p><p>Besides that, this function is easier to perform integration on, which will be handy in the future if anyone attempts to do so. However, I must note that I was only interested in using the point on the curve as the price function, and not the area.</p><h4>The Challenges</h4><p>Everything in life has its pros and cons. As some might realize by looking at the function above, we have a square root. Square root in Solidity is rather challenging to compute. This is due to the fact that Solidity does not handle floating point numbers. To overcome this issue, I had to implement an arbitrary fixed point decimal system in the contract. In simple terms:</p><pre>We can have an arbitrary fixed point decimal system that takes 5 decimal points. This basically means:</pre><pre>    DECIMAL POINT GOES HERE<br>                |<br>                v<br>123456789 = 1234.56789<br>1234567   =   12.34567</pre><p>Hopefully the example above is clear enough to help you guys understand. Thankfully, as I was developing this system, I landed across a library called <a href="https://github.com/CementDAO/Fixidity/blob/master/contracts/FixidityLib.sol">FixidityLib</a> that coincidentally a friend of mine <a href="https://twitter.com/obernardovieira?lang=en">@obernardovieira</a> helped create! 🤯</p><h4>FixedMath.sol</h4><p>I drew some inspiration from FixidityLib and developed a library of mine called <em>FixedMath.sol</em>. It is by no means a fully complete library for fixed point math in Solidity, however, I’ve implemented a square root function which works pretty well using the Babylonian method. (Now I’m starting to think I should call my library another name 😂)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dibymWjodlG25Qg_piepyA.png" /><figcaption>Retrieved from <a href="https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method">Wikipedia</a></figcaption></figure><p>The Babylonian method is rather simple. Start by approximating a number (<em>X₀</em>) which will be used to derive the next approximate number. Then, the process is repeated using the new approximate number each time until you reach a point where the <strong>new</strong> approximate number is the same as the <strong>old </strong>one. It is honestly a rather genius solution if I might say so myself. You can read more about it <a href="https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method">here</a> if you’re interested. That basically sums up the challenge of implementing a Sigmoid function in Solidity!</p><h4>Application</h4><p>I probably should have started the article about why I chose to embark on this challenge, but I figured that more importantly, most people would want to know how this was done. Anyways, here we are now with why I started this. Why specifically a Sigmoid function?</p><p>I’m working on a project called Decentramall that started during the HackFS hackathon. The idea of the project was to allow people to buy a SPACE token which gives the owner the right to open a store on our platform, or rent it out to earn some returns. We decided to have a hard cap of <strong>1200</strong> SPACE tokens, which if the price was based on a quadratic curve, would look and behave very oddly. We thought that a Sigmoid function would be way more rewarding for early adopters as the price will increase rapidly after a certain point, but still benefit late comers as they won’t be paying some absurd price for it. Furthermore, when I first learnt about the algebraic Sigmoid function that was shown above, I really liked how customizable it was, allowing us to mess around with the values to shape our curve as we like. Also, I just wanted to challenge myself to see what I can create with Solidity.</p><p>I’ll be writing an article on the project rather soon, and will link it here when its ready! For now, you can view the code and contracts on <a href="https://github.com/decentramall/contracts">GitHub</a>! If you’ve seen any projects that use a Sigmoid function, please do share it with me! I’ll be interested to learn what I can improve on and optimize in the future versions! 😄 Overall, it was a great experience messing around with decimal numbers and square root functions in Solidity. 💪</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b78d002d8be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Biggest Issue With DeFi]]></title>
            <link>https://easonchaijw.medium.com/the-biggest-issue-with-defi-13dfcd4a7825?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/13dfcd4a7825</guid>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[defi]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[issues]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 10:06:14 GMT</pubDate>
            <atom:updated>2023-12-28T04:59:32.272Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mx4YTemfvceqCoYxk1r-GA.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@moose-photos-170195?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Moose Photos</a> from <a href="https://www.pexels.com/photo/round-gold-colored-ethereum-coin-1036637/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Before I start, no this is not going to be an article about all the ‘hacks’ and how DeFi is still in its early stage and has its flaws. I am talking about the one core issue that everybody seems to be overlooking.</p><h3>What is DeFi?</h3><p>I should probably preface with what is DeFi? DeFi stands for <strong>De</strong>centralized <strong>Fi</strong>nance and refers to a collection of Decentralized Applications (DApps) and protocols that are focused on, well you guessed it, <em>finance</em>. It allows us to do things that we might not have even thought about before and because it is open source and rather developer-focused, it allows anyone with the right mindset and motivation to easily build on top of these blocks creating new possibilities. But enough about what it is, let’s talk about <strong>what is missing?</strong></p><h3>Adoption</h3><p>Yes, adoption. That is the biggest issue with DeFi today, but why? Sure, there are plenty of issues that we have to iron out to drive mass adoption like gas prices (which ETH 2.0 will hopefully solve), protocol security, price volatility and all the ‘hacks’ (I honestly prefer <em>exploit</em>, but I guess hacks drive more views), but there is one thing that people totally forgot about or just seem to neglect, and that is <strong>accessibility</strong>.</p><p>I know companies and developers are constantly working on developing apps, great UI for their DApps and finding more ways to improve the experience for existing users, but have we forgotten about the other 99% of the world?</p><p>When there is an economic crisis, everyone says “crypto solves that”<em>, </em>or maybe you want to find a cheap way to send money back home to your family and you hear people say “use cryptocurrencies”. Well let me ask you a question, <strong><em>how do I even get in to crypto</em></strong>? Let us take a step back and focus on global remittance for a moment. About 80% of global remittance are actually sent to low and middle-income countries (LMIC). If you plug that in to the <strong>US$ 689 billion</strong> sent around the world in 2018, that is equal to roughly <strong>US$ 551 billion </strong>just to LMICs. The average amount that they send home every month is roughly US$ 200–300 so paying high fees aren’t an option.</p><p>So let’s compare purchasing and sending crypto with a service like Western Union, one of the most used remittance service. If you purchase crypto with a credit/debit card, you pay a minimum of $10 + a marked up rate + 3% card fee. Western Union charges $20 + a marked up rate, so on the surface, it seems almost the same, but more importantly, how does the recipient convert crypto back to cash? That brings us back to the issue of accessibility. Now you might argue that we can use P2P platforms like Binance, but not every country is listed there. Same goes for purchasing crypto with your card, not every country is eligible to purchase regardless if they are legally allowed to or not. But like I mentioned, the biggest issue is <strong>how to go from crypto to cash</strong>?</p><h3><strong>Crypto ⇄ Cash</strong></h3><p>To be fair, there has been many efforts to bridge the gap between crypto and cash. More companies are integrating FIAT deposits for stablecoins without any fees so that is a <em>huge step. </em>However, these are still limited to countries in the EU or USA. Services like Dharma allow you to go from crypto ⇄ cash without fees, but they still have limits and this two-way street of crypto to FIAT is only available if you live in the USA. So I guess the real question is how are we going to solve this issue?</p><p>I understand that this will take time and with clearer regulations and bans lifted, it will probably make it easier for a lot of countries. However, I think that we should not neglect this issue and even in the current state, I think it is possible to overcome this with the help of stablecoins. If we can really tackle the underlying problem which is allowing people to get into crypto in a frictionless fashion, it can kick off DeFi adoption at a faster rate than any protocol or product. After all, why build a global decentralized financial system when it can’t be used by everyone?</p><p>What are your thoughts on this? I would love to hear what you all think! Feel free to DM me on <a href="https://twitter.com/easonchaiii">Twitter</a> and follow me right here on Medium!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13dfcd4a7825" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Only Guide You’ll Need To Deploy a React App to GitHub Pages in 2020 [Seriously]]]></title>
            <link>https://easonchaijw.medium.com/the-only-guide-youll-need-to-deploy-a-react-app-to-github-pages-in-2020-seriously-b546d859d1bf?source=rss-58d574a5df8a------2</link>
            <guid isPermaLink="false">https://medium.com/p/b546d859d1bf</guid>
            <category><![CDATA[github-pages]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[easy]]></category>
            <dc:creator><![CDATA[Eason Chai]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 07:26:12 GMT</pubDate>
            <atom:updated>2020-06-26T07:38:15.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijG2c4Bss_UuLW_4XDvPxQ.jpeg" /></figure><p>I remember when I first started using <em>gh-pages</em> to deploy my React App to GitHub. I was admittedly a little lost. We usually refer to a tutorial either on YouTube or right here on Medium to guide us through the first time we use a tool, and I remember being so confused on why I couldn’t get it to work. I did not know what variables to set or why I was constantly getting a white screen. I was frustrated! I looked at the repo to see if I could find any info but that wasn’t much help. I looked at three different blog posts, each teaching a separate thing, and one YouTube video asking me to add a random whitespace character to ‘refresh’ the site and make it work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*WHP3DS6DxcdltI5G24TJgw.gif" /><figcaption>Courtesy from Giphy</figcaption></figure><p>It obviously did not work. Before I knew it, I was mixing and matching tutorials and slowly but surely my code was a mess. I finally got it to work in the end and a few months later, I was working with a developer on a project and by no means was he a beginner. He had to deploy his React App as well and guess what, he was stuck. It led me to think that maybe it was an underlying issue of outdated instructions or maybe it just wasn’t <em>beginner friendly </em>for first time users. That is why I made<strong> Launchpad</strong>.</p><h3>Tutorial</h3><p>Okay, I apologize for that long intro, but I felt like it was somewhat needed. Let’s get straight to the point now.</p><p>The steps are in my <a href="https://github.com/easonchai/launchpad">Launchpad repo</a> but I will provide more detailed instructions &amp; explanations here.</p><p>First, install <a href="https://nodejs.org/en/download/">NodeJS&gt;=10</a> and <a href="https://git-scm.com/downloads">Git</a>. Then, open up Powershell/cmd/Terminal and type</p><pre>git clone https://github.com/easonchai/launchpad.git<br><br>cd launchpad<br><br>npm install</pre><p>This should take a while as it installs all the dependencies you need. Once that is done, hit</p><pre>npm start</pre><p>A new browser tab should open and you should be presented with this!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RNGUszsnB7rFWKHEoTDjVQ.png" /></figure><p>The first two items should already be checked off as we just went through them. After that, just change the <strong>homepage</strong> attribute in <em>package.json </em>according to your username and repo name.</p><p>I assume you already have a GitHub account (hence why you’re here) but if you don’t, its easy to make one. Also, if you have not made a repo yet, now is the time to do so. I will just quickly run over how to do it for the beginners out there but if you’ve already done this, just skip ahead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjWO5teTFX-1MHj0oIlUnw.jpeg" /><figcaption>Click on “New” to create a new repo from your dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v8jXPJ71YnwUNfxCIGVIng.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59dLLNML8hCL2YHdmBIvew.jpeg" /><figcaption>This is your remote repository url</figcaption></figure><p>And done! Three easy steps to create your repo! Once again, make sure you change the username and repo name accordingly as shown below</p><pre>&quot;homepage&quot;: &quot;https://easonchai.github.io/launchpad-test&quot;</pre><p>Next step is where we use the remote repository url</p><pre>git remote rm origin<br>git remote add origin https://github.com/easonchai/launchpad-test.git<br>git push origin master</pre><p>Next, it is ready to deploy! Enter this command in your terminal:</p><pre>npm run deploy</pre><p>Wait for that to complete and finally, it’s the final setting to change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4t0qY3L7LeF0644K3RMWg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eMwNZK885UuWg1P-B5jC9g.jpeg" /><figcaption>Scroll down all the way to the bottom and you should see this</figcaption></figure><p>And there you go! It’s all done! You just deployed a React App to GitHub in <strong>less than 5 minutes</strong>. Just modify the React files and you are good to go!</p><p>If there are any issues, feel free to reach out to me on <a href="https://twitter.com/messages/compose?recipient_id=933716466">Twitter</a> or open an issue on <a href="https://easonchai.github.io/launchpad/">GitHub</a>! <strong>Good luck! 🚀</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b546d859d1bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>