Kabk
Kabk carries the Ruby to Simorgh
The framework-agnostic Ruby backend engine designed exclusively to power the Simurgh Panel.
Installation
Add this line to your application's Gemfile:
gem 'kabk'
Usage
This gem manages the metadata registry, schema manifest generation, server-side validation, pagination, and pessimistic/optimistic concurrency control without depending on any specific web framework (like Roda or Rails). It operates entirely on plain Ruby hashes.
Registering a Resource
require 'kabk'
# Assuming you have a Sequel Model
class NewsItem < Sequel::Model; end
Kabk.register(name: 'news_item', table: NewsItem) do
title fa: 'اخبار و اطلاعیهها', en: 'News & Announcements'
icon 'Newspaper'
plural_name 'news'
api_path '/api/admin/news'
field :id, type: :number, form_type: :number, primary_key: true, hidden_in_form: true
field :title, type: :string, form_type: :text, required: true, validation: { min_length: 5 }
field :publish_date, type: :datetime, form_type: :datetime, calendar: :jalali
end
Generic REST Engine
The Kabk::RestEngine class handles CRUD operations, returning raw hashes that your HTTP layer can easily convert to JSON.
engine = Kabk::RestEngine.new('news_item')
# Pagination, Filtering, Sorting, and Hydration are automatic
result = engine.list("page" => 1, "per_page" => 15, "sort" => "-created_at")
# => { success: true, data: [...], meta: { ... } }
# Validation and OCC automatically applied
result = engine.update(1, { "title" => "New Title", "updated_at" => "2026-03-15T11:00:00Z" })
Testing
bundle install
bundle exec rspec