Skip to content

A minimalist InertiaJS on Rails Template using Vite + SSR

Notifications You must be signed in to change notification settings

ElMassimo/inertia-rails-ssr-template

 
 

Repository files navigation

Inertia on Rails with SSR enabled

This is a minimal installation of Ruby on Rails, Vite, and InertiaJS. (It also uses the Tailwind Play CDN for some simple styling). Feel free to fork this and use it for your next spike, mvp, or entire application. If you'd like to take a look around to see how everything is working, I'd recommend checking out the following files:

  • app/frontend/pages/Dashboard.jsx: The React component being rendered by the / route
  • app/controllers/dashboard_controller.rb: The controller that handled rendering the root page
  • app/frontend/components/Layout.jsx: The React component providing the "magic" layout similar to Rails's application layout
  • app/frontend/entrypoints/application.jsx: The Vite entrypoint that handles initializing InertiaJS

To run locally:

bundle install
npm install
foreman -f Procfile.dev

To create an SSR build:

bin/vite build --ssr

To start the SSR node.js server:

bin/vite ssr

For an example on how to enable SSR for an existing app, see this example in PingCRM.

About

A minimalist InertiaJS on Rails Template using Vite + SSR

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 63.3%
  • HTML 17.1%
  • JavaScript 16.8%
  • CSS 2.1%
  • Other 0.7%