StateSet Core
Pure domain models and business logic for commerce operations. This crate has no I/O dependencies - just data structures and validation.
Overview
stateset-core provides the foundational types for the StateSet iCommerce platform:
- Domain Models: Strongly-typed structs for all commerce entities
- Repository Traits: Abstract interfaces for data access
- Error Types: Comprehensive error handling with categorization
- Validation: Composable validation builders and traits
- Events: Domain event types for event-driven architectures
Core Domains
| Domain | Description |
|---|---|
| Orders | Order management with line items, status tracking |
| Inventory | Stock tracking, reservations, adjustments |
| Customers | Customer profiles, addresses, contact info |
| Products | Product catalog with variants, pricing |
| Returns | Return processing, refunds, RMA |
| Manufacturing | Bill of Materials (BOM), Work Orders |
| Shipments | Shipping, tracking, carrier integration |
| Payments | Payment processing, refunds |
| Subscriptions | Recurring billing, subscription plans |
| Promotions | Discounts, coupons, promotional campaigns |
| Tax | Multi-jurisdiction tax calculation |
| Currency | Multi-currency support, exchange rates |
Error Handling
All operations return Result<T, CommerceError>. Errors can be categorized:
use CommerceError;
Validation
Use ValidationBuilder for composable validations:
use ;
Or implement the Validate trait for domain models:
use ;
// Use with method chaining
// let input = OrderInput { ... }.validated()?;
Example
use *;
use dec;
// Create an order input
let order = CreateOrder ;
Feature Flags
embeddings- Enable vector search via embedding servicesmetrics- Enable Prometheus metrics support