inertiajs/inertia-rails

The Rails adapter for Inertia.js.

Ruby

1,240

771 commits

updated Oct 12, 2026

See the code

README

Inertia Rails

Build frontend experiences with the backend you love

Single-page React, Vue, and Svelte apps powered by your existing Rails controllers, routes, and authentication. No API required.

Gem version Downloads Build status MIT license Discord

Documentation · Get started · Demo · Discord


Your controllers. Your routes. Modern components.

Inertia lets you build a fully client-side rendered single-page app without the complexity of a separate API. Pass data from Rails directly to React, Vue, or Svelte as props — no REST endpoints, no GraphQL, no client-side data fetching, no state-management headaches.

# app/controllers/users_controller.rb
class UsersController < ApplicationController
  def index
    render inertia: {
      users: User.active.map { |user| user.as_json(only: [:id, :name, :email]) }
    }
  end
end
// app/frontend/pages/users/index.jsx
import { Link } from '@inertiajs/react'

const Users = ({ users }) => (
  <>
    {users.map((user) => (
      <div key={user.id}>
        <Link href={`/users/${user.id}`}>{user.name}</Link>
        <p>{user.email}</p>
      </div>
    ))}
  </>
)

export default Users

That's the whole loop: the controller returns props, the component renders them. Links and form submits are intercepted and turned into XHR visits, so navigation feels instant — but you're still writing plain Rails on the server.

Get started

Add to an existing Rails app — the installer sets up Vite, your chosen framework, and example pages:

bundle add inertia_rails
bin/rails generate inertia:install

Or start from a kit with authentication, Vite, optional SSR, and Kamal deployment already wired up:

Full walkthrough: Server-side setup and Client-side setup.

Built for real Rails apps

Forms that workValidation errors flow from Rails to your components automatically — no manual wiring.
Server-side renderingFull SSR for SEO and fast first paint. Your React/Vue/Svelte, rendered on Rails.
Test like RailsRSpec and Minitest matchers that feel native. Assert on props, components, and more.
Partial reloadsRefresh only the data you need. Keep interactions snappy without full page loads.
Shared dataCurrent user, flash, permissions — available on every page automatically.
Deferred propsLoad the page fast, fetch expensive data after, with built-in loading states.
Rails generatorsScaffold entire CRUD interfaces — controllers with matching components.
History encryptionKeep sensitive data private, even in browser history. Toggle per page.
DevToolsInspect every request's props, headers, and route in your browser's DevTools (Chrome or Firefox). On by default in development.

Why Inertia?

Inertia sits between traditional server-rendered apps and full SPAs.

vs. Hotwire — Same monolith, different view layer. Both keep you in Rails; Inertia gives you the full React/Vue/Svelte component model and the npm ecosystem instead of HTML-over-the-wire. Choose Hotwire for minimal JS and server-rendered HTML; choose Inertia for a modern component architecture.

vs. API + SPA — Same frontend, no API hassle. Both give you React/Vue/Svelte, but Inertia removes the API layer entirely: one router (Rails), Rails sessions instead of a JWT/OAuth dance, and props from your controller instead of fetching in useEffect. Choose an API for public/mobile clients; choose Inertia for focused web products. (You can always add an API alongside Inertia later.)

See the full comparison and FAQ →

Documentation

Everything lives at inertia-rails.dev:

Community

Contributing

Bug reports and pull requests are welcome. To set up your environment (this also installs lefthook git hooks that mirror our CI checks):

bin/setup

To run the test suite:

bundle exec rspec

See the Code of Conduct. Everyone interacting with the project is expected to follow it.

Credits

Inertia Rails is part of the official Inertia.js organization. It was originally created by the team at Bellawatt and is maintained by the Inertia.js community.

Released under the MIT License.

inertiajs/inertia-rails

The Rails adapter for Inertia.js.

Ruby

1,240

771 commits

updated Oct 12, 2026

See the code

README

Inertia Rails

Build frontend experiences with the backend you love

