react_on_rails_pro 16.2.0.beta.8

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.
Files changed (109) hide show
  1. checksums.yaml +7 -0
  2. data/.controlplane/Dockerfile +49 -0
  3. data/.controlplane/controlplane.yml +22 -0
  4. data/.controlplane/gvc.yml +25 -0
  5. data/.controlplane/postgres.yml +33 -0
  6. data/.controlplane/rails.yml +49 -0
  7. data/.controlplane/redis.yml +18 -0
  8. data/.gitignore +77 -0
  9. data/.prettierignore +12 -0
  10. data/.prettierrc +19 -0
  11. data/.rspec +2 -0
  12. data/.rubocop.yml +120 -0
  13. data/.scss-lint.yml +205 -0
  14. data/CHANGELOG.md +570 -0
  15. data/CI_SETUP.md +502 -0
  16. data/CONTRIBUTING.md +376 -0
  17. data/Dockerfile +63 -0
  18. data/Gemfile +8 -0
  19. data/Gemfile.development_dependencies +74 -0
  20. data/Gemfile.loader +32 -0
  21. data/Gemfile.lock +527 -0
  22. data/LICENSE +98 -0
  23. data/LICENSE_SETUP.md +272 -0
  24. data/README.md +577 -0
  25. data/Rakefile +13 -0
  26. data/app/controllers/react_on_rails_pro/rsc_payload_controller.rb +7 -0
  27. data/app/helpers/react_on_rails_pro_helper.rb +360 -0
  28. data/app/views/react_on_rails_pro/rsc_payload.html.erb +1 -0
  29. data/babel.config.js +4 -0
  30. data/docs/bundle-caching.md +205 -0
  31. data/docs/caching.md +234 -0
  32. data/docs/code-splitting-loadable-components.md +313 -0
  33. data/docs/code-splitting.md +349 -0
  34. data/docs/configuration.md +165 -0
  35. data/docs/contributors-info/onboarding-customers.md +6 -0
  36. data/docs/contributors-info/releasing.md +40 -0
  37. data/docs/contributors-info/style.md +33 -0
  38. data/docs/home-pro.md +146 -0
  39. data/docs/installation.md +203 -0
  40. data/docs/js-memory-leaks.md +22 -0
  41. data/docs/node-renderer/basics.md +92 -0
  42. data/docs/node-renderer/debugging.md +38 -0
  43. data/docs/node-renderer/error-reporting-and-tracing.md +160 -0
  44. data/docs/node-renderer/heroku.md +102 -0
  45. data/docs/node-renderer/js-configuration.md +91 -0
  46. data/docs/node-renderer/troubleshooting.md +5 -0
  47. data/docs/profiling-server-side-rendering-code.md +179 -0
  48. data/docs/react-server-components/add-streaming-and-interactivity.md +190 -0
  49. data/docs/react-server-components/create-without-ssr.md +448 -0
  50. data/docs/react-server-components/glossary.md +102 -0
  51. data/docs/react-server-components/how-react-server-components-work.md +243 -0
  52. data/docs/react-server-components/inside-client-components.md +332 -0
  53. data/docs/react-server-components/purpose-and-benefits.md +243 -0
  54. data/docs/react-server-components/rendering-flow.md +86 -0
  55. data/docs/react-server-components/selective-hydration-in-streamed-components.md +75 -0
  56. data/docs/react-server-components/server-side-rendering.md +72 -0
  57. data/docs/react-server-components/tutorial.md +19 -0
  58. data/docs/release-notes/4.0.md +94 -0
  59. data/docs/release-notes/v4-react-server-components.md +66 -0
  60. data/docs/ruby-api.md +11 -0
  61. data/docs/streaming-server-rendering.md +210 -0
  62. data/docs/troubleshooting.md +24 -0
  63. data/docs/updating.md +219 -0
  64. data/eslint.config.mjs +220 -0
  65. data/lib/react_on_rails_pro/assets_precompile.rb +230 -0
  66. data/lib/react_on_rails_pro/cache.rb +88 -0
  67. data/lib/react_on_rails_pro/concerns/rsc_payload_renderer.rb +38 -0
  68. data/lib/react_on_rails_pro/concerns/stream.rb +103 -0
  69. data/lib/react_on_rails_pro/configuration.rb +228 -0
  70. data/lib/react_on_rails_pro/constants.rb +8 -0
  71. data/lib/react_on_rails_pro/engine.rb +24 -0
  72. data/lib/react_on_rails_pro/error.rb +14 -0
  73. data/lib/react_on_rails_pro/license_public_key.rb +30 -0
  74. data/lib/react_on_rails_pro/license_validator.rb +188 -0
  75. data/lib/react_on_rails_pro/prepare_node_renderer_bundles.rb +40 -0
  76. data/lib/react_on_rails_pro/rendering_error.rb +5 -0
  77. data/lib/react_on_rails_pro/request.rb +318 -0
  78. data/lib/react_on_rails_pro/routes.rb +13 -0
  79. data/lib/react_on_rails_pro/server_rendering_js_code.rb +102 -0
  80. data/lib/react_on_rails_pro/server_rendering_pool/node_rendering_pool.rb +133 -0
  81. data/lib/react_on_rails_pro/server_rendering_pool/pro_rendering.rb +117 -0
  82. data/lib/react_on_rails_pro/stream_cache.rb +61 -0
  83. data/lib/react_on_rails_pro/stream_request.rb +170 -0
  84. data/lib/react_on_rails_pro/utils.rb +222 -0
  85. data/lib/react_on_rails_pro/v8_log_processor.rb +50 -0
  86. data/lib/react_on_rails_pro/version.rb +6 -0
  87. data/lib/react_on_rails_pro.rb +23 -0
  88. data/package-scripts.yml +109 -0
  89. data/package.json +159 -0
  90. data/rakelib/dummy_apps.rake +22 -0
  91. data/rakelib/lint.rake +32 -0
  92. data/rakelib/public_key_management.rake +155 -0
  93. data/rakelib/rbs.rake +47 -0
  94. data/rakelib/run_rspec.rake +81 -0
  95. data/rakelib/task_helpers.rb +45 -0
  96. data/rakelib/yard.rake +20 -0
  97. data/react_on_rails_pro.gemspec +47 -0
  98. data/readme-gen-docs.md +1 -0
  99. data/script/bootstrap +33 -0
  100. data/script/preinstall.js +31 -0
  101. data/script/setup +23 -0
  102. data/script/test +38 -0
  103. data/sig/react_on_rails_pro/cache.rbs +13 -0
  104. data/sig/react_on_rails_pro/configuration.rbs +100 -0
  105. data/sig/react_on_rails_pro/error.rbs +4 -0
  106. data/sig/react_on_rails_pro/utils.rbs +7 -0
  107. data/sig/react_on_rails_pro.rbs +5 -0
  108. data/yarn.lock +7599 -0
  109. metadata +319 -0
