<?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: Sarvesh S. Kulkarni</title>
    <description>The latest articles on DEV Community by Sarvesh S. Kulkarni (@sarveshk76).</description>
    <link>https://dev.to/sarveshk76</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%2F956306%2F3d9631b5-9021-4e84-b251-311cd8eb385d.jpg</url>
      <title>DEV Community: Sarvesh S. Kulkarni</title>
      <link>https://dev.to/sarveshk76</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarveshk76"/>
    <language>en</language>
    <item>
      <title>Redux with React: A Friendly Guide for Beginners</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Sun, 28 Jul 2024 12:11:43 +0000</pubDate>
      <link>https://dev.to/sarveshk76/redux-with-react-a-friendly-guide-for-beginners-3n2n</link>
      <guid>https://dev.to/sarveshk76/redux-with-react-a-friendly-guide-for-beginners-3n2n</guid>
      <description>&lt;p&gt;Hey there! 🎉 If you’ve been diving into React and are ready to level up your state management game, you’ve probably heard of Redux. It’s a powerful tool that helps you handle state in a predictable and organized way, especially as your app grows bigger. Don’t worry if Redux sounds a bit daunting right now—this guide will break it down step-by-step in a super casual, easy-to-follow way. Let’s get started!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What’s Redux All About?&lt;/strong&gt;&lt;br&gt;
Imagine your React app as a big, busy kitchen. You have ingredients (state) that need to be organized and used in recipes (components). Redux acts like a super-efficient kitchen organizer. It keeps all your ingredients (state) in one place (the store), and whenever you need to make a recipe (update the state), it tells you exactly how to do it (reducers).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Redux Basics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Store:&lt;/strong&gt; Think of this as your pantry where you keep all your ingredients (state).&lt;br&gt;
&lt;strong&gt;2. Actions:&lt;/strong&gt; These are like recipe instructions. They tell the store what you want to do (e.g., "Add sugar").&lt;br&gt;
&lt;strong&gt;3. Reducers:&lt;/strong&gt; They’re the chefs who take the recipe (action) and update the pantry (store) accordingly.&lt;br&gt;
&lt;strong&gt;4. Dispatch:&lt;/strong&gt; This is how you get the recipe instructions to the chefs (reducers).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting Up Your Project&lt;/strong&gt;&lt;br&gt;
Let’s set up a React project with Redux. It’s super easy with create-react-app—a handy tool that gets everything ready for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create Your React App&lt;/strong&gt;&lt;br&gt;
Open up your terminal and run these commands to start a new project:&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 redux-tutorial
cd redux-tutorial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Add React-Redux and @reduxjs/toolkit&lt;/strong&gt;&lt;br&gt;
Now, let’s install &lt;code&gt;React-Redux&lt;/code&gt; and &lt;code&gt;@reduxjs/toolkit&lt;/code&gt;, which helps connect Redux with React.&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 react-redux @reduxjs/toolkit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using createSlice to Manage State&lt;/strong&gt;&lt;br&gt;
We’ll use createSlice to set up our Redux store. It lets us define our state, actions, and reducers all in one place.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Create a Slice&lt;/strong&gt;&lt;br&gt;
Let’s create a counterSlice.tsx file in a new features folder. This file will manage our counter state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createSlice } from '@reduxjs/toolkit'

export const counterSlice = createSlice({
  name: 'counter',
  initialState: {
    value: 0,
  },
  reducers: {
    increment: (state) =&amp;gt; {
      state.value += 1
    },
    decrement: (state) =&amp;gt; {
      state.value -= 1
    },
    incrementByAmount: (state, action) =&amp;gt; {
      state.value += action.payload
    },
  },
})

// Action creators are generated for each case reducer function
export const { increment, decrement, incrementByAmount } = counterSlice.actions

export default counterSlice.reducer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Configure the Store&lt;/strong&gt;&lt;br&gt;
Create a store.ts file to configure the Redux store using the slice we just created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { configureStore } from '@reduxjs/toolkit'
import counterSlice from '../feature/counterSlice'

