Rsodx
rsodx is a minimal, modular framework for building fast and maintainable Ruby microservices.
Inspired by the best of Rails, Sinatra, and Sequel β it gives you just enough structure to scale, without the overhead.
No magic. Just clean code and powerful tools.
$ rsodx new my_rail_company
π€οΈ Initializing Transport Empire...
π¦ Creating folders...
β
Done! Start building your microservice railway!
π§ Philosophy
- Micro-first β focus on small, single-purpose services
- Explicit over implicit β no hidden behavior, no global state
- Modular by design β include only what you need
- Ruby-native β use familiar patterns, no learning curve
- Production-oriented β simple to develop, easy to deploy
β
rsodxincludes routing, interactors, validation, and service structure β
all wrapped into a fast and lightweight toolkit made for modern Ruby apps.
π¦ 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
π CLI Commands
rsodx ships with a powerful and lightweight CLI tool for generating services and scaffolding applications.
You can run CLI commands via:
bin/rsodx [command] [args]
π§ Generators
Generate various application components using simple commands:
bin/rsodx generate controller v1/users/index
bin/rsodx generate presenter v1/users/index
bin/rsodx generate serializer v1/users/index
Or using aliases:
bin/rsodx g controller v1/users/index
To generate all three at once (controller, presenter, serializer):
bin/rsodx g action v1/users/index
This creates:
app/controllers/v1/users/index_controller.rbapp/presenters/v1/users/index_presenter.rbapp/serializers/v1/users/index_serializer.rb
π Scaffold New App
Create a full Rsodx project with:
bin/rsodx new my_app
Or using alias:
bin/rsodx n my_app
This will create a new directory my_app with:
Gemfile,.env,.ruby-versionconfig.ru,Rakefile, environment loaderapp/structure (controllers,services, etc.)bin/consoleandbin/rsodxCLI entrypoints
It will be immediately runnable:
cd my_app
bundle install
bin/rsodx server
π Server Command
Run a local Rack-based Puma server:
bin/rsodx server
Available options:
--port=PORTβ default:9292--env=ENVβ default:development
Example:
bin/rsodx server --port=3000 --env=production
π How it works
This command launches Puma via rackup:
pid = spawn("bundle exec rackup --port=#{port} --host=0.0.0.0")
Process.wait(pid)
It ensures that your config.ru is used correctly and delegates the full startup to Rack.
β Command Summary
| Command | Description |
|---|---|
rsodx new NAME |
Scaffold a new Rsodx project |
rsodx server |
Run the Rack/Puma development server |
rsodx generate controller PATH |
Generate a controller |
rsodx generate presenter PATH |
Generate a presenter |
rsodx generate serializer PATH |
Generate a serializer |
rsodx generate action PATH |
Generate controller + presenter + serializer |
Aliases: g, n, s |
All commands support short versions |
π Folder Structure (Generated App)
my_app/
βββ app/
β βββ controllers/
β βββ presenters/
β βββ serializers/
β βββ services/
βββ bin/
β βββ console
β βββ rsodx
βββ config/
β βββ environment.rb
β βββ environments/
βββ db/
β βββ migrations/
βββ spec/
βββ config.ru
βββ .env
βββ Gemfile
βββ Rakefile
ποΈ PostgreSQL Setup
Your application connects to PostgreSQL using the DATABASE_URL defined in .env:
DATABASE_URL=postgres://rsodx:paSs4321@localhost:5432/rsodx_development
π To create this database manually:
- Open your terminal and run the PostgreSQL client:
psql -U postgres
- Then, execute the following SQL commands:
-- Create the user
CREATE USER rsodx WITH PASSWORD 'paSs4321';
-- Create the database
CREATE DATABASE rsodx_development;
-- Grant privileges
GRANT ALL PRIVILEGES ON DATABASE rsodx_development TO rsodx;
π If your system uses a different PostgreSQL superuser, adjust
-U postgresaccordingly.
β Quick Check
You can test the connection:
psql postgres://rsodx:paSs4321@localhost:5432/rsodx_development
If it connects successfully, your database is ready for development!
π DSL Router Example
class Router < Rsodx::Router
namespace "/v1" do
post "/users", V1::Users::Create
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
Planned features and improvements for upcoming versions of rsodx.
π Inter-service Communication
- β
Add RabbitMQ support for event-driven microservices
- CLI:
rsodx g subscriber user/created - DSL:
on_event "user.created", with: HandleUserCreated
- CLI:
π³ Docker Support
- β Dockerfile and docker-compose.yml templates
- PostgreSQL, RabbitMQ, App
π¦ Generators & Tooling
- [ ]
rsodx g worker fetch_data - [ ]
rsodx g subscriber event_name - [ ] CLI flags:
--dry-run,--force,--skip - [ ] Generate test stubs with each component
π Web Server Improvements
- [ ] Auto-discovery of config.ru or App class
- [ ]
rsodx server --daemon,--log
π Documentation & API
- [ ] Auto-generate OpenAPI / Swagger docs from declared routes and schemas
- [ ] DRY validation + schema β Swagger with types and examples
- [ ]
rsodx g docsorrsodx docs generate
π Developer Experience
- [ ]
rsodx console(IRB + app preload) - [ ]
rsodx doctorfor environment diagnostics - [ ] Starter project templates (
--template=api,--template=evented)
If youβd like to contribute or suggest new features β feel free to open an issue or PR. Letβs make rsodx fast, lean and production-ready together! β€οΈ
𧬠License
MIT β created by Eugene Pervushin