alba-inertia
Alba-Inertia pairs Alba serializers with Typelizer to generate TypeScript types automatically from your Rails models and resources. Define entity, page, and shared props resources once, then render them convention-based in controllers—no manual type declarations needed.
Alba-Inertia lets you serialize Inertia props with Alba resources and auto-generate their TypeScript types.
AI-generated summary based on this skill's SKILL.md
Install
inertia-rails/skills/alba-inertia
git clone https://github.com/inertia-rails/skills
cp -r skills/skills/alba-inertia ~/.claude/skills/alba-inertianpx skillfed install inertia-rails/skills/alba-inertiaFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is alba-inertia and how does it work with Rails?
Alba-Inertia pairs Alba serializers with Typelizer to generate TypeScript types automatically from your Rails models and resources. Define entity, page, and shared props resources once, then render them convention-based in controllers—no manual type declarations needed. It eliminates the friction of keeping Ruby responses and TypeScript types in sync.
How do I set up type-safe Inertia props using Alba serializers?
Alba-Inertia lets you define Alba resources for your entities, pages, and shared props. Once configured, Typelizer auto-generates matching TypeScript types from your Ruby models. In your controller, render Inertia responses using these resources, and your frontend receives both serialized data and type safety without manual type declarations.
Can alba-inertia replace as_json with structured Alba resources?
Yes. Alba-Inertia is designed to replace as_json with structured Alba resources for Inertia responses. Instead of ad-hoc serialization, you define reusable Alba resources that handle both serialization and type generation, giving you consistency and type safety across your entire Rails-Inertia stack.
How does Typelizer generate TypeScript types from Ruby models?
Typelizer scans your Alba resources and Ruby models to auto-generate TypeScript type definitions. Alba-Inertia integrates this process so your resource definitions become the source of truth. Run the generator once, and your frontend has fully typed props matching your backend serializers—no manual syncing required.
What Inertia prop options does alba-inertia support?
Alba-Inertia lets you configure Alba resources with Inertia prop options including defer, once, merge, and scroll. These options control how props are lazy-loaded, cached, merged with existing state, or scroll behavior—all defined declaratively in your Alba resource configuration.
How do I troubleshoot alba-inertia type generation issues?
Alba-Inertia troubleshooting typically involves checking your Alba resource definitions match your model structure, ensuring Typelizer is configured correctly, and verifying your controller renders resources using the expected convention. Check that resource inheritance and shared props are properly declared so type generation captures your full data shape.
SKILL.md
rendered from the published skill — quoted content, verbatim
Alba + Typelizer for Inertia Rails
Requires: alba, typelizer, alba-inertia gems in Gemfile.
Alba serializers for Inertia props with auto-generated TypeScript types.
Replaces as_json(only: [...]) with structured, type-safe resources.
Before creating a resource, ask:
- Reusable data shape (user, course)? → Entity resource (UserResource) — shared across pages
- Page-specific props bundle? → Page resource (UsersIndexResource) — one per controller action
- Global data (auth, notifications)? → Shared props resource (SharedPropsResource)
NEVER: - Use
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 2 files
skills/alba-inertia/SKILL.md
skills/alba-inertia/references/prop-options.md