Enforce package boundaries inside a Rails monolith before coupling spreads with Packwerk
Check a Rails codebase for dependency and visibility violations so domain boundaries stay reviewable instead of dissolving over time.
Prerequisites
Ruby, Bundler, a Rails application with Zeitwerk enabled, Packwerk gem installation, and repository access to the monolith being analyzed
Installation
Use the upstream install or setup path that matches your environment:
- gem 'packwerk'
- $ gem install packwerk
Requirements and caveats from upstream:
- This is because we rely on Zeitwerk's conventions, and code that is loaded differently (like through an explicit require) often doesn't follow these conventions.
Basic usage or getting-started notes:
Packwerk needs Zeitwerk enabled, which comes with Rails 6.
Packwerk supports MRI versions 2.7 and above.
Demo
Extracted from upstream docs: https://raw.githubusercontent.com/Shopify/packwerk/HEAD/README.md