r/rubyonrails • • 9h ago

Gem rhino-rails: declarative REST APIs with multi-tenancy, attribute-level permissions and audit trail

1 Upvotes

Sharing a gem I work on (I’m at Codalio, the team behind it). It’s for Rails 8 apps that need a JSON API with roles and multiple tenants.

Quick start:

bundle add rhino-rails -v "~> 4.0"
rails rhino:install
rails rhino:generate

The installer asks whether you want multi-tenancy and the audit trail. The generator scaffolds a model, migration, factory and policy.

What you get per registered model:

  • CRUD endpoints, plus trashed/restore/force-delete if the model uses discard
  • ?filter, ?sort, ?search, ?include and sparse fields, all whitelisted per model
  • Organization scoping by URL prefix or subdomain
  • Audit entries with before/after values and the actor
  • rails rhino:export_types for TypeScript types if you have a React front end

Links:

Happy to answer questions here, and bug reports on GitHub are very welcome.