OR REACH ME ON

    Switching Between Rails, Node.js, and React: Lessons Learned

    By 2023, I had already spent years with Ruby on Rails as my main framework. But like many developers, I started picking up Node.js more often, especially for lightweight APIs and microservices, while continuing to use React on the frontend.

    Switching between these stacks taught me a lot about trade-offs, productivity, and how to choose the right tool for the job.

    Rails: Batteries Included

    Rails shines when you want to build something quickly with conventions.

    Example: A simple User model with validation.

    				
    					class User < ApplicationRecord
      validates :email, presence: true, uniqueness: true
    end
    				
    			

    With just a few lines, you get validations, migrations, and ORM all together.

    Pros:

    • Super fast prototyping

    • Rich ecosystem (Devise, ActiveAdmin, Sidekiq)

    • Conventions reduce decision fatigue

    Cons:

    • Heavy for small microservices

    • Performance tuning needed at scale

    Node.js: Lightweight & Flexible

    For smaller APIs, Node.js gave me speed and control.

    				
    					const express = require("express");
    const app = express();
    
    app.get("/hello", (req, res) => {
      res.send("Hello World!");
    });
    
    app.listen(3000, () => console.log("Server running on port 3000"));
    				
    			

    Pros:

    • Lightweight and minimal

    • Large ecosystem of npm packages

    • Works well with serverless deployments

    Cons:

    • Too much flexibility → reinventing wheels

    • Callbacks/promises can get messy without discipline

    React: The Constant Frontend

    Regardless of backend, React became my go-to frontend.

    				
    					function Greeting({ name }) {
      return <h1>Hello, {name}!</h1>;
    }
    				
    			

    Pros:

    • Component-based structure scales well

    • Huge community and libraries

    • Works seamlessly with both Rails APIs and Node APIs

    Cons:

    • State management can get complex

    • Requires build setup (Webpack, Vite, etc.)

    🎯 Final Thoughts

    Switching between Rails, Node.js, and React wasn’t about abandoning one for the other. It was about choosing the right tool for the right project.

    By early 2023, I was comfortable context-switching between these stacks — which made me faster at delivering projects for clients and gave me confidence to lead teams across different technologies.