react_on_rails_pro/README.md
Performance enhancements and advanced features for React on Rails.
See the CHANGELOG for release updates and upgrade details.
React on Rails Pro is a commercial extension to the open-source React on Rails gem that provides advanced performance optimizations and enterprise features for Rails applications using React.
Key Points:
react_on_rails_pro/āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā React on Rails Pro (this package) ā
ā ⢠SSR performance enhancements ā
ā ⢠React Server Components ā
ā ⢠Advanced caching ā
ā ⢠Node.js rendering pool ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā React on Rails (open-source, required) ā
ā ⢠Basic SSR ā
ā ⢠Component registration ā
ā ⢠Rails integration ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
React on Rails Pro works without a license for evaluation, development, testing, and CI/CD. No registration or license key is needed to get started.
A paid license is required only for production deployments.
Once you have a paid license, set the environment variable:
export REACT_ON_RAILS_PRO_LICENSE="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
š Detailed setup instructions: See LICENSE_SETUP.md for complete configuration guide, team setup, and troubleshooting.
React on Rails Pro delivers measurable performance improvements for production applications:
Case Study: Popmenu
Consider React on Rails Pro if you:
| Feature | Open Source | Pro |
|---|---|---|
| Basic SSR | ā | ā |
| Component Registration | ā | ā |
| Rails Integration | ā | ā |
| Fragment Caching | ā | ā |
| Prerender Caching | ā | ā |
| Proper Node Renderer | ā | ā |
| React Server Components | ā | ā |
| Streaming SSR | ā | ā |
| Code Splitting (SSR) | ā | ā |
| Bundle Caching | ā | ā |
| Professional Support | ā | ā |
Cache React components at the Rails view layer with intelligent cache key generation.
# Cache component output with automatic cache key from props
<%= cached_react_component("UserProfile", cache_key: [@user]) do
{ user_id: @user.id }
end %>
# Lazy evaluation of props - only evaluated on cache miss
<%= cached_react_component("ExpensiveComponent", cache_key: [@user, @post]) do
expensive_calculation
end %>
Benefits:
š Learn more: docs/oss/building-features/caching.md
Cache the JavaScript evaluation results on the Node.js side.
# In config/initializers/react_on_rails_pro.rb
ReactOnRailsPro.configure do |config|
config.prerender_caching = true
end
Benefits:
š Learn more: docs/oss/building-features/caching.md
High-performance standalone Node.js server for server-side rendering with connection pooling and automatic worker management.
Key Advantages:
Example Configuration:
// node-renderer.js
const path = require('path');
const { reactOnRailsProNodeRenderer } = require('react-on-rails-pro-node-renderer');
reactOnRailsProNodeRenderer({
serverBundleCachePath: path.resolve(__dirname, '.node-renderer-bundles'),
port: 3800,
workersCount: 4,
supportModules: true, // Required for loadable-components
});
š Learn more: docs/oss/building-features/node-renderer/basics.md
Full support for React 18+ Server Components with streaming.
# Stream React Server Components
<%= stream_react_component("MyServerComponent", props: @props) %>
# Or with caching
<%= cached_stream_react_component("MyServerComponent", props: @props) %>
Benefits:
š Learn more: Contact [email protected] for RSC documentation
Speed up webpack rebuilds by caching unchanged bundles.
Benefits:
š Learn more: docs/oss/building-features/bundle-caching.md
Prevent state leaks between SSR requests.
ReactOnRailsPro.configure do |config|
# Run JavaScript before each render to clear global state
config.ssr_pre_hook_js = "global.myLeakyLib && global.myLeakyLib.reset();"
end
š Learn more: docs/oss/configuration/configuration-pro.md
| React on Rails Pro | React on Rails | Rails | Ruby | React |
|---|---|---|---|---|
| 16.x | >= 16.0 | >= 7.0 | >= 3.2 | >= 18 |
| 3.x | >= 13.0 | >= 6.0 | >= 3.0 | >= 16.8 |
Note: Pro version numbers were aligned with the core gem starting at 16.2.0. Pro 16.x is the direct successor to Pro 3.x/4.x.
š Check compatibility: See CHANGELOG.md for version-specific requirements
No license is required to get started. React on Rails Pro runs freely for evaluation, development, and testing. A paid license is only needed for production deployments.
1. Install the Gem
Since React on Rails Pro is part of the public monorepo, you can install it directly from GitHub:
# Gemfile
gem 'react_on_rails_pro', '~> 16.0'
Then run:
bundle install
2. Configure (Optional)
Create config/initializers/react_on_rails_pro.rb:
ReactOnRailsPro.configure do |config|
# Enable prerender caching for performance
config.prerender_caching = true
end
3. Verify Installation
rails console
> ReactOnRails::Utils.react_on_rails_pro?
# => true
š Done! You're now using React on Rails Pro.
The Pro dummy app demonstrates all features in action:
Location: spec/dummy (in this monorepo)
Features Demonstrated:
cached_react_componentRunning the Example:
# From the monorepo root
cd react_on_rails_pro/spec/dummy
bundle install
yarn install
# Start the Rails app
bin/dev
Visit http://localhost:3000 to see the examples.
š Learn more: See spec/dummy/README.md
Check out these production applications using React on Rails Pro:
Need help with your React on Rails project?
ShakaCode offers:
Book a consultation ā with Justin Gordon, creator of React on Rails.
React on Rails Pro is developed and maintained by ShakaCode, the team behind:
Q: Do I need a license to try React on Rails Pro?
A: No! React on Rails Pro works without a license for evaluation, development, testing, and CI/CD. A paid license is only required for production deployments.
Q: How much does a production license cost?
A: Pricing is customized based on your needs. Contact [email protected] for a quote.
Q: What's the difference between Pro and open-source React on Rails?
A: Pro adds performance features on top of the open-source gem:
Q: Do I need the Node Renderer?
A: No, it's optional but recommended. The Node Renderer provides the best performance for high-traffic sites and is required for:
For apps that do not require advanced performance features, ExecJS (the default) works fine.
Q: Is React on Rails Pro compatible with my React version?
A: Pro works with React 16.8+. For React Server Components and Streaming SSR, you need React 18+. See requirements ā
Q: Can I use Pro with Vite instead of Webpack/Shakapacker?
A: The Node Renderer currently expects webpack bundles. For Vite support, contact [email protected].
Q: Does Pro work with TypeScript?
A: Yes! Pro works seamlessly with TypeScript applications.
Q: How do I upgrade from an older Pro version?
A: Check the CHANGELOG for breaking changes and migration steps. For major upgrades, we recommend professional support: [email protected]
Q: Where do I start?
A: Follow our Quick Start guide ā no license needed to get started!
Q: Can I try Pro before buying?
A: Yes! React on Rails Pro works without a license for evaluation and development. Just install and start using it.
Q: Is there a demo application?
A: Yes! The spec/dummy app demonstrates all Pro features. See examples ā
React on Rails Pro is commercial software. See LICENSE for the complete license agreement.
Summary:
React on Rails Pro is part of the React on Rails monorepo. For contribution guidelines, see:
Note: Pro features are developed by the ShakaCode team and licensed customers only.