Project

typelizer

0.06
A long-lived project that still receives updates
A TypeScript type generator for Ruby serializers.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

>= 6.0.0
 Project Readme

Typelizer

Gem Version

Typelizer generates TypeScript types, route helpers, and OpenAPI schemas from your Ruby on Rails application. It keeps your backend and frontend in sync without hand-maintaining types.

Features

  • Automatic TypeScript interface generation from serializers
  • Type-safe route helpers from Rails routes
  • Supports Alba, ActiveModel::Serializer, Oj::Serializer, Panko::Serializer
  • OpenAPI 3.0/3.1 schema generation
  • Multiple output writers with layered configuration
  • File watching with automatic regeneration in development

Quick Start

Add to your Gemfile:

gem "typelizer"

Include the DSL in your serializers:

class ApplicationResource
  include Alba::Resource
  include Typelizer::DSL
end

class PostResource < ApplicationResource
  attributes :id, :title, :body
end

Generate TypeScript types:

rails typelizer:generate

Documentation

Full documentation: https://typelizer.dev

Credits

Typelizer is inspired by types_from_serializers, js-routes, and Wayfinder.

Built by Evil Martians

License

The gem is available as open source under the terms of the MIT License.