<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vinyl-Davyl</title>
    <description>The latest articles on DEV Community by Vinyl-Davyl (@vinyldavyl).</description>
    <link>https://dev.to/vinyldavyl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F944855%2Ff410837c-7a18-418e-a3fc-20c141b5d0e7.jpg</url>
      <title>DEV Community: Vinyl-Davyl</title>
      <link>https://dev.to/vinyldavyl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vinyldavyl"/>
    <language>en</language>
    <item>
      <title>Migrating 120k+ Lines of Legacy Banking JavaScript to TypeScript with Zero Downtime</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Tue, 23 Sep 2025 06:27:31 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/migrating-120k-lines-of-legacy-banking-javascript-to-typescript-with-zero-downtime-2c68</link>
      <guid>https://dev.to/vinyldavyl/migrating-120k-lines-of-legacy-banking-javascript-to-typescript-with-zero-downtime-2c68</guid>
      <description>&lt;p&gt;Migrating a large-scale production application is never a small decision especially when the application in question is powering &lt;strong&gt;wallet operations, bill payments and crypto-to-fiat conversions&lt;/strong&gt;. For context, the system I worked on had grown beyond &lt;strong&gt;120,000 lines of JavaScript&lt;/strong&gt;, much of it mission-critical and actively serving users with real money flowing through it every single day.&lt;/p&gt;

&lt;p&gt;The push to migrate wasn’t just my personal, although I’d long advocated for TypeScript internally. The tipping point came through a combination of &lt;strong&gt;colleague feedback&lt;/strong&gt;, developer pain around ongoing maintenance, and the long-term risks of leaving such a large system in “pure JavaScript mode.”&lt;/p&gt;

&lt;p&gt;I should also note that this work was heavily inspired by &lt;a href="https://benhowdle.im/" rel="noopener noreferrer"&gt;Ben Howdle&lt;/a&gt;. His excellent talk on &lt;a href="https://youtu.be/IZHYRIqexUI?si=i9J8t0YePQi4Lk-r" rel="noopener noreferrer"&gt;Letting Go of Perfectionism in Distributed Systems&lt;/a&gt; and his write-up on migrating on &lt;strong&gt;Production Banking&lt;/strong&gt; convinced me that it could be done, and done without downtime. What follows is my broken voice and process logged in Git history.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why We Migrated
&lt;/h1&gt;

&lt;p&gt;In a fintech company, downtime isn’t a minor inconvenience, it’s a direct hit to &lt;strong&gt;customer trust and financial operations&lt;/strong&gt;. Even a brief outage could result in lost transactions or delayed payments, and the limitations of the existing setup were becoming increasingly evident:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scale &amp;amp; Complexity:&lt;/strong&gt; As features like virtual cards, crypto conversions, biller integrations, and multiple payment rails kept growing, the codebase became more complex and demanded a stronger foundation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer experience&lt;/strong&gt; Without types, changing one module often meant fear of breaking another. Code reviews got slower. Even small changes required significant mental load to avoid regressions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk Management:&lt;/strong&gt; In fintech, errors cost more than just “bugs.” They cost trust, sometimes money (refunds), or regulatory headaches. We wanted earlier detection of issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code stability&lt;/strong&gt; wasn’t keeping up with scaling. Banking logic has no tolerance for “undefined is not a function” at runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TypeScript promised stronger contracts, &lt;strong&gt;compile-time bug detection&lt;/strong&gt;, and better tooling across the team. The key question wasn’t should we migrate, but rather how can we migrate without disrupting production systems?&lt;/p&gt;

&lt;h1&gt;
  
  
  The Core Challenges
&lt;/h1&gt;

&lt;p&gt;Migrating 120k+ lines of production code presented three main challenges:&lt;/p&gt;

&lt;p&gt;1.** Zero Downtime Requirement**&lt;br&gt;
We could not afford any outage. Users relied on the platform daily for wallet operations, bill payments, crypto-to-fiat conversions and more. Downtime would mean failed transactions, regulatory implications, and broken trust.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Large Codebase&lt;/strong&gt;&lt;br&gt;
The frontend was built with Next.js, using RTK Query for data fetching and Redux/Context for state management. Testing was done with Jest, RTL, and Cypress. The backend included a Node.js Express API, GraphQL services, and a real-time event processing system. Additional services ran on AWS Lambda and ECS workers, handling tasks like currency conversion and compliance checks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Parallel Development&lt;/strong&gt;&lt;br&gt;
The business couldn’t pause feature delivery. New features, bug fixes, and compliance requirements had to continue while the migration was ongoing.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;
  
  
  The Migration Strategy
&lt;/h1&gt;
&lt;h2&gt;
  
  
  1. Create a Dedicated Migration Branch
&lt;/h2&gt;

&lt;p&gt;At the time, I was in the lead role, stepping back from day-to-day feature and bug work to orchestrate the migration. The first step was to create a separate branch. Every &lt;code&gt;.js&lt;/code&gt; and &lt;code&gt;.jsx&lt;/code&gt; file in the codebase was renamed to &lt;code&gt;.ts&lt;/code&gt; and &lt;code&gt;.tsx&lt;/code&gt;, giving us a dedicated environment to work in without disturbing production.&lt;/p&gt;

&lt;p&gt;This isolated “migration branch” acted as the staging ground. We could gradually introduce TypeScript features and compiler settings without destabilizing ongoing development.&lt;/p&gt;

&lt;p&gt;Pro Tip: Use incremental commits per module instead of one massive push. This keeps changes reviewable and easier to debug.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Periodic Rebasing Against Main
&lt;/h2&gt;

&lt;p&gt;Because the main branch continued to move with feature delivery, the migration branch required &lt;strong&gt;regular rebasing&lt;/strong&gt;. This ensured that when the eventual merge happened, conflicts were minimized.&lt;/p&gt;

&lt;p&gt;In practice, this meant re-applying TypeScript conversions to any new .js files introduced since the last rebase. A typical cycle looked like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout migration-branch
git fetch origin
git rebase origin/main
# resolve conflicts
# convert any new .js/.jsx files to .ts/.tsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Incremental Typing &amp;amp; Module-by-Module Progress
&lt;/h2&gt;

&lt;p&gt;Rather than converting everything at once. Instead, we prioritized &lt;strong&gt;incremental typing&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Critical workflows (wallet funding, transfer logic, virtual card issuance).&lt;/p&gt;

&lt;p&gt;Core shared utilities (error handling, logging, validation).&lt;/p&gt;

&lt;p&gt;Less critical or peripheral features last (UI-facing non-critical modules, internal dashboards).&lt;/p&gt;

&lt;p&gt;Loosen &lt;code&gt;tsconfig.json&lt;/code&gt; settings at the start (e.g., &lt;code&gt;strict: false&lt;/code&gt;) and progressively tighten them.&lt;/p&gt;

&lt;p&gt;At some point, we encountered &lt;strong&gt;thousands of unique errors&lt;/strong&gt; (missing types, wrong function signatures, incorrect return types). That was expected. Each error was logged, triaged, and fixed in batches, module by module.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. CI/CD Integration &amp;amp; Automated Checks
&lt;/h2&gt;

&lt;p&gt;Every rebase triggered our CI/CD pipeline, which ran:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Jest&lt;/strong&gt; tests. (unit + integration).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend E2E tests&lt;/strong&gt; (Cypress runs on wallet top-ups, card creation, bill payments).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type checks&lt;/strong&gt; via &lt;code&gt;tsc --noEmit&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing hit staging unless it passed the same scrutiny as production.&lt;/p&gt;

&lt;h1&gt;
  
  
  Testing in Staging: Our Safety Nets
&lt;/h1&gt;

&lt;p&gt;Before we even dreamed of a production merge, staging was our battlefield. We simulated &lt;strong&gt;real-world user flows&lt;/strong&gt; for days top-ups, conversions, card transactions, sometimes even looping “heartbeat transfers” between test accounts just to make sure nothing ever silently failed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We deployed the TypeScript-converted version to staging (mirroring production services).&lt;/li&gt;
&lt;li&gt;For 5-6 days, we ran real-world usage simulations: card creation, payments, wallet funding, conversion, bill payments.&lt;/li&gt;
&lt;li&gt;Synthetic transactions were part of the monitoring so we could detect regressions in flows early.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’ve never watched a test wallet send $1 back and forth between itself for 48 hours straight, I can assure you it’s the fintech equivalent of a lava lamp: oddly hypnotic, slightly absurd, but incredibly useful.&lt;/p&gt;

&lt;h1&gt;
  
  
  Fallback / Safe Flags During Deployment
&lt;/h1&gt;

&lt;p&gt;Because not every UI module was migrated at once, we used &lt;strong&gt;feature flags and conditional resolution in the frontend&lt;/strong&gt;. The idea was if a TypeScript-compiled version of a component/page existed, the app would load it; otherwise, it would fall back to the legacy JavaScript version.&lt;/p&gt;

&lt;p&gt;This gave us &lt;strong&gt;granular control&lt;/strong&gt; during rollout, so unfinished modules didn’t block deploys and we could safely rebase our migration branch onto main without risking a broken build.&lt;/p&gt;

&lt;p&gt;Here’s a representative snippet from one of our entry points:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// utils/loadModule.ts
export async function loadModule(moduleName: string) {
  try {
    return await import(`../dist/${moduleName}.js`);
  } catch {
    return await import(`../src/${moduleName}.js`);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This progressive bootstrapping let us ship continuously without waiting for “100% TypeScript.”&lt;/p&gt;

&lt;h1&gt;
  
  
  Cutover: The Zero Downtime Merge
&lt;/h1&gt;

&lt;p&gt;Once staging ran clean for days, we merged the branch and deployed.🪔 Thanks to f*&lt;em&gt;eature flags, our CI/CD guardrails, and fallback loaders&lt;/em&gt;*, the cutover was smooth. Users never noticed the tectonic shift happening under their accounts.&lt;/p&gt;

&lt;h1&gt;
  
  
  Results: What We Gained (and What Hurt)
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Gains
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developer confidence&lt;/strong&gt; rose sharply. With TypeScript, many bugs got caught before QA or staging.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Maintenance cost&lt;/strong&gt; dropped, especially for refactors, less “fear-driven development.” I call this one FDD.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code readability and shared understanding&lt;/strong&gt; improved: new engineers on the team could follow contracts via types.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Hard Parts
&lt;/h2&gt;

&lt;p&gt;The initial error list was overwhelming. Prioritization was critical.&lt;/p&gt;

&lt;p&gt;Rebasing often created merge conflicts (especially around shared utilities). Sometimes took many hours.&lt;/p&gt;

&lt;p&gt;Some third-party libraries had poor typings or none, which meant writing our own &lt;code&gt;.d.ts&lt;/code&gt; or wrapping them.&lt;/p&gt;

&lt;h1&gt;
  
  
  Tools &amp;amp; Key Configurations
&lt;/h1&gt;

&lt;p&gt;Several tools proved invaluable during the migration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://marketplace.visualstudio.com/items?itemName=rbbit.typescript-hero" rel="noopener noreferrer"&gt;Typescript Hero&lt;/a&gt; and &lt;a href="https://marketplace.visualstudio.com/items?itemName=amatiasq.sort-imports" rel="noopener noreferrer"&gt;TypeScript Import Sorter&lt;/a&gt;: import management.&lt;/li&gt;
&lt;li&gt;Code transformation tools (&lt;a href="https://github.com/airbnb/ts-migrate" rel="noopener noreferrer"&gt;ts-migrate&lt;/a&gt;) to automate tedious parts (renaming imports, updating require → import).&lt;/li&gt;
&lt;li&gt;Feature flags / dynamic module loading as above snippet to allow mixing old and new code safely.&lt;/li&gt;
&lt;li&gt;ESLint with TypeScript plugin. Enforced consistent style and caught many import/exports mistakes early.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://jestjs.io/" rel="noopener noreferrer"&gt;Jest&lt;/a&gt; + type checking in CI. Ensured types and tests both passed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Conclusion: Was it worth it?
&lt;/h1&gt;

&lt;p&gt;100%. Migrating a large-scale production banking system from JavaScript to TypeScript is not trivial. It requires &lt;strong&gt;planning, discipline, and collaboration&lt;/strong&gt; across the engineering team. But the payoff is clear: safer code, happier developers, and a platform that can scale confidently.&lt;/p&gt;

&lt;p&gt;For us, the migration took roughly one month plus of focused effort. It was challenging but ultimately transformative.&lt;/p&gt;

&lt;p&gt;I want to credit &lt;a href="https://benhowdle.im/" rel="noopener noreferrer"&gt;Ben Howdle&lt;/a&gt; for openly sharing his own journey, which directly influenced our approach. If you’re considering such a migration, I encourage you to study his experience as well.&lt;/p&gt;

&lt;p&gt;_TypeScript isn’t just about types, it’s about trust. Trust that your system will behave consistently under load, trust that developers can make changes without fear, and trust that users’ money remains safe.&lt;br&gt;
_&lt;br&gt;
If your fintech or enterprise platform is still operating at scale in plain JavaScript, the time to consider migration is now.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Google Summer of Code: Getting Selected, My Time, My Experience, My Journey.</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Sat, 28 Dec 2024 09:49:17 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/google-summer-of-code-getting-selected-my-time-my-experience-my-journey-519</link>
      <guid>https://dev.to/vinyldavyl/google-summer-of-code-getting-selected-my-time-my-experience-my-journey-519</guid>
      <description>&lt;h2&gt;
  
  
  Beginnings in Engineering and Passion for Creation
&lt;/h2&gt;

&lt;p&gt;I am David Okononfua, and I majored in Electrical and Electronics Engineering in Nigeria. Growing up, I always had a penchant for building things, whether it was a small contraption or a digital product. My academic journey in engineering only fueled this passion, giving me the tools to understand complex systems and the drive to explore new horizons.&lt;/p&gt;

&lt;p&gt;Beyond academics, I found joy in coding, which allowed me to develop tools, libraries, and products that brought ideas to life. It became a medium through which I could create and innovate. My enthusiasm wasn't limited to technology; I participated in hackathons and even dabbled in Capture the Flag (CTF) competitions, lol. The thrill of solving problems, collaborating with others, and creating something tangible kept me going.&lt;/p&gt;

&lt;p&gt;Outside tech, I have a deep love for football—a sport that I enjoy playing physically and one I can discuss passionately for hours. I also play the saxophone, an instrument that allows me to express myself musically, and chess, a game that sharpens my strategic thinking. This combination of interests—both technical and recreational—shaped my identity as someone who seeks balance and fulfillment in multiple dimensions of life.&lt;/p&gt;

&lt;h2&gt;
  
  
  The First Encounter: OSCAFEST and the Open Source World
&lt;/h2&gt;

&lt;p&gt;It was in 2022 when I attended a transformative event called &lt;a href="https://festival.oscafrica.org/" rel="noopener noreferrer"&gt;OSCAFEST (Open Source Community Africa Festival)&lt;/a&gt; in Lagos. This was a major milestone in my journey toward open source. At OSCAFEST, I met like-minded individuals who shared the same passion for technology and collaboration. Among them was &lt;a href="https://x.com/FavourJhay" rel="noopener noreferrer"&gt;Favour&lt;/a&gt;, a fellow Electrical Engineering student who was in the same academic level as me. Favour and I clicked instantly; our shared background and interests created an immediate bond. We talked about tech, work, life outside school, and various opportunities and platforms. Learned about &lt;a href="https://ng.linkedin.com/company/communitypro" rel="noopener noreferrer"&gt;Community Pro&lt;/a&gt; and &lt;a href="https://github.com/eddiehubcommunity" rel="noopener noreferrer"&gt;EddieHub&lt;/a&gt;—a community that helps beginners contribute to open source.&lt;/p&gt;

&lt;p&gt;The event itself was a vibrant introduction to the power of open source—the idea that people from around the world could work together to solve problems and build better tools. It was a revelation that coding wasn't just about individual brilliance but also about collective effort. While I heard mentions of Google Summer of Code (GSoC) during OSCAFEST, I didn’t pay much attention at the time. However, the seeds of curiosity had been planted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Open Source
&lt;/h2&gt;

&lt;p&gt;Open source refers to software projects where the source code is publicly available. This allows anyone to view, use, modify, and distribute the code, provided they adhere to the licensing terms. Open source promotes collaboration and transparency, enabling developers worldwide to contribute, learn, and share knowledge.&lt;/p&gt;

&lt;p&gt;Popular examples of open-source software: Linux, Firefox, VLC Media Player and more.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some Benefits of Open Source:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Collaboration:&lt;/strong&gt; Open-source projects enable global collaboration, breaking geographical barriers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learning:&lt;/strong&gt; Contributors gain real-world experience in coding, debugging, and problem-solving.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Community:&lt;/strong&gt; These projects foster strong, supportive communities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quality &amp;amp; Innovation:&lt;/strong&gt; With constant contributions, open-source projects often achieve high quality and foster innovation.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/yzeVMecydCE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Basics of Contributing to Open Source
&lt;/h3&gt;

&lt;p&gt;Open-source collaboration thrives on platforms such as GitHub, GitLab, and Bitbucket, where developers come together to improve software projects. Understanding the key concepts is essential when contributing to these projects.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;At the core of open-source contributions are &lt;strong&gt;issues&lt;/strong&gt;, which serve as a way to highlight bugs, request new features, or propose enhancements. Contributors engage with these issues to help maintainers understand what needs attention.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once contributors find areas to work on, they create a &lt;strong&gt;fork&lt;/strong&gt;, a personal copy of the project’s repository. This lets them make changes without affecting the original project. Changes are made in &lt;strong&gt;branches&lt;/strong&gt;, which are separate spaces for developing new features or fixes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each change is captured in a commit, documenting what was changed and why. These commits form a &lt;strong&gt;pull request (PR)&lt;/strong&gt;, the formal way to propose updates to the main project. Maintainers review PRs to ensure they meet the project's standards before merging them into the main codebase.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In open-source projects, &lt;strong&gt;documentation&lt;/strong&gt; is vital. It helps users and contributors understand the project. For newcomers, improving documentation is a great start, as it requires understanding the software without needing to write code.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By engaging with these processes, contributors not only improve the software but also gain valuable experience in teamwork, problem-solving, and collaboration.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Turning Point: Learning About GSoC
&lt;/h2&gt;

&lt;p&gt;Fast forward to the following year, Favour told me during one of our conversations that she had successfully participated in GSoC. She explained how the program not only paid contributors for their work but also offered a platform to grow and make meaningful contributions to open source. This was a lightbulb moment for me. I had been contributing to open source for years without compensation, purely out of passion. The idea of getting paid to do what I love was both exciting and motivating. I decided then and there to put in the effort and apply for GSoC in the next cycle.&lt;/p&gt;

&lt;p&gt;The process began with researching organizations that aligned with my technical stack. When the list of participating organizations was released, I carefully evaluated each one. Initially, I started with 15 organizations and narrowed them down to 7, then 5, and finally 2. My criteria for narrowing down included the activity level of their communities, the number of open pull requests, and whether I could make a significant impact. For example, one project had over 150 open pull requests, signaling a slim chance of getting noticed to me.&lt;/p&gt;

&lt;p&gt;Eventually, I chose &lt;a href="https://accordproject.org/" rel="noopener noreferrer"&gt;Accord Project&lt;/a&gt;, an organization under &lt;a href="https://www.docusign.com/" rel="noopener noreferrer"&gt;DocuSign&lt;/a&gt; that focuses on agreements, contracts, and document automation. Their mission and technical challenges aligned perfectly with my skills and interests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Immersing Myself in Accord Project
&lt;/h2&gt;

&lt;p&gt;Once I decided on Accord Project, I immediately began contributing to their codebase. Time was of the essence since the application deadline was approaching. I became active in their community, messaging mentors directly to introduce myself and establish a connection. My contributions included opening and merging multiple pull requests, fixing bugs, and adding features—actions that showcased my dedication and technical ability.&lt;/p&gt;

&lt;p&gt;The Accord Project's work fascinated me. They were building tools that powered critical aspects of DocuSign’s operations, focusing on automating contracts and agreements. It felt rewarding to contribute to a project that had real-world applications and was making a difference.&lt;/p&gt;

&lt;p&gt;As the application deadline loomed, I drafted my proposal meticulously. I outlined my goals, the value I intended to bring to the organization, and the skills I’d leverage to achieve them. After submitting the proposal, the waiting period was nerve-wracking. On the result day, I was ecstatic to learn that I had been accepted into GSoC. It was my first attempt, and the joy was indescribable. All the effort, sleepless nights, and determination had paid off.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Got in, How you can possibly get in.
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Choosing the Right Organization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the organizations participating in GSoC were announced, I carefully evaluated them to find the best fit for my skills and interests. Here’s how I narrowed down my options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Started with 15 organizations:&lt;/strong&gt; I looked for active organizations with year-round contributions, not just during GSoC.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Filtered to 7:&lt;/strong&gt; I ensured the organizations matched at least 30% of my tech stack, making it easier to contribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Reduced to 5:&lt;/strong&gt; I checked the activity level of their GitHub repositories, focusing on those with manageable pull requests (PRs).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finalized 2:&lt;/strong&gt; I assessed their community engagement and mentor responsiveness.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chose Accord Project:&lt;/strong&gt; Accord Project’s work on contract agreements and documents resonated with me, as it involved building tools used by DocuSign.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Contributing to the Codebase&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I began contributing to Accord Project even before the GSoC application period opened. I explored their repositories, fixed issues, and interacted with mentors. By the time applications closed, I had multiple PRs merged and had built a solid reputation within the community.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Writing the Proposal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Creating a proposal was a meticulous process. I followed these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Thoroughly studied the project I wanted to work on.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Collaborated with mentors to refine my ideas.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Drafted a clear, concise proposal outlining the problem, solution, timeline, and deliverables.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Submitting the Proposal and Waiting&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After submitting my proposal, I anxiously awaited the results. On the day the results were announced, I couldn’t contain my joy—I had been selected on my first try!&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for Aspiring GSoC Contributors
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Research Organizations:&lt;/strong&gt; Use resources like GSoC Organizations to explore participating organizations.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Look for active organizations with a strong track record.&lt;/p&gt;

&lt;p&gt;Align your interests and skills with their projects.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Be Active in the Community:&lt;/strong&gt; Contribute to discussions, join forums, and connect with mentors. Visibility and engagement are crucial.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Start Early:&lt;/strong&gt; Begin contributing to the organization’s codebase before the application period.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Create a Strong Proposal:&lt;/strong&gt; Tailor your proposal to the organization’s needs. Clearly define your goals, timeline, and approach.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stay Persistent:&lt;/strong&gt; If your chosen organization or project isn’t selected, don’t be discouraged. Your contributions and experience will still hold value.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The GSoC Experience
&lt;/h2&gt;

&lt;p&gt;Participating in Google Summer of Code was a transformative experience. It challenged me to grow as an engineer and collaborator. Working with Accord Project meant I was essentially collaborating daily with the directors of engineering at DocuSign and the DocuSign engineering team. I was tasked with building and improving tools that streamlined document workflows, specifically a template playground in my case. The work required not just technical expertise but also communication and teamwork skills. I interacted with mentors and community members, learning from their vast experience and gaining insights into open-source best practices.&lt;/p&gt;

&lt;p&gt;One of the most rewarding aspects was seeing my contributions make an immediate impact. The pull requests I opened were reviewed, merged, and deployed, becoming part of a tool that people relied on. This sense of purpose fueled my passion for open source even further.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reflections and Future Aspirations
&lt;/h2&gt;

&lt;p&gt;Looking back, my journey into open source and GSoC was shaped by a combination of curiosity, determination, and community support. From attending OSCAFEST and meeting Favour to contributing to Accord Project and succeeding in GSoC, each step was a learning experience. It taught me the value of persistence, the importance of collaboration, and the joy of creating solutions that help others.&lt;/p&gt;

&lt;p&gt;Today, I aim to continue building performant, accessible, and feature-rich applications as a professional Frontend Engineer. My experience spans developing applications across multiple APIs, third-party integrations, and databases, designing beautiful user interfaces, and scaling web products. I strive to leverage these skills to make meaningful contributions, whether in open source or professional settings.&lt;/p&gt;

&lt;p&gt;As I look to the future, I am excited about the possibilities. Open source has shown me that technology can be a force for good, and I’m committed to being part of that change. Whether it’s contributing to impactful projects, mentoring newcomers, or exploring new technologies, I’m ready to embrace the challenges and opportunities ahead.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;To further explore and gain insights into open-source contributions and programs like Google Summer of Code, here are some useful resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://accordproject.org/news/gsoc-2024-template-playground-development/" rel="noopener noreferrer"&gt;GSoC: Accord Project Template Playground Development&lt;/a&gt;&lt;br&gt;
My blog post detailing my experience and work on the Accord Project Template Playground during GSoC 2024.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://open.spotify.com/episode/3g7yFQ4VPEaoXhN6F6X5uo?si=Ie2zGXBiSImSKWrHBwxCkA" rel="noopener noreferrer"&gt;Podcast: Cracking GSoC – How David Succeeded on His First Try&lt;/a&gt;&lt;br&gt;
A podcast episode where I was featured, sharing my journey, strategies, and tips for succeeding in GSoC on my first attempt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://accordproject.org/" rel="noopener noreferrer"&gt;Accord Project Website&lt;/a&gt;&lt;br&gt;
Learn more about the Accord Project, its open-source initiatives, and how it fosters innovation in the legal tech space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://youtu.be/z86P5dKDD1w" rel="noopener noreferrer"&gt;Open Source Internship Programs – YouTube Video&lt;/a&gt;&lt;br&gt;
A helpful video discussing various open-source internship opportunities available for aspiring developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://youtu.be/nn9fF2wz3h4" rel="noopener noreferrer"&gt;All About Google Summer of Code – YouTube Video&lt;/a&gt;&lt;br&gt;
An informative video that provides an overview of GSoC, its processes, and tips for getting selected.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>googlesummerofcode</category>
      <category>opensource</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>What Are Web Workers and How to Leverage Them for Optimized Frontend Performance</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Mon, 23 Dec 2024 09:27:16 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/what-are-web-workers-and-how-to-leverage-them-for-optimized-frontend-performance-3hj4</link>
      <guid>https://dev.to/vinyldavyl/what-are-web-workers-and-how-to-leverage-them-for-optimized-frontend-performance-3hj4</guid>
      <description>&lt;p&gt;Hello guys, Vinyl here again! 👋&lt;/p&gt;

&lt;p&gt;Welcome back to my blog. I know it's been a while, but I’m excited to share some of my latest findings and learnings while working on one projects I’ve been on with this year — a template playground used to draft, test, and experiment with smart legal contracts and documents. Today, we’ll dive into &lt;strong&gt;Web Workers:&lt;/strong&gt; what they are, how they work, and how you can use them to supercharge your frontend projects.&lt;/p&gt;

&lt;p&gt;Okay so let’s imagine you’re at a bar to get some beer right, and the bartender (your main thread) has to take orders, prepare the order, and clean the counter all at once. If they’re busy brewing a complicated order (heavy computation), everyone else in line has to wait—frustrating, right? Now imagine the bartender has an assistant (a Web Worker) who takes care of cleaning and organizing the pint glasses in the background while the bartender focuses on taking and making orders. This teamwork ensures smoother operations.&lt;/p&gt;

&lt;p&gt;That’s just a short overview. I know you might thinking an API from the description lol, No, they are not! Let’s dive right in.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Are Web Workers?
&lt;/h2&gt;

&lt;p&gt;Web Workers in web development are exactly like that assistant. They handle heavy-lifting tasks in the background, freeing the main thread to keep your app responsive and smooth. In this article, we’ll dive into Web Workers, explore their key functions, explain how to navigate them, and use three real-world scenarios to demonstrate their power in frontend development. I’ll also give tips for using Web Workers in other frameworks like Vue because the primary use case here would be React.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Three Types of Web Workers
&lt;/h2&gt;

&lt;p&gt;Before diving into how to use Web Workers, let’s understand the three main types:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dedicated Workers:&lt;/strong&gt; These are specific to a single script and are the most commonly used workers. They’re perfect for tasks like background computations or handling API calls for one app instance.&lt;/p&gt;

&lt;p&gt;Example: Compressing data for a specific user session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shared Workers:&lt;/strong&gt; These can be shared between multiple scripts or browser tabs, making them ideal for tasks that need cross-tab communication, such as syncing data across tabs.&lt;/p&gt;

&lt;p&gt;Example: Keeping user session data consistent across multiple browser tabs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Service Workers:&lt;/strong&gt; Unlike Dedicated and Shared Workers, these intercept network requests and act as a proxy between your app and the network. They’re commonly used for caching and offline support.&lt;/p&gt;

&lt;p&gt;Example: Serving cached templates when a user is offline.&lt;/p&gt;

&lt;p&gt;You can read more about these types in &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API" rel="noopener noreferrer"&gt;MDN’s Web Workers Documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnwwpjorw8z8fmvwscpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnwwpjorw8z8fmvwscpj.png" alt="Web worker and non web worker flow" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To know which worker to use, consider the scope of your task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Use Dedicated Workers for isolated, single-script tasks.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Shared Workers for multi-tab communication.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use Service Workers for network-related tasks like caching or offline capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key advantage of Web Workers is their ability to offload these tasks from the main thread, ensuring a smooth user experience. Communication between the main thread and the worker occurs via a messaging system using the postMessage and onmessage APIs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Web Worker Functions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;onmessage&lt;/code&gt;: Handles messages sent from the main thread to the worker.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;self.onmessage = (event) =&amp;gt; {
  console.log('Message received from main thread:', event.data);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;postMessage&lt;/code&gt;: Sends messages from the worker back to the main thread.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;self.postMessage('Task completed');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;terminate&lt;/code&gt;: Stops the worker from running.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;worker.terminate();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Error Handling&lt;/strong&gt;: Catches errors in the worker.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;self.onerror = (error) =&amp;gt; {
  console.error('Worker error:', error.message);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Other useful functions include &lt;code&gt;importScripts&lt;/code&gt; for loading external scripts, &lt;code&gt;self.close&lt;/code&gt; for shutting down the worker, and &lt;code&gt;setTimeout&lt;/code&gt;/&lt;code&gt;setInterval&lt;/code&gt; for timed operations. Refer to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers" rel="noopener noreferrer"&gt;documentation&lt;/a&gt; for further details if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Use Cases in a Web Playground Project
&lt;/h2&gt;

&lt;p&gt;Here are three practical scenarios where Web Workers can significantly enhance the sample Template Playground project:&lt;/p&gt;

&lt;h3&gt;
  
  
  Case 1: API Calls for Templates Data
&lt;/h3&gt;

&lt;p&gt;Fetching templates data from APIs can result in huge datasets that need to be parsed before use. This can block the UI thread if done directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create the Worker File:&lt;/strong&gt; Create &lt;code&gt;dataParser.worker.js&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// dataParser.worker.js
self.onmessage = (event) =&amp;gt; {
  const { rawData } = event.data;
  const parsedData = rawData.map((template) =&amp;gt; ({
    name: template.name,
    tag: template.tag,
  }));

  self.postMessage(parsedData);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Use the Worker in React:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

export default function templateDataParser({ rawData }) {
  const [parsedData, setParsedData] = useState([]);

  const parseData = () =&amp;gt; {
    const worker = new Worker(new URL('./dataParser.worker.js', import.meta.url));
    worker.postMessage({ rawData });

    worker.onmessage = (event) =&amp;gt; {
      setParsedData(event.data);
      worker.terminate();
    };
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={parseData}&amp;gt;Template Parsed Data&amp;lt;/button&amp;gt;
      &amp;lt;pre&amp;gt;{JSON.stringify(parsedData, null, 2)}&amp;lt;/pre&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Case 2: URL Compression and Decompression
&lt;/h2&gt;

&lt;p&gt;To allow users to share their templates via compact URLs, Web Workers can handle the compression and decompression efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create the Worker File:&lt;/strong&gt; Create &lt;code&gt;urlCompressor.worker.js&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// urlCompressor.worker.js
import LZString from 'lz-string';

self.onmessage = (event) =&amp;gt; {
  const { action, data } = event.data;
  let result;

  if (action === 'compress') {
    result = LZString.compressToEncodedURIComponent(data);
  } else if (action === 'decompress') {
    result = LZString.decompressFromEncodedURIComponent(data);
  }

  self.postMessage(result);
};

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Use the Worker in React:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

export default function URLCompressor({ template }) {
  const [compressedURL, setCompressedURL] = useState('');

  const compressTemplate = () =&amp;gt; {
    const worker = new Worker(new URL('./urlCompressor.worker.js', import.meta.url));
    worker.postMessage({ action: 'compress', data: template });

    worker.onmessage = (event) =&amp;gt; {
      setCompressedURL(event.data);
      worker.terminate();
    };
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={compressTemplate}&amp;gt;Compress Template&amp;lt;/button&amp;gt;
      &amp;lt;pre&amp;gt;{compressedURL}&amp;lt;/pre&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Case 3: Handling Loading Animations for Templates
&lt;/h2&gt;

&lt;p&gt;While loading multiple templates, Web Workers can process metadata or configurations asynchronously.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create the Worker File:&lt;/strong&gt; Create &lt;code&gt;templateLoader.worker.js&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// templateLoader.worker.js
self.onmessage = (event) =&amp;gt; {
  const { templates } = event.data;
  const loadedTemplates = templates.map((template) =&amp;gt; {
    return { ...template, loadedAt: new Date() };
  });

  self.postMessage(loadedTemplates);
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Use the Worker in React:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

export default function TemplateLoader({ templates }) {
  const [loadedTemplates, setLoadedTemplates] = useState([]);

  const loadTemplates = () =&amp;gt; {
    const worker = new Worker(new URL('./templateLoader.worker.js', import.meta.url));
    worker.postMessage({ templates });

    worker.onmessage = (event) =&amp;gt; {
      setLoadedTemplates(event.data);
      worker.terminate();
    };
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;button onClick={loadTemplates}&amp;gt;Load Templates&amp;lt;/button&amp;gt;
      &amp;lt;pre&amp;gt;{JSON.stringify(loadedTemplates, null, 2)}&amp;lt;/pre&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are three scenarios where Web Workers can improve your work. Feel free to try them in your own project and experiment.&lt;/p&gt;

&lt;p&gt;Tips for Using Web Workers in Other Frameworks&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vue:&lt;/strong&gt; Use the &lt;code&gt;worker-loader&lt;/code&gt; plugin and call the worker within Vue components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Angular:&lt;/strong&gt; Leverage Angular’s built-in Web Worker support with the &lt;code&gt;ng generate web-worker&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Svelte:&lt;/strong&gt; Use the &lt;code&gt;vite-plugin-svelte&lt;/code&gt; loader to import and use workers seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Viola, You’ve definitely come to the end now! 🎉 Web Workers are like your app’s secret assistants right, quietly handling the heavy lifting while your main thread focuses on providing a great user experience. By using Web Workers in scenarios like URL compression, API calls, and data preprocessing and more, you can significantly improve your app’s responsiveness and make the experience smoother for your users.&lt;/p&gt;

&lt;p&gt;So, don’t wait—start experimenting with Web Workers today and unlock the full potential of your web applications! See you next time! 👋&lt;/p&gt;

&lt;p&gt;References&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API" rel="noopener noreferrer"&gt;MDN Web Workers API&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/pieroxy/lz-string" rel="noopener noreferrer"&gt;LZ-String Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/async-library/react-webworker" rel="noopener noreferrer"&gt;Using Web Workers with React&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/accordproject/template-playground" rel="noopener noreferrer"&gt;GitHub: Template Playground Example&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The Ultimate Guide to Styling with CSS-in-JS Using Styled Components</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Mon, 13 May 2024 12:33:58 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/the-ultimate-guide-to-styling-with-css-in-js-using-styled-components-389f</link>
      <guid>https://dev.to/vinyldavyl/the-ultimate-guide-to-styling-with-css-in-js-using-styled-components-389f</guid>
      <description>&lt;p&gt;Hello There! Welcome back to my page. Whether you're a seasoned follower or a first-time visitor, I'm thrilled to have you here.&lt;/p&gt;

&lt;p&gt;Today's drill is guaranteed to pique your interest, trust me; The Ultimate Guide to Styling with CSS-in-JS Using Styled Components. We'll delve into the world of writing CSS directly within JavaScript, exploring the power, efficiency, and flexibility this approach offers in styling for your React applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction:
&lt;/h1&gt;

&lt;p&gt;Okay let's imagine styling our web applications is like preparing a dish. You have a pantry full of ingredients (styles) and a recipe (HTML structure) to follow. But instead of traditional pots and pans, you wield a magic wand 🪄 that lets you conjure up your culinary creations effortlessly. This is the magic of CSS-in-JS, particularly when wielded with the power of Styled Components.&lt;/p&gt;

&lt;p&gt;In this comprehensive article, I'll guide you through setting up and utilizing Styled Components, exploring visual and practical examples, and unleashing the full potential of this powerful styling methodology.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why CSS-in-JS? Defeating the Cascading Stylesheet Monster
&lt;/h1&gt;

&lt;p&gt;CSS-in-JS provides a more “atomic” way to scope styles taking only to the components that use them. On the other hand, Traditional CSS can be a double-edged sword. While it offers fine-grained control over styling, it also introduces challenges like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Specificity Wars:&lt;/strong&gt; Naming conflicts and style overrides can lead to a tangled mess of CSS code, making maintenance a nightmare.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Global Scope Pollution:&lt;/strong&gt; Global styles can unintentionally affect unrelated parts of your application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Component Reusability Woes:&lt;/strong&gt; Styling components becomes cumbersome as styles are scattered throughout your codebase.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;CSS-in-JS tackles these issues by integrating styles directly within your JavaScript components. Offers several advantages like Dynamic Styling and Improved Maintainability and Reusability.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 Styled-Components cannot be directly used in HTML and CSS for a few reasons like it being a library designed for React/JavaScript libraries, specifically designed to integrate CSS styling within React components. It utilizes React's component structure and features like JSX syntax.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=rKz6cLXhpwA"&gt;See here, benefits of CSS-in-JS&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Getting Started with Styled Components
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Installation and setup&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's what you'll need to get started with Styled Components:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React Setup:&lt;/strong&gt; Ensure you have a basic React project set up. You can use tools like Create React App to streamline this process (&lt;a href="https://create-react-app.dev/"&gt;https://create-react-app.dev/&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Styled Components Installation:&lt;/strong&gt; Install the Styled Components library using npm or yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install styled-components
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, you can import Styled Components into your project and start using them right away.&lt;/p&gt;

&lt;h1&gt;
  
  
  Deep Dive, Basic Syntax and Usage
&lt;/h1&gt;



&lt;h3&gt;
  
  
  Basic usage and syntax
&lt;/h3&gt;

&lt;p&gt;Styled Components leverage tagged template literals to define styles. Here's a basic example of creating a styled button component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: #007bff;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Creating styled components&lt;/strong&gt;&lt;br&gt;
Styled Components allow you to create custom styled versions of HTML elements or reusable component primitives, For example;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;StyledDiv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: #f0f0f0;
  padding: 1rem;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;StyledDiv&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;world&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/StyledDiv&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With Styled Components, the possibilities are endless. You can style any component or HTML element just like you would with traditional CSS, but with the added benefits of scoping and reusability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Styled Components in Action: Building Common UI Elements (with Illustrations)
&lt;/h3&gt;

&lt;p&gt;Now that we've grasped the core concepts, let's explore how Styled Components can be used to style various UI elements here:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Buttons:&lt;/strong&gt; As seen in the previous example, Styled Components excel at creating reusable buttons with customizable styles.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cards:&lt;/strong&gt; Build visually appealing and informative cards using styled components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Avatar Image:&lt;/strong&gt; Create styled Avatar Image for the card.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Card&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0.1, 0.1, 0.1, 0.2);
  padding: 20px;
  margin: 10px;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CardTitle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="s2"&gt;`
  font-size: 1.2em;
  margin-bottom: 10px;
  align-item: center;
  text-align: center;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CardContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="s2"&gt;`
  margin-bottom: 10px;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  padding: 10px 20px;
  background-color: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;AvatarImage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;img&lt;/span&gt;&lt;span class="s2"&gt;`
  margin: 0px 20px 0px 0px;
  height: 40px;
  border-radius: 50%;
  display: block;
  margin: auto;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProductCard&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
     &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Card&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CardTitle&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;James&lt;/span&gt; &lt;span class="nx"&gt;Washington&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/CardTitle&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;AvatarImage&lt;/span&gt;
      &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://miro.medium.com/v2/resize:fit:740/1*ooOH6jo8I0ns0J-BE0SAow.jpeg&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="nx"&gt;alt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;CardContent&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nx"&gt;Imagine&lt;/span&gt; &lt;span class="nx"&gt;styling&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;web&lt;/span&gt; &lt;span class="nx"&gt;applications&lt;/span&gt; &lt;span class="nx"&gt;like&lt;/span&gt; &lt;span class="nx"&gt;preparing&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;dish&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;You&lt;/span&gt; &lt;span class="nx"&gt;have&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;
      &lt;span class="nx"&gt;pantry&lt;/span&gt; &lt;span class="nx"&gt;full&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nf"&gt;ingredients &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;styles&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nf"&gt;recipe &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HTML&lt;/span&gt; &lt;span class="nx"&gt;structure&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt;
      &lt;span class="nx"&gt;follow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;But&lt;/span&gt; &lt;span class="nx"&gt;instead&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;traditional&lt;/span&gt; &lt;span class="nx"&gt;pots&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;pans&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;wield&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;magic&lt;/span&gt; &lt;span class="nx"&gt;wand&lt;/span&gt;
      &lt;span class="err"&gt;🪄&lt;/span&gt; &lt;span class="nx"&gt;that&lt;/span&gt; &lt;span class="nx"&gt;lets&lt;/span&gt; &lt;span class="nx"&gt;you&lt;/span&gt; &lt;span class="nx"&gt;conjure&lt;/span&gt; &lt;span class="nx"&gt;up&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;culinary&lt;/span&gt; &lt;span class="nx"&gt;creations&lt;/span&gt; &lt;span class="nx"&gt;effortlessly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;This&lt;/span&gt;
      &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;magic&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;CSS&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;JS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;particularly&lt;/span&gt; &lt;span class="nx"&gt;when&lt;/span&gt; &lt;span class="nx"&gt;wielded&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;power&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;
      &lt;span class="nx"&gt;Styled&lt;/span&gt; &lt;span class="nx"&gt;Components&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/CardContent&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Try&lt;/span&gt; &lt;span class="nx"&gt;Now&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Card&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Live Preview🛠️:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codesandbox.io/p/sandbox/css-in-js-using-styled-components-27yhsx"&gt;Explore the live preview in this sandbox environment.&lt;/a&gt; Feel free to experiment and apply various styling techniques within the playground.&lt;/p&gt;

&lt;p&gt;As an Engineer, while building and as my projects grew in complexity, I recognized the value of reusable components for streamlining development. This led me to create Vinyl Component Blocks, a component library built using Styled Components as the major styling methodology. &lt;a href="https://www.npmjs.com/package/vinyl-component-blocks"&gt;Vinyl Component Blocks&lt;/a&gt; aims to reduce repetitive tasks associated with UI component creation, promoting efficiency and a more consistent development experience. Feel free to explore the library on &lt;a href="https://github.com/Vinyl-Davyl/vinyl-component-blocks"&gt;GitHub&lt;/a&gt; to see its capabilities and how it leverages Styled Components for complex UI architectures.&lt;/p&gt;

&lt;p&gt;Check this links for Further Exploration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Styled Components Official Documentation:&lt;/strong&gt; Dive deeper into the library's features and API reference: &lt;a href="https://styled-components.com/docs"&gt;https://styled-components.com/docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Advanced Techniques with Styled Components:&lt;/strong&gt; Explore advanced techniques like theming, nesting, and global styles: &lt;a href="https://styled-components.com/docs/api"&gt;https://styled-components.com/docs/api&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Vinyl Component Blocks:&lt;/strong&gt; Explore the component library and it's capabilities and how it leverages Styled Components for complex UI architectures. &lt;a href="https://github.com/Vinyl-Davyl/vinyl-component-blocks"&gt;https://github.com/Vinyl-Davyl/vinyl-component-blocks&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Styling Strategies with Styled Components
&lt;/h3&gt;

&lt;p&gt;Unleashing the Power of Styled Components: Strategies for Dynamic and Reusable UIs. Styled Components offer a range of features to enhance your styling capabilities:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Global styles vs. component-specific styles&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Styled Components offer flexibility in defining both global styles and component-specific styles. Global styles can be defined using the createGlobalStyle API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;createGlobalStyle&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;styled-components&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;GlobalStyles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;createGlobalStyle&lt;/span&gt;&lt;span class="s2"&gt;`
  body {
    font-family: 'Roboto', sans-serif;
    background-color: #f8f8f8;
  }
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyApp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;GlobalStyles&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;While the component-specific styles are encapsulated within individual components. Like the previous example.&lt;/p&gt;

&lt;p&gt;This approach allows you to maintain a consistent design system across your application while still benefiting from the modularity of component-specific styles.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Theming and customizing with props&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One of the key features of Styled Components is the ability to customize styles based on component props. This is particularly useful for creating reusable components with dynamic styles and &lt;a href="https://styled-components.com/docs/advanced#theming"&gt;theming&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background-color: &lt;/span&gt;&lt;span class="p"&gt;${(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#007bff&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#6c757d&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;;
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Primary&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Secondary&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By leveraging props, you can create versatile components that adapt to different use cases without duplicating code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Nesting:&lt;/strong&gt; Nest styles within each other for more complex layouts and organization.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Styled System Integration:&lt;/strong&gt; Leverage popular styling systems like Bootstrap or Material-UI with Styled Components for a unified styling approach.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Beyond Styled Components: Exploring Alternatives
&lt;/h1&gt;

&lt;p&gt;While Styled Components is a popular choice for styling React applications, there are several alternatives worth exploring. &lt;a href="https://emotion.sh/docs/introduction"&gt;Emotion&lt;/a&gt;, &lt;a href="https://cssinjs.org/"&gt;JSS&lt;/a&gt;, and &lt;a href="https://css-modules.github.io/"&gt;CSS Modules&lt;/a&gt; are all viable options, each with its unique features and use cases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://emotion.sh/docs/introduction"&gt;Emotion&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Emotion is another CSS-in-JS library that offers similar functionality to Styled Components but with additional features like built-in CSS prop support and automatic vendor prefixing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://cssinjs.org/"&gt;JSS&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;JSS (JSS is great for... inline styles and theming) is a CSS-in-JS library that focuses on inline styles and theming. It provides a powerful API for dynamically generating styles based on component props, making it ideal for building highly customizable UI components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://css-modules.github.io/"&gt;CSS Modules&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CSS Modules is a different approach to styling in React applications that leverages the built-in CSS module support in bundlers like webpack. With CSS Modules, you can write traditional CSS files and import them into your components, enjoying benefits like &lt;strong&gt;local scope&lt;/strong&gt; and &lt;strong&gt;automatic class name generation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Hey, I’m not an expert on every single JavaScript styling library, so take this as you will. The bulk of my experience is with &lt;a href="https://styled-components.com/"&gt;Styled Components&lt;/a&gt;. It is an excellent tool popular with most of the &lt;a href="https://vinyldavyl.xyz"&gt;works I've done&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion and Next Steps
&lt;/h1&gt;

&lt;p&gt;Congratulations!🎊 You've now mastered the art of styling with CSS-in-JS using Styled Components. Armed with this knowledge, you can create beautiful and maintainable UI components that bring your web applications to life.&lt;/p&gt;

&lt;p&gt;But remember, mastering styling is an ongoing journey. Continue to explore new techniques, experiment with different libraries, and stay up-to-date with the latest trends in frontend development. With dedication and practice. Stay with me also for more updates and contents like this!&lt;/p&gt;

&lt;h1&gt;
  
  
  Illustrations and References
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://styled-components.com/docs"&gt;Styled Components official documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://emotion.sh/docs"&gt;Emotion official documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://cssinjs.org/"&gt;JSS official documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://css-modules.github.io/"&gt;CSS Modules official documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/diegohaz/awesome-react-components"&gt;GitHub repository for awesome React components&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://github.com/Vinyl-Davyl/vinyl-component-blocks"&gt;Vinyl-Component-Blocks, Styled Component Based UI library&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ready to conquer the world of styling with CSS-in-JS using Styled Components 💅🏻. Hope to see you next time, Merci!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>css</category>
    </item>
    <item>
      <title>Understanding the Role of Husky, ESLint and Prettier: Reasons for Adoption and Implementation Guidelines</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Mon, 14 Aug 2023 04:50:28 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/understanding-the-role-of-husky-eslint-and-prettier-reasons-for-adoption-and-implementation-guidelines-476j</link>
      <guid>https://dev.to/vinyldavyl/understanding-the-role-of-husky-eslint-and-prettier-reasons-for-adoption-and-implementation-guidelines-476j</guid>
      <description>&lt;p&gt;Frontend development has undergone rapid evolution throughout the years, introducing fresh frameworks, libraries, and tools that have streamlined the process of crafting visually appealing and user-friendly web applications. However, due to the escalating complexity of web projects, maintaining code quality, and consistency, and fostering developer collaboration have emerged as a notable challenge. This is where the robust combination of Husky, ESLint, and Prettier proves to be a lifesaver, offering an effective solution to amplify the frontend development workflow. In this comprehensive article, we will delve deep into the rationales behind utilizing this trio, the benefits it brings, and a step-by-step guide on configuring it to create a flawless development experience in general. Yeah! Let's dive right in.&lt;/p&gt;

&lt;h1&gt;
  
  
  1. Introduction to Husky, ESLint, and Prettier
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1.1 Husky
&lt;/h2&gt;

&lt;p&gt;Named after the loyal and sturdy husky dog, Husky is a Git hook manager for frontend developers mostly and developers in general. It helps enforce coding standards and prevent subpar code from being committed to a repository. By integrating Husky into your project, you can define scripts that run automatically before certain Git commands, such as committing or pushing code. This allows you to catch errors, run tests, and perform other pre-commit or pre-push tasks, ensuring that your codebase remains consistent and high-quality. Cool Right?&lt;/p&gt;

&lt;p&gt;You should see it as a stern dog, that always barks at you when do something wrong or do not follow its rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.2 ESLint
&lt;/h2&gt;

&lt;p&gt;ESLint is a widely used and configurable linter tool for JavaScript. It analyzes your code statically to identify potential issues, enforce coding standards, and maintain code quality. ESLint comes with a plethora of rules that can be customized based on your project's requirements. This tool not only detects syntax errors but also enforces best practices, ensuring that your code is readable, maintainable, and follows consistent coding conventions.&lt;/p&gt;

&lt;h2&gt;
  
  
  1.3 Prettier
&lt;/h2&gt;

&lt;p&gt;Code formatting is often a contentious topic within development teams. Prettier solves this challenge by automatically formatting your code according to a predefined style guide. It eliminates debates over coding style, ensuring that your codebase looks neat and uniform. Prettier supports various file formats and can be configured to format code as you write, creating a seamless experience for developers.&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Why Use the Husky, ESLint, and Prettier Trio?
&lt;/h1&gt;

&lt;p&gt;The combination of Husky, ESLint, and Prettier addresses several pain points in development and offers a multitude of benefits:&lt;/p&gt;

&lt;h2&gt;
  
  
  2.1 Code Consistency
&lt;/h2&gt;

&lt;p&gt;In collaborative development environments, maintaining a consistent code style across the entire codebase can be challenging. Different developers might have varying coding styles, leading to code that is hard to read and maintain. By integrating ESLint and Prettier through Husky hooks, you can enforce a unified coding style, ensuring that all code adheres to the same set of guidelines. This consistency improves code readability and reduces confusion among developers.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.2 Error Prevention
&lt;/h2&gt;

&lt;p&gt;Detecting errors and bugs early in the development process is essential for minimizing debugging time and maintaining a high-quality codebase. The Husky, ESLint, and Prettier trio assist in error prevention by running pre-commit and pre-push scripts. ESLint's static analysis capabilities catch issues such as syntax errors, potential bugs, and adherence to coding standards. This proactive approach helps developers identify and rectify problems before they reach the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.3 Efficient Collaboration
&lt;/h2&gt;

&lt;p&gt;In collaborative projects, differing coding styles can lead to unnecessary conflicts and discussions among developers. Prettier's automated code formatting and ESLint's rule enforcement eliminate the need for manual code formatting and style debates. Developers can focus on writing code and implementing features, knowing that the tools will handle formatting and standards compliance. This enhances teamwork, as the trio reduces friction and allows developers to concentrate on the creative aspects of their work.&lt;/p&gt;

&lt;h2&gt;
  
  
  2.4 Time Savings
&lt;/h2&gt;

&lt;p&gt;Manually formatting code, identifying and fixing errors, and debating coding standards consume a considerable amount of development time. The trio of Husky, ESLint, and Prettier automates these tasks, freeing up developers to concentrate on innovation and problem-solving. With automated code formatting, time spent on adjusting code style is minimized, and the development process becomes more efficient overall.&lt;/p&gt;

&lt;p&gt;As an illustration, consider a scenario where you wish to transition the import style from single quotes to double quotes throughout an entire legacy project to ensure uniformity. Prettier and ESLint can effectively accomplish this task on your behalf. Isn't that great?&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Setting Up Husky, ESLint, and Prettier: A Step-by-Step Guide
&lt;/h1&gt;

&lt;p&gt;In this section, we'll walk you through the process of setting up the Husky, ESLint, and Prettier trio in your frontend project. We'll cover installation, configuration, and integration with code samples to illustrate each step. Putting the Trio to Work.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.1 Integrating ESLint
&lt;/h2&gt;

&lt;p&gt;ESLint can be integrated into your project by installing it and configuring its rules. Start by installing ESLint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using npm
npm install eslint --save-dev

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using yarn
yarn add eslint --dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, initialize ESLint configuration using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx eslint --init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Subsequently, inaugurate ESLint configuration using the ensuing command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init @eslint/config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnj9e73w7cwbiqmz5zwh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnj9e73w7cwbiqmz5zwh.png" alt="Image description" width="800" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This command will guide you through setting up ESLint and selecting a configuration style. You can choose between popular styles like Standard, XO and more.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42dlurtcbpzq9aym4otn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F42dlurtcbpzq9aym4otn.png" alt="Image description" width="800" height="122"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After configuration, ESLint will generate a .eslintrc.cjs file with your chosen settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.2 Configuring ESLint
&lt;/h2&gt;

&lt;p&gt;Customizing ESLint rules is essential to align it with your project's coding standards. Open the .eslintrc.cjs file in your&lt;/p&gt;

&lt;p&gt;project directory and modify the rules accordingly. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
    "env": {
        "browser": true,
        "commonjs": true,
        "es2021": true,
        "jest": true,
    },
    "extends": "standard",
    "overrides": [
        {
            "env": {
                "node": true
            },
            "files": [
                ".eslintrc.{js,cjs}"
            ],
            "parserOptions": {
                "sourceType": "script"
            }
        }
    ],
    "parserOptions": {
        "ecmaVersion": "latest"
    },
    rules: {
    // Add your custom ESLint rules here
    'no-console': 'warn',
    'no-unused-vars': 'error',
    // ...
  },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By defining rules in your ESLint configuration, you can ensure that the codebase adheres to your desired coding conventions.&lt;/p&gt;

&lt;p&gt;Then in your package.json file, add the following commands to your scripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   //...
    "scripts": {
        //...
        "lint": "eslint .",
        "lint: fix": "eslint --fix ."
    },
    //...
}

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

&lt;/div&gt;



&lt;p&gt;Subsequently, run the lint command with npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run lint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvav1ubwewnxxk44f744x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvav1ubwewnxxk44f744x.png" alt="Image description" width="800" height="188"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Based on the above image, it is evident that several errors are present, particularly within a specific file that doesn't meet ESLint's criteria. Subsequently, we proceed to address these issues individually or utilize the npm run lint:fix command to potentially rectify errors that can be automatically resolved.&lt;/p&gt;

&lt;p&gt;For issues that can be rectified, employ:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run lint:fix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notably, certain software, such as CRA (Create React App) and Vite, incorporate ESLint by default, negating the need for a separate setup of ESlint. Alright, give it a try and see if you understand the idea! I hope you did. Excellent, let's proceed. Prettier next!&lt;/p&gt;

&lt;h2&gt;
  
  
  3.3 Automating Code Formatting with Prettier
&lt;/h2&gt;

&lt;p&gt;Prettier's automatic code formatting can be integrated into your project with a few simple steps:&lt;/p&gt;

&lt;p&gt;Install Prettier using npm or yarn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using npm
npm install prettier --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using yarn
yarn add prettier --dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a .prettierrc.js file in your project directory to define your code formatting preferences. For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  singleQuote: true,
  trailingComma: 'es5',
  useTabs: false,
};

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

&lt;/div&gt;



&lt;p&gt;Post-installation of Prettier, add it to plugins and extends in ESLint, allowing it to complement Prettier's formatting.&lt;/p&gt;

&lt;p&gt;Ensure the functionality of Prettier by installing the Prettier extension for VSCode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdeumfp0f7xbk53vvjk9k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdeumfp0f7xbk53vvjk9k.png" alt="Image description" width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the settings, ensure that your default formatter is set to Prettier and enable the "format on save" feature.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk217dbi0p82gywflb8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk217dbi0p82gywflb8y.png" alt="Image description" width="800" height="165"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And there you have it, whenever you save a file while working on a specific task, Prettier automatically performs its formatting function.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.4 Installing Husky
&lt;/h2&gt;

&lt;p&gt;Husky can be easily installed using a package manager like npm or yarn. Open your terminal and navigate to your project directory.&lt;/p&gt;

&lt;p&gt;One thing to always note is that the concept of Husky revolves around setting up ESLint or performing linting just before or as we prepare to commit. This approach aims to prevent the contamination of the existing code style of another element by executing a pre-commit script, among other considerations. I feel that's great.&lt;/p&gt;

&lt;p&gt;Setting up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using npm
npm install husky --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Using yarn
yarn add husky --dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Subsequently, execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx husky init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once installed, Husky provides a simple yet powerful way to manage Git hooks.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.5 Configuring Husky Hooks
&lt;/h2&gt;

&lt;p&gt;Husky hooks are scripts that run automatically before specific Git actions. To set up a pre-commit hook that integrates ESLint and Prettier, follow these steps:&lt;/p&gt;

&lt;p&gt;Open your project's &lt;code&gt;package.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Add a husky property to define your hooks. Here's an example configuration for running ESLint and Prettier before committing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;here's an example of a husky pre-commit file, which would be in the generated .husky folder&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, lint-staged is a tool that runs linters on staged files. We can then configure lint-staged to run ESLint and Prettier.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.6 Editor Integration
&lt;/h2&gt;

&lt;p&gt;Integrating Husky, ESLint, and Prettier with your code editor enhances your development experience by providing real-time feedback. Most modern code editors support extensions or plugins for these tools. So just like is specified for prettier, earlier on. Here's how you can integrate them with popular editors:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual Studio Code:&lt;/strong&gt; Install the ESLint and Prettier extensions from the Visual Studio Code marketplace. Once installed, these extensions will automatically apply linting and formatting to your code as you write.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sublime Text:&lt;/strong&gt; Use the SublimeLinter-eslint and SublimeLinter-contrib-prettier packages to integrate ESLint and Prettier into Sublime Text.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Atom:&lt;/strong&gt; Install the linter-eslint and atom-prettier packages to enable linting and formatting in the Atom editor.&lt;/p&gt;

&lt;p&gt;By integrating these tools into your code editor, you receive immediate feedback on code quality and formatting, ensuring that your code adheres to standards as you write.&lt;/p&gt;

&lt;h1&gt;
  
  
  4. Real-world Examples: Putting the Trio to Work
&lt;/h1&gt;

&lt;p&gt;In this section, we'll explore two real-world examples to demonstrate how the Husky, ESLint, and Prettier trio enhances frontend development workflows.&lt;/p&gt;

&lt;h2&gt;
  
  
  4.1 Example 1: Creating a React Component
&lt;/h2&gt;

&lt;p&gt;Let's consider a scenario where you're creating a React component named Button. With the Husky, ESLint, and Prettier trio in place, your workflow would look like this:&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Writing Code: *&lt;/em&gt; As you write the code for the Button component, ESLint provides real-time feedback on potential issues such as syntax errors, unused variables, and adherence to coding standards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Formatting:&lt;/strong&gt; Prettier automatically formats your code according to the defined style guide. This ensures that your code remains consistent and follows best practices.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Pre-commit Checks: *&lt;/em&gt; Before committing your changes, Husky's pre-commit hook kicks in. It runs lint-staged, which in turn runs ESLint and Prettier on the staged files. Any errors or formatting issues are caught and displayed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Committing:&lt;/strong&gt; With clean code and proper formatting, you can confidently commit your changes, knowing that you're contributing high-quality code to the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  4.2 Example 2: Collaborative Project Development
&lt;/h2&gt;

&lt;p&gt;Consider a larger project with multiple developers collaborating on different features. The Husky, ESLint, and Prettier trio becomes invaluable in this scenario:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pull Requests:&lt;/strong&gt; When developers create pull requests, the pre-commit and pre-push hooks ensure that the code adheres to coding standards. This minimizes the chances of introducing bugs or inconsistencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Reviews:&lt;/strong&gt; During code reviews, ESLint highlights issues that reviewers can address, enhancing the review process's efficiency. Prettier-formatted code is visually consistent, making it easier for reviewers to focus on the logic and functionality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Continuous Integration:&lt;/strong&gt; Automated testing and continuous integration pipelines benefit from the trio as well. Code that passes pre-commit and pre-push checks is more likely to pass automated tests, reducing the chances of build failures.&lt;/p&gt;

&lt;h1&gt;
  
  
  5. Best Practices and Customization
&lt;/h1&gt;

&lt;p&gt;Although the initial configurations offered by ESLint and Prettier are valuable, customizing them to align with your project's unique requirements is crucial. With that said, let's delve into some recommended practices and tips for customization that should unquestionably be part of your toolkit.&lt;/p&gt;

&lt;h2&gt;
  
  
  5.1 Choosing ESLint Rules
&lt;/h2&gt;

&lt;p&gt;ESLint's extensive collection of rules can be overwhelming. When choosing rules for your project, consider the following:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project Type:&lt;/strong&gt; Different project types might have different requirements. For instance, a Node.js backend project might have different ESLint rules compared to a frontend project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Team Consensus:&lt;/strong&gt; Collaborate with your development team to define a set of rules that everyone agrees on. This ensures consistency and prevents disagreements later on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Mistakes:&lt;/strong&gt; ESLint rules can catch common mistakes and potential bugs. Prioritize rules that address issues specific to your codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  5.2 Tailoring Prettier Formatting
&lt;/h2&gt;

&lt;p&gt;Prettier offers a wide range of formatting options that you can configure to match your team's preferences. Some customization options include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Indentation:&lt;/strong&gt; Set the number of spaces or tabs used for indentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Semicolons:&lt;/strong&gt; Choose whether to use semicolons at the end of statements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Line Length:&lt;/strong&gt; Define the maximum line length before Prettier wraps lines.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quotation Marks:&lt;/strong&gt; Specify whether to use single or double quotes for strings.&lt;/p&gt;

&lt;p&gt;By adjusting these formatting options, you can ensure that Prettier aligns with your project's coding standards and visual preferences.&lt;/p&gt;

&lt;h1&gt;
  
  
  6. Future Trends and Conclusion
&lt;/h1&gt;

&lt;p&gt;As frontend development continues to evolve, tools like Husky, ESLint, and Prettier are likely to become even more integral to the development workflow. With the increasing emphasis on code quality, collaboration, and efficiency, developers will continue to seek ways to streamline their processes and deliver high-quality web applications.&lt;/p&gt;

&lt;p&gt;I'm certain that after reading this article, you should now possess a comprehension of these three components (Eslint, Prettier, and Husky), their functions within the development journey, and the steps involved in setting them up for practical use. This understanding is what truly brings satisfaction to me in crafting this article – the act of sharing this knowledge. Do you agree? Yes lol, Fantastic!&lt;/p&gt;

&lt;p&gt;In summary, the Husky, ESLint, and Prettier trio empower frontend developers to produce precise, clean, and faultless code. This combination establishes a benchmark for superior frontend development by upholding coding standards, identifying errors promptly, and automating code formatting. By dedicating effort to tool setup and refinement, developers can unlock project potential and contribute to the development community's advancement.&lt;/p&gt;

&lt;p&gt;Keep on building and learning, buddy! For more similar content, do stay connected on my blog. Looking forward to your return.&lt;/p&gt;

&lt;p&gt;Till then, Merci!👋&lt;/p&gt;

&lt;p&gt;Useful resources I used in this article: Prettier: &lt;a href="https://prettier.io/"&gt;https://prettier.io/&lt;/a&gt; ESLint: &lt;a href="https://eslint.org/"&gt;https://eslint.org/&lt;/a&gt; Husky: &lt;a href="https://www.npmjs.com/package/husky"&gt;https://www.npmjs.com/package/husky&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to Deploy a FullStack NodeJs and Express App on Vercel</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Mon, 05 Jun 2023 18:04:39 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel-1ghb</link>
      <guid>https://dev.to/vinyldavyl/how-to-deploy-a-fullstack-nodejs-and-express-app-on-vercel-1ghb</guid>
      <description>&lt;p&gt;Hello there, Welcome back to my page. Whether you're a returning visitor or visiting for the first time, Voila! I'm more than thrilled to have you here. Recently, I completed a full-stack project named "Talku-Talku".&lt;/p&gt;

&lt;p&gt;Although after sharing it with my peers and the public in general, some developer friends of mine informed me that they struggled with deploying the project. As a result, I decided to write this insightful article on deploying a MERN stack project using Vercel. If you're interested in learning how to deploy a full MERN stack app on Vercel, you're right at the spot. Please join me and let's dive right in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Deploying a full-stack NodeJs and Express app on Vercel can seem daunting, especially if you're new to web development. But don't worry! With the right guidance and a fun analogy like I always use, you'll be able to deploy your app in no time.&lt;/p&gt;

&lt;p&gt;Imagine that your app is like a pizza. You have all the ingredients (code) ready, and now it's time to bake it and serve it to your customers (users). Vercel Here! Let's take it as a pizza oven – it takes care of all the technical details so that you can focus on making a delicious pizza (bakes the pizza so it can be served to consumers or customers).&lt;/p&gt;

&lt;p&gt;In this article, we'll walk through the steps of deploying your NodeJs and Express app on Vercel. And we'll cover everything from setting up your environment to configuring your deployment settings. Ace Up, Let's get started!&lt;/p&gt;

&lt;h2&gt;
  
  
  First Step: Setting up your environment
&lt;/h2&gt;

&lt;p&gt;Before we dive into deploying our app, let's make sure we have the right tools installed. Here are some of the most important things you'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js and npm: You can download and install Node.js from the official website. Npm comes bundled with Node.js.&lt;/li&gt;
&lt;li&gt;Git: This version control system will help you keep track of changes to your code. Download Git from the official website.&lt;/li&gt;
&lt;li&gt;A code editor: Choose a code editor that suits your preferences. We recommend Visual Studio Code, which is free and easy to use.&lt;/li&gt;
&lt;li&gt;Express.js: The popular web framework for Node.js, It provides several features such as routing, middleware support, and template engine integration, making it easier for developers to build server-side applications and APIs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you have these tools installed, you are one step ahead and almost ready to go. Open the terminal and navigate to your project folder by typing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd path/to/your/folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ensure that both the client and server of your application are ready for development, add another terminal for the server, navigate its server path and run both servers, Your server needs to be connected to your database and listening on the specified port(check out my &lt;a href="https://vinyldavyl.hashnode.dev/how-to-create-a-database-in-mongodb-atlas-and-connect-your-database-to-your-application-step-by-step"&gt;article&lt;/a&gt; to get more insight on connecting your app to a database), while your client should be accessible through the browser on your localhost.&lt;/p&gt;

&lt;p&gt;Now that we have our environment set up, let's move on to deploying your app on vercel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Second Step: Kicking off deployment on Vercel
&lt;/h2&gt;

&lt;p&gt;Now that we have our app up and running locally, it's time to deploy it to Vercel. Here's what you need to do:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign up for a Vercel account: If you don't already have a Vercel account, sign up at &lt;a href="https://vercel.com/signup"&gt;https://vercel.com/signup&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install the Vercel CLI: The Vercel CLI is a command-line tool that makes it easy to deploy your app. Install it by running the following command in your terminal:
&lt;code&gt;npm install -g vercel&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Log in to Vercel&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deploying the Backend or API of your MERN application:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Log in to &lt;strong&gt;Vercel&lt;/strong&gt; dashboard and click on the “Add New…” button and select the “Project” category. As you can see here, I'm already logged in and I have quite a number of projects with vercel already deployed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxx2bwuiwta7qdrn3veyk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxx2bwuiwta7qdrn3veyk.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Import your Git repository after linking your Github/Gitlab/BitBucket account with Vercel, In this case, we would be working with "&lt;a href="https://talku-talku-v3.vercel.app"&gt;talku-talku-v3&lt;/a&gt;" for this article.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8l84mshzu4n5at3n6w1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8l84mshzu4n5at3n6w1.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Configure the backend/server for your MERN application on Vercel&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdn1wb3adcwmt7rpj33w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdn1wb3adcwmt7rpj33w.png" alt="Image description" width="800" height="352"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name your project, such as "my-project-backend"&lt;/li&gt;
&lt;li&gt;Select "Other" in the framework option to tailor the setup and customization process to Node.js.&lt;/li&gt;
&lt;li&gt;Indicate the backend directory of your project where Vercel will run the build command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fipe6q5lfa6bbrtl0xrln.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fipe6q5lfa6bbrtl0xrln.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add any necessary environmental variables, such as &lt;strong&gt;MONGO_ATLAS_URL: my-mongo-atlas-url&lt;/strong&gt;. Note: There could be more than one!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f276giatd0063h1dz8m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f276giatd0063h1dz8m.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, click on the "Deploy" button.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frlpkqxmcok4a6qqo4mcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frlpkqxmcok4a6qqo4mcy.png" alt="Image description" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt; Very Important, Include the provided &lt;strong&gt;vercel.json&lt;/strong&gt; file in your backend/server root directory and then push it to your remote repository. This will enable Vercel configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "version": 2,
    "builds": [
        {
            "src": "*.js",
            "use": "@vercel/node"
        }
    ],
    "routes": [
        {
            "src": "/(.*)",
            "dest": "/"
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt;🎊 Your backend will be up and running within a few minutes after deployment. You should see something &lt;a href="https://talku-talku-v3-server.vercel.app"&gt;like this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0oc1xg6hmyy15k7g72rs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0oc1xg6hmyy15k7g72rs.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quick Note:&lt;/strong&gt; As soon as possible, don’t forget to save the new deployment link of your server. "&lt;a href="https://talku-talku-v3-sever.vercel.app"&gt;https://talku-talku-v3-server.vercel.app&lt;/a&gt;" in this case, and replace it in your code wherever the local server link was provided.&lt;/p&gt;

&lt;h3&gt;
  
  
  Deploying the Frontend of your MERN application:
&lt;/h3&gt;

&lt;p&gt;Quite similar to the backend deployment of our app, we follow the same process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Once again, Go to &lt;strong&gt;Vercel&lt;/strong&gt; dashboard and click on the “Add New…” button and select the “Project” category.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Import your Git repository after linking your Github/Gitlab/BitBucket account with Vercel, In this case, we would are definitely working with "&lt;a href="https://talku-talku-v3.vercel.app"&gt;talku-talku-v3&lt;/a&gt;" for this article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Configure the frontend for your MERN application on Vercel&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name your project, such as "my-project-frontend"&lt;/li&gt;
&lt;li&gt;Choose "Create-React-App" from the available frameworks to ensure that the configuration and modification procedures are tailored for React.js.&lt;/li&gt;
&lt;li&gt;Indicate the frontend directory of your project where Vercel will run the build command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhn87lld7yt5fm9fyly9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhn87lld7yt5fm9fyly9d.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add any necessary environmental variables, such as &lt;strong&gt;REACT_APP_LOCALHOST_KEY: chat-app-current-user&lt;/strong&gt;. Note: There could be more than one and you might want to consider adding &lt;strong&gt;GENERATE_SOURCEMAP: false&lt;/strong&gt; for security and performance reasons.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6p3c0x4dspbw77yrc87q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6p3c0x4dspbw77yrc87q.png" alt="Image description" width="800" height="357"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally, click on the "Deploy" button once you're done.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Congratulations!&lt;/strong&gt;🎊 Your frontend will be up and running within a few minutes after deployment. You should see something &lt;a href="https://talku-talku-v3.vercel.app"&gt;like this&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffaw8it5i8j478sue8pwm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffaw8it5i8j478sue8pwm.png" alt="Image description" width="800" height="354"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Finally, Checking and Allowing CORS policy after deployment
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To solve for CORS policy error if one eventually comes up after deployment of your full-stack app, you can install the cors package and use it to allow cross-origin requests from other domains. This can be done by adding the following code snippet to your backend server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const cors = require('cors');

// Allow all origins
app.use(cors());

// Allow specific origin(s)
app.use(cors({
  origin: 'https://yourdeployedsite.com'
}));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additionally, you should always check the console for errors, including any CORS errors. This will help you identify and fix any issues that may arise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Deploying a full-stack Node.js and Express app on Vercel doesn't have to be difficult. By following the steps outlined in this article and using the pizza analogy at the introduction of this article to get a clearer view, you can easily get your app up and running in no time.&lt;/p&gt;

&lt;p&gt;After all that's been said and done, don't forget to check out "&lt;a href="https://talku-talku-v3.vercel.app"&gt;Talku-Talku-V3&lt;/a&gt;" on &lt;a href="https://github.com/Vinyl-Davyl/talku-talku-v3"&gt;GitHub&lt;/a&gt;. Sign up to chat and send media with friends and foes! Share your review and feedback, and leave a star⭐️ if you find something interesting.&lt;/p&gt;

&lt;p&gt;Overall, you should by now have a good understanding of the deployment process for a full-stack MERN app using Vercel, including common challenges and best practices. I sure hope so. Please do follow me for more content and updates like this in the future. Until we meet again.&lt;/p&gt;

&lt;p&gt;Merci!!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Getting Started with Solidity, All you need to know (A Step by Step Guide).</title>
      <dc:creator>Vinyl-Davyl</dc:creator>
      <pubDate>Wed, 03 May 2023 16:39:05 +0000</pubDate>
      <link>https://dev.to/vinyldavyl/getting-started-with-solidity-all-you-need-to-know-a-step-by-step-guide-p7d</link>
      <guid>https://dev.to/vinyldavyl/getting-started-with-solidity-all-you-need-to-know-a-step-by-step-guide-p7d</guid>
      <description>&lt;p&gt;Solidity is a high-level programming language used to write smart contracts on the Ethereum blockchain. Smart contracts are self-executing programs that automatically enforce the terms of an agreement between two or more parties.&lt;/p&gt;

&lt;p&gt;In this article, we will provide a step-by-step guide on getting started with Solidity. We'll begin by giving a brief introduction to the language and its basic structure, followed by an overview of data types, functions, and events in Solidity. So, let's dive right in and learn how to write smart contracts using Solidity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;To start writing Solidity code, you need to have at least all of the following;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A development environment like Remix or Hardhat: Remix is an online IDE that allows you to write and test Solidity code in your browser, while Hardhat is a local development environment that gives you more control over your development process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A text editor: This can be any text editor, such as Visual Studio Code, Atom, or Sublime Text.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An Ethereum wallet: You will need to have an Ethereum wallet to deploy your smart contracts to the blockchain. There are several wallets available, including MetaMask and MyEtherWallet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Solidity compiler: You will need a Solidity compiler to compile your code into bytecode that can be executed on the Ethereum Virtual Machine (EVM). The most popular compiler is the solc compiler.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Basic Structure
&lt;/h2&gt;

&lt;p&gt;A Solidity contract is a collection of functions and data that can be deployed to the Ethereum blockchain. Here's an example of a simple Solidity contract:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    uint256 myVariable;

    function set(uint256 _myVariable) public {
        myVariable = _myVariable;
    }

    function get() public view returns (uint256) {
        return myVariable;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hey, Don't Chicken Out! We would explain and go through this together. Cool!👌&lt;/p&gt;

&lt;p&gt;In this contract, there is a state variable myVariable, set, get.&lt;/p&gt;

&lt;p&gt;This Solidity code creates a smart contract with a single unsigned integer variable called myVariable It has two functions, set and get. The set function takes an argument _myVariable and sets the value of myVariable to it. The get function returns the current value of myVariable. The pragma statement specifies the version of the Solidity compiler to be used.&lt;/p&gt;

&lt;p&gt;Cool Right? It's Just the Intro, Let's dive right into data types In solidity.👨‍🍳&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Types
&lt;/h2&gt;

&lt;p&gt;Here's an explanation of some data types in Solidity with examples&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;bool&lt;/strong&gt;
: A boolean value that can be either true or false. For example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bool myBool = true;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;int&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and uint: These are integer types where int can store negative values and uint can only store positive values. The number after the type determines the number of bits used to represent the value. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int8 myInt8 = -123;
uint16 myUint16 = 12345;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;address&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: This is a 20-byte variable used to store Ethereum addresses. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;address myAddress = 0x1234567890123456789012345678901234567890;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;string&lt;/strong&gt;
: This is used to store dynamic string values. For example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string myString = "Hello, world!";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;bytes&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: This is used to store byte arrays. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bytes myBytes = hex"0011223344556677";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;struct&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: A struct is a custom-defined composite type that groups other variables. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;struct Person {
    string name;
    uint age;
}

Person myPerson = Person("Alice", 25);

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;enum&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: An enumeration is a custom-defined type that defines a set of named constants. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;enum Color { RED, GREEN, BLUE }
Color myColor = Color.RED;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;mapping&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: A mapping is a key-value store where the keys and values can be of any type. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mapping(address =&amp;gt; uint256) balances;
balances[0x1234567890123456789012345678901234567890] = 100;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;array&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;: An array is used to store a collection of values of the same type. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;uint256[] myArray = [1, 2, 3];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are just some of the basic data types available in Solidity. There are more specialized types such as fixed-point numbers, multi-dimensional arrays, and others that you can learn about as you dive deeper into Solidity programming.&lt;/p&gt;

&lt;p&gt;Next Up, Functions!✨&lt;/p&gt;

&lt;h2&gt;
  
  
  Functions
&lt;/h2&gt;

&lt;p&gt;Functions are an essential component of Solidity, allowing developers to define the behavior and functionality of smart contracts. We would go through some key examples of functions in Solidity:&lt;/p&gt;

&lt;p&gt;Defining a public function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    uint256 myVariable;

    function set(uint256 _myVariable) public {
        myVariable = _myVariable;
    }

    function get() public view returns (uint256) {
        return myVariable;
    }
}

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

&lt;/div&gt;



&lt;p&gt;In this example, we define two functions set and get. The set function is a public function that sets the value of myVariable, while the get function is a public view function that returns the value of myVariable.&lt;/p&gt;

&lt;p&gt;Defining a private function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    uint256 myVariable;

    function set(uint256 _myVariable) public {
        myVariable = _myVariable;
        doSomething();
    }

    function doSomething() private {
        // Do something here
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we define a private function doSomething which can only be called from within the contract (set calls doSomething). Private functions are not visible to external contracts or accounts.&lt;/p&gt;

&lt;p&gt;Defining an external function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    function doSomething() external {
        // Do something here
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similarly! In this case, we define an external function doSomething. External functions can only be called from outside the contract and not from within the contract itself.&lt;/p&gt;

&lt;p&gt;Defining an internal function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    uint256 myVariable;

    function set(uint256 _myVariable) public {
        myVariable = _myVariable;
        doSomething();
    }

    function doSomething() internal {
        // Do something here
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We define an internal function here, doSomething which can only be called from within the contract or any derived contracts. Internal functions are not visible to external contracts or accounts.&lt;/p&gt;

&lt;p&gt;Next Up, Events!✨&lt;/p&gt;

&lt;h2&gt;
  
  
  Events
&lt;/h2&gt;

&lt;p&gt;Events in Solidity are used to notify external applications or contracts about certain actions that have occurred within a smart contract. They are similar to log messages and can be accessed via the Ethereum blockchain.&lt;/p&gt;

&lt;p&gt;Here is an example of how to create and emit an event in Solidity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.8.0;

contract MyContract {
    event MyEvent(uint256 indexed id, string message);

    function doSomething(uint256 id, string memory message) public {
        // perform some action here

        emit MyEvent(id, message);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we define an event called MyEventwith two parameters: id (an unsigned integer with an index) and message (a string). Within the doSomething function, we perform some action and then emit the event with the appropriate values.&lt;/p&gt;

&lt;p&gt;To listen for and respond to events in another contract or application, you can use the web3.js library or a similar tool. Here is an example of how to listen for events emitted by the above contract using web3.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myContract = new web3.eth.Contract(contractABI, contractAddress);

myContract.events.MyEvent({ filter: { id: 123 } })
    .on('data', function(event) {
        console.log(event.returnValues.message);
    })
    .on('error', console.error);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code creates a new instance of MyContractusing the contract's ABI and address. It then listens for the MyEvent event with an ID of 123 and logs the corresponding message to the console when the event is triggered. If an error occurs, it will also be logged into the console.&lt;/p&gt;

&lt;p&gt;Overall, events are a powerful way to communicate information between different parts of a decentralized application or even between different applications on the Ethereum network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Congratulations, you've successfully taken your first steps into the exciting world of Solidity! Armed with the knowledge of basic structure, data types, functions, and events, you're ready to start building on the Ethereum blockchain like a pro. Get ready to amaze your friends and family with your newfound skills in writing smart contracts - who knows, you might even become the next Vitalik Buterin!🧖‍♂️(Imagination)&lt;/p&gt;

&lt;p&gt;This is just an Introductory guide to Solidity, but don't be afraid to dive deep and expand your knowledge! Get friendly with the language, read through the documentation, try building a mini Dapp and maybe you'll even create the next big thing on the blockchain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;In a blog post for &lt;a href="https://blog.web3afrika.com/"&gt;Web3Afrika&lt;/a&gt;, I discussed the benefits of using blockchain technology and an Introductory guide on all you need to know to get started with solidity. For more content analysis like this, check out my &lt;a href="https://dev.to/vinyldavyl"&gt;Personal Page&lt;/a&gt; here and follow me here on DevTo.&lt;/p&gt;

&lt;p&gt;Until next time, Happy Exploring!&lt;/p&gt;

&lt;p&gt;Cheers,&lt;/p&gt;

&lt;p&gt;Vinyl-Davyl.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>javascript</category>
      <category>web3</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