data/LICENSE_SETUP.md ADDED
@@ -0,0 +1,272 @@
1
+ # React on Rails Pro License Setup
2
+
3
+ This document explains how to configure your React on Rails Pro license.
4
+
5
+ ## Getting a FREE License
6
+
7
+ **All users need a license** - even for development and evaluation!
8
+
9
+ ### Get Your FREE Evaluation License (3 Months)
10
+
11
+ 1. Visit [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
12
+ 2. Register with your email
13
+ 3. Receive your FREE 3-month evaluation license immediately
14
+ 4. Use it for development, testing, and evaluation
15
+
16
+ **No credit card required!**
17
+
18
+ **⚠️ Important: The free 3-month evaluation license is intended for personal, educational, and evaluation purposes only. It should NOT be used for production deployments. Production use requires a paid license.**
19
+
20
+ ## License Types
21
+
22
+ ### Free License
23
+ - **Duration**: 3 months
24
+ - **Usage**: Personal, educational, and evaluation purposes only (development, testing, evaluation, CI/CD) - **NOT for production**
25
+ - **Cost**: FREE - just register with your email
26
+ - **Renewal**: Get a new free license or upgrade to paid
27
+
28
+ ### Paid License
29
+ - **Duration**: 1 year (or longer)
30
+ - **Usage**: Production deployment
31
+ - **Cost**: Subscription-based
32
+ - **Support**: Includes professional support
33
+
34
+ ## Installation
35
+
36
+ ### Method 1: Environment Variable (Recommended)
37
+
38
+ Set the `REACT_ON_RAILS_PRO_LICENSE` environment variable:
39
+
40
+ ```bash
41
+ export REACT_ON_RAILS_PRO_LICENSE="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
42
+ ```
43
+
44
+ **For different environments:**
45
+
46
+ ```bash
47
+ # Development (.env file)
48
+ REACT_ON_RAILS_PRO_LICENSE=your_license_token_here
49
+
50
+ # Production (Heroku)
51
+ heroku config:set REACT_ON_RAILS_PRO_LICENSE="your_token"
52
+
53
+ # Production (Docker)
54
+ # Add to docker-compose.yml or Dockerfile ENV
55
+
56
+ # CI/CD
57
+ # Add to your CI environment variables (see CI_SETUP.md)
58
+ ```
59
+
60
+ ### Method 2: Configuration File
61
+
62
+ Create `config/react_on_rails_pro_license.key` in your Rails root:
63
+
64
+ ```bash
65
+ echo "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..." > config/react_on_rails_pro_license.key
66
+ ```
67
+
68
+ **Important**: Add this file to your `.gitignore` to avoid committing your license:
69
+
70
+ ```bash
71
+ # Add to .gitignore
72
+ echo "config/react_on_rails_pro_license.key" >> .gitignore
73
+ ```
74
+
75
+ **Never commit your license to version control.**
76
+
77
+ ## License Validation
78
+
79
+ The license is validated at multiple points:
80
+
81
+ 1. **Ruby Gem**: When Rails application starts
82
+ 2. **Node Renderer**: When the Node renderer process starts
83
+ 3. **Browser Package**: Trusts server-side validation (via `railsContext.rorPro`)
84
+
85
+ ### All Environments Require Valid License
86
+
87
+ React on Rails Pro requires a valid license in **all environments**:
88
+
89
+ - ✅ **Development**: Requires license (use FREE license) - **Fails immediately on expiration**
90
+ - ✅ **Test**: Requires license (use FREE license) - **Fails immediately on expiration**
91
+ - ✅ **CI/CD**: Requires license (use FREE license) - **Fails immediately on expiration**
92
+ - ✅ **Production**: Requires license (use paid license) - **1-month grace period after expiration**
93
+
94
+ Get your FREE evaluation license in 30 seconds - no credit card required!
95
+
96
+ ### Production Grace Period
97
+
98
+ **Production environments only** receive a **1-month grace period** when a license expires:
99
+
100
+ - ⚠️ **During grace period**: Application continues to run but logs ERROR messages on every startup
101
+ - ❌ **After grace period**: Application fails to start (same as dev/test)
102
+ - 🔔 **Warning messages**: Include days remaining in grace period
103
+ - ✅ **Development/Test**: No grace period - fails immediately (helps catch expiration early)
104
+
105
+ **Important**: The grace period is designed to give production deployments time to renew, but you should:
106
+ 1. Monitor your logs for license expiration warnings
107
+ 2. Renew licenses before they expire
108
+ 3. Test license renewal in development/staging first
109
+
110
+ ## Team Setup
111
+
112
+ ### For Development Teams
113
+
114
+ Each developer should:
115
+
116
+ 1. Get their own FREE license from [shakacode.com](https://shakacode.com/react-on-rails-pro)
117
+ 2. Store it locally using one of the methods above
118
+ 3. Ensure `config/react_on_rails_pro_license.key` is in your `.gitignore`
119
+
120
+ ### For CI/CD
121
+
122
+ Set up CI with a license (see [CI_SETUP.md](./CI_SETUP.md) for detailed instructions):
123
+
124
+ 1. Get a FREE license (can use any team member's or create `ci@yourcompany.com`)
125
+ 2. Add to CI environment variables as `REACT_ON_RAILS_PRO_LICENSE`
126
+ 3. Renew every 3 months (or use a paid license)
127
+
128
+ **Recommended**: Use GitHub Secrets, GitLab CI Variables, or your CI provider's secrets management.
129
+
130
+ ## Verification
131
+
132
+ ### Verify License is Working
133
+
134
+ **Ruby Console:**
135
+ ```ruby
136
+ rails console
137
+ > ReactOnRails::Utils.react_on_rails_pro?
138
+ # Should return: true
139
+ ```
140
+
141
+ **Note:** With startup validation enabled, your Rails app won't start with an invalid license. If you can run the Rails console, your license is valid.
142
+
143
+ **Check License Details:**
144
+ ```ruby
145
+ > ReactOnRailsPro::LicenseValidator.license_data
146
+ # Shows: {"sub"=>"your@email.com", "exp"=>1234567890, "plan"=>"free", ...}
147
+ ```
148
+
149
+ **Browser JavaScript Console:**
150
+ ```javascript
151
+ window.railsContext.rorPro
152
+ // Should return: true
153
+ ```
154
+
155
+ ## Troubleshooting
156
+
157
+ ### Error: "No license found"
158
+
159
+ **Solutions:**
160
+ 1. Verify environment variable: `echo $REACT_ON_RAILS_PRO_LICENSE`
161
+ 2. Check config file exists: `ls config/react_on_rails_pro_license.key`
162
+ 3. **Get a FREE license**: [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
163
+
164
+ ### Error: "Invalid license signature"
165
+
166
+ **Causes:**
167
+ - License token was truncated or modified
168
+ - Wrong license format (must be complete JWT token)
169
+
170
+ **Solutions:**
171
+ 1. Ensure you copied the complete license (starts with `eyJ`)
172
+ 2. Check for extra spaces or newlines
173
+ 3. Get a new FREE license if corrupted
174
+
175
+ ### Error: "License has expired"
176
+
177
+ **What happens:**
178
+ - **Development/Test/CI**: Application fails to start immediately
179
+ - **Production**: 1-month grace period with ERROR logs, then fails to start
180
+
181
+ **Solutions:**
182
+ 1. **Free License**: Get a new 3-month FREE license
183
+ 2. **Paid License**: Contact support to renew
184
+ 3. Visit: [https://shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
185
+
186
+ **If you see grace period warnings in production:**
187
+ - You have time to renew, but don't wait!
188
+ - The warning shows how many days remain
189
+ - Plan your license renewal before the grace period ends
190
+
191
+ ### Error: "License is missing required expiration field"
192
+
193
+ **Cause:** You may have an old license format
194
+
195
+ **Solution:** Get a new FREE license from [shakacode.com](https://shakacode.com/react-on-rails-pro)
196
+
197
+ ### Application Won't Start
198
+
199
+ If your application fails to start due to license issues:
200
+
201
+ 1. **Quick fix**: Set a valid license environment variable
202
+ 2. **Get FREE license**: Takes 30 seconds at [shakacode.com](https://shakacode.com/react-on-rails-pro)
203
+ 3. Check logs for specific error message
204
+ 4. Ensure license is accessible to all processes (Rails + Node renderer)
205
+
206
+ ## License Technical Details
207
+
208
+ ### Format
209
+
210
+ The license is a JWT (JSON Web Token) signed with RSA-256, containing:
211
+
212
+ ```json
213
+ {
214
+ "sub": "user@example.com", // Your email (REQUIRED)
215
+ "iat": 1234567890, // Issued at timestamp (REQUIRED)
216
+ "exp": 1234567890, // Expiration timestamp (REQUIRED)
217
+ "plan": "free", // License plan: "free" or "paid" (Optional)
218
+ "organization": "Your Company", // Organization name (Optional)
219
+ "iss": "api" // Issuer identifier (Optional, standard JWT claim)
220
+ }
221
+ ```
222
+
223
+ ### Security
224
+
225
+ - **Offline validation**: No internet connection required
226
+ - **Public key verification**: Uses embedded RSA public key
227
+ - **Tamper-proof**: Any modification invalidates the signature
228
+ - **No tracking**: License validation happens locally
229
+
230
+ ### Privacy
231
+
232
+ - We only collect email during registration
233
+ - No usage tracking or phone-home in the license system
234
+ - License is validated offline using cryptographic signatures
235
+
236
+ ## Support
237
+
238
+ Need help?
239
+
240
+ 1. **Quick Start**: Get a FREE license at [shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
241
+ 2. **Documentation**: Check [CI_SETUP.md](./CI_SETUP.md) for CI configuration
242
+ 3. **Email**: support@shakacode.com
243
+ 4. **License Management**: [shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro)
244
+
245
+ ## Security Best Practices
246
+
247
+ 1. ✅ **Never commit licenses to Git** - Add `config/react_on_rails_pro_license.key` to `.gitignore`
248
+ 2. ✅ **Use environment variables in production**
249
+ 3. ✅ **Use CI secrets for CI/CD environments**
250
+ 4. ✅ **Don't share licenses publicly**
251
+ 5. ✅ **Each developer gets their own FREE license**
252
+ 6. ✅ **Renew before expiration** (we'll send reminders)
253
+
254
+ ## FAQ
255
+
256
+ **Q: Why do I need a license for development?**
257
+ A: We provide FREE 3-month licenses so we can track usage and provide better support. Registration takes 30 seconds!
258
+
259
+ **Q: Can I use a free license in production?**
260
+ A: Free licenses are for evaluation only. Production deployments require a paid license.
261
+
262
+ **Q: Can multiple developers share one license?**
263
+ A: Each developer should get their own FREE license. For CI, you can share one license via environment variable.
264
+
265
+ **Q: What happens when my free license expires?**
266
+ A: Get a new 3-month FREE license, or upgrade to a paid license for production use.
267
+
268
+ **Q: Do I need internet to validate the license?**
269
+ A: No! License validation is completely offline using cryptographic signatures.
270
+
271
+ **Q: Is my email shared or sold?**
272
+ A: Never. We only use it to send you license renewals and important updates.