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:
Or install directly:
Requirements
- Ruby 3.0+
- Rust toolchain (for building from source)
Quick Start
# Create commerce instance (uses SQLite)
commerce = StateSet::Commerce.new()
# Or use in-memory database
commerce = StateSet::Commerce.new()
# Create a customer
customer = commerce.customers.create(
email: ,
first_name: ,
last_name:
)
# Create a product
product = commerce.products.create(
name: ,
description:
)
# Create an order
order = commerce.orders.create(
customer_id: customer.id,
items: [
{ sku: , name: , quantity: 2, unit_price: 29.99 }
]
)
# Process the order
commerce.orders.confirm(order.id)
commerce.orders.ship(order.id, tracking_number: )
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
Running Tests
Publishing
# Build native gems for all platforms
# Or use rb-sys-dock for cross-compilation
# Publish to RubyGems
License
MIT