Project

rsodx

0.0
There's a lot of open issues
Rsodx is a lightweight Ruby microframework designed for modular, service-oriented applications. Built with simplicity and performance in mind, it's perfect for small web apps, microservices, and CLI tools.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 0.3
~> 3.1
~> 1.2
~> 2.7
~> 3.16
~> 0.5
~> 1.5
~> 6.4
~> 2.2
~> 13.1
~> 5.91
~> 4.1
~> 1.15
~> 6.13
~> 2.7
 Project Readme

Rsodx

Rsodx banner

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

βœ… rsodx includes 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]

ΠšΠΎΠ½Π΅Ρ‡Π½ΠΎ! Π’ΠΎΡ‚ сСкция для README.md Π½Π° английском β€” ΠΏΡ€ΠΎ ΠΊΠΎΠΌΠ°Π½Π΄Ρ‹ db:migrate ΠΈ db:rollback:


πŸ›  Database Commands

The rsodx CLI provides simple tools for running Sequel migrations:

πŸ”Ό db:migrate

Runs all pending migrations in db/migrations.

bin/rsodx db:migrate
  • Automatically creates the schema_migrations table if it doesn't exist.
  • Supports timestamped migrations (e.g. 20250417061127_create_users.rb).
  • Prints a success message on completion.

πŸ”½ db:rollback

Rolls back the last executed migration.

bin/rsodx db:rollback
  • Determines the current version from the schema_migrations table.
  • Rolls back to the previous migration based on timestamp.
  • Skips rollback if only one migration is applied.

πŸ”§ 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.rb
  • app/presenters/v1/users/index_presenter.rb
  • app/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-version
  • config.ru, Rakefile, environment loader
  • app/ structure (controllers, services, etc.)
  • bin/console and bin/rsodx CLI 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:

  1. Open your terminal and run the PostgreSQL client:
psql -U postgres
  1. 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 postgres accordingly.


βœ… 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

🐳 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 docs or rsodx docs generate

πŸ›  Developer Experience

  • rsodx console (IRB + app preload)
  • rsodx doctor for 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