<?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: Arunkumar</title>
    <description>The latest articles on DEV Community by Arunkumar (@aruneeyy).</description>
    <link>https://dev.to/aruneeyy</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%2F1796997%2Fddcdaced-4c89-401d-bccb-34319f15360a.jpg</url>
      <title>DEV Community: Arunkumar</title>
      <link>https://dev.to/aruneeyy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aruneeyy"/>
    <language>en</language>
    <item>
      <title>🔐 Authentication vs Authorization</title>
      <dc:creator>Arunkumar</dc:creator>
      <pubDate>Mon, 21 Jul 2025 17:19:40 +0000</pubDate>
      <link>https://dev.to/aruneeyy/authentication-vs-authorization-5hfm</link>
      <guid>https://dev.to/aruneeyy/authentication-vs-authorization-5hfm</guid>
      <description>&lt;h2&gt;
  
  
  🧑‍💻 Authentication
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Defines&lt;/strong&gt;: Who you are
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Purpose&lt;/strong&gt;: Verify &lt;strong&gt;identity&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Happens&lt;/strong&gt;: &lt;em&gt;Before&lt;/em&gt; authorization
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;🔑 Entering username &amp;amp; password
&lt;/li&gt;
&lt;li&gt;📲 Logging in with Google
&lt;/li&gt;
&lt;li&gt;🔍 Scanning fingerprint
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛂 Authorization
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Defines&lt;/strong&gt;: What you can do
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Purpose&lt;/strong&gt;: Control &lt;strong&gt;access&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Happens&lt;/strong&gt;: &lt;em&gt;After&lt;/em&gt; authentication
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;✅ Access to admin dashboard
&lt;/li&gt;
&lt;li&gt;🚫 Restricting users from editing content
&lt;/li&gt;
&lt;li&gt;📂 Viewing certain files
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 Think of It Like This
&lt;/h2&gt;

&lt;p&gt;🏛️ &lt;strong&gt;Authentication&lt;/strong&gt; = Showing your ID at the door&lt;br&gt;&lt;br&gt;
🚪 &lt;strong&gt;Authorization&lt;/strong&gt; = Which rooms you're allowed to enter  &lt;/p&gt;




&lt;p&gt;✅ &lt;strong&gt;Both work together&lt;/strong&gt; to keep apps and data secure.&lt;br&gt;&lt;br&gt;
Without one, the other can't function effectively.&lt;/p&gt;

</description>
      <category>security</category>
      <category>coding</category>
      <category>programming</category>
    </item>
    <item>
      <title>The Godfather of AI: Which Jobs Are Safe from Automation?</title>
      <dc:creator>Arunkumar</dc:creator>
      <pubDate>Fri, 04 Jul 2025 06:24:14 +0000</pubDate>
      <link>https://dev.to/aruneeyy/the-godfather-of-ai-which-jobs-are-safe-from-automation-3kf3</link>
      <guid>https://dev.to/aruneeyy/the-godfather-of-ai-which-jobs-are-safe-from-automation-3kf3</guid>
      <description>&lt;h2&gt;
  
  
  📌 Key Insights from Geoffrey Hinton
&lt;/h2&gt;

&lt;p&gt;Geoffrey Hinton, a leading voice in AI and often dubbed the “Godfather of AI,” recently warned that &lt;strong&gt;many jobs are already being replaced by artificial intelligence&lt;/strong&gt;, especially in white-collar sectors.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⚠️ At-Risk Jobs
&lt;/h3&gt;

&lt;p&gt;AI is rapidly replacing roles that involve routine cognitive tasks, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Call center staff
&lt;/li&gt;
&lt;li&gt;Paralegals
&lt;/li&gt;
&lt;li&gt;Junior analysts
&lt;/li&gt;
&lt;li&gt;Help desk support
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hinton notes:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“One person with AI can do the work of ten. That changes everything.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  ✅ Safer Job Categories
&lt;/h3&gt;

&lt;p&gt;Jobs involving hands-on work and physical dexterity remain harder to automate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plumbing
&lt;/li&gt;
&lt;li&gt;Electricians
&lt;/li&gt;
&lt;li&gt;Skilled mechanics
&lt;/li&gt;
&lt;li&gt;Construction workers
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;“These tasks are still tough for machines,” says Hinton. “Tradespeople may be safer than many office workers.”&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 The Hidden Threat: Loss of Meaning
&lt;/h3&gt;

&lt;p&gt;Beyond job loss, Hinton highlights a deeper concern:&lt;br&gt;&lt;br&gt;
Even if basic income becomes a reality, &lt;strong&gt;people may lose their sense of purpose&lt;/strong&gt;, leading to widespread unhappiness.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“We’re heading into a world where many may not feel useful anymore.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🏥 More Resilient Sectors
&lt;/h3&gt;

&lt;p&gt;Certain jobs are more resistant to automation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Healthcare&lt;/strong&gt;: AI can assist, but not replace, frontline care.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creative fields and emotional labor&lt;/strong&gt;: Roles involving originality, empathy, or physical skill remain uniquely human—for now.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💬 Final Thought
&lt;/h2&gt;

