{"id":13879089,"url":"https://github.com/Shopify/packwerk","last_synced_at":"2025-07-16T15:30:51.958Z","repository":{"id":37264547,"uuid":"298001192","full_name":"Shopify/packwerk","owner":"Shopify","description":"Good things come in small packages.","archived":false,"fork":false,"pushed_at":"2024-04-02T22:43:48.000Z","size":7454,"stargazers_count":1480,"open_issues_count":39,"forks_count":109,"subscribers_count":261,"default_branch":"main","last_synced_at":"2024-04-14T09:45:30.094Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shopify.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-23T14:44:21.000Z","updated_at":"2024-04-29T19:29:04.049Z","dependencies_parsed_at":"2023-09-21T23:48:51.222Z","dependency_job_id":"d641a4e6-53c3-4d26-829c-beb69bc6b685","html_url":"https://github.com/Shopify/packwerk","commit_stats":{"total_commits":446,"total_committers":66,"mean_commits":6.757575757575758,"dds":0.8340807174887892,"last_synced_commit":"4e02bf1800ff8e653edb65ac1d47be72b0a27c96"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fpackwerk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fpackwerk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fpackwerk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shopify%2Fpackwerk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shopify","download_url":"https://codeload.github.com/Shopify/packwerk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226138849,"owners_count":17579496,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T08:02:09.450Z","updated_at":"2024-11-24T07:31:32.937Z","avatar_url":"https://github.com/Shopify.png","language":"Ruby","readme":"# Packwerk [![Build Status](https://github.com/Shopify/packwerk/workflows/CI/badge.svg)](https://github.com/Shopify/packwerk/actions?query=workflow%3ACI)\n\n\u003e \"I know who you are and because of that I know what you do.\"\n\u003e This knowledge is a dependency that raises the cost of change.\n\n-- _Sandi Metz, Practical Object-Oriented Design in Ruby_\n\nPackwerk is a Ruby gem used to enforce boundaries and modularize Rails applications.\n\nPackwerk can be used to:\n* Combine groups of files into packages\n* Define package-level constant visibility (i.e. have publicly accessible constants)\n* Help existing codebases to become more modular without obstructing development\n\n## Prerequisites\n\nPackwerk needs [Zeitwerk](https://github.com/fxn/zeitwerk) enabled, which comes with Rails 6.\n\nPackwerk supports MRI versions 2.7 and above.\n\n## Demo\n\nWatch a [1-minute video demo](https://www.youtube.com/watch?v=NwqlyBAxVpQ\u0026feature=youtu.be) on how Packwerk works.\n\n[![](./static/packwerk-check-demo.png)](https://www.youtube.com/watch?v=NwqlyBAxVpQ\u0026feature=youtu.be)\n\n## Installation\n\n1. Add this line to your application's Gemfile:\n\n```ruby\ngem 'packwerk'\n```\n\n2. Install the gem\n\nExecute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install packwerk\n\n2. Run `bundle binstub packwerk` to generate the binstub\n3. Run `bin/packwerk init` to generate the configuration files\n\n## Usage\n\nRead [USAGE.md](USAGE.md) for usage once Packwerk is installed on your project.\n\n## Pronunciation\n\n\"Packwerk\" is pronounced [[ˈpakvɛʁk]](https://cdn.shopify.com/s/files/1/0258/7469/files/packwerk.mp3).\n\n## Ecosystem\n\nVarious third parties have built tooling on top of packwerk. Here's a selection of some that might prove useful:\n\n- https://github.com/bellroy/graphwerk draws a graph of your package dependencies\n- https://github.com/rubyatscale/packwerk-vscode integrates packwerk into Visual Studio Code so you can see violations right in your editor\n- https://github.com/vinted/packwerk-intellij integrates packwerk into RubyMine so you can see violations right in your editor\n- https://github.com/rubyatscale/packs-rails sets up Rails autoloading, as well as `rspec` and `FactoryBot` integration, for packages arranged in a flat list. packs-rails is quite convenient, but for autoloading we recommend to use `Rails::Engine`s instead.\n- https://github.com/rubyatscale/danger-packwerk integrates packwerk with [danger.systems](https://danger.systems) to provide packwerk feedback as Github inline PR comments\n- https://github.com/rubyatscale/packwerk-extensions contains extensions for packwerk, including a checker for packwerk that allows you to enforce public API boundaries. This was originally extracted from `packwerk` itself.\n- https://github.com/alexevanczuk/packs is a Rust implementation of packwerk that has experimental support for non-Rails, non-Zeitwerk applications.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Limitations\n\nWith Ruby being a very dynamic language, static analysis tools such as Packwerk are bound to have limitations.\nTo reduce the impact of those limitations, Packwerk is designed to avoid false positives (reporting references as violations that are actually fine) at any cost, and we pay the cost by accepting a small number of false negatives (failing to report actual violations).\n\n- Packwerk can only resolve references to constants that are defined in code loaded by the application's Zeitwerk autoloader.\n  This is because we rely on [Zeitwerk's conventions](https://github.com/fxn/zeitwerk#file-structure), and code that is loaded differently (like through an explicit `require`) often doesn't follow these conventions.\n- Method calls and objects passed around the application are completely ignored. Packwerk only cares about static constant references. That said, if you want Packwerk to analyze parameters of a method, you can use [Sorbet](https://sorbet.org/) to define a type signature. Sorbet signatures are pure Ruby code and use constants to express types, and Packwerk understands that.\n- Support for custom Zeitwerk configuration is limited. If [custom ActiveSupport inflections](https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#customizing-inflections) are used, Packwerk will understand that and everything is fine. However, if Zeitwerk is directly configured with [custom Zeitwerk inflections](https://github.com/fxn/zeitwerk#inflection) or to [collapse directories](https://github.com/fxn/zeitwerk#collapsing-directories), _Packwerk will get confused and produce false positives_.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Shopify/packwerk.\n\nRead and follow the guidelines in [CONTRIBUTING.md](https://github.com/Shopify/packwerk/blob/main/CONTRIBUTING.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShopify%2Fpackwerk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShopify%2Fpackwerk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShopify%2Fpackwerk/lists"}