AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Inertia Rails Setup

skill-cole-robertson-inertia-rails-skills-inertia-rails-setup · by cole-robertson

Set up a new Inertia Rails project or add Inertia to an existing Rails application. Use when creating new projects, configuring Inertia, or setting up the development environment with React, Vue, or Svelte.

No reviews yet
0 installs
3 views
0.0% view→install

Install

$ agentstack add skill-cole-robertson-inertia-rails-skills-inertia-rails-setup

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access Used
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets Used
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-cole-robertson-inertia-rails-skills-inertia-rails-setup)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Inertia Rails Setup? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Inertia Rails Setup

This skill helps you set up Inertia.js in a Ruby on Rails application with your choice of frontend framework.

Recommended: Official Starter Kits

For new projects, the fastest way to get started is cloning an official starter kit. These include authentication, shadcn/ui components, TypeScript, and optional SSR support out of the box.

React Starter Kit (Recommended)

git clone https://github.com/inertia-rails/react-starter-kit myapp
cd myapp
bin/setup

Includes:

  • React 19 + TypeScript
  • shadcn/ui component library (20+ components)
  • User authentication (login, register, password reset)
  • Settings pages (profile, password, email, sessions, appearance)
  • Multiple layouts (sidebar, header, auth variants)
  • Dark mode support
  • Kamal deployment config
  • Optional SSR support
  • Flash messages with Sonner toasts

Vue Starter Kit

git clone https://github.com/inertia-rails/vue-starter-kit myapp
cd myapp
bin/setup

Svelte Starter Kit

git clone https://github.com/inertia-rails/svelte-starter-kit myapp
cd myapp
bin/setup

Customizing the Starter Kit

After cloning:

  1. Rename the app:

```bash # Update config/application.rb module YourAppName class Application


### 4. Install Frontend Dependencies

**For React:**
```bash
npm install @inertiajs/react @inertiajs/vite react react-dom

For Vue 3:

npm install @inertiajs/vue3 @inertiajs/vite vue

For Svelte:

npm install @inertiajs/svelte @inertiajs/vite svelte

5. Configure the Frontend Entry Point

Create app/frontend/entrypoints/application.js:

React:

import { createInertiaApp } from '@inertiajs/react'
import { createRoot } from 'react-dom/client'
import { inertia } from '@inertiajs/vite'

createInertiaApp({
  resolve: inertia.resolvePages('../pages'),
  setup({ el, App, props }) {
    createRoot(el).render()
  },
})

Vue 3:

import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/vue3'
import { inertia } from '@inertiajs/vite'

createInertiaApp({
  resolve: inertia.resolvePages('../pages'),
  setup({ el, App, props, plugin }) {
    createApp({ render: () => h(App, props) })
      .use(plugin)
      .mount(el)
  },
})

Svelte:

import { createInertiaApp } from '@inertiajs/svelte'
import { inertia } from '@inertiajs/vite'

createInertiaApp({
  resolve: inertia.resolvePages('../pages'),
  setup({ el, App }) {
    new App({ target: el })
  },
})

6. Create the Pages Directory

mkdir -p app/frontend/pages

7. Configure the Initializer

Create config/initializers/inertia_rails.rb:

# frozen_string_literal: true

InertiaRails.configure do |config|
  # Asset versioning
  config.version = -> { ViteRuby.digest }

  # Flash keys exposed to frontend
  config.flash_keys = %i[notice alert]

  # Required for Inertia.js v3
  config.use_script_element_for_initial_page = true
  config.use_data_inertia_head_attribute = true
  config.always_include_errors_hash = true

  # Deep merge shared data with page props
  # config.deep_merge_shared_data = true

  # Encrypt history for sensitive data (requires HTTPS)
  # config.encrypt_history = Rails.env.production?
end

8. Set Up Shared Data

In app/controllers/application_controller.rb:

class ApplicationController 
      {message}
    
  )
}

Page Component (Vue):


defineProps(['message'])

  
    {{ message }}
  

10. Start the Development Servers

# Terminal 1: Rails server
bin/rails server

# Terminal 2: Vite dev server
bin/vite dev

Configuration Options Reference

| Option | Default | Description | |--------|---------|-------------| | version | nil | Asset version for cache busting | | layout | 'application' | Default layout template | | flash_keys | [:notice, :alert] | Flash keys to share | | deep_merge_shared_data | false | Deep merge props | | encrypt_history | false | Encrypt browser history | | ssr_enabled | false | Enable SSR | | ssr_url | 'http://localhost:13714' | SSR server URL | | default_render | false | Auto-render Inertia | | root_dom_id | 'app' | Root element ID | | use_script_element_for_initial_page | false | Use ` tag for initial page data (required for v3) | | usedatainertiaheadattribute | false | Use data-inertia attribute for head tags (required for v3) | | alwaysincludeerrorshash | nil | Always include errors object in page props | | proptransformer | identity | Transform prop keys (e.g., camelCase) | | componentpathresolver | "path/action" | Custom component name resolution | | parentcontroller | '::ApplicationController' | Base controller for static routes | | exposesharedpropkeys | true | Include shared prop keys in page metadata | | precognitionpreventwrites | false` | Prevent DB writes during precognition |

Environment Variables

All config options can be set via INERTIA_ prefixed env vars:

INERTIA_SSR_ENABLED=true
INERTIA_ENCRYPT_HISTORY=true

Upgrading to Inertia.js v3

If upgrading an existing Inertia.js v2 project:

Required Configuration Changes

Add these to your Inertia Rails initializer:

config.use_script_element_for_initial_page = true
config.use_data_inertia_head_attribute = true
config.always_include_errors_hash = true

Breaking Changes

  • React 19+ required
  • Svelte 5+ with runes syntax required
  • ES2022 build target required
  • ESM-only — no CommonJS
  • Axios removed — uses built-in XHR (use axiosAdapter() to keep Axios)
  • Event renames: invalidhttpException, exceptionnetworkError
  • router.cancel()router.cancelAll()
  • Head attribute: inertiadata-inertia

Install the Vite Plugin

npm install @inertiajs/vite

Update vite.config.js:

import inertia from '@inertiajs/vite'

export default defineConfig({
  plugins: [
    inertia(),
    // ... other plugins
  ],
})

The Vite plugin provides:

  • Automatic page component resolution
  • Simplified SSR setup (no separate entry point in development)
  • withApp callback for providers/plugins

Troubleshooting

"Cannot find module '@inertiajs/react'"

Run npm install to install dependencies.

Blank page with no errors

Check browser console for JavaScript errors. Ensure Vite dev server is running.

Props not updating

Ensure you're using render inertia: not render json:.

CSRF token errors

Inertia handles CSRF automatically. Ensure protect_from_forgery is enabled.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.