GitPedia

From fat controllers to use cases

Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic.

From serradura·Updated August 22, 2025·View on GitHub·

Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic. The project is written primarily in Ruby, first published in 2019. Key topics include: architecture, clean-architecture, concerns, domain-objects, fat-controller.

From fat controllers to use cases

Rails (API) app that shows different kinds of architecture (one per commit), and in the last one, how to use the Micro::Case gem to handle the application business logic.

Instructions to run this application

  • Ruby version: 2.6.5
  • System dependencies: sqlite3
  • Configuration and database creation: bin/setup
  • How to run the test suite: bin/rails test

The different kinds of architecture (project versions)

VersionDescriptionRubycritic Score
1Fat controller91.53
2Fat model, skinny controller87.45
3Concerns89.25
4Service objects92.55
4.1Service objects - Inheritance92.93
4.2Service objects - Inheritance overusing93.15
5Interactors96.36
6Domain objects94.71
7Use cases (Micro::Case)94.97
7.1Use cases - Dryer version95.24
7.2Use cases- Improving the SRP95.11

Hint: in any of the versions above, use bin/rails rubycritic to see the full report result.

Extra: How to list all the use cases?

Use the use_cases task. e.g:

sh
bin/rails use_cases # Lines: # 11 ./app/models/user/register/step/serialize_as_json.rb # 12 ./app/models/user/register/step/validate_password.rb # 17 ./app/models/user/register/step/create_record.rb # 19 ./app/models/user/register/step/normalize_params.rb # 10 ./app/models/user/register/flow.rb # 18 ./app/models/todo/list/add_item.rb # 16 ./app/models/todo/list/complete_item.rb # 14 ./app/models/todo/list/delete_item.rb # 12 ./app/models/todo/list/fetch_items.rb # 14 ./app/models/todo/list/find_item.rb # 19 ./app/models/todo/list/update_item.rb # 16 ./app/models/todo/list/activate_item.rb # 21 ./app/models/todo/serialize.rb # 199 total # # Files: 13

Note: This task will only be available in the branches with use cases (v7, v7.1, v7.2).

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from serradura/from-fat-controllers-to-use-cases via the GitHub API.Last fetched: 6/15/2026