&lt;p&gt;As AI reshapes the job market, Hinton's message is clear:&lt;br&gt;&lt;br&gt;
&lt;strong&gt;The safest jobs are those that require human touch—physical, emotional, or deeply creative.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🔗 Full article:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://www.businessinsider.com/geoffrey-hinton-godfather-of-ai-safe-jobs-2025-6" rel="noopener noreferrer"&gt;Business Insider – Geoffrey Hinton on Job Safety and AI&lt;/a&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>career</category>
      <category>hiring</category>
    </item>
    <item>
      <title>Building a Modern Rails App with React and Vite: A Complete Guide</title>
      <dc:creator>Arunkumar</dc:creator>
      <pubDate>Wed, 25 Jun 2025 10:24:31 +0000</pubDate>
      <link>https://dev.to/aruneeyy/building-a-modern-rails-app-with-react-and-vite-a-complete-guide-3fhh</link>
      <guid>https://dev.to/aruneeyy/building-a-modern-rails-app-with-react-and-vite-a-complete-guide-3fhh</guid>
      <description>&lt;p&gt;The evolution of front-end tooling has significantly enhanced the developer experience. &lt;strong&gt;Vite&lt;/strong&gt;, known for its lightning-fast build tool and hot module replacement, now integrates seamlessly with &lt;strong&gt;Ruby on Rails&lt;/strong&gt; via the &lt;code&gt;vite_rails&lt;/code&gt; gem. Gone are the days of slow webpack builds – with Vite, you get instant feedback and blazing-fast development cycles.&lt;/p&gt;

&lt;p&gt;In this comprehensive guide, we'll walk through setting up a modern Rails application with React using Vite, creating a powerful full-stack development environment.&lt;/p&gt;

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

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

&lt;ul&gt;
&lt;li&gt;Ruby (3.0+)&lt;/li&gt;
&lt;li&gt;Rails (7.0+)&lt;/li&gt;
&lt;li&gt;Node.js (16+)&lt;/li&gt;
&lt;li&gt;npm or yarn&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Create a New Rails Application
&lt;/h2&gt;

&lt;p&gt;First, let's create a fresh Rails project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails new rails_react_app &lt;span class="nt"&gt;--skip-javascript&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;rails_react_app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; We use &lt;code&gt;--skip-javascript&lt;/code&gt; to avoid conflicts with Rails' default JavaScript setup since we'll be using Vite.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2: Add Vite Rails
&lt;/h2&gt;

&lt;p&gt;Add the &lt;code&gt;vite_rails&lt;/code&gt; gem to your Gemfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Gemfile&lt;/span&gt;
&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'vite_rails'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the gem and set up Vite:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bundle &lt;span class="nb"&gt;install
&lt;/span&gt;bundle &lt;span class="nb"&gt;exec &lt;/span&gt;vite &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate &lt;code&gt;package.json&lt;/code&gt; with Vite dependencies&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;vite.config.ts&lt;/code&gt; configuration file&lt;/li&gt;
&lt;li&gt;Set up the &lt;code&gt;app/frontend/entrypoints/&lt;/code&gt; directory (default location for JS entrypoints)&lt;/li&gt;
&lt;li&gt;Configure Rails to work with Vite&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For more details, check the official guide:&lt;/strong&gt; &lt;a href="https://vite-ruby.netlify.app/guide/" rel="noopener noreferrer"&gt;vite-ruby.netlify.app/guide/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Install React Dependencies
&lt;/h2&gt;

&lt;p&gt;Install React and its dependencies using npm:&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;react react-dom @vitejs/plugin-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update your &lt;code&gt;vite.config.ts&lt;/code&gt; to include the React plugin:&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="c1"&gt;// vite.config.ts&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;defineConfig&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;vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;RubyPlugin&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;vite-plugin-ruby&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;react&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;@vitejs/plugin-react&lt;/span&gt;&lt;span class="dl"&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="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;RubyPlugin&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="nf"&gt;react&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;h2&gt;
  
  
  Step 4: Create Your React Application Structure
&lt;/h2&gt;

&lt;p&gt;Let's organize our code properly. Create the necessary directories and files:&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="nb"&gt;mkdir&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; app/frontend/src/components
&lt;span class="nb"&gt;touch &lt;/span&gt;app/frontend/entrypoints/application.jsx
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Create the main React component:&lt;/strong&gt;&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="c1"&gt;// app/frontend/src/App.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;react&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;App&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"container mx-auto p-8"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text-4xl font-bold text-blue-600"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Hello from Rails + React + Vite! 🚀
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mt-4 text-gray-600"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        Your modern full-stack development environment is ready!
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&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;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Create a sample component:&lt;/strong&gt;&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="c1"&gt;// app/frontend/src/components/Welcome.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;react&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;Welcome&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;message&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&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;Welcome&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Set Up Your Application Entrypoint
&lt;/h2&gt;

