Skip to content

Latest commit

 

History

4,322 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reactrails


LicenseGem Version npm version Gem Downloads

Integration Tests Gem Tests JS Tests Linting

Documentation · Quick Start · Examples · Pro · Pricing

React on Rails

React on Rails integrates React into Ruby on Rails applications with Rails view helpers, server-side rendering, hot reloading, and automatic bundle generation.

This README is intentionally brief. For setup guides, architecture, API reference, upgrades, examples, and Pro features, use the main documentation site: reactonrails.com/docs.

React on Rails is maintained by ShakaCode.

Start Here

These docs are for React on Rails 17. Historical docs and code are available for v15 (code), v14, v13, v12, and v11. See the upgrade guide before using v15 material.

Install in 30 Seconds

Create a new React on Rails app:

npx create-react-on-rails-app my-app
cd my-app
bin/rails db:prepare
bin/dev

New apps default to React on Rails Pro for React 19.2 support. Use --standard only when you intentionally want an open-source-only setup.

Add React on Rails to an existing Rails app:

bundle add react_on_rails --strict
bundle exec rails generate react_on_rails:install
bin/dev

Render a component in any Rails view:

<%= react_component("HelloWorld", props: { name: "World" }) %>

If you hit setup issues, run:

bundle exec rake react_on_rails:doctor

Why Teams Use React on Rails

  • Render React directly inside Rails views with react_component.
  • Use Rails-oriented SSR in OSS, or upgrade to Pro for Node-rendered SSR, streaming SSR, and React Server Components.
  • Keep a single Rails app instead of splitting into a separate frontend and API.
  • Use modern bundling with Shakapacker, including Rspack support.

React on Rails Pro

React on Rails Pro adds higher-throughput SSR and advanced rendering features on top of the open-source gem, including Node renderer support, streaming SSR, React Server Components, fragment caching, and TanStack Router SSR.

ShakaCode Trust-Based Commercial Licensing: React on Rails Pro is free in development, test, CI, and staging for everyone, and free in production for small organizations (under 10 people, under $1M revenue, under $1M raised) and for charities, schools, and hospitals at any size. Larger organizations subscribe for production use at pro.reactonrails.com: $1,800 per year covers the whole organization. No license key is needed to run it; a key from your subscription only marks your pages Licensed. See the license.

Start with the docs here:

Requirements

  • Ruby on Rails >= 5.2
  • Shakapacker >= 6.0 (autobundling requires >= 7.0; CI tested: 8.2.0 - 10.3.2)
  • Ruby >= 3.3 (CI tested: 3.3 - 4.0)
  • Node.js >= 18
  • A JavaScript package manager such as pnpm, npm, yarn, or bun

Help

Contributing

Bug reports and pull requests are welcome. Start with CONTRIBUTING.md and the help wanted issues.

Security

Suspected security vulnerabilities should be reported privately. See SECURITY.md for the disclosure process and supported version policy. Please do not open a public issue for security reports.

License

React on Rails is available as open source under the terms of the MIT License.

React on Rails Pro is offered under The React on Rails Pro License, an application of ShakaCode Trust-Based Commercial Licensing. TL;DR: free in development, test, CI, and staging for everyone; free in production for organizations under 10 people, $1M revenue, and $1M raised, and for charities, schools, and hospitals at any size. Otherwise a subscription: $1,800 per year covers your whole organization. No license key is needed to run it. Questions: contact@shakacode.com.

Supporters

Thanks to the companies supporting ShakaCode's open-source work.

JetBrains Scout Control Plane BrowserStack Honeybadger CodeRabbit

About

Integration of React + Webpack + Rails including server-side rendering of React, enabling a better developer experience and faster client performance.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5.2k stars

Watchers

68 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages