react_on_rails 16.2.0.beta.3 → 16.2.0.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/CLAUDE.md +59 -0
- data/CONTRIBUTING.md +48 -0
- data/Gemfile.development_dependencies +1 -0
- data/Gemfile.lock +25 -2
- data/SWITCHING_CI_CONFIGS.md +55 -6
- data/Steepfile +51 -0
- data/bin/ci-rerun-failures +34 -11
- data/bin/ci-run-failed-specs +25 -1
- data/bin/ci-switch-config +254 -32
- data/bin/lefthook/check-trailing-newlines +2 -12
- data/bin/lefthook/eslint-lint +0 -10
- data/bin/lefthook/prettier-format +0 -10
- data/bin/lefthook/ruby-autofix +1 -5
- data/lib/react_on_rails/configuration.rb +56 -12
- data/lib/react_on_rails/controller.rb +3 -3
- data/lib/react_on_rails/doctor.rb +4 -2
- data/lib/react_on_rails/helper.rb +3 -3
- data/lib/react_on_rails/pro_helper.rb +2 -44
- data/lib/react_on_rails/react_component/render_options.rb +7 -7
- data/lib/react_on_rails/utils.rb +40 -0
- data/lib/react_on_rails/version.rb +1 -1
- data/react_on_rails_pro/CHANGELOG.md +135 -29
- data/react_on_rails_pro/Gemfile.development_dependencies +1 -0
- data/react_on_rails_pro/Gemfile.lock +6 -3
- data/react_on_rails_pro/README.md +559 -38
- data/react_on_rails_pro/docs/installation.md +40 -22
- data/react_on_rails_pro/docs/node-renderer/basics.md +26 -19
- data/react_on_rails_pro/docs/node-renderer/js-configuration.md +24 -22
- data/react_on_rails_pro/docs/node-renderer/troubleshooting.md +2 -0
- data/react_on_rails_pro/lib/react_on_rails_pro/version.rb +1 -1
- data/react_on_rails_pro/package.json +1 -1
- data/react_on_rails_pro/packages/node-renderer/src/master/restartWorkers.ts +39 -17
- data/react_on_rails_pro/packages/node-renderer/src/master.ts +15 -4
- data/react_on_rails_pro/packages/node-renderer/src/shared/configBuilder.ts +44 -5
- data/react_on_rails_pro/packages/node-renderer/src/shared/utils.ts +4 -2
- data/react_on_rails_pro/packages/node-renderer/src/worker/handleGracefulShutdown.ts +49 -0
- data/react_on_rails_pro/packages/node-renderer/src/worker/vm.ts +3 -3
- data/react_on_rails_pro/packages/node-renderer/src/worker.ts +5 -2
- data/react_on_rails_pro/packages/node-renderer/tests/helper.ts +8 -8
- data/react_on_rails_pro/packages/node-renderer/tests/testingNodeRendererConfigs.js +1 -1
- data/react_on_rails_pro/packages/node-renderer/tests/worker.test.ts +19 -19
- data/react_on_rails_pro/rakelib/rbs.rake +47 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/cache.rbs +13 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/configuration.rbs +100 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/error.rbs +4 -0
- data/react_on_rails_pro/sig/react_on_rails_pro/utils.rbs +7 -0
- data/react_on_rails_pro/sig/react_on_rails_pro.rbs +5 -0
- data/react_on_rails_pro/spec/dummy/Gemfile.lock +6 -3
- data/react_on_rails_pro/spec/dummy/client/node-renderer.js +1 -1
- data/react_on_rails_pro/spec/dummy/spec/system/integration_spec.rb +16 -17
- data/sig/react_on_rails/controller.rbs +1 -1
- data/sig/react_on_rails/error.rbs +4 -0
- data/sig/react_on_rails/helper.rbs +2 -2
- data/sig/react_on_rails/json_parse_error.rbs +10 -0
- data/sig/react_on_rails/prerender_error.rbs +21 -0
- data/sig/react_on_rails/smart_error.rbs +28 -0
- data/sig/react_on_rails.rbs +3 -24
- metadata +14 -3
- data/lib/react_on_rails/pro_utils.rb +0 -37
|
@@ -9,7 +9,7 @@ GIT
|
|
|
9
9
|
PATH
|
|
10
10
|
remote: ..
|
|
11
11
|
specs:
|
|
12
|
-
react_on_rails (16.2.0.beta.
|
|
12
|
+
react_on_rails (16.2.0.beta.4)
|
|
13
13
|
addressable
|
|
14
14
|
connection_pool
|
|
15
15
|
execjs (~> 2.5)
|
|
@@ -20,14 +20,14 @@ PATH
|
|
|
20
20
|
PATH
|
|
21
21
|
remote: .
|
|
22
22
|
specs:
|
|
23
|
-
react_on_rails_pro (16.2.0.beta.
|
|
23
|
+
react_on_rails_pro (16.2.0.beta.4)
|
|
24
24
|
addressable
|
|
25
25
|
connection_pool
|
|
26
26
|
execjs (~> 2.9)
|
|
27
27
|
httpx (~> 1.5)
|
|
28
28
|
jwt (~> 2.7)
|
|
29
29
|
rainbow
|
|
30
|
-
react_on_rails (= 16.2.0.beta.
|
|
30
|
+
react_on_rails (= 16.2.0.beta.4)
|
|
31
31
|
|
|
32
32
|
GEM
|
|
33
33
|
remote: https://rubygems.org/
|
|
@@ -300,6 +300,8 @@ GEM
|
|
|
300
300
|
rb-fsevent (0.11.2)
|
|
301
301
|
rb-inotify (0.11.1)
|
|
302
302
|
ffi (~> 1.0)
|
|
303
|
+
rbs (3.9.5)
|
|
304
|
+
logger
|
|
303
305
|
rdoc (6.12.0)
|
|
304
306
|
psych (>= 4.0.0)
|
|
305
307
|
regexp_parser (2.9.2)
|
|
@@ -476,6 +478,7 @@ DEPENDENCIES
|
|
|
476
478
|
pry-theme
|
|
477
479
|
puma (~> 6)
|
|
478
480
|
rails (~> 7.1)
|
|
481
|
+
rbs
|
|
479
482
|
react_on_rails!
|
|
480
483
|
react_on_rails_pro!
|
|
481
484
|
rspec-rails
|
|
@@ -1,56 +1,577 @@
|
|
|
1
|
-
|
|
1
|
+
# React on Rails Pro
|
|
2
|
+
|
|
3
|
+
[](./LICENSE)
|
|
4
|
+
[](https://github.com/shakacode/react_on_rails/actions/workflows/pro-integration-tests.yml)
|
|
5
|
+
[](https://github.com/shakacode/react_on_rails/actions/workflows/pro-lint.yml)
|
|
6
|
+
[](https://github.com/shakacode/react_on_rails/actions/workflows/pro-package-tests.yml)
|
|
7
|
+
|
|
8
|
+
**Performance enhancements and advanced features for [React on Rails](https://github.com/shakacode/react_on_rails).**
|
|
2
9
|
|
|
3
10
|
_See the [CHANGELOG](./CHANGELOG.md) for release updates and **upgrade** details._
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
- [What is React on Rails Pro?](#-what-is-react-on-rails-pro)
|
|
17
|
+
- [License & Pricing](#-license--pricing)
|
|
18
|
+
- [Why Use Pro?](#-why-use-pro)
|
|
19
|
+
- [Key Features](#-key-features)
|
|
20
|
+
- [Requirements](#-requirements)
|
|
21
|
+
- [Getting Started](#-getting-started)
|
|
22
|
+
- [Documentation](#-documentation)
|
|
23
|
+
- [Examples](#-examples)
|
|
24
|
+
- [Support & Contact](#-support--contact)
|
|
25
|
+
- [FAQ](#-faq)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🎯 What is React on Rails Pro?
|
|
30
|
+
|
|
31
|
+
React on Rails Pro is a **commercial extension** to the open-source [React on Rails](https://github.com/shakacode/react_on_rails) gem that provides advanced performance optimizations and enterprise features for Rails applications using React.
|
|
32
|
+
|
|
33
|
+
**Key Points:**
|
|
34
|
+
|
|
35
|
+
- **Requires**: [React on Rails](https://github.com/shakacode/react_on_rails) (open-source) as a foundation
|
|
36
|
+
- **Location**: Part of the React on Rails monorepo at `react_on_rails_pro/`
|
|
37
|
+
- **Free for**: Non-commercial use, development, testing, and evaluation (with registration)
|
|
38
|
+
- **Commercial license**: Required for production deployments
|
|
39
|
+
|
|
40
|
+
### How It Relates to React on Rails
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
┌─────────────────────────────────────────────────┐
|
|
44
|
+
│ React on Rails Pro (this package) │
|
|
45
|
+
│ • SSR performance enhancements │
|
|
46
|
+
│ • React Server Components │
|
|
47
|
+
│ • Advanced caching │
|
|
48
|
+
│ • Node.js rendering pool │
|
|
49
|
+
└─────────────────────────────────────────────────┘
|
|
50
|
+
↓
|
|
51
|
+
┌─────────────────────────────────────────────────┐
|
|
52
|
+
│ React on Rails (open-source, required) │
|
|
53
|
+
│ • Basic SSR │
|
|
54
|
+
│ • Component registration │
|
|
55
|
+
│ • Rails integration │
|
|
56
|
+
└─────────────────────────────────────────────────┘
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 📜 License & Pricing
|
|
62
|
+
|
|
63
|
+
### License Types
|
|
64
|
+
|
|
65
|
+
#### 🆓 Free License (Non-Commercial)
|
|
66
|
+
|
|
67
|
+
- **Duration**: 3 months (renewable)
|
|
68
|
+
- **Usage**: Personal projects, evaluation, development, testing, CI/CD
|
|
69
|
+
- **Restrictions**: **NOT for production deployments**
|
|
70
|
+
- **Cost**: FREE - just register with your email
|
|
71
|
+
- **Get it**: [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
|
|
72
|
+
|
|
73
|
+
**⚠️ Important**: All environments (development, test, CI) require a valid license. The free license is perfect for these use cases!
|
|
74
|
+
|
|
75
|
+
#### 💼 Commercial License (Production)
|
|
76
|
+
|
|
77
|
+
- **Duration**: 1 year subscription (or longer)
|
|
78
|
+
- **Usage**: Production deployments and commercial applications
|
|
79
|
+
- **Support**: Professional support included
|
|
80
|
+
- **Contact**: [justin@shakacode.com](mailto:justin@shakacode.com) for pricing
|
|
81
|
+
|
|
82
|
+
### Quick License Setup
|
|
83
|
+
|
|
84
|
+
**Get your FREE license in 30 seconds:**
|
|
85
|
+
|
|
86
|
+
1. Visit [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
|
|
87
|
+
2. Register with your email
|
|
88
|
+
3. Receive your license token immediately
|
|
89
|
+
4. Set environment variable:
|
|
90
|
+
```bash
|
|
91
|
+
export REACT_ON_RAILS_PRO_LICENSE="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**📖 Detailed setup instructions**: See [LICENSE_SETUP.md](./LICENSE_SETUP.md) for complete configuration guide, team setup, CI/CD integration, and troubleshooting.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🚀 Why Use Pro?
|
|
99
|
+
|
|
100
|
+
### Real-World Performance Gains
|
|
101
|
+
|
|
102
|
+
React on Rails Pro delivers **measurable performance improvements** for production applications:
|
|
103
|
+
|
|
104
|
+
**Case Study: Popmenu**
|
|
105
|
+
|
|
106
|
+
- **73% decrease** in average response times
|
|
107
|
+
- **20-25% reduction** in Heroku costs
|
|
108
|
+
- **Tens of millions** of SSR requests served daily
|
|
109
|
+
- [Read the full case study →](https://www.shakacode.com/recent-work/popmenu/)
|
|
110
|
+
|
|
111
|
+
### When You Need Pro
|
|
112
|
+
|
|
113
|
+
Consider React on Rails Pro if you:
|
|
114
|
+
|
|
115
|
+
- ✅ Need **faster server-side rendering** for SEO and initial page loads
|
|
116
|
+
- ✅ Want **advanced caching** to reduce server load
|
|
117
|
+
- ✅ Require **React Server Components** (RSC) support
|
|
118
|
+
- ✅ Need **streaming SSR** for progressive rendering
|
|
119
|
+
- ✅ Want **code splitting** with React Router or loadable-components
|
|
120
|
+
- ✅ Have **high-traffic applications** where performance matters
|
|
121
|
+
- ✅ Need **professional support** for your Rails + React stack
|
|
122
|
+
|
|
123
|
+
### Pro vs. Open Source
|
|
124
|
+
|
|
125
|
+
| Feature | Open Source | Pro |
|
|
126
|
+
| ----------------------- | ----------- | --- |
|
|
127
|
+
| Basic SSR | ✅ | ✅ |
|
|
128
|
+
| Component Registration | ✅ | ✅ |
|
|
129
|
+
| Rails Integration | ✅ | ✅ |
|
|
130
|
+
| Fragment Caching | ❌ | ✅ |
|
|
131
|
+
| Prerender Caching | ❌ | ✅ |
|
|
132
|
+
| Proper Node Renderer | ❌ | ✅ |
|
|
133
|
+
| React Server Components | ❌ | ✅ |
|
|
134
|
+
| Streaming SSR | ❌ | ✅ |
|
|
135
|
+
| Code Splitting (SSR) | ❌ | ✅ |
|
|
136
|
+
| Bundle Caching | ❌ | ✅ |
|
|
137
|
+
| Professional Support | ❌ | ✅ |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## ✨ Key Features
|
|
142
|
+
|
|
143
|
+
### 1. Fragment Caching
|
|
144
|
+
|
|
145
|
+
Cache React components at the Rails view layer with intelligent cache key generation.
|
|
146
|
+
|
|
147
|
+
```ruby
|
|
148
|
+
# Cache component output with automatic cache key from props
|
|
149
|
+
<%= cached_react_component("UserProfile", cache_key: [@user]) do
|
|
150
|
+
{ user_id: @user.id }
|
|
151
|
+
end %>
|
|
152
|
+
|
|
153
|
+
# Lazy evaluation of props - only evaluated on cache miss
|
|
154
|
+
<%= cached_react_component("ExpensiveComponent", cache_key: [@user, @post]) do
|
|
155
|
+
expensive_calculation
|
|
156
|
+
end %>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Benefits:**
|
|
160
|
+
|
|
161
|
+
- Reduces server rendering time by 80%+ for repeated renders
|
|
162
|
+
- Automatic cache invalidation based on props
|
|
163
|
+
- Works with Rails fragment caching infrastructure
|
|
164
|
+
|
|
165
|
+
**📖 Learn more**: [docs/caching.md](./docs/caching.md)
|
|
166
|
+
|
|
167
|
+
### 2. Prerender Caching
|
|
168
|
+
|
|
169
|
+
Cache the JavaScript evaluation results on the Node.js side.
|
|
170
|
+
|
|
171
|
+
```ruby
|
|
172
|
+
# In config/initializers/react_on_rails_pro.rb
|
|
173
|
+
ReactOnRailsPro.configure do |config|
|
|
174
|
+
config.prerender_caching = true
|
|
175
|
+
end
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Benefits:**
|
|
179
|
+
|
|
180
|
+
- Dramatically reduces Node.js CPU usage
|
|
181
|
+
- Caches across multiple requests
|
|
182
|
+
- Complements fragment caching for maximum performance
|
|
183
|
+
|
|
184
|
+
**📖 Learn more**: [docs/caching.md](./docs/caching.md)
|
|
185
|
+
|
|
186
|
+
### 3. React on Rails Pro Node Renderer
|
|
187
|
+
|
|
188
|
+
High-performance standalone Node.js server for server-side rendering with connection pooling and automatic worker management.
|
|
189
|
+
|
|
190
|
+
**Key Advantages:**
|
|
191
|
+
|
|
192
|
+
- **Parallel rendering**: Multiple worker processes for concurrent SSR
|
|
193
|
+
- **Memory management**: Automatic worker restarts to prevent leaks
|
|
194
|
+
- **Better performance**: Up to 10x faster than ExecJS for high-traffic sites
|
|
195
|
+
- **Loadable Components**: Full support for code splitting with SSR
|
|
196
|
+
|
|
197
|
+
**Example Configuration:**
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
// react-on-rails-pro/react-on-rails-pro-node-renderer.js
|
|
201
|
+
const { reactOnRailsProNodeRenderer } = require('@shakacode-tools/react-on-rails-pro-node-renderer');
|
|
202
|
+
|
|
203
|
+
reactOnRailsProNodeRenderer({
|
|
204
|
+
bundlePath: path.resolve(__dirname, '../app/assets/webpack'),
|
|
205
|
+
port: 3800,
|
|
206
|
+
workersCount: 4,
|
|
207
|
+
supportModules: true, // Required for loadable-components
|
|
208
|
+
});
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
**📖 Learn more**: [docs/node-renderer/basics.md](./docs/node-renderer/basics.md)
|
|
212
|
+
|
|
213
|
+
### 4. React Server Components (RSC)
|
|
214
|
+
|
|
215
|
+
Full support for React 18+ Server Components with streaming.
|
|
216
|
+
|
|
217
|
+
```ruby
|
|
218
|
+
# Stream React Server Components
|
|
219
|
+
<%= stream_react_component("MyServerComponent", props: @props) %>
|
|
220
|
+
|
|
221
|
+
# Or with caching
|
|
222
|
+
<%= cached_stream_react_component("MyServerComponent", props: @props) %>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Benefits:**
|
|
226
|
+
|
|
227
|
+
- Reduce JavaScript bundle size
|
|
228
|
+
- Fetch data on the server
|
|
229
|
+
- Progressive rendering with Suspense
|
|
230
|
+
- Automatic code splitting
|
|
231
|
+
|
|
232
|
+
**📖 Learn more**: Contact [justin@shakacode.com](mailto:justin@shakacode.com) for RSC documentation
|
|
233
|
+
|
|
234
|
+
### 5. Bundle Caching
|
|
235
|
+
|
|
236
|
+
Speed up webpack rebuilds by caching unchanged bundles.
|
|
237
|
+
|
|
238
|
+
**Benefits:**
|
|
239
|
+
|
|
240
|
+
- **Faster CI/CD**: Skip rebuilding unchanged bundles
|
|
241
|
+
- **Faster development**: Hot reload only what changed
|
|
242
|
+
- **Lower costs**: Reduce build server time
|
|
243
|
+
|
|
244
|
+
**📖 Learn more**: [docs/bundle-caching.md](./docs/bundle-caching.md)
|
|
245
|
+
|
|
246
|
+
### 6. Global State Management
|
|
247
|
+
|
|
248
|
+
Prevent state leaks between SSR requests.
|
|
249
|
+
|
|
250
|
+
```ruby
|
|
251
|
+
ReactOnRailsPro.configure do |config|
|
|
252
|
+
# Run JavaScript before each render to clear global state
|
|
253
|
+
config.ssr_pre_hook_js = "global.myLeakyLib && global.myLeakyLib.reset();"
|
|
254
|
+
end
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**📖 Learn more**: [docs/configuration.md](./docs/configuration.md)
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 📋 Requirements
|
|
262
|
+
|
|
263
|
+
### Prerequisites
|
|
264
|
+
|
|
265
|
+
- **Ruby**: >= 3.0
|
|
266
|
+
- **Rails**: >= 6.0 (recommended: 7.0+)
|
|
267
|
+
- **React on Rails**: >= 11.0.7 (recommended: latest)
|
|
268
|
+
- **Node.js**: >= 18 (for Node Renderer)
|
|
269
|
+
- **React**: >= 16.8 (recommended: 18+ for RSC/Streaming)
|
|
270
|
+
|
|
271
|
+
### Compatibility Matrix
|
|
272
|
+
|
|
273
|
+
| React on Rails Pro | React on Rails | Rails | Ruby | React |
|
|
274
|
+
| ------------------ | -------------- | ------ | ------ | ------- |
|
|
275
|
+
| 4.x | >= 16.0 | >= 7.0 | >= 3.2 | >= 18 |
|
|
276
|
+
| 3.x | >= 13.0 | >= 6.0 | >= 3.0 | >= 16.8 |
|
|
277
|
+
|
|
278
|
+
**📖 Check compatibility**: See [CHANGELOG.md](./CHANGELOG.md) for version-specific requirements
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## 🏁 Getting Started
|
|
283
|
+
|
|
284
|
+
### Quick Start (5 Minutes)
|
|
285
|
+
|
|
286
|
+
**1. Get a License**
|
|
287
|
+
|
|
288
|
+
Visit [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro) to get your FREE license (takes 30 seconds).
|
|
289
|
+
|
|
290
|
+
**2. Set License Environment Variable**
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
# Add to .env or your shell profile
|
|
294
|
+
export REACT_ON_RAILS_PRO_LICENSE="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**3. Install the Gem**
|
|
298
|
+
|
|
299
|
+
Since React on Rails Pro is part of the public monorepo, you can install it directly from GitHub:
|
|
300
|
+
|
|
301
|
+
```ruby
|
|
302
|
+
# Gemfile
|
|
303
|
+
gem 'react_on_rails_pro', '~> 4.0'
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Or use a specific version/tag:
|
|
307
|
+
|
|
308
|
+
```ruby
|
|
309
|
+
gem 'react_on_rails_pro', git: 'https://github.com/shakacode/react_on_rails.git',
|
|
310
|
+
glob: 'react_on_rails_pro/*.gemspec',
|
|
311
|
+
tag: 'v4.0.0'
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Then run:
|
|
315
|
+
|
|
316
|
+
```bash
|
|
317
|
+
bundle install
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**4. Configure (Optional)**
|
|
321
|
+
|
|
322
|
+
Create `config/initializers/react_on_rails_pro.rb`:
|
|
323
|
+
|
|
324
|
+
```ruby
|
|
325
|
+
ReactOnRailsPro.configure do |config|
|
|
326
|
+
# Enable prerender caching for performance
|
|
327
|
+
config.prerender_caching = true
|
|
328
|
+
end
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**5. Verify Installation**
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
rails console
|
|
335
|
+
> ReactOnRails::Utils.react_on_rails_pro?
|
|
336
|
+
# => true
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**🎉 Done!** You're now using React on Rails Pro.
|
|
340
|
+
|
|
341
|
+
### Next Steps
|
|
342
|
+
|
|
343
|
+
- **Enable caching**: See [docs/caching.md](./docs/caching.md)
|
|
344
|
+
- **Set up Node Renderer**: See [docs/node-renderer/basics.md](./docs/node-renderer/basics.md)
|
|
345
|
+
- **Optimize performance**: See [docs/configuration.md](./docs/configuration.md)
|
|
346
|
+
- **Set up for your team**: See [LICENSE_SETUP.md](./LICENSE_SETUP.md#team-setup)
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 📚 Documentation
|
|
351
|
+
|
|
352
|
+
### Installation & Setup
|
|
353
|
+
|
|
354
|
+
- **[Installation Guide](./docs/installation.md)** - Detailed installation instructions
|
|
355
|
+
- **[License Setup](./LICENSE_SETUP.md)** - Complete license configuration guide
|
|
356
|
+
- **[Configuration Reference](./docs/configuration.md)** - All configuration options
|
|
357
|
+
|
|
358
|
+
### Features
|
|
359
|
+
|
|
360
|
+
- **[Caching Guide](./docs/caching.md)** - Fragment and prerender caching
|
|
361
|
+
- **[Bundle Caching](./docs/bundle-caching.md)** - Speed up webpack builds
|
|
362
|
+
- **[Node Renderer Basics](./docs/node-renderer/basics.md)** - Standalone Node.js server
|
|
363
|
+
- **[Node Renderer Configuration](./docs/node-renderer/js-configuration.md)** - JavaScript config
|
|
364
|
+
|
|
365
|
+
### API Reference
|
|
366
|
+
|
|
367
|
+
- **[Ruby API](./docs/ruby-api.md)** - Helper methods and utilities
|
|
368
|
+
- **[CHANGELOG](./CHANGELOG.md)** - Version history and upgrade notes
|
|
369
|
+
|
|
370
|
+
### Upgrading
|
|
371
|
+
|
|
372
|
+
- **[CHANGELOG](./CHANGELOG.md)** - See "Changed (Breaking)" sections for migration steps
|
|
373
|
+
- **Contact Support**: For upgrade assistance, email [justin@shakacode.com](mailto:justin@shakacode.com)
|
|
374
|
+
|
|
375
|
+
---
|
|
376
|
+
|
|
377
|
+
## 💡 Examples
|
|
378
|
+
|
|
379
|
+
### Example Application
|
|
380
|
+
|
|
381
|
+
The **Pro dummy app** demonstrates all features in action:
|
|
382
|
+
|
|
383
|
+
**Location**: [spec/dummy](./spec/dummy) (in this monorepo)
|
|
384
|
+
|
|
385
|
+
**Features Demonstrated**:
|
|
386
|
+
|
|
387
|
+
1. ✅ Fragment caching with `cached_react_component`
|
|
388
|
+
2. ✅ Prerender caching configuration
|
|
389
|
+
3. ✅ Node Renderer with loadable-components
|
|
390
|
+
4. ✅ Streaming SSR (React 18+)
|
|
391
|
+
5. ✅ React Server Components
|
|
392
|
+
6. ✅ Code splitting with SSR
|
|
393
|
+
7. ✅ HMR with loadable-components
|
|
394
|
+
|
|
395
|
+
**Running the Example**:
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# From the monorepo root
|
|
399
|
+
cd react_on_rails_pro/spec/dummy
|
|
400
|
+
bundle install
|
|
401
|
+
yarn install
|
|
402
|
+
|
|
403
|
+
# Start the Rails app
|
|
404
|
+
bin/dev
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
Visit `http://localhost:3000` to see the examples.
|
|
408
|
+
|
|
409
|
+
**📖 Learn more**: See [spec/dummy/README.md](./spec/dummy/README.md)
|
|
410
|
+
|
|
411
|
+
### Real-World Examples
|
|
412
|
+
|
|
413
|
+
Check out these production applications using React on Rails Pro:
|
|
414
|
+
|
|
415
|
+
- **[Popmenu](https://www.shakacode.com/recent-work/popmenu/)** - Restaurant digital marketing platform (case study)
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## 💬 Support & Contact
|
|
420
|
+
|
|
421
|
+
### Getting Help
|
|
422
|
+
|
|
423
|
+
- **📧 Email Support**: [support@shakacode.com](mailto:support@shakacode.com)
|
|
424
|
+
- **💼 Sales & Licensing**: [justin@shakacode.com](mailto:justin@shakacode.com)
|
|
425
|
+
- **📖 Documentation**: [docs/](./docs/)
|
|
426
|
+
- **🐛 Found a Bug?**: Email [support@shakacode.com](mailto:support@shakacode.com) (for Pro customers)
|
|
427
|
+
|
|
428
|
+
### Professional Services
|
|
429
|
+
|
|
430
|
+
Need help with your React on Rails project?
|
|
431
|
+
|
|
432
|
+
**ShakaCode offers**:
|
|
433
|
+
|
|
434
|
+
- 🚀 Performance optimization
|
|
435
|
+
- ⬆️ React on Rails upgrades
|
|
436
|
+
- 🏗️ Architecture consulting
|
|
437
|
+
- 🎓 Team training
|
|
438
|
+
- 🔧 Custom development
|
|
439
|
+
|
|
440
|
+
**[Book a consultation →](https://meetings.hubspot.com/justingordon/30-minute-consultation)** with Justin Gordon, creator of React on Rails.
|
|
441
|
+
|
|
442
|
+
### About ShakaCode
|
|
443
|
+
|
|
444
|
+
React on Rails Pro is developed and maintained by [ShakaCode](https://www.shakacode.com), the team behind:
|
|
445
|
+
|
|
446
|
+
- **[React on Rails](https://github.com/shakacode/react_on_rails)** - Open-source Rails + React integration
|
|
447
|
+
- **[Shakapacker](https://github.com/shakacode/shakapacker)** - Official successor to rails/webpacker
|
|
448
|
+
- **[Control Plane Flow](https://github.com/shakacode/control-plane-flow/)** - Heroku alternative with Kubernetes
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## ❓ FAQ
|
|
453
|
+
|
|
454
|
+
### Licensing Questions
|
|
455
|
+
|
|
456
|
+
**Q: Is React on Rails Pro free?**
|
|
457
|
+
|
|
458
|
+
A: Yes for non-commercial use! You get a FREE 3-month license (renewable) for:
|
|
459
|
+
|
|
460
|
+
- Personal projects
|
|
461
|
+
- Evaluation and testing
|
|
462
|
+
- Development environments
|
|
463
|
+
- CI/CD
|
|
464
|
+
|
|
465
|
+
Production deployments require a commercial license. [Learn more →](./LICENSE_SETUP.md)
|
|
466
|
+
|
|
467
|
+
**Q: Do I need a license for development?**
|
|
468
|
+
|
|
469
|
+
A: Yes, but it's FREE! Register at [shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro) to get your free 3-month license in 30 seconds (no credit card required).
|
|
470
|
+
|
|
471
|
+
**Q: Can multiple developers share one license?**
|
|
472
|
+
|
|
473
|
+
A: Yes! All developers in an organization can share the same license. You can use a shared license via environment variable or configuration file. [See team setup →](./LICENSE_SETUP.md#team-setup)
|
|
474
|
+
|
|
475
|
+
**Q: What happens when my free license expires?**
|
|
476
|
+
|
|
477
|
+
A:
|
|
478
|
+
|
|
479
|
+
- **Development/Test**: Application fails to start immediately (helps catch expiration early)
|
|
480
|
+
- **Production**: 1-month grace period with warnings, then fails to start
|
|
481
|
+
- **Solution**: Get a new free license or purchase a commercial license
|
|
482
|
+
|
|
483
|
+
**Q: How much does a commercial license cost?**
|
|
484
|
+
|
|
485
|
+
A: Pricing is customized based on your needs. Contact [justin@shakacode.com](mailto:justin@shakacode.com) for a quote.
|
|
486
|
+
|
|
487
|
+
### Technical Questions
|
|
488
|
+
|
|
489
|
+
**Q: What's the difference between Pro and open-source React on Rails?**
|
|
490
|
+
|
|
491
|
+
A: Pro adds performance features on top of the open-source gem:
|
|
492
|
+
|
|
493
|
+
- Advanced caching (fragment + prerender)
|
|
494
|
+
- Proper Node.js rendering pool
|
|
495
|
+
- React Server Components
|
|
496
|
+
- Streaming SSR
|
|
497
|
+
- Immediate hydration
|
|
498
|
+
- Code splitting with SSR support
|
|
499
|
+
|
|
500
|
+
[See full comparison →](#pro-vs-open-source)
|
|
501
|
+
|
|
502
|
+
**Q: Do I need the Node Renderer?**
|
|
503
|
+
|
|
504
|
+
A: No, it's optional but recommended. The Node Renderer provides the best performance for high-traffic sites and is required for:
|
|
505
|
+
|
|
506
|
+
- Loadable-components with SSR
|
|
507
|
+
- React Server Components
|
|
508
|
+
- Streaming SSR
|
|
509
|
+
|
|
510
|
+
For apps that do not require advanced performance features, ExecJS (the default) works fine.
|
|
511
|
+
|
|
512
|
+
**Q: Is React on Rails Pro compatible with my React version?**
|
|
513
|
+
|
|
514
|
+
A: Pro works with React 16.8+. For React Server Components and Streaming SSR, you need React 18+. [See requirements →](#requirements)
|
|
515
|
+
|
|
516
|
+
**Q: Can I use Pro with Vite instead of Webpack/Shakapacker?**
|
|
517
|
+
|
|
518
|
+
A: The Node Renderer currently expects webpack bundles. For Vite support, contact [justin@shakacode.com](mailto:justin@shakacode.com).
|
|
519
|
+
|
|
520
|
+
**Q: Does Pro work with TypeScript?**
|
|
521
|
+
|
|
522
|
+
A: Yes! Pro works seamlessly with TypeScript applications.
|
|
523
|
+
|
|
524
|
+
**Q: How do I upgrade from an older Pro version?**
|
|
525
|
+
|
|
526
|
+
A: Check the [CHANGELOG](./CHANGELOG.md) for breaking changes and migration steps. For major upgrades, we recommend professional support: [justin@shakacode.com](mailto:justin@shakacode.com)
|
|
527
|
+
|
|
528
|
+
### Getting Started Questions
|
|
529
|
+
|
|
530
|
+
**Q: Where do I start?**
|
|
531
|
+
|
|
532
|
+
A: Follow our [Quick Start guide](#-getting-started) - you can be up and running in 5 minutes!
|
|
533
|
+
|
|
534
|
+
**Q: Can I try Pro before buying?**
|
|
535
|
+
|
|
536
|
+
A: Yes! Get a FREE 3-month license to evaluate all features. No credit card required. [Get started →](https://shakacode.com/react-on-rails-pro)
|
|
537
|
+
|
|
538
|
+
**Q: Is there a demo application?**
|
|
6
539
|
|
|
7
|
-
|
|
540
|
+
A: Yes! The [spec/dummy](./spec/dummy) app demonstrates all Pro features. [See examples →](#-examples)
|
|
8
541
|
|
|
9
|
-
|
|
10
|
-
The best way to see how React on Rails Pro works is to install this repo locally and take a look at
|
|
11
|
-
the example application:
|
|
542
|
+
---
|
|
12
543
|
|
|
13
|
-
|
|
14
|
-
1. Uses a standard [Shakapacker](https://github.com/shakacode/shakapacker) configuration.
|
|
15
|
-
1. Has pages that demonstrate:
|
|
16
|
-
1. caching
|
|
17
|
-
2. loadable-components
|
|
18
|
-
1. Has all the basic react_on_rails specs that run against the Node Renderer
|
|
19
|
-
1. Demonstrates using HMR and loadable-components with almost the same example that is present in [loadable-components for SSR](https://github.com/gregberge/loadable-components/tree/main/examples/server-side-rendering)
|
|
20
|
-
|
|
21
|
-
See [the README.md](./spec/dummy/README.md) in those sample apps for more details.
|
|
544
|
+
## 📄 License
|
|
22
545
|
|
|
23
|
-
|
|
546
|
+
React on Rails Pro is commercial software. See [LICENSE](./LICENSE) for the complete license agreement.
|
|
24
547
|
|
|
25
|
-
|
|
26
|
-
Caching of SSR is critical for achieving optimum performance.
|
|
548
|
+
**Summary**:
|
|
27
549
|
|
|
28
|
-
|
|
29
|
-
|
|
550
|
+
- ✅ **Free** for non-commercial use (personal, evaluation, development, testing)
|
|
551
|
+
- 💼 **Commercial license required** for production deployments
|
|
552
|
+
- 📧 **Questions?** Contact [justin@shakacode.com](mailto:justin@shakacode.com)
|
|
30
553
|
|
|
31
|
-
|
|
554
|
+
**Get your FREE license**: [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
|
|
32
555
|
|
|
33
|
-
|
|
34
|
-
If you detect that some library used in server-rendering is leaking state between calls to server render, then you can set the `config.ssr_pre_hook_js` in your `config/initializers/react_on_rails_pro.rb` to run some JavaScript to clear the globally leaked state at the beginning of each call to server render.
|
|
556
|
+
---
|
|
35
557
|
|
|
36
|
-
|
|
558
|
+
## 🤝 Contributing
|
|
37
559
|
|
|
38
|
-
|
|
39
|
-
The "React on Rails Pro Node Renderer" provides more efficient server rendering on a standalone Node JS server.
|
|
40
|
-
See the [Node Renderer Docs](docs/node-renderer/basics.md).
|
|
560
|
+
React on Rails Pro is part of the React on Rails monorepo. For contribution guidelines, see:
|
|
41
561
|
|
|
42
|
-
|
|
43
|
-
|
|
562
|
+
- **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Pro-specific contribution guide
|
|
563
|
+
- **[Main CONTRIBUTING.md](../CONTRIBUTING.md)** - General contribution guidelines
|
|
44
564
|
|
|
45
|
-
|
|
46
|
-
See the [Ruby API](docs/ruby-api.md).
|
|
565
|
+
**Note**: Pro features are developed by the ShakaCode team and licensed customers only.
|
|
47
566
|
|
|
48
|
-
|
|
567
|
+
---
|
|
49
568
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* [Node Renderer Docs](./docs/node-renderer/basics.md)
|
|
569
|
+
<p align="center">
|
|
570
|
+
Made with ❤️ by <a href="https://www.shakacode.com">ShakaCode</a>
|
|
571
|
+
</p>
|
|
54
572
|
|
|
55
|
-
|
|
56
|
-
|
|
573
|
+
<p align="center">
|
|
574
|
+
<a href="https://www.shakacode.com">
|
|
575
|
+
<img src="https://user-images.githubusercontent.com/10421828/79436256-517d0500-7fd9-11ea-9300-dfbc7c293f26.png" alt="ShakaCode" height="60">
|
|
576
|
+
</a>
|
|
577
|
+
</p>
|