StateSet iCommerce
The SQLite of commerce operations. An embeddable commerce library that runs anywhere with zero external dependencies.
Quick Start
use ;
use dec;
// Initialize with a database file (creates if not exists)
let commerce = new?;
// Create a customer
let customer = commerce.customers.create?;
// Create inventory
commerce.inventory.create_item?;
// Create an order
let order = commerce.orders.create?;
// Adjust inventory
commerce.inventory.adjust?;
# Ok::
Features
- Zero configuration - Just point to a file and go
- Embedded SQLite - No external database server needed (default)
- PostgreSQL support - Scale to production with
postgresfeature - Full commerce stack - Orders, inventory, customers, products, returns
- Sync API - Simple blocking operations
- Async API - True async for PostgreSQL with
AsyncCommerce - Event-driven - Subscribe to commerce events for side effects
Database Backends
SQLite (default)
let commerce = new?;
// or in-memory for testing
let commerce = new?;
PostgreSQL (requires postgres feature)
let commerce = with_postgres?;
// or via builder
let commerce = builder
.postgres
.max_connections
.build?;
Async PostgreSQL API
For true async operations with PostgreSQL, use AsyncCommerce:
use ;
use dec;
async
Architecture
┌─────────────────────────────────────────┐
│ Your Application │
│ ┌───────────────────────────────────┐ │
│ │ Commerce (this crate) │ │
│ │ ┌─────────────────────────────┐ │ │
│ │ │ SQLite or PostgreSQL │ │ │
│ │ └─────────────────────────────┘ │ │
│ └───────────────────────────────────┘ │
└─────────────────────────────────────────┘