RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

subflag-rails — self-hosted feature flags with typed values

I’ve been working on a feature flag/dynamic config gem and just released a self-hosted option. Flags live in your database (ActiveRecord), no external service needed.

Built it because I wanted typed flags (strings, numbers, JSON) without paying for a hosted service or setting up infrastructure. Flipper is boolean-only, and the bigger tools (LaunchDarkly, etc.) felt like overkill for what I needed.

It also has user targeting (show different values to different users based on attributes) and a basic admin UI you can mount at /subflag.

Quick setup:

ruby gem "subflag-rails"

bash rails generate subflag:install --backend=active_record rails db:migrate

ruby # config/routes.rb mount Subflag::Rails::Engine => "/subflag"

Usage:

ruby limit = subflag_value(:max_uploads, default: 10) config = subflag_value(:pricing_tiers, default: { free: 5, pro: 50 })

GitHub: https://github.com/subflag/sdk/tree/main/packages/subflag-rails

Would love any feedback if you try it.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in