Ask HN: Next.js or Rails for a new project in 2023

  • I'm biased (having started Next.js), but I found a comment on the recent HN thread "The Market for Lemons"[1] thread quite insightful.

    Basically, @christophilus makes the case that projects they'd work with always end up "accreting interactivity to the point that I’d wished we had started with a single, unified, well-structured way for managing the UI that handled interactivity well."

    I think that's the core argument for Next.js vs Rails. For Next.js, interactivity, fast page loads and transitions, client-side statefulness are priorities. You can import rich UI components from libraries like https://www.tremor.so/ or https://ui.shadcn.com/ or the dozens of others in seconds.

    For Rails, the rich, JS-based interactivity model was not a priority. The reason you probably miss `ActiveRecord` is that we certainly didn't start there, and given it was a focus for Rails, it's probably amazing. The Next.js ecosystem is strengthening a lot in that area, so I'm very optimistic we'll get there too.

    In a nutshell, Next.js prioritizes the frontend experience. Rails prioritized the backend. Choose the tech that's best aligned to your goals.

    With regards to hiring, there's a very active job market[2], and a very large community[3]. Let me know if you found this helpful!

    [1] https://news.ycombinator.com/item?id=34666938

    [2] https://twitter.com/rauchg/status/1621233983819509760

    [3] https://twitter.com/nextjs/status/1620419717319258114

  • I would personally go with Rails backend + Next.js front-end. You don't need to use Next.js to build your backend. In fact, I would never use Next.js to build my backend unless it's for something simple.

    A lot of things don't work as well with Next.js' serverless backend approach such as database connections, websockets, or even something as simple as a cron job done on the server.

    Serverless backends tend to make things more complicated when you're trying to build an MVP - unless cheap scaling is part of that MVP.

  • Related: As a fellow Rubyist, Javascript (in general) didn't really "click" until I started using curried functions, particularly / almost entirely when dealing with callbacks. Highly recommend!

  • Rails backend (since you know it)

    Next frontend (to enforce loose coupling)