1 unstable release
| new 0.7.13 | Feb 27, 2026 |
|---|
#7 in #commerce
2MB
42K
SLoC
StateSet Embedded Commerce for Ruby
Local-first commerce engine for Ruby. Provides a complete commerce API with embedded SQLite storage.
Installation
Add to your Gemfile:
gem 'stateset_embedded'
Or install directly:
gem install stateset_embedded
Requirements
- Ruby 3.0+
- Rust toolchain (for building from source)
Quick Start
require 'stateset_embedded'
# Create commerce instance (uses SQLite)
commerce = StateSet::Commerce.new('commerce.db')
# Or use in-memory database
commerce = StateSet::Commerce.new(':memory:')
# Create a customer
customer = commerce.customers.create(
email: 'john@example.com',
first_name: 'John',
last_name: 'Doe'
)
# Create a product
product = commerce.products.create(
name: 'Widget Pro',
description: 'The best widget ever'
)
# Create an order
order = commerce.orders.create(
customer_id: customer.id,
items: [
{ sku: 'WIDGET-001', name: 'Widget Pro', quantity: 2, unit_price: 29.99 }
]
)
# Process the order
commerce.orders.confirm(order.id)
commerce.orders.ship(order.id, tracking_number: '1Z999AA10123456784')
commerce.orders.deliver(order.id)
Available APIs
| API | Description |
|---|---|
customers |
Customer management |
orders |
Order processing |
products |
Product catalog |
inventory |
Stock management |
returns |
Return requests |
payments |
Payment recording |
carts |
Shopping carts |
analytics |
Sales reports |
shipments |
Shipment tracking |
warranties |
Warranty management |
purchase_orders |
Supplier orders |
invoices |
Invoice management |
bom |
Bills of materials |
work_orders |
Manufacturing |
currency |
Currency conversion |
subscriptions |
Recurring billing |
promotions |
Discount codes |
tax |
Tax calculations |
Building from Source
cd bindings/ruby
bundle install
bundle exec rake compile
Running Tests
bundle exec rake spec
Publishing
# Build native gems for all platforms
bundle exec rake native gem
# Or use rb-sys-dock for cross-compilation
rb-sys-dock --platform x86_64-linux -- bundle exec rake native gem
# Publish to RubyGems
gem push pkg/stateset_embedded-*.gem
License
MIT
Dependencies
~20–28MB
~442K SLoC