Inertia Rails Architecture Server-driven architecture for Rails + Inertia.js + React when building pages, forms, navigation, or data refresh. Inertia is NOT a traditional SPA — the server owns routing, data, and auth. React handles rendering only. The Core Mental Model The server is the source of truth. React receives data as props and renders UI. There is no client-side router, no global state store, no API layer. Before building any feature, ask: Where does the data come from? → If server: controller prop. If user interaction: useState . Who owns this state? → If it's in the URL or DB: server owns it (use props). If it's ephemeral UI: React owns it. Am I reaching for a React/SPA pattern? → Check the decision matrix below first — Inertia likely has a server-driven equivalent. Decision Matrix Need Solution NOT This Page data from server Controller props useEffect + fetch Global data (auth, config) inertia_share + usePage() React Context / Redux Flash messages / toasts Rails flash + usePage().flash inertia_share / React state Form submission
inertia-rails-architecture
安装
npx skills add https://github.com/inertia-rails/skills --skill inertia-rails-architecture