Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

645 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Servactory

A set of tools for building reliable services of any complexity.

Gem version Release Date Downloads Ruby version

📚 Documentation

See servactory.com for comprehensive documentation, including:

  • Detailed guides for all features
  • Advanced configuration options
  • Best practices and patterns
  • Migration guides
  • API reference

💡 Why Servactory?

Building reliable services shouldn't be complicated. Servactory provides a battle-tested framework for creating service objects with:

  • 🛡️ Type Safety - Enforce types on inputs and outputs, catch errors early
  • Built-in Validation - Rich validation DSL with custom rules
  • 🧪 Test-Friendly - RSpec matchers and service mocking helpers
  • 📊 Structured Output - Consistent Result object pattern
  • 🔧 Highly Configurable - Extensions, helpers, and custom options
  • 📚 Well Documented - Comprehensive guides and examples

🚀 Quick Start

Installation

gem "servactory"

Define service

class Users::Authenticate < Servactory::Base
  input :email, type: String
  input :password, type: String

  output :user, type: User

  make :authenticate!

  private

  def authenticate!
    if (user = User.authenticate_by(email: inputs.email, password: inputs.password)).present?
      outputs.user = user
    else
      fail!(message: "Authentication failed", meta: { email: inputs.email })
    end
  end
end

Usage in controller

class SessionsController < ApplicationController
  def create
    service = Users::Authenticate.call(**session_params)

    if service.success?
      session[:current_user_id] = service.user.id
      redirect_to service.user
    else
      flash.now[:alert] = service.error.message
      render :new, status: :unprocessable_entity
    end
  end

  private

  def session_params
    params.require(:session).permit(:email, :password)
  end
end

🧩 Ecosystem

  • Stroma — A foundation for building modular, extensible DSLs in Ruby
  • OpenTelemetry Instrumentation — Automatic tracing of service calls and actions with span attributes and failure detection

🤝 Contributing

We love contributions! Check out our Contributing Guide to get started.

Ways to contribute:

  • 🐛 Report bugs and issues
  • 💡 Suggest new features
  • 📝 Improve documentation
  • 🧪 Add test cases
  • 🔧 Submit pull requests

🙏 Acknowledgments

Special thanks to all our contributors!

📄 License

Servactory is available as open source under the terms of the MIT License.

About

Powerful Service Object for Ruby applications

Topics

Resources

Code of conduct

Contributing

Stars

36 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages