{"id":13878689,"url":"https://github.com/light-ruby/light-services","last_synced_at":"2025-10-08T18:24:51.629Z","repository":{"id":56881195,"uuid":"74996225","full_name":"light-ruby/light-services","owner":"light-ruby","description":"Robust service architecture for Ruby frameworks","archived":false,"fork":false,"pushed_at":"2024-09-09T15:32:28.000Z","size":190,"stargazers_count":71,"open_issues_count":9,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-10-05T19:52:50.139Z","etag":null,"topics":["ruby","ruby-on-rails","service-objects"],"latest_commit_sha":null,"homepage":"https://light-services.kodkod.me","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/light-ruby.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":"2016-11-28T17:17:59.000Z","updated_at":"2025-07-30T12:11:24.000Z","dependencies_parsed_at":"2025-01-28T19:34:39.025Z","dependency_job_id":"27b638ff-46e2-4efd-a775-363adf9ab26b","html_url":"https://github.com/light-ruby/light-services","commit_stats":{"total_commits":19,"total_committers":1,"mean_commits":19.0,"dds":0.0,"last_synced_commit":"eaefdcad784d18d1323b66f67da15679fa6dceb3"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/light-ruby/light-services","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/light-ruby%2Flight-services","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/light-ruby%2Flight-services/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/light-ruby%2Flight-services/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/light-ruby%2Flight-services/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/light-ruby","download_url":"https://codeload.github.com/light-ruby/light-services/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/light-ruby%2Flight-services/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278855914,"owners_count":26057761,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","service-objects"],"created_at":"2024-08-06T08:01:56.836Z","updated_at":"2025-10-08T18:24:51.601Z","avatar_url":"https://github.com/light-ruby.png","language":"Ruby","readme":"# 🚀 Light Services\n\nLight Services is a simple yet powerful way to organize your business logic. This Ruby gem helps you build services that are easy to test, maintain, and understand.\n\n![GitHub CI](https://github.com/light-ruby/light-services/actions/workflows/ci.yml/badge.svg)\n[![Codecov](https://codecov.io/gh/light-ruby/light-services/graph/badge.svg?token=IGJNZ2BQ26)](https://codecov.io/gh/light-ruby/light-services)\n\n## Features\n\n- 🧩 **Simple**: Define your service as a class with `arguments`, `steps`, and `outputs`\n- 🎢 **Transactions**: Automatically rollback database changes if any step fails\n- 👵 **Inheritance**: Inherit from other services to reuse logic seamlessly\n- 🚨 **Error Handling**: Collect errors from steps and handle them your way\n- ⛓️ **Context**: Run multiple services sequentially within the same context\n- 🤔 **Framework Agnostic**: Compatible with Rails, Hanami, or any Ruby framework\n- 🏗️ **Modularity**: Isolate and test your services with ease\n- 🐛 **100% Test Coverage**: Bugs are not welcome here!\n- 🛡️ **Battle-Tested**: In production use since 2017\n\n## Simple Example\n\n```ruby\nclass GreetService \u003c Light::Services::Base\n  # Arguments\n  arg :name\n  arg :age\n\n  # Steps\n  step :build_message\n  step :send_message\n\n  # Outputs\n  output :message\n\n  private\n\n  def build_message\n    self.message = \"Hello, #{name}! You are #{age} years old.\"\n  end\n\n  def send_message\n    # Send logic goes here\n  end\nend\n```\n\n## Advanced Example\n\n```ruby\nclass User::ResetPassword \u003c Light::Services::Base\n  # Arguments\n  arg :user, type: User, optional: true\n  arg :email, type: :string, optional: true\n  arg :send_email, type: :boolean, default: true\n\n  # Steps\n  step :validate\n  step :find_user, unless: :user?\n  step :generate_reset_token\n  step :save_reset_token\n  step :send_reset_email, if: :send_email?\n\n  # Outputs\n  output :user, type: User\n  output :reset_token, type: :string\n\n  private\n\n  def validate\n    errors.add(:base, \"user or email is required\") if !user? \u0026\u0026 !email?\n  end\n\n  def find_user\n    self.user = User.find_by(\"LOWER(email) = ?\", email.downcase)\n    errors.add(:email, \"not found\") unless user\n  end\n\n  def generate_reset_token\n    self.reset_token = SecureRandom.hex(32)\n  end\n\n  def save_reset_token\n    user.update!(\n      reset_password_token: reset_token,\n      reset_password_sent_at: Time.current,\n    )\n  rescue ActiveRecord::RecordInvalid =\u003e e\n    errors.from_record(e.record)\n  end\n\n  def send_reset_email\n    Mailer::SendEmail\n      .with(self) # Call sub-service with the same context\n      .run(template: :reset_password, user:, reset_token:)\n  end\nend\n```\n\n## Documentation\n\nYou can find the full documentation at [light-services.kodkod.me](https://light-services.kodkod.me).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flight-ruby%2Flight-services","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flight-ruby%2Flight-services","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flight-ruby%2Flight-services/lists"}