<?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: Morshedul Munna</title>
    <description>The latest articles on DEV Community by Morshedul Munna (@morshedulmunna).</description>
    <link>https://dev.to/morshedulmunna</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%2F898559%2Fea66e1c9-61dc-42d1-b395-5eaa8d042b9c.jpg</url>
      <title>DEV Community: Morshedul Munna</title>
      <link>https://dev.to/morshedulmunna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morshedulmunna"/>
    <language>en</language>
    <item>
      <title>Common Deployment Strategies with Kubernetes</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Sat, 23 Nov 2024 10:50:50 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/common-deployment-strategies-with-kubernetes-5hf7</link>
      <guid>https://dev.to/morshedulmunna/common-deployment-strategies-with-kubernetes-5hf7</guid>
      <description>&lt;p&gt;Common Deployment Strategies with Kubernetes&lt;/p&gt;

&lt;p&gt;✡️ Recreate Deployment&lt;br&gt;
Replaces the old version with the new one by terminating all old pods before starting new ones.&lt;/p&gt;

&lt;p&gt;When to Use:&lt;br&gt;
➤ Use when zero downtime isn’t critical and a clean slate of application state is required. Not so common.&lt;/p&gt;

&lt;p&gt;Kubernetes Implementation:&lt;br&gt;
➤ Set strategy.type to Recreate in the deployment manifest.&lt;/p&gt;

&lt;p&gt;✡️ Rolling Deployment&lt;br&gt;
Gradually replaces old instances with new ones without downtime.&lt;/p&gt;

&lt;p&gt;When to Use:&lt;br&gt;
➤ Use when high availability is essential and gradual rollouts are needed to prevent downtime. This is the most common strategy.&lt;/p&gt;

&lt;p&gt;Kubernetes Implementation:&lt;br&gt;
➤ Default strategy in Kubernetes.&lt;br&gt;
➤ Controlled by maxSurge and maxUnavailable parameters in the deployment spec.&lt;/p&gt;

&lt;p&gt;✡️ Blue-Green Deployment&lt;br&gt;
Involves two environments (Blue for current, Green for new). Traffic switches to Green after testing, with easy rollback to Blue.&lt;/p&gt;

&lt;p&gt;When to Use:&lt;br&gt;
➤ When quick, risk-free rollback is needed if the new release fails.&lt;br&gt;
➤ For critical applications requiring stability and controlled validation before going live.&lt;/p&gt;

&lt;p&gt;Kubernetes Implementation:&lt;br&gt;
➤ Maintain separate deployments for Blue and Green environments.&lt;br&gt;
➤ Use Kubernetes services to route traffic between the two environments.&lt;/p&gt;

&lt;p&gt;✡️ Canary Deployment&lt;br&gt;
Gradually rolls out the new version by directing a small percentage of traffic to the canary while the rest goes to the stable version.&lt;/p&gt;

&lt;p&gt;When to Use:&lt;br&gt;
➤ Test new features with real traffic before a full rollout.&lt;br&gt;
➤ Ideal for feature flags and gradual rollouts to minimize user impact and catch issues early.&lt;/p&gt;

&lt;p&gt;Kubernetes Implementation:&lt;br&gt;
➤ Use multiple replica sets with a smaller number of canary pods.&lt;br&gt;
➤ Leverage Ingress, service meshes (Istio/Linkerd), or Argo CD for gradual rollouts.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a real-time notification system</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Sun, 08 Sep 2024 05:09:15 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/creating-a-real-time-notification-system-178a</link>
      <guid>https://dev.to/morshedulmunna/creating-a-real-time-notification-system-178a</guid>
      <description>&lt;p&gt;Creating a real-time notification system involves setting up a server that can push notifications to clients as events occur. Using &lt;strong&gt;Express.js&lt;/strong&gt; for the backend server, &lt;strong&gt;MongoDB&lt;/strong&gt; for data storage, &lt;strong&gt;Socket.io&lt;/strong&gt; for real-time communication, and &lt;strong&gt;React&lt;/strong&gt; for the frontend provides a robust stack for building such a system.&lt;/p&gt;

