Skip to content

Midas

Financial primitives

Turn complexity into clarity.

A Rails engine providing a single source of truth for currency values using a polymorphic Coin ledger.

4K

Downloads

1

GitHub star

v0.5.0

Latest release

7

Releases

Overview

Give every model that handles money a consistent interface, without adding another pair of amount and currency columns to its table. Midas stores values in a shared, polymorphic Coin ledger:

class Product < ApplicationRecord
  include WhittakerTech::Midas::Bankable
  has_coin :price
end

Use the same approach for prices, fees, balances, or several independent values on one record. Midas handles currency-aware amounts and conversion, so money behavior can stay consistent as your application grows.

From monetary values to auditable flows

For everyday model attributes, Coin and Bankable are the core. When billing or payments also need a clear, auditable explanation of how balances changed, Midas adds a double-entry Ledger with balanced, immutable postings. The Ledger complements the simpler value model; it does not replace it. See the documentation for the API and implementation details.

  • Polymorphic Coin ledger

    One Coin model stores every monetary value, for any model.

  • Multi-currency support

    Built on the money gem, with conversion between currencies.

  • Declarative DSL

    has_coin and has_coins attach money to a model in one line.

  • Zero schema duplication

    No more price_cents and currency columns repeated across tables.

  • Headless currency input

    A Stimulus-powered input field that leaves the markup to you.

  • Tested and documented

    90%+ test coverage, full API documentation and an architecture overview.

  • Additive double-entry ledger

    Record balanced, immutable postings when a monetary workflow needs an auditable trail.

Gemfile
gem "whittaker_tech-midas"
Install
bundle install
Install Midas and run the migrations
bin/rails generate whittaker_tech:midas:install
bin/rails db:migrate

Next steps

Read the full documentation for configuration, usage and API guides.

View documentation

  • Product catalogs and configurable pricing
  • Multi-currency applications
  • Invoices, billing, fees and payments
  • Models with multiple independent monetary values
  • Exchange rate fetching
  • Versioned coin histories
  • ViewComponent integrations
  • Billing integration examples (Stripe and LemonSqueezy)

Poly

Rails primitives

Make polymorphism predictable.

1.8K Downloads