---
title: "The State of Ruby Static Typing at Shopify"
description: "Shopify’s Ruby monolith receives about 400 commits and 40 deployments daily, spanning 37,000 files, 622,000 methods, and over 2,000,000 calls, making correctness difficult despite rigorous review and 150,000 automated tests. Since 2018, Shopify’s Ruby Infrastructure team has pursued static typing and adopted Sorbet, discussed in a 2020 Shipit! event. The post describes Sorbet’s handling of simple collections such as T::Array[Integer], nested types using T.untyped, and dedicated classes for complex structures, while noting obstacles involving ActiveSupport::Concern, implicit inclusion requirements, metaprogramming, and dynamic GraphQL resolvers. For Rails projects, guidance is to begin with typed: false, generate RBI files using Tapioca or sorbet-rails, then move suitable files toward typed: true based on reuse, errors, collaboration, or churn, checking generated files into the repository."
---

# The State of Ruby Static Typing at Shopify

[Shopify](https://yomu.fyi/company/shopify) · 2023-10-18 · Dec 7, 2020

**Type:** Explainer

## Summary

Shopify’s Ruby monolith receives about 400 commits and 40 deployments daily, spanning 37,000 files, 622,000 methods, and over 2,000,000 calls, making correctness difficult despite rigorous review and 150,000 automated tests. Since 2018, Shopify’s Ruby Infrastructure team has pursued static typing and adopted Sorbet, discussed in a 2020 Shipit! event. The post describes Sorbet’s handling of simple collections such as T::Array\[Integer\], nested types using T.untyped, and dedicated classes for complex structures, while noting obstacles involving ActiveSupport::Concern, implicit inclusion requirements, metaprogramming, and dynamic GraphQL resolvers. For Rails projects, guidance is to begin with typed: false, generate RBI files using Tapioca or sorbet-rails, then move suitable files toward typed: true based on reuse, errors, collaboration, or churn, checking generated files into the repository.

## Context

Shopify’s rapidly changing Ruby monolith is large and dynamically typed: it has 37,000 Ruby files, 622,000 methods, and more than 2,000,000 calls, while receiving about 400 daily commits and 40 daily deployments. Even with rigorous review and over 150,000 automated tests, maintaining stability is challenging.

## Approach / What changed

Shopify adopted Sorbet for gradual static typing. The recommended rollout starts files at typed: false, uses Tapioca or sorbet-rails to generate RBI files, and moves suitable files toward typed: true. Signatures are prioritized in heavily reused, error-prone, widely touched, or high-churn files, with generated RBI files checked into the repository.

## Takeaways

- Sorbet can type simple collections such as T::Array\[Integer\]; nested structures can use T.untyped at varying depths, though complex shapes may be better represented by a dedicated class.
- Deeply nested ActiveSupport::Concern usage, implicit module inclusion requirements, extensive metaprogramming, and dynamic GraphQL resolvers are identified as major obstacles to Sorbet adoption.
- Sorbet annotations remain in Ruby and Sorbet provides runtime type checking, but its Ruby feature coverage and type-system expressiveness lag behind TypeScript’s JavaScript support.

**Tags:** [Ruby](https://yomu.fyi/topic/ruby), [Sorbet](https://yomu.fyi/topic/sorbet), [Static Typing](https://yomu.fyi/topic/static-typing)

- Source: [Shopify](https://shopify.engineering/the-state-of-ruby-static-typing-at-shopify)
- Source URL: https://shopify.engineering/the-state-of-ruby-static-typing-at-shopify
- Ingested by Yomu: 2026-08-31T01:10:51.702Z

[Read original post](https://shopify.engineering/the-state-of-ruby-static-typing-at-shopify)
