angusfretwell / inertia-react-rails-example

Example Rails app with Vite + Inertia.js

Home Page:https://fragrant-river-7241.fly.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rails + React with Inertia

Live demo


This is an example Rails app with a React frontend using Inertia.js to glue the two parts together. It uses Vite to bundle the JavaScript and deliver it the asset pipeline.

The app features a basic CRUD interface for managing articles.

It demonstrates:

  • Rendering React pages with data from the Rails app
  • Client side routing based on regular Rails routes
  • Updating resources using regular controller methods using Inertia.post, etc.
  • Rendering Active Record validations in the React app
  • Sharing data between Rails and React apps (flash messages)
  • Setting page titles using Inertia's <Head /> component

Running the

You'll need to have Ruby, Node.js and PostgreSQL available.

Install dependencies and initialise the database:

$ bin/setup

Start the Rails and Vite development servers:

$ bin/dev

About

Example Rails app with Vite + Inertia.js

https://fragrant-river-7241.fly.dev


Languages

Language:Ruby 60.4%Language:JavaScript 18.5%Language:HTML 13.2%Language:Dockerfile 5.3%Language:CSS 1.7%Language:Shell 0.5%Language:TypeScript 0.5%