<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Ivad Yves HABIMANA</title>
    <description>The latest articles on Forem by Ivad Yves HABIMANA (@ivadyhabimana).</description>
    <link>https://forem.com/ivadyhabimana</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%2F837524%2Fd40e404e-b5df-4701-9299-597d7f397177.jpeg</url>
      <title>Forem: Ivad Yves HABIMANA</title>
      <link>https://forem.com/ivadyhabimana</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ivadyhabimana"/>
    <language>en</language>
    <item>
      <title>2. Why do we add @Module() on the Nest.js app module?</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Mon, 03 Nov 2025 11:28:40 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/2-why-do-we-add-module-on-the-nestjs-app-module-3lel</link>
      <guid>https://forem.com/ivadyhabimana/2-why-do-we-add-module-on-the-nestjs-app-module-3lel</guid>
      <description>&lt;p&gt;This article is part of the &lt;a href="https://dev.to/ivadyhabimana/series/33931"&gt;Nest.js Deep Dive Series&lt;/a&gt;. I recommend reading the previous article first to make following along easier.&lt;br&gt;
You can find the code described in the article &lt;a href="https://github.com/Yvad60/blog-code-references/tree/nest-deep-dive-02" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/ivadyhabimana/nestjs-deep-dive-series-the-simplest-nest-application-with-javascript-27ed"&gt;previous article&lt;/a&gt;, we introduced Nest.js, explained what it is, and created a simple Nest application in JavaScript.&lt;/p&gt;

&lt;p&gt;Here is the code we currently have&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&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;NestFactory&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="s2"&gt;@nestjs/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppModule&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// Just an empty class for now&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bootstrapp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AppModule&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// we create the app with our module&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;bootstrapp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point, we are calling await NestFactory.create() and passing in AppModule to create our Nest.js application. The AppModule is currently just an empty class, so the code runs but doesn’t actually do anything.&lt;/p&gt;

&lt;p&gt;In this article, we’ll take a closer look at what the AppModule is and how it’s supposed to work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nest.js Modules
&lt;/h2&gt;

&lt;p&gt;According to the official &lt;a href="https://docs.nestjs.com/modules" rel="noopener noreferrer"&gt;Nest documentation&lt;/a&gt; &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A module is a class that is annotated with the @Module() decorator. This decorator provides metadata that Nest uses to efficiently organize and manage the application structure.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But what does this really mean? Let’s break it down into simpler terms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First, a module is a class&lt;/strong&gt;&lt;br&gt;
In the previous article, we initialized a Nest application by calling the NestFactory.create() function. This function expects a Nest.js module, which is why we were able to pass an empty class—it worked because, at its core, a module is a class.&lt;/p&gt;

&lt;p&gt;However, a module is not just &lt;em&gt;any&lt;/em&gt; class. The definition says, &lt;em&gt;“A module is a class that is annotated with the @Module() decorator.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This a&lt;code&gt;@Module()&lt;/code&gt; decorator is what makes it special. It adds extra metadata that Nest internally uses to organize and manage the application structure.&lt;/p&gt;

&lt;p&gt;To really understand this, we first need to understand what a decorator is.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is a decorator?
&lt;/h3&gt;

&lt;p&gt;At a high level, a decorator is a function that wraps another function, class, or method to add extra behavior to it, without modifying its original code.&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%2F6y871yby5it3qzopbfif.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%2F6y871yby5it3qzopbfif.png" alt="Decorator demonstration" width="785" height="415"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;source: &lt;a href="https://www.telerik.com/blogs/decorators-in-javascript" rel="noopener noreferrer"&gt;https://www.telerik.com/blogs/decorators-in-javascript&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let's take a real-life example&lt;/p&gt;

&lt;p&gt;We decorate things because we want them to look or behave differently. For example, you might take a plain box and wrap it in gift paper to turn it into a Christmas present. 🎁&lt;br&gt;
In this case, the box hasn’t changed; it’s just been decorated to serve a new purpose as a gift container.&lt;/p&gt;

&lt;p&gt;Another example is when someone uses lipstick for makeup; they are decorating their lips to make them have a different look&lt;/p&gt;

&lt;p&gt;Notice that by decorating something, we don’t change its original structure. This gives us flexibility—we can apply or remove decorations as we like. Lipstick, for example, doesn’t permanently alter someone’s lips (it would be weird if they did 😁); they can always apply a different makeup style later.&lt;/p&gt;

&lt;p&gt;Now let’s see this concept in code&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;class&lt;/span&gt; &lt;span class="nc"&gt;Box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&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;We define a box that has a white color&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GiftContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;coverColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;color&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;We define a decorator &lt;code&gt;GiftContainer&lt;/code&gt; that takes a cover color and applies it to the given "target" class&lt;/p&gt;

&lt;p&gt;Here is the full code example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GiftContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;color&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="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;coverColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;GiftContainer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;red&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Box&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;color&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;white&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&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;birthdayBox&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Box&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;birthdayBox&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;coverColor&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Outputs "red"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We use the &lt;code&gt;@&lt;/code&gt; syntax to apply the decorator. It calls the &lt;code&gt;GiftContainer&lt;/code&gt; function and passes the Box class as its target.&lt;/p&gt;

