{"id":13877900,"url":"https://github.com/solid-process/solid-process","last_synced_at":"2025-04-15T21:17:36.757Z","repository":{"id":226297731,"uuid":"768323684","full_name":"solid-process/solid-process","owner":"solid-process","description":"Write business logic for Ruby/Rails that scales.","archived":false,"fork":false,"pushed_at":"2024-06-24T17:48:03.000Z","size":114,"stargazers_count":78,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-15T21:17:31.457Z","etag":null,"topics":["ruby","ruby-on-rails","solid-process","solid-result"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/solid-process","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/solid-process.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-06T21:55:49.000Z","updated_at":"2025-02-27T22:42:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"16213656-d870-46a4-9950-5678d02cd017","html_url":"https://github.com/solid-process/solid-process","commit_stats":{"total_commits":82,"total_committers":2,"mean_commits":41.0,"dds":"0.012195121951219523","last_synced_commit":"fb62d1f1d97667a08f67cad211067682563925bf"},"previous_names":["serradura/solid-process"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-process%2Fsolid-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-process%2Fsolid-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-process%2Fsolid-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solid-process%2Fsolid-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solid-process","download_url":"https://codeload.github.com/solid-process/solid-process/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249153953,"owners_count":21221330,"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":["ruby","ruby-on-rails","solid-process","solid-result"],"created_at":"2024-08-06T08:01:34.444Z","updated_at":"2025-04-15T21:17:36.726Z","avatar_url":"https://github.com/solid-process.png","language":"Ruby","readme":"\u003cp align=\"center\"\u003e\n  \u003ch1 align=\"center\" id=\"-solidprocess\"\u003e⚛️ Solid::Process\u003c/h1\u003e\n  \u003cp align=\"center\"\u003e\u003ci\u003eWrite business logic for Ruby/Rails that scales.\u003c/i\u003e\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://codeclimate.com/github/solid-process/solid-process/maintainability\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/643a53e99bb591321c9f/maintainability\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://codeclimate.com/github/solid-process/solid-process/test_coverage\"\u003e\u003cimg src=\"https://api.codeclimate.com/v1/badges/643a53e99bb591321c9f/test_coverage\" /\u003e\u003c/a\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Ruby%20%3E%3D%202.7%2C%20%3C%3D%20Head-ruby.svg?colorA=444\u0026colorB=333\" alt=\"Ruby\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Rails%20%3E%3D%206.0%2C%20%3C%3D%20Edge-rails.svg?colorA=444\u0026colorB=333\" alt=\"Rails\"\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n## 📚 Table of Contents \u003c!-- omit from toc --\u003e\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [The Basic Structure](#the-basic-structure)\n- [Further Reading](#further-reading)\n- [Development](#development)\n- [Contributing](#contributing)\n- [License](#license)\n- [Code of Conduct](#code-of-conduct)\n- [Acknowledgments](#acknowledgments)\n- [About](#about)\n\n## Supported Ruby and Rails \u003c!-- omit from toc --\u003e\n\nThis library is tested (100% coverage) against:\n\n| Ruby / Rails | 6.0 | 6.1 | 7.0 | 7.1 | Edge |\n|--------------|-----|-----|-----|-----|------|\n| 2.7          | ✅  | ✅  | ✅  | ✅   |      |\n| 3.0          | ✅  | ✅  | ✅  | ✅   |      |\n| 3.1          | ✅  | ✅  | ✅  | ✅   | ✅   |\n| 3.2          | ✅  | ✅  | ✅  | ✅   | ✅   |\n| 3.3          | ✅  | ✅  | ✅  | ✅   | ✅   |\n| Head         |    |     |     | ✅   | ✅   |\n\n## Introduction\n\n`solid-process` is a Ruby/Rails library designed to encapsulate business logic into manageable processes. It simplifies writing, testing, maintaining, and evolving your code, ensuring it remains clear and approachable as your application scales.\n\n**Features:** (_touch to expand_)\n\n\u003cdetails\u003e\u003csummary\u003e1️⃣ \u003cstrong\u003eSeamless Rails integration\u003c/strong\u003e\u003c/summary\u003e\n\n  \u003e Designed to complement Ruby on Rails, this library integrates smoothly without conflicting with existing framework conventions and features.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e2️⃣ \u003cstrong\u003eSupport progressive mastery\u003c/strong\u003e\u003c/summary\u003e\n\n  \u003e Offers an intuitive entry point for novices while providing robust, advanced features that cater to experienced developers.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e3️⃣ \u003cstrong\u003ePromote conceptual integrity and rapid onboarding\u003c/strong\u003e\u003c/summary\u003e\n\n  \u003e By maintaining a consistent design philosophy, `solid-process` reduces the learning curve for new developers, allowing them to contribute more effectively and quickly to a codebase.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003e4️⃣ \u003cstrong\u003eEnhanced observability\u003c/strong\u003e\u003c/summary\u003e\n\n  \u003e Equipped with sophisticated instrumentation mechanisms, the library enables detailed logging and tracing without compromising code readability, even when processes are nested.\n\n\u003c/details\u003e\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n### Examples \u003c!-- omit in toc --\u003e\n\nCheck out [Solid Rails App](https://github.com/solid-process/solid-rails-app) for a complete example of how to use `solid-process` in a Rails application. [Twelve versions (branches)](https://github.com/solid-process/solid-rails-app?tab=readme-ov-file#-repository-branches) show how the gem can be incrementally integrated, access it to see from simple services/form objects to implementing the ports and adapters (hexagonal) architectural pattern.\n\nYou can also check the [examples](examples) directory for more simple examples of how to use the gem.\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Installation\n\nInstall the gem and add to the application's Gemfile by executing:\n\n    $ bundle add solid-process\n\nIf bundler is not being used to manage dependencies, install the gem by executing:\n\n    $ gem install solid-process\n\nAnd require it in your code:\n\n    require 'solid/process'\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## The Basic Structure\n\nAll `Solid::Process` requires at least two things: an `input` and a `call` method.\n\n1. The `input` is a set of attributes needed to perform the work.\n2. The `#call` method is the entry point and where the work is done.\n  - It receives the attributes Hash (symbolized keys), defined by the `input`.\n  - It returns a `Success` or `Failure` as the output.\n\n```ruby\nclass User::Creation \u003c Solid::Process\n  input do\n    # Define the attributes needed to perform the work\n  end\n\n  def call(attributes)\n    # Perform the work and return a Success or Failure as the output\n  end\nend\n```\n\n#### Example \u003c!-- omit in toc --\u003e\n\n```ruby\nclass User::Creation \u003c Solid::Process\n  input do\n    attribute :email\n    attribute :password\n    attribute :password_confirmation\n  end\n\n  def call(attributes)\n    user = User.create(attributes)\n\n    if user.persisted?\n      Success(:user_created, user: user)\n    else\n      Failure(:user_not_created, user: user)\n    end\n  end\nend\n```\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n### Calling a Process \u003c!-- omit from toc --\u003e\n\nTo call a process, you can use the `call` method directly, or instantiate the class and call the `#call` method.\n\n```ruby\n###############\n# Direct call #\n###############\n\nUser::Creation.call(email: 'john.doe@email.com', password: 'password', password_confirmation: 'password')\n# =\u003e #\u003cSolid::Output::Success type=:user_created value={:user=\u003e#\u003cUser id: 1, ...\u003e}\u003e\n\n########################\n# Instantiate and call #\n########################\n\nprocess = User::Creation.new\n\nprocess.call(email: 'john.doe@email.com', password: 'password', password_confirmation: 'password')\n```\n\nFor now, it's essential to know that a process instance is stateful, and because of this, you can call it only once.\n\n```ruby\nprocess = User::Creation.new\n\ninput = {email: 'john.doe@email.com', password: 'password', password_confirmation: 'password'}\n\nprocess.call(input)\n\nprocess.call(input)\n# The `User::Creation#output` is already set. Use `.output` to access the result or create a new instance to call again. (Solid::Process::Error)\n```\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Further Reading\n\n1. [Key Concepts](docs/010_KEY_CONCEPTS.md)\n2. [Basic Usage](docs/020_BASIC_USAGE.md)\n3. [Intermediate Usage](docs/030_INTERMEDIATE_USAGE.md)\n4. [Advanced Usage](docs/040_ADVANCED_USAGE.md)\n5. [Error Handling](docs/050_ERROR_HANDLING.md)\n6. [Testing](docs/060_TESTING.md)\n7. [Instrumentation / Observability](docs/070_INSTRUMENTATION.md)\n8. [Rails Integration](docs/080_RAILS_INTEGRATION.md)\n9. [Internal libraries](docs/090_INTERNAL_LIBRARIES.md)\n  - Solid::Input\n  - Solid::Model\n  - Solid::Value\n  - ActiveModel validations\n10. [Ports and Adapters (Hexagonal Architecture)](docs/100_PORTS_AND_ADAPTERS.md)\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake dev` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/solid-process/solid-process. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/solid-process/solid-process/blob/main/CODE_OF_CONDUCT.md).\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Code of Conduct\n\nEveryone interacting in the Solid::Process project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/solid-process/solid-process/blob/main/CODE_OF_CONDUCT.md).\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n\n## Acknowledgments\n\nI want to thank some people who helped me by testing and giving feedback as this project took shape, they are:\n\n- [Diego Linhares](https://github.com/diegolinhares) and [Ralf Schmitz Bongiolo](https://github.com/mrbongiolo) they were the brave ones who worked for a few months with the first versions of the ecosystem (it was called B/CDD). Their feedback was essential for improving DX and helped me to pivot some core decisions.\n- [Vitor Avelino](https://github.com/vitoravelino), [Tomás Coêlho](https://github.com/tomascco), [Haroldo Furtado](https://github.com/haroldofurtado) (I could repeat Ralf and Diego again) for the various feedbacks, documentation, API, support and words of encouragement.\n\n## About\n\n[Rodrigo Serradura](https://rodrigoserradura.com) created this project. He is the Solid Process creator and has already made similar gems like the [u-case](https://github.com/serradura/u-case) and [kind](https://github.com/serradura/kind). This gem can be used independently, but it also contains essential features that facilitate the adoption of Solid Process (the method) in code.\n\n\u003cp align=\"right\"\u003e\u003ca href=\"#-table-of-contents-\"\u003e⬆️ \u0026nbsp;back to top\u003c/a\u003e\u003c/p\u003e\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolid-process%2Fsolid-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolid-process%2Fsolid-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolid-process%2Fsolid-process/lists"}