export default configureStore({
  reducer: {
    counter: counterSlice, 
  },
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Provide the Redux Store to React&lt;/strong&gt;&lt;br&gt;
Wrap your app with the Provider component so that Redux can manage the state. Update index.tsx like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import {
  createBrowserRouter,
  RouterProvider,
} from "react-router-dom";
import store from './app/store'
import { Provider } from 'react-redux'
import Navbar from './components/Navbar';
import Footer from './components/Footer';

const router = createBrowserRouter([
  {
    path: "/",
    element: &amp;lt;App/&amp;gt;,
  },
  {
    path: "*",
    element: &amp;lt;div className='d-flex justify-content-center align-items-center m-5'&amp;gt;Not Found&amp;lt;/div&amp;gt;,
  }
]);

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  &amp;lt;React.StrictMode&amp;gt;
      &amp;lt;Navbar/&amp;gt;
        &amp;lt;Provider store={store}&amp;gt;
        &amp;lt;RouterProvider router={router}/&amp;gt;
        &amp;lt;/Provider&amp;gt;
      &amp;lt;Footer/&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Connect Your Component to Redux&lt;/strong&gt;&lt;br&gt;
Now, let’s connect a React component to the Redux store using useSelector and useDispatch from react-redux. Create a Counter.tsx 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 from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { increment, decrement } from '../feature/counterSlice';

// Define the types for your state
interface CounterState {
  value: number;
}

interface RootState {
  counter: CounterState;
}

export function Counter() {
  // Use useSelector to access the counter and food items from the state
  const count = useSelector((state: RootState) =&amp;gt; state.counter.value);

  const dispatch = useDispatch();

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;fieldset className='border m-5'&amp;gt;
        &amp;lt;legend className='text-center'&amp;gt;Basic Counter&amp;lt;/legend&amp;gt;
        &amp;lt;div  className='d-flex justify-content-center align-items-center'&amp;gt;
        &amp;lt;button
          aria-label="Increment value"
          className='btn btn-outline-success'
          onClick={() =&amp;gt; dispatch(increment())}
        &amp;gt;
          Increment
        &amp;lt;/button&amp;gt;
        &amp;lt;span className='p-5 fs-5 fw-semibold text-secondary'&amp;gt;{count}&amp;lt;/span&amp;gt;
        &amp;lt;button
          aria-label="Decrement value"
          className='btn btn-outline-danger'
          onClick={() =&amp;gt; dispatch(decrement())}
        &amp;gt;
          Decrement
        &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
      &amp;lt;/fieldset&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Update App.tsx to include the Counter 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 './App.css';
import { Counter } from './components/Counter';

function App() {

  return (
    &amp;lt;&amp;gt;
    &amp;lt;Counter/&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Wrapping Up&lt;/strong&gt;&lt;br&gt;
You’ve just set up Redux in your React app using Redux Toolkit and createSlice. Here’s a quick rundown of what we did:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Setup:&lt;/strong&gt; Created a new React project and installed Redux Toolkit.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slice:&lt;/strong&gt; Defined our state and reducers in one place using createSlice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store:&lt;/strong&gt; Configured the store with the slice’s reducer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Provider:&lt;/strong&gt; Wrapped our app with the Redux Provider.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Component:&lt;/strong&gt; Connected a React component to the Redux store with useSelector and useDispatch.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I have implemented the example of the multi-state management in the this &lt;a href="https://github.com/Sarveshk76/React-Redux" rel="noopener noreferrer"&gt;repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Please feel free to explore the code, and if you have any questions or suggestions, don’t hesitate to open an issue or submit a pull request. Your feedback is always appreciated!&lt;/p&gt;

&lt;p&gt;Redux Toolkit makes it super easy to manage state in a scalable and maintainable way. Enjoy building your app, and have fun with Redux Toolkit! 🚀&lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
      <category>typescript</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Streamline Your Workflow: Automate Frontend Deployment with GitHub Actions</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Wed, 24 Jul 2024 08:55:11 +0000</pubDate>
      <link>https://dev.to/sarveshk76/streamline-your-workflow-automate-frontend-deployment-with-github-actions-271f</link>
      <guid>https://dev.to/sarveshk76/streamline-your-workflow-automate-frontend-deployment-with-github-actions-271f</guid>
      <description>&lt;p&gt;Manually deploying your frontend code can be a time-consuming and error-prone process. But fear not, developers! GitHub Actions offers a powerful solution for automating your CI/CD pipeline, allowing for seamless frontend deployments with every code change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is CI/CD?&lt;/strong&gt;&lt;br&gt;
CI/CD stands for Continuous Integration and Continuous Delivery/Deployment. It's an automated workflow that streamlines the software development process. With CI/CD, code changes are continuously integrated, tested, and deployed, ensuring a faster and more reliable development cycle.&lt;/p&gt;

&lt;p&gt;Using GitHub Actions runners on an EC2 instance is a powerful way to extend the capabilities of GitHub Actions beyond the default hosted runners provided by GitHub. This setup gives you more control over the environment in which your workflows run and allows you to leverage resources within your own AWS account. Here's a guide on how to set up and use GitHub Actions self-hosted runners on an EC2 instance:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install and Configure the Runner:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Connect to your EC2 Instance: SSH into your EC2 instance using the key pair associated with the instance.&lt;/p&gt;

&lt;p&gt;Download and Install the Runner: Follow the instructions provided by GitHub to download and configure the GitHub Actions runner. You can find the installation steps in the GitHub repository under Settings -&amp;gt; Actions -&amp;gt; Self-hosted runners.&lt;/p&gt;

&lt;p&gt;Register the Runner: During the installation process, you'll be prompted to enter your GitHub repository URL, an access token, and other configuration details. This registers the runner with your GitHub repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with GitHub Actions&lt;/strong&gt;&lt;br&gt;
If you're new to GitHub Actions, getting started is straightforward:&lt;br&gt;
(For this example I've created a sample react project.)&lt;/p&gt;

&lt;p&gt;Create a Workflow File: Inside your repository, create a .github/workflows directory if it doesn't exist. In this directory, add a YAML file (e.g., deploy.yml) where you'll define your workflow.&lt;/p&gt;

&lt;p&gt;Define Workflow Steps: In your YAML file, define the steps required to build and deploy your frontend application. This typically includes installing dependencies, building assets (e.g., with webpack or npm scripts), and deploying to an ec2 instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name: Deploy to ec2 instance

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: self-hosted

    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Cache Node.js dependencies
        uses: actions/cache@v2
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-

      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{matrix.node-version}}

      - name: Install dependencies
        run: npm install

      - name: Build React application
        run: |
          npm run build
          rm -rf /var/www/react_sample/static
          mv build/* /var/www/react_sample
          rm -r *
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example workflow installs dependencies, builds the project, and deploys the built assets to an ec2 instance using a self-hosted runner. Adjust the details (like branches and build commands) to fit your project's setup.&lt;/p&gt;

&lt;p&gt;Configure Secrets: For deploying to certain services (like GitHub Pages or AWS), you'll need API keys or access tokens. Store these securely in your repository's Secrets settings (Settings -&amp;gt; Secrets), and reference them in your workflow YAML file.&lt;/p&gt;

&lt;p&gt;Trigger Workflow: With your workflow file set up, GitHub Actions will automatically trigger it when changes are pushed to the specified branch (main in the example). You can also trigger workflows manually or on other events like pull requests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of GitHub Actions for Frontend Deployment
&lt;/h2&gt;

&lt;p&gt;Automation: Once set up, deployments happen automatically on every push or as scheduled, reducing manual intervention.&lt;/p&gt;

&lt;p&gt;Consistency: Eliminates human error in deployment steps, ensuring each deployment follows the exact same process.&lt;/p&gt;

&lt;p&gt;Visibility and Monitoring: GitHub Actions provides logs and status checks for each workflow run, making it easy to monitor deployment outcomes and debug issues.&lt;/p&gt;

&lt;p&gt;Community Actions: Leverage a wide range of community-maintained actions for common tasks, reducing the need to reinvent the wheel.&lt;/p&gt;

&lt;p&gt;Happy Coding!&lt;/p&gt;

</description>
      <category>cicd</category>
      <category>webdev</category>
      <category>devops</category>
      <category>react</category>
    </item>
    <item>
      <title>Nuxt Your Way to Native: Building Mobile Apps with Capacitor</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Mon, 10 Jun 2024 05:53:02 +0000</pubDate>
      <link>https://dev.to/sarveshk76/nuxt-your-way-to-native-building-mobile-apps-with-capacitor-2lbf</link>
      <guid>https://dev.to/sarveshk76/nuxt-your-way-to-native-building-mobile-apps-with-capacitor-2lbf</guid>
      <description>&lt;p&gt;Nuxt.js is a fantastic framework for building lightning-fast and feature-rich web applications. But what if you want to take your Nuxt.js creation and turn it into a native mobile app? With Capacitor, you can bridge the gap and deliver your Nuxt.js app as a native Android or iOS experience!&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Capacitor for Nuxt.js Mobile Apps?
&lt;/h2&gt;

&lt;p&gt;Capacitor offers a compelling solution for building native apps with Nuxt.js:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Leverage Your Existing Skills:&lt;/strong&gt; If you're already comfortable with Nuxt.js, you can use your Vue knowledge to create the core application logic. Capacitor handles the native parts.&lt;br&gt;
&lt;strong&gt;Reduced Development Time:&lt;/strong&gt; By reusing your Nuxt.js codebase, you can significantly speed up development compared to building separate native apps from scratch.&lt;br&gt;
&lt;strong&gt;Native Look and Feel:&lt;/strong&gt; Capacitor integrates your Nuxt.js app into a native container, allowing you to access device features and provide a platform-specific user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with Nuxt.js and Capacitor
&lt;/h2&gt;

&lt;p&gt;Here's a quick overview of the process:&lt;/p&gt;

&lt;p&gt;Create Your Nuxt.js App: Start by building your Nuxt.js application as usual.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Integrate Capacitor:&lt;/strong&gt; Add Capacitor to your project using npm or yarn. This configures the native app structure and environment.&lt;br&gt;
&lt;strong&gt;Build for Mobile Platforms:&lt;/strong&gt; Use Capacitor commands to generate native app builds for Android and iOS. Capacitor will bundle your Nuxt.js app into the native container.&lt;br&gt;
&lt;strong&gt;Deploy to App Stores:&lt;/strong&gt; Once you're happy with your native builds, you can submit them to the respective app stores (Google Play Store and Apple App Store) following their guidelines.&lt;/p&gt;

&lt;h2&gt;
  
  
  Beyond the Basics
&lt;/h2&gt;

&lt;p&gt;While Capacitor provides a smooth foundation, there's more to explore:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Native Plugins:&lt;/strong&gt; Capacitor supports various plugins that grant access to native device functionalities like camera, GPS, and local storage within your Nuxt.js app.&lt;br&gt;
&lt;strong&gt;Advanced Customization:&lt;/strong&gt; You can further customize the native app experience using platform-specific code within the Capacitor project structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nuxt.js and Capacitor: A Powerful Combination
&lt;/h2&gt;

&lt;p&gt;By combining Nuxt.js and Capacitor, you can create high-quality mobile apps efficiently. Capacitor empowers you to deliver your Nuxt.js creations to a wider audience on mobile devices, all while maintaining a familiar development workflow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ready to dive deeper?&lt;/strong&gt; Check out the official Nuxt.js documentation and Capacitor docs for detailed guides and tutorials to get your hands dirty and build your first native app with Nuxt.js!&lt;/p&gt;

&lt;p&gt;(Comment for the detailed blog)&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>capacitor</category>
      <category>android</category>
      <category>ios</category>
    </item>
    <item>
      <title>Localize Your Vue: Internationalization with Nuxt 3</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Mon, 25 Mar 2024 07:15:24 +0000</pubDate>
      <link>https://dev.to/sarveshk76/localize-your-vue-internationalization-with-nuxt-3-5gf4</link>
      <guid>https://dev.to/sarveshk76/localize-your-vue-internationalization-with-nuxt-3-5gf4</guid>
      <description>&lt;p&gt;I'd be glad to create a blog post on Nuxt 3 internationalization, incorporating the best aspects of previous responses and addressing potential shortcomings:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Taking Your Nuxt 3 App Global: A Step-by-Step Guide to Internationalization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today's interconnected world, building websites that cater to international audiences is essential. Nuxt 3, the powerful Vue.js framework, streamlines this process with its robust internationalization (i18n) capabilities. This comprehensive guide will walk you through setting up i18n in your Nuxt 3 application, making it a breeze to localize your content for different languages and regions.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;A basic understanding of Nuxt 3 and Vue.js concepts.&lt;/li&gt;
&lt;li&gt;Node.js and npm (or yarn) installed on your development machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Installation:&lt;/strong&gt;&lt;br&gt;
Begin by installing the @nuxtjs/i18n module in your Nuxt 3 project using either npm or yarn:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm install -D @nuxtjs/i18n
# or
yarn add -D @nuxtjs/i18n


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

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;2. Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;nuxt.config.ts (or nuxt.config.js):&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Import the defineNuxtConfig function and the i18n module from &lt;br&gt;
  @nuxtjs/i18n. Configure the i18n module as follows:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

export default defineNuxtConfig({
  modules: ['@nuxtjs/i18n'],
  i18n({
      // Your i18n configuration options go here
    })
});


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

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;3. Locale Settings:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define the languages your application supports in the locales array:
```
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;i18n({&lt;br&gt;
  locales: [&lt;br&gt;
      {&lt;br&gt;
        name: 'English',&lt;br&gt;
        code: 'en',&lt;br&gt;
        file: 'locales/en.json'&lt;br&gt;
      },&lt;br&gt;
      {&lt;br&gt;
        name: 'French',&lt;br&gt;
        code: 'fr',&lt;br&gt;
        file: 'locales/fr.json'&lt;br&gt;
      },&lt;br&gt;
      {&lt;br&gt;
        name: 'Spanish',&lt;br&gt;
        code: 'es',&lt;br&gt;
        file: 'locales/es.json'&lt;br&gt;
      }&lt;br&gt;
    ],&lt;br&gt;
}),&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Set the default locale (the language your app loads first) using the defaultLocale option:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;i18n({&lt;br&gt;
  locales: [&lt;br&gt;
      {&lt;br&gt;
        name: 'English',&lt;br&gt;
        code: 'en',&lt;br&gt;
        file: 'locales/en.json'&lt;br&gt;
      },&lt;br&gt;
      {&lt;br&gt;
        name: 'French',&lt;br&gt;
        code: 'fr',&lt;br&gt;
        file: 'locales/fr.json'&lt;br&gt;
      },&lt;br&gt;
      {&lt;br&gt;
        name: 'Spanish',&lt;br&gt;
        code: 'es',&lt;br&gt;
        file: 'locales/es.json'&lt;br&gt;
      }&lt;br&gt;
    ],&lt;br&gt;
    defaultLocale: 'en',&lt;br&gt;
}),&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**4. Translation Files:**
- Create a locales directory in your project's root. Inside this directory, create a separate JSON file for each supported locale. For example:
 - locales/en.json
 - locales/fr.json
 - locales/es.json

- Add translation keys and their corresponding values in each language file:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;// locales/en.json&lt;br&gt;
{&lt;br&gt;
    "heading1": "Supercharge your Vue.js projects",&lt;br&gt;
    "desc1": "Nuxt.js is a powerful framework for building performant, SEO-friendly web applications with Vue.js. It provides a collection of features and conventions that streamline the development process, allowing you to focus on creating amazing user experiences."&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// locales/fr.json&lt;br&gt;
{&lt;br&gt;
    "heading1": "Boostez vos projets Vue.js",&lt;br&gt;
    "desc1": "Nuxt.js est un framework puissant pour créer des applications Web performantes et conviviales pour le référencement avec Vue.js. Il fournit un ensemble de fonctionnalités et de conventions qui rationalisent le processus de développement, vous permettant ainsi de vous concentrer sur la création d'expériences utilisateur étonnantes."&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;// locales/es.json&lt;br&gt;
{&lt;br&gt;
    "heading1": "Potencia tus proyectos Vue.js",&lt;br&gt;
    "desc1": "Nuxt.js es un marco poderoso para crear aplicaciones web de alto rendimiento y compatibles con SEO con Vue.js. Proporciona una colección de características y convenciones que agilizan el proceso de desarrollo, permitiéndole concentrarse en crear experiencias de usuario increíbles."&lt;br&gt;
}&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**5. Using Translations in Components:**
 - Import the useI18n composable from @nuxtjs/i18n in your Vue 
 components:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            &amp;lt;v-col cols="3"&amp;gt;
                &amp;lt;v-select label="Select Language" :items="['en', 'fr', 'es']" variant="outlined" v-model="locale"&amp;gt;&amp;lt;/v-select&amp;gt;
            &amp;lt;/v-col&amp;gt;

        &amp;lt;/v-row&amp;gt;

        &amp;lt;v-card class="mx-5" variant="outlined" elevation="3"&amp;gt;
            &amp;lt;v-card-title class="text-center"&amp;gt;
                {{ $t("heading1") }}
            &amp;lt;/v-card-title&amp;gt;
            &amp;lt;v-card-text class="text-center"&amp;gt;
                {{ $t("desc1") }}
            &amp;lt;/v-card-text&amp;gt;
        &amp;lt;/v-card&amp;gt;

    &amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;



const { locale } = useI18n()



&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Use the $t function provided by useI18n to access translations:
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;br&gt;
   &lt;br&gt;
       {{ $t("heading1") }}&lt;br&gt;
   &lt;br&gt;
   &lt;br&gt;
       {{ $t("desc1") }}&lt;br&gt;
   &lt;br&gt;
&lt;/p&gt;




&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Output:

&lt;p&gt;&lt;a href="https://media.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%2Fcjrphy5l5qehprroelg3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fcjrphy5l5qehprroelg3.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;source code: &lt;a href="https://github.com/Sarveshk76/nuxt3-i18n" rel="noopener noreferrer"&gt;nuxt3-i18n&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember, the key to successful internationalization lies in understanding your audience and providing them with a seamless user experience, no matter their language or locale. With Nuxt 3, you’re well-equipped to do just that. So go ahead, take your projects to new heights and let your applications speak to the world.&lt;/p&gt;

&lt;p&gt;Until next time, happy coding!&lt;br&gt;
&lt;/p&gt;&lt;/code&gt;&lt;/pre&gt;

</description>
      <category>vue</category>
      <category>nuxt</category>
      <category>i18n</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Squashing Migrations in Django for Beginners</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Tue, 19 Dec 2023 07:16:20 +0000</pubDate>
      <link>https://dev.to/sarveshk76/squashing-migrations-in-django-for-beginners-dc5</link>
      <guid>https://dev.to/sarveshk76/squashing-migrations-in-django-for-beginners-dc5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Django migrations:&lt;/strong&gt; awesome for keeping track of changes, but sometimes they turn into a tangled mess. Enter the squash migration – your superhero sidekick for a tidier project. Think of it as Marie Kondo for your code!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Squash?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine your migrations as a growing pile of clothes. Each change is a new shirt, and soon you have a mountain of confusing layers. Squashing is like folding everything neatly, making it easier to find what you need (and way less embarrassing for guests... I mean, deployments).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Squashing Superpowers:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Smaller History:&lt;/strong&gt; A leaner migration history means a smaller project, making backups and deployments a breeze. You won't need to pack a suitcase for each update!&lt;br&gt;
&lt;strong&gt;Easier Understanding:&lt;/strong&gt; A clean history is like a well-labeled closet. You can easily see how your project evolved, making future tweaks and fixing bugs a walk in the park.&lt;br&gt;
&lt;strong&gt;Improved Maintenance:&lt;/strong&gt; Finding specific changes becomes a cinch, like spotting that perfect outfit for a specific occasion. No more rummaging through piles!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Squash (Without Breaking Something):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick Your Tool:&lt;/strong&gt; Use Django's built-in &lt;code&gt;squashmigrations&lt;/code&gt; option for quick merges, or Use the &lt;code&gt;squashmigrations --squashed-name&lt;/code&gt; option if you want to set the name of the squashed migration rather than use an autogenerated one.. Just remember, with great power comes great responsibility (aka backups before every squash!).&lt;br&gt;
&lt;strong&gt;Squash Selectively:&lt;/strong&gt; Don't just dump everything together! Merge migrations that make sense together, like grouping all the changes to your user model into one "spruced-up-users" squashed migration.&lt;br&gt;
&lt;strong&gt;Name Wisely:&lt;/strong&gt; Don't leave your squashed migration a mystery. Give it a descriptive name that tells you exactly what's inside, like "combined-profile-picture-and-bio-updates."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ./manage.py squashmigrations myapp 0004
Will squash the following migrations:
 - 0001_initial
 - 0002_some_change
 - 0003_another_change
 - 0004_undo_something
Do you wish to proceed? [yN] y
Optimizing...
  Optimized from 12 operations to 7 operations.
Created new squashed migration /home/andrew/Programs/DjangoTest/test/migrations/0001_squashed_0004_undo_something.py
  You should commit this migration but leave the old ones in place;
  the new migration will be used for new installs. Once you are sure
  all instances of the codebase have applied the migrations you squashed,
  you can delete them.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remember:&lt;/strong&gt;&lt;br&gt;
Squashing is powerful, but use it wisely. Once merged, changes are stuck together like conjoined twins. Be sure you're happy with the combination before hitting that squash button!&lt;br&gt;
Test, test, test! After squashing, make sure everything still works like a charm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Squash with Confidence:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Don't let messy migrations hold you back! With a little knowledge and these simple tips, you can squash your way to a cleaner, happier Django project. So go forth, fold (squash!), and enjoy the newfound organization!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus Tip:&lt;/strong&gt; Document your squashing process! Future you will thank you for the clear roadmap through your project's history.&lt;/p&gt;

</description>
      <category>django</category>
      <category>webdev</category>
      <category>performance</category>
      <category>cleancode</category>
    </item>
    <item>
      <title>24 Pull Requests: A Holiday Tradition for Open Source Contributors</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Mon, 04 Dec 2023 18:48:24 +0000</pubDate>
      <link>https://dev.to/sarveshk76/24-pull-requests-a-holiday-tradition-for-open-source-contributors-465h</link>
      <guid>https://dev.to/sarveshk76/24-pull-requests-a-holiday-tradition-for-open-source-contributors-465h</guid>
      <description>&lt;p&gt;24 Pull Requests is a yearly initiative that encourages open source contributors around the world to send 24 pull requests between December 1st and December 24th. The goal of the project is to help people get involved in open source and make a positive impact on the world.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Participate
&lt;/h2&gt;

&lt;p&gt;To participate in 24 Pull Requests, simply find an open source project that you're interested in and start contributing. You can find projects to contribute to on GitHub, GitLab, and other code hosting platforms. Once you've found a project, you can start by fixing bugs, adding new features, or writing documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Participating
&lt;/h2&gt;

&lt;p&gt;There are many benefits to participating in 24 Pull Requests. Some of the benefits include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn new skills:&lt;/strong&gt; By contributing to open source projects, you can learn new skills and technologies.&lt;br&gt;
&lt;strong&gt;Gain experience:&lt;/strong&gt; Contributing to open source projects is a great way to gain experience and build your portfolio.&lt;br&gt;
&lt;strong&gt;Make a difference:&lt;/strong&gt; Your contributions can help make open source projects better and more useful for everyone.&lt;br&gt;
&lt;strong&gt;Meet new people:&lt;/strong&gt; You can meet new people from all over the world by contributing to open source projects.&lt;br&gt;
&lt;strong&gt;Give back:&lt;/strong&gt; Contributing to open source is a great way to give back to the community.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tips for Success
&lt;/h2&gt;

&lt;p&gt;Here are a few tips for success when participating in 24 Pull Requests:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start small:&lt;/strong&gt; Don't try to do too much too soon. Start by fixing small bugs or adding small features.&lt;br&gt;
&lt;strong&gt;Ask for help:&lt;/strong&gt; If you're stuck, don't be afraid to ask for help. Most open source communities are very welcoming and helpful.&lt;br&gt;
&lt;strong&gt;Be patient:&lt;/strong&gt; It takes time to become a good open source contributor. Don't get discouraged if you don't get positive feedback right away.&lt;br&gt;
&lt;strong&gt;Have fun!:&lt;/strong&gt; Contributing to open source should be fun. If you're not enjoying yourself, you're less likely to stick with it.&lt;/p&gt;

&lt;p&gt;24 Pull Requests is a great way to get involved in open source and make a positive impact on the world. I encourage everyone to participate this year!&lt;/p&gt;

&lt;p&gt;In addition to the benefits mentioned above, 24 Pull Requests is also a great way to learn about different open source projects and communities. By participating, you'll be exposed to a wide range of projects and people, which can help you find new projects to contribute to in the future.&lt;/p&gt;

&lt;p&gt;So, what are you waiting for? Get started today and make a difference!&lt;/p&gt;

&lt;p&gt;I hope this blog post has been helpful. If you have any questions, please feel free to leave a comment below.&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>24pullrequests</category>
      <category>opensource</category>
      <category>webdev</category>
      <category>learning</category>
    </item>
    <item>
      <title>Setting Up Nuxt 3 with Vuetify 3: A Comprehensive Guide</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Thu, 16 Nov 2023 19:13:57 +0000</pubDate>
      <link>https://dev.to/sarveshk76/setting-up-nuxt-3-with-vuetify-3-a-comprehensive-guide-gmg</link>
      <guid>https://dev.to/sarveshk76/setting-up-nuxt-3-with-vuetify-3-a-comprehensive-guide-gmg</guid>
      <description>&lt;p&gt;Nuxt 3 and Vuetify 3 are powerful tools that can help you build modern, responsive, and performant web applications. Nuxt 3 provides a framework for building Vue.js applications, while Vuetify 3 offers a comprehensive UI component library. Combining these two technologies allows you to create stunning and functional web apps with ease.&lt;/p&gt;

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

&lt;p&gt;Before you begin, ensure you have the following prerequisites:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Node.js: Install Node.js, which includes the npm package manager.&lt;/li&gt;
&lt;li&gt;Vite: Install Vite, a front-end build tool used by Nuxt 3.&lt;/li&gt;
&lt;li&gt;Basic Vue.js Knowledge: Familiarity with Vue.js concepts and syntax is recommended.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Creating a Nuxt 3 Project
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Project Directory:&lt;/strong&gt; Create a new directory for your Nuxt 3 project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Initialize Nuxt:&lt;/strong&gt; Open a terminal window and navigate to the project directory. Run the following command to initialize a new Nuxt 3 project:
&lt;/li&gt;
&lt;/ol&gt;

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

&lt;/div&gt;



&lt;p&gt;This command will create a basic Nuxt 3 project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Vuetify 3
&lt;/h2&gt;

&lt;p&gt;Install the required Vuetify modules as dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -D vuetify vite-plugin-vuetify
npm i @mdi/font
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating a Vuetify Plugin
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a Plugins Folder:&lt;/strong&gt; Create a directory named plugins inside the Nuxt 3 project root.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Create the Vuetify Plugin:&lt;/strong&gt; Inside the plugins directory, create a file named vuetify.ts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Import Vuetify:&lt;/strong&gt; Import Vuetify and its components using the following code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createVuetify } from 'vuetify'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configure And Export Vuetify :&lt;/strong&gt; Create a Vuetify instance and configure its options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   export default defineNuxtPlugin((nuxtApp) =&amp;gt; {
   const vuetify = createVuetify({
    icons: {
      defaultSet: 'mdi',

    },
   })
   nuxtApp.vueApp.use(vuetify)
})

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Integrating Vuetify with Nuxt 3
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Import Vuetify Plugin And Enable Sass/SCSS Support:&lt;/strong&gt; In the nuxt.config.js file, import the Vuetify plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'

export default defineNuxtConfig({
  css: [
    'vuetify/lib/styles/main.sass',
    "@mdi/font/css/materialdesignicons.css",
  ],
  build: {
    transpile: ['vuetify']
  },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use Vuetify Components:&lt;/strong&gt; You can now use Vuetify components in your Vue.js templates. For example, to add a button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;v-btn&amp;gt;Click Me&amp;lt;/v-btn&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the Application
&lt;/h2&gt;

&lt;p&gt;To start the Nuxt 3 development server, run the following command in the project directory:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;This will start the server and open your application in the browser. You can now start developing your Nuxt 3 application with Vuetify 3.&lt;/p&gt;

</description>
      <category>nuxt</category>
      <category>vue</category>
      <category>vuetify</category>
      <category>node</category>
    </item>
    <item>
      <title>Tutorial to Predict the Genre of Books using MindsDB [Mongo API]</title>
      <dc:creator>Sarvesh S. Kulkarni</dc:creator>
      <pubDate>Thu, 27 Oct 2022 10:35:35 +0000</pubDate>
      <link>https://dev.to/sarveshk76/tutorial-to-predict-the-genre-of-books-using-mongodb-2a1n</link>
      <guid>https://dev.to/sarveshk76/tutorial-to-predict-the-genre-of-books-using-mongodb-2a1n</guid>
      <description>&lt;p&gt;In this tutorial, we will be learning to:&lt;br&gt;
👉 Connect a MongoDB database to MindsDB.&lt;br&gt;
👉 Train a model to predict the genre of books based on the titles and descriptions.&lt;br&gt;
👉 Get a prediction from the model given certain input parameters.&lt;/p&gt;

&lt;p&gt;We will be using the Books genre dataset 📖 that can be downloaded from &lt;a href="https://www.kaggle.com/datasets/athu1105/book-genre-prediction"&gt;here&lt;/a&gt;. You are also free to use your own dataset and follow along the tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  #️⃣Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;This tutorial is primarily going to be about &lt;code&gt;MindsDB&lt;/code&gt; so the reader is expected to have some level of familiarity with &lt;a href="https://www.mongodb.com/cloud/atlas"&gt;MongoDB Atlas&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;In short, MongoDB Atlas is a Database as a Service(DaaS), which we will be using to spin up a MongoDB database cluster and load our dataset.&lt;/li&gt;
&lt;li&gt;Download a copy of the Books genre dataset from &lt;a href="https://www.kaggle.com/datasets/athu1105/book-genre-prediction"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;You are also expected to have an account on &lt;code&gt;MindsDB Cloud&lt;/code&gt;. If not, head over to &lt;a href="https://cloud.mindsdb.com/"&gt;https://cloud.mindsdb.com/&lt;/a&gt; and create an account. It hardly takes a few minutes. ⚡&lt;/li&gt;
&lt;li&gt;We also need MongoDB Compass to load the dataset into the collection. It can be downloaded from &lt;a href="https://www.mongodb.com/try/download/compass"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  #️⃣About MindsDB
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;MindsDB&lt;/code&gt; is a predictive platform that makes databases intelligent and machine learning easy to use. It allows data analysts to build and visualize forecasts in BI dashboards without going through the complexity of ML pipelines, all through SQL. It also helps data scientists to streamline MLOps by providing advanced instruments for in-database machine learning and optimize ML workflows through a declarative JSON-AI syntax.&lt;br&gt;
Although only SQL is mentioned, MongoDB is also supported.&lt;/p&gt;

&lt;h2&gt;
  
  
  #️⃣Dataset Overview
&lt;/h2&gt;

&lt;p&gt;The dataset contains information about the title, genre and summary of books.&lt;/p&gt;

&lt;h2&gt;
  
  
  #️⃣Setting up a Cluster on MongoDB Atlas
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head over to &lt;a href="https://cloud.mongodb.com/"&gt;https://cloud.mongodb.com/&lt;/a&gt; and create a new project named &lt;code&gt;booksdb&lt;/code&gt; and within it a new database cluster named &lt;code&gt;cluster0&lt;/code&gt;. Typically, it takes a minute or two to provision a cluster. Once it is done, you should have something like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7lyTOBZp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u07wqe1is0zfu5x3wat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7lyTOBZp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u07wqe1is0zfu5x3wat.png" alt="Image description" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on "Connect" button. In pop-up modal, you will be asked to select a tool to interact with your cluster. For this tutorial I'm choosing MongoDB Compass for connection.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OhCDeQ_4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwvvy1ppvdh94s4qfruf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OhCDeQ_4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwvvy1ppvdh94s4qfruf.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next, you will be asked to choose the connection method.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fUeTqKpc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x2d9ai2knkfj9w0jp5k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fUeTqKpc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7x2d9ai2knkfj9w0jp5k.png" alt="Image description" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After that, you will be asked to create a new database user. After providing a username and password, click on the "Create Database User" button.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RxGzhDV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avdezpjoavod1nqrcu7e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RxGzhDV0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/avdezpjoavod1nqrcu7e.png" alt="Image description" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In the next step, select "Connect using MongoDB Compass". Copy the connection string which should look like this:&lt;br&gt;
&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;mongodb://cloud.mindsdb.com/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And from Advanced Connection Option, select Authentication method as "Username/Password" and enter your MindsDB cloud credentials.&lt;/p&gt;

&lt;p&gt;Now we will connect to our database from MongoDB Compass and load our dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  #️⃣Loading the dataset with MongoDB Compass
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Head over to &lt;a href="https://cloud.mindsdb.com/"&gt;https://cloud.mindsdb.com/&lt;/a&gt; and after login click on "Add data" to import data from csv file.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--J_rhrCGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dph3dguci59643ow3az.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--J_rhrCGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dph3dguci59643ow3az.png" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;br&gt;
This imported data will be available in files database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open MongoDB Compass. Paste the connection string and click on "Connect". On successful authentication, you will be welcomed by this screen.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tGLvgUL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s162qjq35xy30k6eag9l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tGLvgUL5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s162qjq35xy30k6eag9l.png" alt="Image description" width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now open Mongosh terminal in MongoDB Compass, enter the command below to insert a database in MindsDB.&lt;br&gt;
&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;db.databases.insertOne({
    name: "BooksDB", // name of database
    engine: "mongodb", // databaase engine to use,
    connection_args: {
        "port": 27017, // connection port
        "host": "mongodb://cloud.mindsdb.com:27017", // connection host
        "database": "files" // connecting database           
    }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--irP5hDWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wybi1v1uqebctbkcenn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--irP5hDWV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wybi1v1uqebctbkcenn.png" alt="Image description" width="800" height="365"&gt;&lt;/a&gt;&lt;br&gt;
We are now ready to train an ML model to predict the &lt;code&gt;books_genre&lt;/code&gt; using &lt;code&gt;MindsDB&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  #️⃣Training the ML Model
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Head over to &lt;a href="https://cloud.mindsdb.com/"&gt;MindsDB cloud&lt;/a&gt; to create predictor. Enter the command below and execute.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE PREDICTOR mindsdb.books_genre_predictor
FROM files
(SELECT * FROM books)
PREDICT genre;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UQu1CSmw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwnb9r1hiyywqwh79c5y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UQu1CSmw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lwnb9r1hiyywqwh79c5y.png" alt="Image description" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;That's how simple training an ML model is with MindsDB. Now all you have to do is wait for a few minutes for the model to get trained after which you will be able to run queries and get predictions on the books_genre.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  #️⃣Running Queries to get predictions
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Once the status changes to COMPLETE, it means that our model is now ready and we can start getting predictions.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LwOoWu0j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b8xvrfnzf8ztyfn9ro0h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LwOoWu0j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b8xvrfnzf8ztyfn9ro0h.png" alt="Image description" width="800" height="193"&gt;&lt;/a&gt;&lt;br&gt;
We can see that the model has an accuracy of 98.8%, which is impressive!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To start getting prediction, enter the query below in the terminal:&lt;br&gt;
&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;db.books_genre_predictor.find({title:"Yendi", summary:"Six months after he took control of his own territory in the criminal"})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we wanted to know the genre of a book with following details.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We can see that the model predicted with 99.9% confidence that the genre for the given book details is "fantasy".
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YKKL42Xb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4a3z0pitj020jgf0iy9o.png" alt="Image description" width="800" height="211"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can play with the inputs and run a few more queries and observe the results.&lt;br&gt;
Thank you for reading this article. If you liked it, please like and share it with others. If you want to learn more about &lt;code&gt;MindsDB&lt;/code&gt;, visit their official documentation and/or talk to the team behind it on Slack.&lt;/p&gt;

&lt;p&gt;See you in my next article, Happy Querying! 📉&lt;/p&gt;

</description>
      <category>mindsdb</category>
      <category>machinelearning</category>
      <category>mongodb</category>
      <category>hacktoberfest</category>
    </item>
  </channel>
</rss>