&lt;p&gt;The real power of decorators comes from separating enhancement logic from the original implementation.&lt;/p&gt;

&lt;p&gt;In Nest.js, for example, you might have the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Controller&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserController&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on how @Controller is implemented, applying it to UserController adds extra information and behavior that Nest can recognize internally to make your application work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using Decorators in our JavaScript Nest.js application
&lt;/h3&gt;

&lt;p&gt;Now that we have a basic understanding of how decorator works, let’s integrate them into our Nest.js app from the previous article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: &lt;br&gt;
Currently, JavaScript doesn’t officially support decorator syntax—it’s still considered experimental. However, we can use Babel, a JavaScript transpiler, to enable decorators even before they become a standard feature.&lt;/p&gt;

&lt;p&gt;Let's install the necessary Babel dependencies&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @babel/core @babel/cli @babel/plugin-proposal-decorators
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@babel/core&lt;/code&gt; includes the base functionality that Babel needs to work&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@babel/cli&lt;/code&gt;: Allow us to use Babel via command line (terminal)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@babel/plugin-proposal-decorators&lt;/code&gt;: Now the package that will allow us to use decorators.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After installing, we need to configure Babel so it recognizes our setup. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a file called &lt;code&gt;babel.config.json&lt;/code&gt; paste the following configuration
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;babel.config.json&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"plugins"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="s2"&gt;"@babel/plugin-proposal-decorators"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2023-05"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Babel that we’re using the decorators plugin (the one we just installed) and specifies the version we’re targeting (the latest one as of now)&lt;/p&gt;