&lt;p&gt;Update your entrypoint file to render the React app:&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="c1"&gt;// app/frontend/entrypoints/application.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;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;createRoot&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;react-dom/client&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="nx"&gt;App&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;../src/App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Import CSS if you're using any&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./application.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;DOMContentLoaded&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="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;rootElement&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rootElement&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;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;rootElement&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;App&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 6: Update Your Rails Layout
&lt;/h2&gt;

&lt;p&gt;Modify your application layout to include Vite assets and provide a mount point for React:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- app/views/layouts/application.html.erb --&amp;gt;&lt;/span&gt;
&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Rails React App&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width,initial-scale=1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;csrf_meta_tags&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;csp_meta_tag&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;vite_client_tag&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;vite_stylesheet_tag&lt;/span&gt; &lt;span class="s1"&gt;'application'&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"root"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;

    &lt;span class="cp"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="n"&gt;vite_javascript_tag&lt;/span&gt; &lt;span class="s1"&gt;'application'&lt;/span&gt; &lt;span class="cp"&gt;%&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 7: Create a Controller and Route
&lt;/h2&gt;

&lt;p&gt;Generate a controller to serve your React app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails generate controller Pages index
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update the controller:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# app/controllers/pages_controller.rb&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;PagesController&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;ApplicationController&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;index&lt;/span&gt;
    &lt;span class="c1"&gt;# This will render the view where React will mount&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up your routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# config/routes.rb&lt;/span&gt;
&lt;span class="no"&gt;Rails&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;application&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;routes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;draw&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="s1"&gt;'pages#index'&lt;/span&gt;
  &lt;span class="n"&gt;get&lt;/span&gt; &lt;span class="s1"&gt;'pages/index'&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the view (it can be minimal since React handles the UI):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight erb"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- app/views/pages/index.html.erb --&amp;gt;&lt;/span&gt;
&lt;span class="c"&gt;&amp;lt;!-- React will mount here via the #root div in the layout --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 8: Start Your Development Servers
&lt;/h2&gt;

&lt;p&gt;Now you can start both Rails and Vite in development mode:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Terminal 1 - Rails server:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;rails server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Terminal 2 - Vite dev server:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/vite dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can use a process manager like &lt;code&gt;foreman&lt;/code&gt;. Create a &lt;code&gt;Procfile.dev&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;web: rails server -p 3000
vite: bin/vite dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;foreman start &lt;span class="nt"&gt;-f&lt;/span&gt; Procfile.dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Key Benefits of This Setup
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;⚡ Lightning Fast&lt;/strong&gt;: Vite's hot module replacement provides instant feedback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔧 Modern Tooling&lt;/strong&gt;: ES modules, TypeScript support out of the box&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📦 Optimized Builds&lt;/strong&gt;: Vite creates highly optimized production bundles&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🎯 Rails Integration&lt;/strong&gt;: Seamless integration with Rails asset pipeline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🛠️ Developer Experience&lt;/strong&gt;: Excellent debugging and development tools&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Production Deployment
&lt;/h2&gt;

&lt;p&gt;For production deployment, Vite will automatically build optimized assets. Make sure to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add the build step to your deployment process:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   bundle &lt;span class="nb"&gt;exec &lt;/span&gt;vite build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Ensure your production environment serves static assets properly&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Troubleshooting Common Issues
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Issue: React not mounting&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure the &lt;code&gt;#root&lt;/code&gt; div exists in your layout&lt;/li&gt;
&lt;li&gt;Check browser console for JavaScript errors&lt;/li&gt;
&lt;li&gt;Verify Vite dev server is running&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Issue: Assets not loading&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirm &lt;code&gt;vite_client_tag&lt;/code&gt; and &lt;code&gt;vite_javascript_tag&lt;/code&gt; are in your layout&lt;/li&gt;
&lt;li&gt;Check that Vite configuration is correct&lt;/li&gt;
&lt;li&gt;Ensure all dependencies are installed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Issue: Hot reload not working&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restart the Vite dev server&lt;/li&gt;
&lt;li&gt;Check for syntax errors in your React components&lt;/li&gt;
&lt;li&gt;Verify your Vite configuration includes the React plugin&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;You now have a powerful, modern Rails application with React and Vite! This setup provides:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Instant hot module replacement for rapid development&lt;/li&gt;
&lt;li&gt;Optimized production builds&lt;/li&gt;
&lt;li&gt;Modern JavaScript tooling&lt;/li&gt;
&lt;li&gt;Seamless Rails integration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The combination of Rails' robust backend capabilities with React's dynamic frontend and Vite's exceptional developer experience creates an ideal environment for building modern web applications.&lt;/p&gt;

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




&lt;p&gt;&lt;em&gt;For more advanced configurations and deployment strategies, check out the &lt;a href="https://vite-ruby.netlify.app/" rel="noopener noreferrer"&gt;Vite Ruby documentation&lt;/a&gt; and &lt;a href="https://react.dev/" rel="noopener noreferrer"&gt;React documentation&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>rails</category>
      <category>ruby</category>
      <category>vite</category>
    </item>
  </channel>
</rss>
