Skip to content

Commit 79c1d87

Browse files
committed
Add evaluator decision docs
1 parent 5d699ef commit 79c1d87

5 files changed

Lines changed: 132 additions & 16 deletions

File tree

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The core React on Rails gem and npm package.
1919
**Experienced developers:**
2020

2121
- [Installation Guide](./oss/getting-started/installation-into-an-existing-rails-app.md) - Add to existing Rails app
22+
- [Compare React on Rails to alternatives](./oss/getting-started/comparing-react-on-rails-to-alternatives.md) - Evaluate Hotwire, Inertia Rails, and react-rails
2223
- [API Reference](./oss/api-reference/view-helpers-api.md) - View helpers and JavaScript API
2324
- [Configuration](./oss/configuration/README.md) - All configuration options
2425
- [Core Concepts](./oss/core-concepts/how-react-on-rails-works.md) - Architecture and SSR
@@ -41,6 +42,7 @@ The core React on Rails gem and npm package.
4142
| I want to... | Go here |
4243
| -------------------------------------- | ----------------------------------------------------------------------------------------- |
4344
| **Add React to existing Rails app** | [Installation Guide](./oss/getting-started/installation-into-an-existing-rails-app.md) |
45+
| **Compare Rails + frontend options** | [Comparison Guide](./oss/getting-started/comparing-react-on-rails-to-alternatives.md) |
4446
| **Enable server-side rendering** | [SSR Guide](./oss/core-concepts/react-server-rendering.md) |
4547
| **Set up hot reloading** | [HMR Setup](./oss/building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md) |
4648
| **Use Redux with Rails** | [Redux Integration](./oss/building-features/react-and-redux.md) |
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Comparing React on Rails to Alternatives
2+
3+
If you are evaluating frontend approaches for a Rails application, the right choice depends on how much of your UI should live in React, how much Rails should keep rendering, and whether server rendering is a requirement from day one.
4+
5+
This page is intentionally practical. It focuses on the tradeoffs teams usually care about when choosing between React on Rails, Hotwire/Turbo, Inertia Rails, and react-rails.
6+
7+
## Short Version
8+
9+
Choose **React on Rails** when you want Rails and React tightly integrated, you expect a meaningful amount of React UI, and you want server rendering or a path to React on Rails Pro features such as React Server Components and streaming SSR.
10+
11+
Choose **Hotwire/Turbo** when Rails-rendered HTML is still your preferred model and you only need modest JavaScript sprinkles or progressive enhancement.
12+
13+
Choose **Inertia Rails** when you want a page-oriented SPA workflow with Rails controllers and Vite, and you are comfortable making the frontend shell the main rendering model.
14+
15+
Choose **react-rails** when you want a smaller helper-based integration for embedding React components in Rails views and do not need the broader React on Rails feature set.
16+
17+
## At a Glance
18+
19+
| Option | Primary view model | Best fit | What to watch |
20+
| ------------------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
21+
| **React on Rails** | Rails views rendering React components with tight Rails integration | Existing Rails apps, SSR, mixed Rails + React pages, progressive adoption | More setup than lightweight helper-based integrations |
22+
| **Hotwire/Turbo** | Rails renders HTML, Turbo updates the page | Rails-first apps with minimal client-side complexity | Not a React solution, so React ecosystem reuse is limited |
23+
| **Inertia Rails** | Controllers return page props to a client-rendered frontend shell | Teams that want SPA-style page transitions without building a separate JSON API first | Different rendering model than traditional Rails views; review current SSR support in official docs |
24+
| **react-rails** | Rails views mount React components with helper-based integration | Smaller React islands and simpler embedding needs | Fewer integrated Rails + React workflow features than React on Rails |
25+
26+
## React on Rails vs Hotwire/Turbo
27+
28+
Hotwire/Turbo is strongest when your team wants to keep Rails fully in charge of the HTML response lifecycle. It is a good fit for CRUD-heavy applications, low-JavaScript back offices, and teams that prefer Stimulus plus server-rendered views over a React-centric frontend architecture.
29+
30+
React on Rails is the better fit when your product already benefits from React's component model, third-party React libraries, complex client-side state, or reusable frontend architecture across many pages. It lets you keep Rails as the backend and routing layer while still using React as the main UI model where needed.
31+
32+
Choose Hotwire/Turbo if your goal is "stay mostly Rails views."
33+
34+
Choose React on Rails if your goal is "build substantial React UI without splitting Rails away from the app."
35+
36+
Official docs:
37+
38+
- [Hotwire Turbo handbook](https://turbo.hotwired.dev/handbook/introduction)
39+
40+
## React on Rails vs Inertia Rails
41+
42+
Inertia Rails gives you a different tradeoff. Instead of embedding React within Rails views, it uses Rails controllers to feed props into a frontend-driven page shell. That can feel closer to an SPA workflow while still avoiding a fully separate API for many use cases.
43+
44+
React on Rails keeps Rails views and helpers directly in play. That matters if you are incrementally adopting React inside an established Rails application, embedding React in only part of the UI, or relying on React component rendering from ERB/Haml without changing the app's page model.
45+
46+
Choose Inertia Rails if you want a page-oriented SPA style and are comfortable centering the frontend runtime in the request/response flow.
47+
48+
Choose React on Rails if you want deeper Rails-view integration, easier incremental adoption in existing apps, or the React on Rails Pro upgrade path for advanced rendering features.
49+
50+
Official docs:
51+
52+
- [Inertia Rails documentation](https://inertia-rails.dev/)
53+
- [Inertia Rails SSR guide](https://inertia-rails.dev/guide/server-side-rendering)
54+
55+
## React on Rails vs react-rails
56+
57+
react-rails is a good baseline comparison because it also helps you render React from Rails. The main difference is how much framework and workflow support you want around that integration.
58+
59+
react-rails is lighter-weight and helper-oriented. It can be a reasonable choice if you mostly need to mount React components in Rails views and want to keep the surrounding integration simple.
60+
61+
React on Rails goes further on the Rails + React integration story: generator workflows, Shakapacker-first tooling, server rendering support, richer integration patterns, and a clearer path to advanced features through React on Rails Pro.
62+
63+
Choose react-rails if your requirement is "mount React in Rails with minimal ceremony."
64+
65+
Choose React on Rails if your requirement is "treat React as a first-class frontend architecture inside Rails."
66+
67+
Official docs:
68+
69+
- [react-rails README](https://github.com/reactjs/react-rails)
70+
71+
## Common Decision Patterns
72+
73+
If you are adding React to an existing Rails application page by page, start with [installation into an existing Rails app](./installation-into-an-existing-rails-app.md).
74+
75+
If you want to validate React on Rails quickly in a fresh app, use the [quick start](./quick-start.md).
76+
77+
If you are currently on `react-rails`, see the dedicated [migration guide](../migrating/migrating-from-react-rails.md).
78+
79+
If you expect React Server Components, streaming SSR, or faster production SSR to matter soon, review [OSS vs Pro](./oss-vs-pro.md) and the [upgrade to Pro guide](../../pro/upgrading-to-pro.md) early so your evaluation includes the full path.
80+
81+
## Verify Current Capabilities in the Official Docs
82+
83+
These projects continue to evolve. Before making a final architectural decision, verify the current feature set, version support, and SSR story in the official docs for the option you are evaluating.
84+
85+
That is especially important if your decision depends on:
86+
87+
- server-side rendering behavior
88+
- Rails version support
89+
- Vite or bundler expectations
90+
- React version support
91+
- upgrade and maintenance posture
92+
93+
## Next Steps
94+
95+
- [Quick Start](./quick-start.md)
96+
- [Installation into an Existing Rails App](./installation-into-an-existing-rails-app.md)
97+
- [OSS vs Pro](./oss-vs-pro.md)
98+
- [Upgrading to Pro](../../pro/upgrading-to-pro.md)

docs/oss/getting-started/quick-start.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ Add the React on Rails gem and run its installer:
2626
# Add the gem
2727
bundle add react_on_rails --strict
2828

29-
# Commit your changes (required for generator)
30-
git add . && git commit -m "Add react_on_rails gem"
29+
# Optional but recommended: commit or stash first for easier diff review
30+
# git add . && git commit -m "Prepare for React on Rails install"
3131

32-
# Run the installer
33-
bin/rails generate react_on_rails:install
32+
# Run the installer for TypeScript
33+
bundle exec rails generate react_on_rails:install --typescript
34+
35+
# Optional: Use Rspack for faster builds
36+
# bundle exec rails generate react_on_rails:install --typescript --rspack
3437

35-
# Optional: Use Rspack for ~20x faster builds
36-
# bin/rails generate react_on_rails:install --rspack
38+
# For JavaScript instead of TypeScript, omit --typescript
39+
# bundle exec rails generate react_on_rails:install
3740
```
3841

3942
Take a look at the files created by the generator.
@@ -175,6 +178,7 @@ Now that you have React on Rails working, here's what to explore next:
175178
1. **[Using React on Rails](./using-react-on-rails.md)** - Core concepts explained
176179
2. **[View Helpers API](../api-reference/view-helpers-api.md)** - Learn all the options for `react_component`
177180
3. **[Hot Module Replacement](../building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md)** - Optimize your dev workflow
181+
4. **[Compare React on Rails to alternatives](./comparing-react-on-rails-to-alternatives.md)** - Evaluate Hotwire, Inertia Rails, and react-rails
178182

179183
### Dive Deeper
180184

docs/oss/getting-started/tutorial.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ By the time you read this, the latest may have changed. Be sure to check the ver
4040
- [Moving from the Rails default `/app/javascript` to the recommended `/client` structure](#moving-from-the-rails-default-appjavascript-to-the-recommended-client-structure)
4141
- [Custom IP & PORT setup (Cloud9 example)](#custom-ip--port-setup-cloud9-example)
4242
- [RubyMine performance tip](#rubymine-performance-tip)
43-
- [Conclusion](#conclusion)
43+
- [What's Next](#whats-next)
4444

4545
## Installation
4646

@@ -257,6 +257,7 @@ It's super important to exclude certain directories from RubyMine or else it wil
257257
Now that you have React on Rails running, here are ways to level up:
258258

259259
- **Add server-side rendering** — [SSR guide](../core-concepts/react-server-rendering.md)
260+
- **Compare React on Rails to alternatives** — [Comparison guide](./comparing-react-on-rails-to-alternatives.md)
260261
- **See the feature comparison** — [OSS vs Pro](./oss-vs-pro.md)
261262
- **Upgrade to Pro** for React Server Components, streaming SSR, and 10-100x faster SSR — [3-step upgrade guide](../../pro/upgrading-to-pro.md)
262263
- **Explore the full docs** — [Documentation index](../../README.md)

docs/oss/introduction.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ Unlike a separate SPA approach, React on Rails lets you leverage Rails conventio
4141
**Consider alternatives if:**
4242

4343
- ❌ You're building a standalone SPA with a separate API backend
44+
- ❌ You mainly want Rails-rendered HTML plus minimal JavaScript enhancements
45+
- ❌ You want a page-oriented SPA shell instead of embedding React into Rails views
46+
47+
If you're evaluating the tradeoffs, start with **[Comparing React on Rails to alternatives](./getting-started/comparing-react-on-rails-to-alternatives.md)**.
4448

4549
## Getting Started
4650

@@ -64,6 +68,12 @@ Detailed integration instructions for existing Rails applications with Shakapack
6468

6569
Step-by-step walkthrough building a full app with Redux, routing, and deployment.
6670

71+
### 🔍 Comparing Rails + Frontend Options?
72+
73+
**[Comparison Guide →](./getting-started/comparing-react-on-rails-to-alternatives.md)**
74+
75+
Compare React on Rails with Hotwire/Turbo, Inertia Rails, and react-rails.
76+
6777
### 👀 Learn by Example?
6878

6979
- **[Spec/Dummy App](https://github.com/shakacode/react_on_rails/tree/master/react_on_rails/spec/dummy)** - Simple example in this repo
@@ -74,15 +84,16 @@ Step-by-step walkthrough building a full app with Redux, routing, and deployment
7484

7585
Find guidance for your specific scenario:
7686

77-
| I want to... | Go here |
78-
| ----------------------------------- | ------------------------------------------------------------------------------------- |
79-
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
80-
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
81-
| **Set up hot reloading** | [HMR Setup](./building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md) |
82-
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
83-
| **Use TanStack Router** | [TanStack Router Guide](./building-features/tanstack-router.md) |
84-
| **Deploy to production** | [Deployment Guide](./deployment/README.md) |
85-
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
87+
| I want to... | Go here |
88+
| ------------------------------------ | ------------------------------------------------------------------------------------- |
89+
| **Add React to existing Rails app** | [Installation Guide](./getting-started/installation-into-an-existing-rails-app.md) |
90+
| **Compare Rails + frontend options** | [Comparison Guide](./getting-started/comparing-react-on-rails-to-alternatives.md) |
91+
| **Enable server-side rendering** | [SSR Guide](./core-concepts/react-server-rendering.md) |
92+
| **Set up hot reloading** | [HMR Setup](./building-features/hmr-and-hot-reloading-with-the-webpack-dev-server.md) |
93+
| **Use Redux with Rails** | [Redux Integration](./building-features/react-and-redux.md) |
94+
| **Use TanStack Router** | [TanStack Router Guide](./building-features/tanstack-router.md) |
95+
| **Deploy to production** | [Deployment Guide](./deployment/README.md) |
96+
| **Troubleshoot issues** | [Troubleshooting](./deployment/troubleshooting.md) |
8697

8798
## Core Concepts
8899

0 commit comments

Comments
 (0)