Single-page React, Vue, and Svelte apps powered by your existing Rails controllers, routes, and authentication. No API required.

Gem version Downloads Build status MIT license Discord

Documentation · Get started · Demo · Discord


Your controllers. Your routes. Modern components.

Inertia lets you build a fully client-side rendered single-page app without the complexity of a separate API. Pass data from Rails directly to React, Vue, or Svelte as props — no REST endpoints, no GraphQL, no client-side data fetching, no state-management headaches.

# app/controllers/users_controller.rb
class UsersController < ApplicationController
  def index
    render inertia: {
      users: User.active.map { |user| user.as_json(only: [:id, :name, :email]) }
    }
  end
end
// app/frontend/pages/users/index.jsx
import { Link } from '@inertiajs/react'

const Users = ({ users }) => (
  <>
    {users.map((user) => (
      <div key={user.id}>
        <Link href={`/users/${user.id}`}>{user.name}</Link>
        <p>{user.email}</p>
      </div>
    ))}
  </>
)

export default Users

That's the whole loop: the controller returns props, the component renders them. Links and form submits are intercepted and turned into XHR visits, so navigation feels instant — but you're still writing plain Rails on the server.

Get started

Add to an existing Rails app — the installer sets up Vite, your chosen framework, and example pages:

bundle add inertia_rails
bin/rails generate inertia:install

Or start from a kit with authentication, Vite, optional SSR, and Kamal deployment already wired up:

Full walkthrough: Server-side setup and Client-side setup.

Built for real Rails apps

Forms that workValidation errors flow from Rails to your components automatically — no manual wiring.
Server-side renderingFull SSR for SEO and fast first paint. Your React/Vue/Svelte, rendered on Rails.
Test like RailsRSpec and Minitest matchers that feel native. Assert on props, components, and more.
Partial reloadsRefresh only the data you need. Keep interactions snappy without full page loads.
Shared dataCurrent user, flash, permissions — available on every page automatically.
Deferred propsLoad the page fast, fetch expensive data after, with built-in loading states.
Rails generatorsScaffold entire CRUD interfaces — controllers with matching components.
History encryptionKeep sensitive data private, even in browser history. Toggle per page.
DevToolsInspect every request's props, headers, and route in your browser's DevTools (Chrome or Firefox). On by default in development.

Why Inertia?

Inertia sits between traditional server-rendered apps and full SPAs.

vs. Hotwire — Same monolith, different view layer. Both keep you in Rails; Inertia gives you the full React/Vue/Svelte component model and the npm ecosystem instead of HTML-over-the-wire. Choose Hotwire for minimal JS and server-rendered HTML; choose Inertia for a modern component architecture.

vs. API + SPA — Same frontend, no API hassle. Both give you React/Vue/Svelte, but Inertia removes the API layer entirely: one router (Rails), Rails sessions instead of a JWT/OAuth dance, and props from your controller instead of fetching in useEffect. Choose an API for public/mobile clients; choose Inertia for focused web products. (You can always add an API alongside Inertia later.)

See the full comparison and FAQ →

Documentation

Everything lives at inertia-rails.dev:

Community

Contributing

Bug reports and pull requests are welcome. To set up your environment (this also installs lefthook git hooks that mirror our CI checks):

bin/setup

To run the test suite:

bundle exec rspec

See the Code of Conduct. Everyone interacting with the project is expected to follow it.

Credits

Inertia Rails is part of the official Inertia.js organization. It was originally created by the team at Bellawatt and is maintained by the Inertia.js community.

Released under the MIT License.

Project health

Overall

5.8/10

Maintained

10/10

Code review

9/10
OpenSSF Scorecard

Latest release

3.22.0 · Jul 17, 2026

Releases this year

14

Significant stargazers

Garen Torikian

944 followers · starred May 2025

Janko Marohnić

819 followers · starred Aug 2026

Juanito

966 followers · starred Feb 2025

Philipp Spiess

694 followers · starred Sep 2025