&lt;p&gt;Next, we need to update or start the script so Babel compiles our code before Node runs it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;package.json&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"start"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"babel index.js -d dist &amp;amp;&amp;amp; node dist/index.js"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now our start script first runs Babel to compile index.js and output the result in a &lt;code&gt;dist&lt;/code&gt; folder. Once that’s done, Node runs the compiled version (&lt;code&gt;dist/index.js&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Now if you run &lt;code&gt;npm start&lt;/code&gt;, our app should work as before, but now with Babel in place to support decorators.&lt;/p&gt;

&lt;h3&gt;
  
  
  Back to Our Module
&lt;/h3&gt;

&lt;p&gt;Let’s revisit the definition of a module:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;A module is a class annotated with a &lt;code&gt;@Module()&lt;/code&gt; decorator. The &lt;code&gt;@Module()&lt;/code&gt; decorator provides metadata that &lt;/em&gt;&lt;em&gt;Nest&lt;/em&gt;&lt;em&gt; makes use of to organize the application structure.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With our new understanding of decorators, we can guess what &lt;code&gt;@Module()&lt;/code&gt; is doing; it wraps a class and attaches metadata that Nest uses internally to link different parts of the app together.&lt;/p&gt;

&lt;p&gt;With our new knowledge of decorator, we can have an idea of what &lt;code&gt;@Module()&lt;/code&gt; must be doing, it will wrap a class and provide some metadata that Nest will use internally to know which parts of the application are related. Let’s see this in action &lt;/p&gt;

&lt;p&gt;We updated our application to be like the following&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;Module&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="s2"&gt;@nestjs/common&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&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="s2"&gt;@nestjs/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;@&lt;/span&gt;&lt;span class="nd"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;({})&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppModule&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;bootstrapp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AppModule&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;bootstrapp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we imported the @Module decorator and applied it to our AppModule class.&lt;br&gt;
We’re passing an empty object for now, since @Module() expects metadata—such as which controllers or providers belong to this module—but we haven’t added any yet.&lt;/p&gt;

&lt;p&gt;You can have multiple modules in a Nest.js application, but you need at least one root module to initialize the app. The module passed into NestFactory.create() is known as the root module.&lt;/p&gt;

&lt;p&gt;Now, if you run npm start again, your Nest application should start up just as before—only this time, it’s using proper module structure.&lt;/p&gt;

</description>
      <category>backend</category>
      <category>nextjs</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>1. Set up a Nest.js application in Node.js from scratch</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Fri, 22 Aug 2025 14:37:30 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/nestjs-deep-dive-series-the-simplest-nest-application-with-javascript-27ed</link>
      <guid>https://forem.com/ivadyhabimana/nestjs-deep-dive-series-the-simplest-nest-application-with-javascript-27ed</guid>
      <description>&lt;p&gt;Hi reader!&lt;br&gt;
Welcome to the "Nest.js Deep Dive" series. In this series, we’ll explore the internals of Nest.js to understand how it works and how you can start using it to build your backend applications.&lt;/p&gt;

&lt;p&gt;We’ll begin with the complete basics and gradually build strong mental models that will give you confidence when developing your next Nest.js project.&lt;/p&gt;

&lt;p&gt;I created this series after doing a lot of research and realizing that there weren’t enough resources that go deep into the framework for people starting. Most tutorials jump straight into practical usage without first building a strong foundation for beginners. This series is the resource I wish I had when I was learning Nest.js myself.&lt;br&gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;You can find the code discussed in this article &lt;a href="https://github.com/Yvad60/blog-code-references/tree/nest-deep-dive-01" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;/em&gt;&lt;br&gt;
Let’s get started...&lt;/p&gt;
&lt;h3&gt;
  
  
  What is Nest.js
&lt;/h3&gt;

&lt;p&gt;According to the Nest.js documentation:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Nest (NestJS) is a framework for building efficient, scalable Node.js server-side applications.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s break down this simple definition to understand what it means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Nest.js as a framework&lt;/strong&gt;: A &lt;a href="https://www.reddit.com/r/AskProgramming/comments/14tahm3/so_what_exactly_is_a_framework/" rel="noopener noreferrer"&gt;framework&lt;/a&gt; is a foundational structure you can build software on, so you’re not starting entirely from scratch. Since Nest.js is a framework, it “forces” its users to structure their code in a predefined way, making it easier to maintain, test, and reason about.&lt;br&gt;
.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-side application&lt;/strong&gt;: Nest.js is built with Node.js to create applications that run on the server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's talk a bit more about building a server-side application&lt;/p&gt;

&lt;p&gt;The term "server" can mean different things depending on context. Sometimes it refers to a &lt;em&gt;"physical computer"&lt;/em&gt; that provides resources to other computers (clients). Other times, it refers to the &lt;em&gt;"software application"&lt;/em&gt; running on that machine for handling requests and sending back responses.   &lt;/p&gt;

&lt;p&gt;For example, when you open a profile page on Facebook, your browser sends a request to Facebook’s servers (the machines). On those servers, a "web server application" processes the request and responds with the page you see.&lt;/p&gt;
&lt;h4&gt;
  
  
  Nest.js and Express.js
&lt;/h4&gt;

&lt;p&gt;Another popular framework for building web servers in Node.js is &lt;strong&gt;Express.js&lt;/strong&gt;. In fact, under the hood, Nest.js uses Express (or similar frameworks) to simplify the process of creating server-side applications.  &lt;/p&gt;

&lt;p&gt;The main difference between the two is that &lt;strong&gt;Nest.js is opinionated&lt;/strong&gt;, while &lt;strong&gt;Express is unopinionated&lt;/strong&gt;. This means the creators of Nest.js have strong "opinions" and a set of best practices for how backend code should be organized and written. With Express, however, you are free to define your own structure and approach. &lt;/p&gt;

&lt;p&gt;Enough with the words, let's start writing some code... &lt;/p&gt;
&lt;h3&gt;
  
  
  Creating the simplest Nest.js application
&lt;/h3&gt;

&lt;p&gt;Usually, to create a Nest.js application, we use the &lt;a href="https://docs.nestjs.com/cli/overview" rel="noopener noreferrer"&gt;Nest CLI&lt;/a&gt;. The CLI sets up and configures most of the boilerplate for you, giving you a working application in seconds.  &lt;/p&gt;

&lt;p&gt;The downside is that it works like magic; we don’t get to see what’s happening under the hood. In this article, we’ll create the base files ourselves. For simplicity, we’ll start by using &lt;strong&gt;Nest.js in a JavaScript environment&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Note: Nest.js uses and recommends TypeScript. We are only using JavaScript here for learning purposes. Later in the series, we’ll discuss using TypeScript and the CLI to simplify development once we understand the basics.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Set up a new Node.js application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Installing the required dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;--save&lt;/span&gt; @nestjs/core @nestjs/common @nestjs/platform-express rxjs reflect-metadata
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understanding the packages we just installed&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@nestjs/core&lt;/code&gt;: This is the core package that includes essential functionalities and the environment needed to run a Nest application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@nestjs/common&lt;/code&gt;: This contains elements commonly used across a Nest application, such as controller decorators and HTTP handling logic (we’ll cover this in detail later).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;@nestjs/platform-express&lt;/code&gt;: Since Nest is built on top of Express, this package enables seamless integration between Nest and Express.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;rxjs&lt;/code&gt;: Nest uses rxjs internally to handle asynchronous tasks and allow reactive programming, such as processing incoming requests or managing data flows.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;reflect-metadata&lt;/code&gt;: This package allows Nest to attach additional metadata to classes and functions, which is required for decorators (we’ll explain decorators later in the series).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Initializing the Nest application
&lt;/h4&gt;

&lt;p&gt;Create an &lt;code&gt;index.js&lt;/code&gt; file and add the following piece of code&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;NestFactory&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="s2"&gt;@nestjs/core&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;bootstrapp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// creating the app&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// listening on Port 3000&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;bootstrapp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Running the code above with node index.js will cause an error because NestFactory.create() expects arguments, which we haven’t passed yet.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&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%2F2389mt9kq5z0v0yjl7ae.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%2F2389mt9kq5z0v0yjl7ae.png" alt="Image showing error thrown by nest application" width="800" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Even though the code will throw an error, let’s take a moment to understand what’s happening here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;We are importing the &lt;code&gt;NestFactory&lt;/code&gt; object from the &lt;code&gt;@nestjs/core package&lt;/code&gt;. As the name “factory” suggests, this object contains methods required to create a Nest application.&lt;br&gt;
.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We define a function called &lt;code&gt;bootstrap&lt;/code&gt; that initializes (or "bootstraps") a new Nest application by calling &lt;code&gt;NestFactory.create()&lt;/code&gt;. This method returns a promise that resolves to the app object, so we await it to get the actual application instance.&lt;br&gt;
.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;From the app object, we call the &lt;code&gt;listen&lt;/code&gt; method and tell it to listen on port 3000. This means any requests sent to port 3000 will be handled by our Nest application.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Now let’s fix our&lt;/strong&gt; &lt;code&gt;NestFactory.create()&lt;/code&gt; &lt;strong&gt;error&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;NestFactory.create()&lt;/code&gt; method expects at least one argument, which is the &lt;strong&gt;root module&lt;/strong&gt; of our application. For now, don’t worry too much about what a module is. At a high level, a module is simply a class that holds information about the available controllers, services (we’ll talk about these later), and other application logic. You can think of it as the "root of our application logic".  &lt;/p&gt;

&lt;p&gt;To keep things simple, we can just create a basic plain JavaScript class with nothing inside it for now, just to make &lt;code&gt;NestFactory.create()&lt;/code&gt; stop crying 😂&lt;/p&gt;

&lt;p&gt;Update the code in &lt;code&gt;index.js&lt;/code&gt; to be the following&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;NestFactory&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="s2"&gt;@nestjs/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;AppModule&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// Just an empty class for now&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bootstrapp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;NestFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;AppModule&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// we create the app with our module&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nf"&gt;bootstrapp&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it, that’s the simplest Nest application you can create in JavaScript :). If you try to open &lt;code&gt;http://localhost:3000&lt;/code&gt; in the browser or something like Postman, you should get an error that looks like&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="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&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="s2"&gt;Cannot GET /&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="s2"&gt;error&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="s2"&gt;Not Found&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="s2"&gt;statusCode&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is because we have not implemented any endpoint, but at least our web server application is up and running and responding to requests.&lt;/p&gt;

&lt;p&gt;In the next article we will, we will build on our current progress go deep into Nest.js Module&lt;/p&gt;

&lt;p&gt;See you next...&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>node</category>
      <category>typescript</category>
      <category>backend</category>
    </item>
    <item>
      <title>Building Jira apps with Atlassian Forge | A tutorial series for beginners</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Mon, 01 Jan 2024 21:11:47 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/building-jira-apps-with-atlassian-forge-for-beginners-1bjl</link>
      <guid>https://forem.com/ivadyhabimana/building-jira-apps-with-atlassian-forge-for-beginners-1bjl</guid>
      <description>&lt;p&gt;Hi reader!&lt;br&gt;
Welcome to this article series where we will learn about building Jira apps with the Atlassian Forge platform.&lt;br&gt;
I will be working with Forge, and during my research about it, I noticed that the community and resources about this topic are limited especially for a beginner getting started with it.&lt;/p&gt;

&lt;p&gt;I am creating this series for me and anyone getting started with creating Jira applications as a learning resource that dives deeper into the basics and provides hands-on practice through a project we will be developing throughout the series. &lt;/p&gt;

&lt;p&gt;In this first article, we will be answering some questions about what Jira and Forge are and why you should use them.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Jira
&lt;/h3&gt;

&lt;p&gt;Jira is a powerful project management software developed by Atlassian that enables its users to plan, track, and manage their projects or product progress to deliver value efficiently.&lt;/p&gt;

&lt;p&gt;With Jira features, you can have one big project to work on and divide it into smaller tasks that can be worked on sequentially by different people collaborating.&lt;/p&gt;

&lt;p&gt;This is enough introduction to Jira for now we will get back to the topic later in the series, but you can learn more about Jira software &lt;a href="https://www.atlassian.com/software/jira/guides/getting-started/introduction#what-is-jira-software"&gt;Here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Atlassian Forge
&lt;/h3&gt;

&lt;p&gt;Atlassian Forge is a cloud-based platform created by Atlassian to allow developers to build applications that integrate or interact with Atlassian products (including Jira).&lt;/p&gt;

&lt;p&gt;For example, you are using Jira to manage your project and you realize that there is a feature you need that Jira does not provide by default. &lt;br&gt;
Forge allows you to extend and customize Atlassian products beyond what's provided out of the box.&lt;br&gt;
You can think of these applications as Chrome extensions that add new functionality to what the browser offers by default, and Forge as a set of tools that Atlassian provided for us to make the process of creating those applications easier&lt;/p&gt;

&lt;p&gt;You may need to bookmark &lt;a href="https://developer.atlassian.com/platform/forge/"&gt;Forgse documentation&lt;/a&gt; as we will be referring to it a lot in the series.&lt;/p&gt;

&lt;p&gt;In this series, we will learn the basics of Atlassian Jira and Forge from scratch, along the way we will also create an application as a project to apply our knowledge.&lt;/p&gt;

&lt;p&gt;Now that we have an idea of what Jira and Forge are, in the next article, we will look into creating our first Jira project and Forge application&lt;/p&gt;

&lt;p&gt;See you there... &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
      <category>forge</category>
    </item>
    <item>
      <title>Customizing Swiper.js prev/next arrow buttons and pagination bullets in React</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Sat, 08 Apr 2023 18:24:12 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/customizing-swiperjs-prevnext-arrow-buttons-and-pagination-bullets-in-react-3gkh</link>
      <guid>https://forem.com/ivadyhabimana/customizing-swiperjs-prevnext-arrow-buttons-and-pagination-bullets-in-react-3gkh</guid>
      <description>&lt;p&gt;I was working on an image carousel using the Swiper.js library in a React project and I had a hard time customizing the navigation buttons and pagination bullets to match my design, &lt;br&gt;
luckily after some long research, I was able to find a solution which I am going to share with you in today's article.&lt;/p&gt;

&lt;p&gt;In this guide, we will set up Swiper in React using the Swiper Elements (WebComponents) and after getting Swiper to work, we will customize the navigation arrows and pagination bullets using custom CSS. &lt;/p&gt;
&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;A Working React project: to keep things short I will start with a React project already set therefore to follow along you will need to have a React project already set up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will be using Vite to set up the React project using &lt;a href="https://vitejs.dev/guide/#scaffolding-your-first-vite-project" rel="noopener noreferrer"&gt;this guide&lt;/a&gt; but you can also use &lt;a href="https://create-react-app.dev/docs/getting-started" rel="noopener noreferrer"&gt;create-react-app&lt;/a&gt; or any other way you want.&lt;/p&gt;

&lt;p&gt;You can find the React setup I will be using in &lt;a href="https://github.com/Yvad60/blog-code-references/tree/0016bddfba92656d41b17efb95f9939f19e4e64c" rel="noopener noreferrer"&gt;HERE&lt;/a&gt; &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A code editor: I will be using &lt;a href="https://code.visualstudio.com/" rel="noopener noreferrer"&gt;Visual Studio Code&lt;/a&gt; but feel free to use any editor of your preference.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Since this is a React guide I am assuming prior basic experience working with JavaScript and React applications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all you need Let's get started&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Installing Swiper
&lt;/h3&gt;

&lt;p&gt;Swiper JS is a library used to create sliders for web and mobile devices and it can integrate well with Vanilla JavaScript, React, Vue, and Web components&lt;/p&gt;

&lt;p&gt;You can install Swiper by running the following command in the terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# For npm&lt;/span&gt;
npm &lt;span class="nb"&gt;install &lt;/span&gt;swiper
&lt;span class="c"&gt;# For yarn&lt;/span&gt;
yarn add swiper
&lt;span class="c"&gt;# For pnpm&lt;/span&gt;
pnpm &lt;span class="nb"&gt;install &lt;/span&gt;swiper

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

&lt;/div&gt;



&lt;p&gt;This will install the Swiper package which will allow us to write the swipe logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Swiper in React
&lt;/h2&gt;

&lt;p&gt;In many tutorials and articles, you will find Swipe being used in React by using Swiper React components like the following.&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;Swiper&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;SwiperSlide&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;swiper/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// don't use this&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;According to the &lt;a href="https://swiperjs.com/react" rel="noopener noreferrer"&gt;swiper documentation&lt;/a&gt;, this way is no longer recommended as Swiper React components are likely to be removed in the future. &lt;br&gt;
Swiper recommends using their Web components instead and that's what we will be using. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web components&lt;/strong&gt;&lt;br&gt;
Web Components are a set of standardized technologies that allow developers to create and use reusable custom elements in web applications. Web components will allow you to write your own HTML elements and easily reuse them without using a framework.&lt;/p&gt;

&lt;p&gt;For example, with Web components, you can create your own element like &lt;code&gt;&amp;lt;validated-input&amp;gt;&lt;/code&gt; which takes the normal HTML input and add CSS and JavaScript to it so that whenever used it will come with validation, error messages, and styles out of the box. For more information about Web components check the &lt;a href="https://kinsta.com/blog/web-components/" rel="noopener noreferrer"&gt;following article&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Swiper has created their own custom elements that are preconfigured to provide the swiping logic out of the box with a syntax that looks like you are writing normal HTML&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;MySwiper.jsx&lt;/code&gt; and add the following code&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;register&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="s2"&gt;swiper/element/bundle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;register&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;MySwiper&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;&lt;/span&gt;&lt;span class="nx"&gt;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="nx"&gt;navigation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;pagination&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;true&lt;/span&gt;&lt;span class="dl"&gt;"&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blue-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yellow-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;green-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;/swiper-container&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MySwiper&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the top two lines, we are importing the &lt;code&gt;register&lt;/code&gt; function from the swiper package which allows us to use the Swiper element in our component, and we register them by invoking the &lt;code&gt;register()&lt;/code&gt; function.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;swiper-container&amp;gt;&lt;/code&gt; is the Swiper custom element (Web component) which is used as the wrapper (parent) of our Swiper slides &lt;/li&gt;
&lt;li&gt;The &lt;code&gt;navigation = "true"&lt;/code&gt; attribute is used to add navigation arrows so that we can navigate between slides.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;pagination="true"&lt;/code&gt; attribute is used to add the pagination bullets which indicates the slide we are currently on.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;swiper-slide&lt;/code&gt; is another swiper custom element that creates individual slide &lt;/li&gt;
&lt;li&gt;The &lt;code&gt;class&lt;/code&gt; attribute is the same as a normal HTML class used to add CSS styles to the element.&lt;strong&gt;Notice that we are using &lt;code&gt;class&lt;/code&gt; not &lt;code&gt;className&lt;/code&gt; even if it's in React&lt;/strong&gt;  (you can read more about using web components in React projects in &lt;a href="https://react.dev/reference/react-dom/components#custom-html-elements" rel="noopener noreferrer"&gt;The React documentation&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am using those classes (blue-slide, yellow-slide, and green-slide) to add different background colors for each slide. and centering the slide label text. You can find the current CSS &lt;a href="https://github.com/Yvad60/blog-code-references/blob/413674128751648fdc8ee0d5da3c8a32c6bcba96/src/index.css" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After adding those styles and importing &lt;code&gt;MySwiper&lt;/code&gt; component in the entry of the app you should have the following results in the browser.&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%2Fcm09iafz1yzshsmt172f.gif" 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%2Fcm09iafz1yzshsmt172f.gif" alt="Basic swiper" width="1905" height="916"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you may have noticed the color of the current navigation buttons is not clear and the pagination bullets are too small to see therefore we need to customize them.&lt;/p&gt;

&lt;p&gt;By default, swiper provides the following CSS classes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;swiper-pagination-bullet&lt;/code&gt;: for styling pagination bullets &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;swiper-pagination-bullet-active&lt;/code&gt;: for styling the active pagination bullet&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.swiper-button-next&lt;/code&gt;: for styling the next (right) navigation arrow &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.swiper-button-prev&lt;/code&gt;: for styling the previous (left) navigation arrow&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But the catch here is that trying to add our custom CSS to these classes directly from our CSS files will not work because the web components are kind of isolated in their own DOM therefore our CSS styles may not be able to reach them. &lt;/p&gt;

&lt;p&gt;To add custom styles we will need to inject styles directly into the component itself and we will use React refs for it.&lt;/p&gt;

&lt;p&gt;Update &lt;code&gt;MySwiper&lt;/code&gt; component to be like the following&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;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useRef&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="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;register&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="s2"&gt;swiper/element/bundle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;register&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;MySwiper&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swiperRef&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useRef&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swiperContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;swiperRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&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;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;navigation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;pagination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&gt;();&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;swiperRef&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;false&lt;/span&gt;&lt;span class="dl"&gt;"&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;blue-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yellow-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;swiper&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;slide&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;green-slide&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Slide&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/swiper-slide&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;/swiper-container&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MySwiper&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the exact same configuration we had earlier but we changed the way we are accessing the swiper container. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First we introduced the &lt;code&gt;React useRef&lt;/code&gt; hook, which is allowing us to access the swiper container DOM node. We are using &lt;code&gt;useEffect&lt;/code&gt; in this process to access the swiper container after React has finished rendering the page (so that it will not be null) You can read more about manipulating the DOM with refs &lt;a href="https://react.dev/learn/manipulating-the-dom-with-refs" rel="noopener noreferrer"&gt;HERE&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We created the &lt;code&gt;params&lt;/code&gt; object and we moved the navigation and pagination configurations we had earlier there. From now on all customizations to our swiper will live in this object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After defining our swiper configurations we copy them to the swiper container using the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign" rel="noopener noreferrer"&gt;Object.assign() method&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Notice how we added the attribute &lt;code&gt;init="false"&lt;/code&gt; to make sure that the swiper will not render before have applied our custom configuration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;swiperContainer.initialize()&lt;/code&gt;: we finally initialize the swiper after applying our configurations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding custom styles &lt;/p&gt;

&lt;p&gt;The Swiper container receives another property &lt;code&gt;injectStyles&lt;/code&gt; which is an array of strings where each string will contain CSS styles to apply on Swiper elements&lt;/p&gt;

&lt;p&gt;To apply the custom styles add the following changes (I am only mentioning a part of the previous file that I changed everything else stays the same)&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="nf"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swiperContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;swiperRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&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;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;navigation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;pagination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;// These are new...&lt;/span&gt;
      &lt;span class="na"&gt;injectStyles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;`
          .swiper-button-next,
          .swiper-button-prev {
            background-color: white;
            padding: 8px 16px;
            border-radius: 100%;
            border: 2px solid black;
            color: red;
          }
          .swiper-pagination-bullet{
            width: 40px;
            height: 40px;
            background-color: red;
          }
      `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&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;We just introduced custom styles where we are targeting both the next and prev buttons (using the CSS classes I mentioned earlier) and add change their color to &lt;code&gt;red&lt;/code&gt; and adding the white circled background with a black border. &lt;/p&gt;

&lt;p&gt;On the pagination bullet, we are increasing the width and height to be &lt;code&gt;40px&lt;/code&gt; and changing their color to be &lt;code&gt;red&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After applying these changes you should have the following results in the browser &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%2Fldf7a094r1x6poolcl89.gif" 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%2Fldf7a094r1x6poolcl89.gif" alt="Result after customising swiper" width="1905" height="916"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the current progress in this &lt;a href="https://github.com/Yvad60/blog-code-references/tree/0400a1e911452e97b685cd6c961090b49c8e2311" rel="noopener noreferrer"&gt;Github repo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus
&lt;/h3&gt;

&lt;p&gt;What if you want to change the arrows and use completely custom ones? You can achieve this using the following code&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="nf"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;swiperContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;swiperRef&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;current&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;params&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;navigation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;pagination&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="c1"&gt;//add this&lt;/span&gt;
      &lt;span class="na"&gt;injectStyles&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;`
          .swiper-button-next,
          .swiper-button-prev {
            background-color: white;
            background-position: center;
            background-size: 40px;
            background-repeat: no-repeat;
            padding: 8px 16px;
            border-radius: 100%;
            border: 2px solid black;
            color: red;
          }

          .swiper-button-prev {
            background-image: url("/box-arrow-in-left.svg");
          }

          .swiper-button-next {
            background-image: url("/box-arrow-in-right.svg");
          }

          .swiper-button-next::after,
          .swiper-button-prev::after {
            content: "";
          }

          .swiper-pagination-bullet{
            width: 40px;
            height: 40px;
            background-color: red;
          }
      `&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assign&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;swiperContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;initialize&lt;/span&gt;&lt;span class="p"&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;We are giving the next and prev buttons their custom svg icons (I downloaded the svg icons added them in the public folder of the project) by setting them as the background image and removing background-repeat and setting the background size and background-position.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt; &lt;span class="nc"&gt;.swiper-button-next&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;&lt;span class="nc"&gt;.swiper-button-prev&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&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;This part is for hiding the default icons provided by Swiper itself since we are using our custom icons&lt;/p&gt;

&lt;p&gt;Here is the result after adding custom arrows &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%2Fj9c5lyg5gya7blm8hz73.gif" 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%2Fj9c5lyg5gya7blm8hz73.gif" alt="results after adding custom arrows" width="1905" height="916"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it, that's how you customize the navigation buttons and pagination bullets using Swiper web components. Hope this helps. &lt;/p&gt;

&lt;p&gt;You can find the final code in the &lt;a href="https://github.com/Yvad60/blog-code-references/tree/customise-swiper-arrow-and-bullets" rel="noopener noreferrer"&gt;Github Repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>gratitude</category>
    </item>
    <item>
      <title>Day 160: Fighting with Swiper JS</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Sun, 05 Feb 2023 21:47:09 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-160-fighting-with-swiper-js-o2i</link>
      <guid>https://forem.com/ivadyhabimana/day-160-fighting-with-swiper-js-o2i</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
Today was all about fighting with Swiper JS. Swiper JS is a package used to create sliders for mobile and the web and today I was using it to implement a design but I had a hard time getting it to work and customizing it the way I wanted&lt;/p&gt;

&lt;p&gt;Initially getting it working was quite straight forward but after it was working I tried to customize it to match the design I was working with but the styles were not working no matter what I tried to do. After long research, I found something that worked which still feels like a hack even though it is the recommended way from their docs. I was so irritated with this to the extent I started to work on an extended blog this that I will share soon&lt;/p&gt;

&lt;p&gt;It was a good experience though I learned a lot about Swiper itself and also about fighting with CSS therefore I declare today as a success. Hopefully, the following week will be too&lt;/p&gt;

&lt;p&gt;Signing off...&lt;/p&gt;

</description>
      <category>devto</category>
      <category>announcement</category>
      <category>cryptocurrency</category>
      <category>web3</category>
    </item>
    <item>
      <title>Day 159: A project never ends</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Sat, 04 Feb 2023 22:42:49 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-159-a-project-never-ends-56m5</link>
      <guid>https://forem.com/ivadyhabimana/day-159-a-project-never-ends-56m5</guid>
      <description>&lt;p&gt;"A project never ends" that's what they say means that there will always something to fix on a project even after it reaches production and starts being used by real people. But why really project never ends? why even the best team can not deliver a simple project &lt;/p&gt;

&lt;p&gt;Speaking from my own experience the moment you have something solid to present everyone will start feeling accomplished and that whatever they had been doing is no longer motivating or fun to do. But in reality, at that exact, that's when you need to invest more time and energy to push the working hustle because at the end of the day, delivery is the most important thing &lt;/p&gt;

&lt;p&gt;I have learned this through a lot of mistakes and deadlines not met but it's very important and something I will be working on to improve for my future work&lt;/p&gt;

&lt;p&gt;signing off...  &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 158: Deep research day</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Thu, 02 Feb 2023 20:17:43 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-158-deep-research-day-4p8m</link>
      <guid>https://forem.com/ivadyhabimana/day-158-deep-research-day-4p8m</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
I usually update my journal in the mornings and today I woke up too late to write so I am writing the night which sounds weird as it is almost the next day. but yesterday was a research day I was going through things here and there diving through the rabbit hole of the internet and discovering a lot of content along the way.&lt;br&gt;
I looked into 3d animations, Vue js, Vite, and different open-source projects. I really love and enjoy these research sessions because I always discover new things to learn and some interesting projects from very smart people on the internet I may be learning Vue JS sometime soon (who knows)&lt;/p&gt;

&lt;p&gt;About the blog I said I will publish, I lied I was too lazy to write yesterday but it is planned and I know I will do it I just need to push myself more and spare some time for it but for now that was the status&lt;/p&gt;

&lt;p&gt;Signing off... &lt;/p&gt;

</description>
      <category>productivity</category>
      <category>career</category>
    </item>
    <item>
      <title>Day 157: All over the place</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Wed, 01 Feb 2023 06:10:02 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-157-all-over-the-place-4154</link>
      <guid>https://forem.com/ivadyhabimana/day-157-all-over-the-place-4154</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
Yesterday was a bit of a mess, I can't even recall what I did (probably because I didn't do much :) I did some style refactoring and responsiveness fix for the page I was working on but other than that I was just sitting around.&lt;/p&gt;

