Development runtime orchestration
The development runtime is a group of local processes that lets Rails serve pages while ReScript and JavaScript assets rebuild in the background. It also keeps the Node renderer and Redis available so server-rendered React, React Server Components, and realtime features use the same boundaries as the full application.
Runtime topology
Rails is the request entry point on port 3000 in the normal development mode. Thruster starts in front of Puma and forwards application requests while the client asset server supplies development bundles. The Node renderer serves React rendering requests on port 3800. Redis is a local support service for Action Cable and is started by the static profiles rather than by the HMR profile.
The following diagram shows how local requests and source changes move through the runtime.
flowchart LR
Browser[Browser] --> Thruster[Thruster / Rails :3000]
Browser -. HMR assets .-> ClientDev[Client asset server :3035]
Thruster -->|React SSR or RSC| Renderer[Node renderer :3800]
Rails[Rails application] -->|Action Cable| Redis[Redis :6379]
ReScript[ReScript watcher] --> ClientBuild[Generated ReScript]
ClientBuild --> ClientDev
ClientBuild --> SSRWatch[SSR bundle watcher]
ClientBuild --> RSCWatch[RSC bundle watcher]
SSRWatch --> Renderer
RSCWatch --> Renderer
The HMR profile separates the three JavaScript targets so a browser change, an SSR change, or an RSC change can rebuild without rebuilding unrelated targets. The client target runs in the development asset server. The SSR and RSC targets write bundles that the Node renderer loads.
References: Procfile.dev• L8-17 config/shakapacker.yml• L34-63 config/…/react_on_rails_pro.rb• L7-29 config/cable.yml• L1-8
Startup commands
bin/dev is the normal entry point for local development. Before it starts the selected process profile, it builds the ReScript source and generates the locale JavaScript files. This order gives the asset watchers the generated inputs they need at startup. The matching package scripts provide the ReScript build and watch commands used by this startup path. The project requires Node 22 or newer and pins Yarn to 1.22.22 for these commands.
| Command | Runtime profile | Main use |
|---|---|---|
bin/dev | Procfile.dev | HMR with client, SSR, and RSC watchers |
bin/dev static | Procfile.dev-static-assets | Static development assets with a watcher |
bin/dev prod | Procfile.dev-prod-assets | Production-like asset serving on a separate Rails port |
bin/dev-static | Static mode forced through the development server manager | A short command when HMR is not useful |
bundle exec foreman start -f Procfile.dev | Direct HMR profile | Low-level process profile invocation |
yarn node-renderer | Node renderer only | Directly start the React rendering service |
Use bin/dev when possible because a direct Foreman command does not run the pre-start ReScript and locale work performed by the script. The profile manager starts each process from the selected Procfile and gives each process its own log stream. The runtime uses Puma, Thruster, Redis, and Foreman through the Ruby dependencies declared in Gemfile.
References: bin/dev• L10-25 bin/dev• L30-70 bin/dev-static• L4-19 Procfile.dev-static-assets• L1-10 Procfile.dev-prod-assets• L1-10 Gemfile• L17-19 Gemfile• L35 Gemfile• L68-70 package.json• L5-7 package.json• L19-34 package.json• L181-182
Process roles
Each process has one narrow role in the local system. Together they turn source changes into browser assets and renderer bundles while Rails remains available for page requests.
| Process | Role | Output or boundary |
|---|---|---|
rescript | Watches ReScript source and creates JavaScript inputs. | Generated ReScript files used by the asset builds |
rails or web | Runs the Rails application through Thruster. | HTTP requests on port 3000, or port 3001 in the production-assets profile |
wp-client | Runs the client development server with HMR. | Browser assets and live module updates |
wp-server | Watches the server bundle. | SSR code consumed by the Node renderer |
wp-rsc | Watches the RSC bundle. | React Server Components payload code consumed by the Node renderer |
node-renderer | Runs the React on Rails Pro Node rendering service. | SSR and RSC responses on port 3800 |
redis | Runs the local Redis service in static profiles. | Action Cable backing store on port 6379 |
rspack | Rebuilds static assets after source changes. | Files served from the Rails public asset path |
The client, SSR, and RSC watchers use one bundler configuration with separate target selection. The client development server selects the client bundle by default. SERVER_BUNDLE_ONLY=yes selects SSR, and RSC_BUNDLE_ONLY=yes selects RSC.
References: Procfile.dev• L8-17 Procfile.dev-static-assets• L2-10 Procfile.dev-prod-assets• L2-10 config/…/webpackConfig.js• L16-34 renderer/node-renderer.js• L31-59 Gemfile• L9 Gemfile• L19 Gemfile• L35 package.json• L23-34
Asset serving modes
Development offers two asset paths because fast browser feedback and stable files on disk serve different needs. HMR keeps client modules in the development asset server, while static profiles rebuild files into the Rails public asset path.
Hot module replacement
The default profile uses a client development server with HMR and separate watchers for SSR and RSC. The development server listens on port 3035 in the Shakapacker settings, while Rails continues to receive application requests on port 3000.
The client asset server is the right choice for rapid browser work. Changes to server-rendered or RSC code still depend on their matching watcher and the Node renderer process.
References: Procfile.dev• L10-17 config/shakapacker.yml• L34-63 config/…/development.js• L4-10
Static asset builds
The static profiles run Rails, Redis, and one asset watcher. The watcher first generates locale files, clears the existing public packs, and then rebuilds changed assets. Procfile.dev-static adds a short wait before that work so preceding ReScript output has time to appear when the profile is started directly.
The production-assets profile uses Rails port 3001. This lets it run beside the normal development profile when a developer needs to compare static or production-like assets with HMR assets.
References: Procfile.dev-static• L2-11 Procfile.dev-static-assets• L2-10 Procfile.dev-prod-assets• L2-10 config/puma.rb• L29-39
Cross-process contracts
Rails and the Node renderer must agree on the renderer URL and password. Local defaults point Rails to http://localhost:3800 and use the same development password on both sides. Production must provide an explicit password.
The renderer loads the changing SSR and RSC bundles from its bundle cache path. Its default host is localhost, its default port is 3800, and its runtime settings keep timers and async logs working for React Server Components. These settings make the renderer a live part of the development loop rather than a one-time build step.
Redis is a separate local service for the Redis Action Cable adapter. If a profile does not start Redis, a system Redis service must already be running before features that use Action Cable are exercised.
References: config/…/react_on_rails_pro.rb• L7-29 renderer/node-renderer.js• L5-10 renderer/node-renderer.js• L31-56 config/cable.yml• L1-8 Gemfile• L35 package.json• L81-87
Change checklist
When these files or sections are changed, remember to consider these:
- If the ReScript or locale build order changes, check that both
bin/devand the static asset profiles still create generated inputs before their watchers start. - If a bundle target or entry changes, keep the
SERVER_BUNDLE_ONLYandRSC_BUNDLE_ONLYprocess settings aligned with the Rails renderer settings. - If the renderer host, port, or password changes, update both the Rails initializer and the Node renderer process contract.
- If the development asset server port changes, update the Shakapacker dev-server setting and any browser or proxy entry point that directs requests to it.
- If Redis connection settings change, keep the Action Cable URL and the profile that starts Redis consistent.
- If the supported Node or Yarn version changes, keep the package engine, package-manager field, and runtime scripts aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Starting the Procfile directly without the required generated ReScript or locale files | A watcher can start with missing inputs or stale generated assets. | Use bin/dev, or run the same pre-start build steps first. |
| Starting Rails without the Node renderer | React server rendering fails because Rails is configured not to fall back to ExecJS. | Start node-renderer with the selected SSR and RSC watchers. |
| Using different renderer passwords in Rails and Node | Rails cannot authenticate its renderer requests. | Keep RENDERER_PASSWORD shared, or use the matching local default on both sides. |
| Running Action Cable features without Redis on port 6379 | Redis-backed cable operations cannot connect. | Start the profile's Redis process or run a local Redis service. |
| Clearing public packs while relying on static assets | Rails can serve missing packs until the watcher completes a new build. | Wait for the static watcher to finish its first build before loading the page. |
| Running the runtime with an unsupported Node or Yarn version | ReScript or asset commands can fail before the process group is ready. | Use the versions declared in package.json. |
Key files
| File | Why to read it |
|---|---|
bin/dev | Defines the supported entry point and the pre-start generation work. |
Procfile.dev | Shows the complete HMR process topology. |
Procfile.dev-static-assets | Shows the normal static asset profile with Rails, Redis, and a watcher. |
Procfile.dev-prod-assets | Shows the production-assets development variant and its separate Rails port. |
| config/shakapacker.yml | Defines the development asset server and its HMR behavior. |
| config/…/webpackConfig.js | Explains how client, SSR, and RSC watcher processes select their targets. |
| renderer/node-renderer.js | Defines the local Node rendering service boundary and defaults. |
| config/…/react_on_rails_pro.rb | Defines how Rails reaches and authenticates the renderer. |
| config/cable.yml | Defines the Redis-backed Action Cable connection used by local runtime features. |
Gemfile | Declares the Ruby services and process manager that support the local runtime. |
| package.json | Declares the Node and Yarn versions and the scripts that build or watch ReScript and runtime assets. |
For the asset build model, see JavaScript and asset build pipeline. For the Rails-to-Node rendering boundary, see Node server rendering. For the ReScript example and its generated-code lifecycle, see ReScript comment demo. For the commands that build assets before validation, see Automated validation.