Rsodx

Add Rsodx and just code ✨

Rsodx is a lightweight, modular microservice framework for Ruby β€” designed to be fast, clean, and scalable. It provides a minimal architecture inspired by Rails, Sinatra, and Sequel, allowing you to focus on writing business logic without boilerplate.


🧠 Philosophy

  • No monoliths β€” build small services
  • No magic β€” just plain Ruby
  • No opinionated ORM or router β€” just simple tools
  • Easily extendable and production-ready

Π’ΠΎΡ‚ Π°ΠΊΠΊΡƒΡ€Π°Ρ‚Π½ΠΎ ΠΎΡ„ΠΎΡ€ΠΌΠ»Π΅Π½Π½Ρ‹ΠΉ Ρ€Π°Π·Π΄Π΅Π» Installation для Ρ‚Π²ΠΎΠ΅Π³ΠΎ README:


πŸ“¦ Installation

gem 'rsodx', github: 'eugene-ruby/rsodx'

You can install the gem directly from RubyGems.org after release:

With Bundler

bundle add rsodx

Without Bundler

gem install rsodx

βœ… rsodx is designed for microservice architecture and includes routing, interactors, validation, and more β€” all in one lightweight package.


πŸ“¦ Project Structure

my_service/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ interactors/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ presenters/
β”‚   β”œβ”€β”€ serializers/
β”‚   β”œβ”€β”€ app.rb
β”‚   └── router.rb
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ environment.rb
β”‚   β”œβ”€β”€ environments/
β”‚   └── initializers/
β”œβ”€β”€ db/
β”‚   └── migrations/
β”œβ”€β”€ bin/
β”‚   └── console
β”œβ”€β”€ .env
β”œβ”€β”€ config.ru
β”œβ”€β”€ Gemfile
└── Rakefile

🧰 CLI Commands

Create new service

rsodx new my_service

Generate interactor

bin/rsodx generate interactor CreateUser

Creates app/interactors/create_user.rb:

class CreateUser < Rsodx::Interactor
  def call
    # business logic here
  end
end

Generate migration

bin/rsodx generate migration CreateUsers

Creates db/migrations/20240413_create_users.rb:

Sequel.migration do
  change do
    # create_table :users do
    #   primary_key :id
    #   String :email
    #   DateTime :created_at
    # end
  end
end

πŸ“‚ DSL Router Example

class Router < Rsodx::Router
  namespace "/v1" do
    post "/users", CreateUsers
  end
end

βš™οΈ Rake Tasks

You can define your own DB.connect logic and use built-in tasks:

# config/environment.rb
require "rsodx"
require "rsodx/db"
Rsodx::DB.connect

Run migration

rake db:migrate

Rollback migration

rake db:rollback

πŸ’» Interactive Console

bin/console

Inside IRB:

reload!  # reload environment
CreateUser.call(params: {...})

πŸ”œ Roadmap

  • Generator for models, serializers, presenters
  • HTTP + JSON helpers
  • Authentication middleware
  • Better documentation site

🧬 License

MIT β€” created by Eugene Pervushin