&lt;p&gt;I did some reading though! (not a total loser huh :) I want to finish the blog about the &lt;code&gt;Event loop&lt;/code&gt; which I plan to release today or tomorrow at the latest as I strive to get back to writing and that would be the focus for today&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 156: Hello Event loop...</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Tue, 31 Jan 2023 05:18:23 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-156-hello-event-loop-9k1</link>
      <guid>https://forem.com/ivadyhabimana/day-156-hello-event-loop-9k1</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
Yesterday was a good one! I spent it mostly going through JavaScript specifically learning about Event loop which is a crucial part of having asynchronous behaviour in JavaScript which by design is a synchronous single-threaded language.&lt;/p&gt;

&lt;p&gt;Generally, JavaScript runs everything one line at a time and every line has to wait for the previous one to complete before it runs but this is not the case in the real-world application as we often want to run multiple things at the same time or don't want to block the program while we wait for this one thing to finish to run &lt;/p&gt;

&lt;p&gt;This where asynchronous code and event loop comes into the picture where blocking code is put in the callback queue and the job of the event loop is to moderate the callback/task queue and the program call stack so that blocking code will be able to run when their time comes without blocking the rest of the program&lt;/p&gt;

&lt;p&gt;whew! this was not clear enough I know, still much to cover to understand fully how the event loop works in the JavaScript runtime environment. I am preparing a more in-depth blog that will explain more about the topic maybe sometime this week&lt;/p&gt;

&lt;p&gt;In the meantime, I am trying to get back in the flow of writing and keep consistency as in the good old days &lt;/p&gt;

&lt;p&gt;Signing off for now...&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>web3</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Day 155: I'm back...</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Mon, 30 Jan 2023 05:12:36 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-155-im-back-i1j</link>
      <guid>https://forem.com/ivadyhabimana/day-155-im-back-i1j</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
Long time no see! &lt;br&gt;
It's been a while since my last time here. to be precise it's been 141 days (quite a long time) and during this time I had been on another learning adventure but home (here) is the best, and here I am, back to the beginning again.&lt;/p&gt;

&lt;p&gt;I stopped (or paused) blogging for a while because I thought I was busy that I would not find time to write but I recently realized that I have forgotten the main reason that I started the blogging challenge in the first place. When I started the main point was to challenge myself to write something about anything every day no matter how unmotivated or busy I thought I was. Just something too simple to avoid doing. And these small short articles I used them to document my learning journey, and stay focused and organized and that's where came motivation for writing tutorials and learned a lot in the process.&lt;br&gt;&lt;br&gt;
when I started I struggled with consistency but after realizing the benefits that come with it I was addicted to it and now &lt;strong&gt;I'm Back again&lt;/strong&gt;,  same place, same purpose: Writing daily to improve my coding, writing, and communication skills in general.&lt;/p&gt;