&lt;p&gt;Below is a step-by-step guide to creating a notification system with these technologies.&lt;/p&gt;




&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Prerequisites&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Setting Up the Backend&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* [Initialize the Project](#initialize-the-project)

* [Set Up Express Server](#set-up-express-server)

* [Integrate Socket.io](#integrate-socketio)

* [Connect to MongoDB](#connect-to-mongodb)

* [Create Notification Schema](#create-notification-schema)

* [API Endpoints](#api-endpoints)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;Setting Up the Frontend&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* [Initialize React App](#initialize-react-app)

* [Install Dependencies](#install-dependencies)

* [Set Up Socket.io Client](#set-up-socketio-client)

* [Display Notifications](#display-notifications)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Testing the Notification System&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conclusion&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Node.js and npm&lt;/strong&gt; installed on your machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MongoDB&lt;/strong&gt; installed locally or have access to a MongoDB Atlas cluster.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic knowledge of JavaScript, Node.js, Express.js, MongoDB, Socket.io, and React.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Setting Up the Backend
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initialize the Project
&lt;/h3&gt;

&lt;p&gt;Create a new directory for your project and initialize it 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;bashCopy codemkdir notification-system
cd notification-system
npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Up Express Server
&lt;/h3&gt;

&lt;p&gt;Install Express and other necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenpm install express cors mongoose socket.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an &lt;code&gt;index.js&lt;/code&gt; file for your server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// index.js
const express = require('express');
const http = require('http');
const cors = require('cors');

const app = express();
app.use(cors());
app.use(express.json());

const server = http.createServer(app);

server.listen(5000, () =&amp;gt; {
  console.log('Server is running on port 5000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Integrate Socket.io
&lt;/h3&gt;

&lt;p&gt;Install Socket.io:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenpm install socket.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Modify your &lt;code&gt;index.js&lt;/code&gt; to include Socket.io:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// index.js
const socketIo = require('socket.io');
const io = socketIo(server, {
  cors: {
    origin: 'http://localhost:3000', // React app domain
    methods: ['GET', 'POST'],
  },
});

io.on('connection', (socket) =&amp;gt; {
  console.log('New client connected');

  // Handle disconnection
  socket.on('disconnect', () =&amp;gt; {
    console.log('Client disconnected');
  });
});

// Export io for use in routes
module.exports = io;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Connect to MongoDB
&lt;/h3&gt;

&lt;p&gt;Install Mongoose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenpm install mongoose
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;code&gt;index.js&lt;/code&gt; to connect to MongoDB:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// index.js
const mongoose = require('mongoose');

mongoose
  .connect('mongodb://localhost:27017/notifications', {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(() =&amp;gt; console.log('MongoDB connected'))
  .catch((err) =&amp;gt; console.log(err));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Create Notification Schema
&lt;/h3&gt;

&lt;p&gt;Create a &lt;code&gt;models&lt;/code&gt; directory and add a &lt;code&gt;Notification.js&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// models/Notification.js
const mongoose = require('mongoose');

const NotificationSchema = new mongoose.Schema({
  message: String,
  date: { type: Date, default: Date.now },
});

module.exports = mongoose.model('Notification', NotificationSchema);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  API Endpoints
&lt;/h3&gt;

&lt;p&gt;Create a route to handle creating notifications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// routes/notifications.js
const express = require('express');
const router = express.Router();
const Notification = require('../models/Notification');
const io = require('../index'); // Import io instance

// Create a new notification
router.post('/', async (req, res) =&amp;gt; {
  const { message } = req.body;
  try {
    const notification = new Notification({ message });
    await notification.save();

    // Emit the notification to all connected clients
    io.emit('notification', notification);

    res.status(201).json(notification);
  } catch (err) {
    res.status(500).json({ error: err.message });
  }
});

module.exports = router;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update &lt;code&gt;index.js&lt;/code&gt; to use the route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// index.js
const notificationRoutes = require('./routes/notifications');

app.use('/notifications', notificationRoutes);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Setting Up the Frontend
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Initialize React App
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;create-react-app&lt;/code&gt; to bootstrap your React application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenpx create-react-app client
cd client
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install Dependencies
&lt;/h3&gt;

&lt;p&gt;Install Socket.io client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenpm install socket.io-client axios
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Set Up Socket.io Client
&lt;/h3&gt;

&lt;p&gt;In your &lt;code&gt;App.js&lt;/code&gt;, set up the Socket.io client to listen for notifications:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javascriptCopy code// src/App.js
import React, { useEffect, useState } from 'react';
import socketIOClient from 'socket.io-client';
import axios from 'axios';

const ENDPOINT = 'http://localhost:5000';

function App() {
  const [notifications, setNotifications] = useState([]);

  useEffect(() =&amp;gt; {
    // Fetch existing notifications
    axios.get(`${ENDPOINT}/notifications`).then((response) =&amp;gt; {
      setNotifications(response.data);
    });

    // Set up Socket.io client
    const socket = socketIOClient(ENDPOINT);

    socket.on('notification', (data) =&amp;gt; {
      setNotifications((prevNotifications) =&amp;gt; [data, ...prevNotifications]);
    });

    // Clean up the connection when the component unmounts
    return () =&amp;gt; socket.disconnect();
  }, []);

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Notifications&amp;lt;/h1&amp;gt;
      {notifications.map((notif) =&amp;gt; (
        &amp;lt;div key={notif._id}&amp;gt;
          &amp;lt;p&amp;gt;{notif.message}&amp;lt;/p&amp;gt;
          &amp;lt;small&amp;gt;{new Date(notif.date).toLocaleString()}&amp;lt;/small&amp;gt;
        &amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Display Notifications
&lt;/h3&gt;

&lt;p&gt;The above code in &lt;code&gt;App.js&lt;/code&gt; will display the list of notifications and update the list in real-time when a new notification is received.&lt;/p&gt;




&lt;h2&gt;
  
  
  Testing the Notification System
&lt;/h2&gt;

&lt;p&gt;To test the notification system:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Start the backend server&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codenode index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Start the React app&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codecd client
npm start
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Send a notification&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Use a tool like Postman or &lt;code&gt;curl&lt;/code&gt; to send a POST request to the &lt;code&gt;/notifications&lt;/code&gt; endpoint:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bashCopy codecurl -X POST -H "Content-Type: application/json" -d '{"message": "New notification"}' http://localhost:5000/notifications
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;Alternatively, you can create a simple form in your React app to send notifications.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Observe the React app&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;The new notification should appear instantly in your React application without a page refresh.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;You've now set up a basic real-time notification system using Express.js, MongoDB, Socket.io, and React. This system can be expanded and customized to fit more complex use cases, such as user-specific notifications, different notification types, and persistent user sessions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Steps:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authentication&lt;/strong&gt;: Implement user authentication to send notifications to specific users.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Notification Types&lt;/strong&gt;: Categorize notifications and add filtering options.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Persistent Connections&lt;/strong&gt;: Handle reconnection logic for Socket.io in case of network issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UI Enhancements&lt;/strong&gt;: Improve the frontend with better styling and user experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;strong&gt;Resources:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://expressjs.com/" rel="noopener noreferrer"&gt;Express.js Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://docs.mongodb.com/" rel="noopener noreferrer"&gt;MongoDB Documentation&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Socket.io Documentation&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;React Documentation&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>How to detect a click outside a React component</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Thu, 08 Dec 2022 17:46:54 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/how-to-detect-a-click-outside-a-react-component-5hk8</link>
      <guid>https://dev.to/morshedulmunna/how-to-detect-a-click-outside-a-react-component-5hk8</guid>
      <description>&lt;p&gt;How to detect a click outside a React component&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, { useEffect, useRef } from 'react';
import { FiSearch } from 'react-icons/fi';
import { useDispatch, useSelector } from 'react-redux';
import { focusToggle } from '../Redux/actionsCreators/searchAction';

const SearchAutoComplete = () =&amp;gt; {
    const state = useSelector((state) =&amp;gt; state.searchReducer);
    const dispatch = useDispatch();

    const { suggestions, isFocus } = state;

    console.log(isFocus);

    const ref = useRef(null);
    useEffect(() =&amp;gt; {
        const handleClickOutside = (event) =&amp;gt; {
            if (ref.current &amp;amp;&amp;amp; !ref.current.contains(event.target)) {
                dispatch(focusToggle(false));
            }
        };
        document.addEventListener('click', handleClickOutside, true);
        return () =&amp;gt; {
            document.removeEventListener('click', handleClickOutside, true);
        };
    }, [dispatch]);

    return (
        &amp;lt;&amp;gt;
            &amp;lt;div className="flex justify-center items-center direction flex-col "&amp;gt;
                &amp;lt;p className="text-[20px] mb-6 font-bold"&amp;gt;Search Product&amp;lt;/p&amp;gt;
                &amp;lt;div className=" relative "&amp;gt;
                    &amp;lt;div ref={ref} className="flex items-center relative"&amp;gt;
                        &amp;lt;FiSearch className=" absolute left-2 text-white-700 " /&amp;gt;
                        &amp;lt;input
                            autocomplete="off"
                            onFocus={() =&amp;gt; dispatch(focusToggle(true))}
                            className="bg-white-500 py-2 text-[14px] p-[5px] pl-7 min-w-[500px] shadow-boxSad rounded-sm px-6 outline-none"
                            type="text"
                            name="search"
                            placeholder="search..."
                        /&amp;gt;
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div className=" shadow-boxSad bg-white-100 absolute w-full"&amp;gt;
                        {suggestions.map((item, i) =&amp;gt;
                            isFocus ? (
                                &amp;lt;div className="px-7 text-[14px] py-2 bg-white-500 hover:bg-white-100 duration-300 ease-in-out cursor-pointer rounded-sm" key={i}&amp;gt;
                                    {item}
                                &amp;lt;/div&amp;gt;
                            ) : null
                        )}
                    &amp;lt;/div&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/div&amp;gt;
        &amp;lt;/&amp;gt;
    );
};

export default SearchAutoComplete;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>How to Connect Rust lib + Web Assembly + React.js(typescript)</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Sat, 29 Oct 2022 14:27:51 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/how-to-connect-rust-lib-web-assembly-reactjstypescript-23j3</link>
      <guid>https://dev.to/morshedulmunna/how-to-connect-rust-lib-web-assembly-reactjstypescript-23j3</guid>
      <description>&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this article, I’ll introduce followings through creating simple demo application.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How to create a React app quickly with create-react-app.&lt;/li&gt;
&lt;li&gt;How to create a Wasm library with Rust.&lt;/li&gt;
&lt;li&gt;How to create a Wasm library with Rust.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Create a React App with create-react-app
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn create react-app myApp --template typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app myApp --template typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then you can run this App in your Local Mechine&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd myApp
npm start or yarn start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Starting the development server...&lt;br&gt;
Compiled successfully!&lt;/p&gt;

&lt;p&gt;You can now view react-wasm-tutorial in the browser.&lt;/p&gt;

&lt;p&gt;Local: &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;br&gt;
On Your Network: &lt;a href="http://192.168.0.153:3000" rel="noopener noreferrer"&gt;http://192.168.0.153:3000&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create Rust library for Wasm
&lt;/h2&gt;

&lt;p&gt;To Connected Wasm to the React app, you need to follow these steps.&lt;/p&gt;

&lt;p&gt;Create Rust library with cargo.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cargo new myApp-lib --lib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Now Implement a Rust function that you want to call from JavaScript.
&lt;/h4&gt;

&lt;p&gt;Simply, we’ll implement add function and call it from JavaScript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// lib.rs

fn add(a: i32, b: i32) -&amp;gt; i32 {
    a + b
}

#[test]
fn add_test() {
    assert_eq!(1 + 1, add(1, 1));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Wrap the function with wasm-bindgen to export it as Wasm.
&lt;/h4&gt;

&lt;p&gt;wasm-bindgen is Rust library that facilitate high-level interactions between Wasm and JavaScript. For example, you can call Rust(Wasm) from JavaScript, and vice versa.&lt;/p&gt;

&lt;p&gt;To add wasm-bindgen dependency, you need to add it to Cargo.toml.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[package]
name = "wasm-lib"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib"]

[dependencies]
wasm-bindgen = "0.2.78"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, Let’s wrap the function with wasm-bindgen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use wasm_bindgen::prelude::*;

#[wasm_bindgen]
fn add(a: i32, b: i32) -&amp;gt; i32 {
    a + b
}

#[test]
fn add_test() {
    assert_eq!(1 + 1, add(1, 1));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Build as Wasm library with wasm-pack
&lt;/h4&gt;

&lt;p&gt;By using wasm-bindgen, you can build Rust as Wasm. However, To load and run Wasm from JavaScript, You need some JavaScript boilerplate codes (like WebAssembly.instantiate).&lt;/p&gt;

&lt;p&gt;To do that, you can use wasm-pack!&lt;/p&gt;

&lt;p&gt;At first, you need to install it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ..
cargo update
wasm-pack --version
=&amp;gt; wasm-pack 0.10.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, let’s add npm script to call it by npm run build-lib.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
   "build-lib:wasm": "cd myApp-lib &amp;amp;&amp;amp; wasm-pack build --target web --out-dir pkg",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s check the output directory generated by wasm-pack.&lt;/p&gt;

&lt;p&gt;You noticed package.json file was generated.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ tree wasm-lib/pkg
├── package.json
├── wasm_lib.d.ts
├── wasm_lib.js
├── wasm_lib_bg.wasm
└── wasm_lib_bg.wasm.d.ts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you can install the Wasm library to other project easily. Let’s install it to the React app.&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 ./wasm-lib/pkg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add ./wasm-lib/pkg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Call the Wasm function from the React app.
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import and call
import React, { useEffect, useState } from 'react';
+import init, { add } from "wasm-lib";
import logo from './logo.svg';
import './App.css';

function App() {
+  const [ans, setAns] = useState(0);
+  useEffect(() =&amp;gt; {
+    init().then(() =&amp;gt; {
+      setAns(add(1, 1));
+    })
+  }, [])
  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;header className="App-header"&amp;gt;
        &amp;lt;img src={logo} className="App-logo" alt="logo" /&amp;gt;
        &amp;lt;p&amp;gt;
          Edit &amp;lt;code&amp;gt;src/App.tsx&amp;lt;/code&amp;gt; and save to reload.
        &amp;lt;/p&amp;gt;
+        &amp;lt;p&amp;gt;1 + 1 = {ans}&amp;lt;/p&amp;gt;
        &amp;lt;a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        &amp;gt;
          Learn React
        &amp;lt;/a&amp;gt;
      &amp;lt;/header&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finaly, you can see this screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  Advanced topics
&lt;/h3&gt;

&lt;p&gt;In this article, I provided the quick introduction for Rust and Wasm. To use Wasm in production, you should think about the following topics.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logging&lt;/li&gt;
&lt;li&gt;Multi-Threading&lt;/li&gt;
&lt;li&gt;Exception handling&lt;/li&gt;
&lt;li&gt;Call JavaScript from Rust&lt;/li&gt;
&lt;li&gt;Call Rust struct from JavaScript&lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;li&gt;Cross platform&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Backend-Development Learning Roadmap - Step by Step</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Thu, 13 Oct 2022 16:54:46 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/backend-development-learning-roadmap-step-by-step-3a4f</link>
      <guid>https://dev.to/morshedulmunna/backend-development-learning-roadmap-step-by-step-3a4f</guid>
      <description>&lt;h3&gt;
  
  
  Hard Part  for Backend : Row Requirement Analysis to thinking Data Modelling and Database Design.
&lt;/h3&gt;

&lt;p&gt;We need to learn Data Modeling and Database Design....... see Next article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API Design

&lt;ul&gt;
&lt;li&gt;Rest APi&lt;/li&gt;
&lt;li&gt;GraphQL&lt;/li&gt;
&lt;li&gt;gRPC&lt;/li&gt;
&lt;li&gt;Web Socket&lt;/li&gt;
&lt;li&gt;Message Broker&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Api Security

&lt;ul&gt;
&lt;li&gt;JWT Token&lt;/li&gt;
&lt;li&gt;Refresh Token&lt;/li&gt;
&lt;li&gt;OAuth2&lt;/li&gt;
&lt;li&gt;SAML&lt;/li&gt;
&lt;li&gt;Identity Proviiders

&lt;ul&gt;
&lt;li&gt;Cognito&lt;/li&gt;
&lt;li&gt;Auth0&lt;/li&gt;
&lt;li&gt;Firebase&lt;/li&gt;
&lt;li&gt;Okta&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Role Base Authorization&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;API Testing

&lt;ul&gt;
&lt;li&gt;Unit Testing&lt;/li&gt;
&lt;li&gt;Acceptance Testing&lt;/li&gt;
&lt;li&gt;Load Testing&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;API Documentation

&lt;ul&gt;
&lt;li&gt;Swagger&lt;/li&gt;
&lt;li&gt;Postman&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;— Concept Must Need for Backend Developer &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ORM ( Object Relational Model)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;SQL

&lt;ul&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;mySQL&lt;/li&gt;
&lt;li&gt;MSSQL/ Oracle&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;NoSQL

&lt;ul&gt;
&lt;li&gt;MongoDB&lt;/li&gt;
&lt;li&gt;AWS DynamoDB&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;In Memory*** - (for Cashing)

&lt;ul&gt;
&lt;li&gt;Redis**&lt;/li&gt;
&lt;li&gt;Mem Cashed&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Graph Database

&lt;ul&gt;
&lt;li&gt;Neo4j&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;Linux server&lt;/li&gt;

&lt;li&gt;Cloud Computing&lt;/li&gt;

&lt;li&gt;DevOps&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Server Application Responsibility
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Listen Request&lt;/li&gt;
&lt;li&gt;Process

&lt;ul&gt;
&lt;li&gt;Algorithm&lt;/li&gt;
&lt;li&gt;Data Structure&lt;/li&gt;
&lt;li&gt;Database&lt;/li&gt;
&lt;li&gt;Problem Solving&lt;/li&gt;
&lt;li&gt;CURD Operation&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Response&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  HTTP Knowladges: - Stateless communication
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Get Request - ( Want to Read from server)&lt;/li&gt;
&lt;li&gt;POST - ( Create new Data )&lt;/li&gt;
&lt;li&gt;PUT/PATCH - ( Update Existing Content)&lt;/li&gt;
&lt;li&gt;DELETE - (Delete Data from Database)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>backend</category>
      <category>api</category>
      <category>database</category>
      <category>roadmap</category>
    </item>
    <item>
      <title>Learn Rust Programming Language</title>
      <dc:creator>Morshedul Munna</dc:creator>
      <pubDate>Fri, 07 Oct 2022 18:37:49 +0000</pubDate>
      <link>https://dev.to/morshedulmunna/learn-rust-programming-language-4402</link>
      <guid>https://dev.to/morshedulmunna/learn-rust-programming-language-4402</guid>
      <description>&lt;blockquote&gt;
&lt;h2&gt;
  
  
  Lets Start Learning Rust Programming Language
&lt;/h2&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Installing rustup on Windows
&lt;/h3&gt;

&lt;p&gt;Go To the Link and Downloads Rustup exe file.&lt;br&gt;
&lt;a href="https://www.rust-lang.org/tools/install" rel="noopener noreferrer"&gt;https://www.rust-lang.org/tools/install&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%2Fbypdnjug2499y6q48yq4.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%2Fbypdnjug2499y6q48yq4.png" alt=" " width="562" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run The exe File and Type 1 Then Press Enter. installing...................&lt;/p&gt;
&lt;h3&gt;
  
  
  Installing rustup on Linux or macOS
&lt;/h3&gt;

&lt;p&gt;Run The Bellow Commend in your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check whether you have Rust installed correctly, open a shell and enter this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rustc --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Updating and Uninstalling&lt;br&gt;
Once Rust is installed via rustup, when a new version of Rust is released, updating to the latest version is easy. From your shell, run the following update script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rustup update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To uninstall Rust and rustup, run the following uninstall script from your shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rustup self uninstall
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;learn more From official Book &lt;br&gt;
&lt;a href="https://doc.rust-lang.org/book/" rel="noopener noreferrer"&gt;Rust Book&lt;/a&gt;&lt;/p&gt;

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