&lt;p&gt;During this hibernation time, I had been doing mostly the fronted stuff and deep diving into JavaScript language itself, I got introduced to Next JS and did a lot of Tailwind CSS, and CSS animation. I have a lot to share with the community now and I plan to hustle to write a lot more this year.&lt;/p&gt;

&lt;p&gt;See you around!&lt;/p&gt;

&lt;p&gt;Signing off &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 154: 3 days missed</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Sun, 11 Sep 2022 05:17:50 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-154-3-days-missed-i42</link>
      <guid>https://forem.com/ivadyhabimana/day-154-3-days-missed-i42</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
it's been a while I didn't update the journal for the past three days which is like the first time I missed a day so here is the thing. I radically changed so I couldn't make time on the usual time so I will have to change and pick another time which may be late late in the night or the morning either way I will try to make time for the blog&lt;/p&gt;

&lt;p&gt;for the past 3 days I have been heavily working on the frontend cloning websites and implementing designs using plain html and CSS and also Tailwind CSS I have projects to work on which will be the focus for today also &lt;/p&gt;

&lt;p&gt;Signing off... &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Day 151: just busy</title>
      <dc:creator>Ivad Yves HABIMANA</dc:creator>
      <pubDate>Wed, 07 Sep 2022 22:10:56 +0000</pubDate>
      <link>https://forem.com/ivadyhabimana/day-151-just-busy-4m1g</link>
      <guid>https://forem.com/ivadyhabimana/day-151-just-busy-4m1g</guid>
      <description>&lt;p&gt;Hi!&lt;br&gt;
now busy packing... byee&lt;br&gt;
 Signing off...&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
