1. Multi-Tenant Database Isolation
Our Rust API server verifies the workspace context of every authenticated request against the database session token. Client-provided workspace identifiers are never blindly trusted.
PostgreSQL foreign keys and composite unique constraints guarantee that records (orders, appointments, shifts, inventory) strictly reference the verified workspace.
2. Immutable Financial Ledgers & Math
To prevent floating-point calculation errors common in web applications, BeeTable calculates subtotals, line items, and change due using exact integer mathematics.
When a sale or shift is closed, price snapshots are stored immutably. Even if a product price changes tomorrow, historical receipts preserve the exact price at the moment of sale.
Database triggers (such as `commerce_ledger_immutable`) reject unauthorized UPDATE or DELETE commands on financial events.
3. Idempotent Commands & Operational Recovery
All critical catalog, stock, and booking actions utilize idempotent command tokens stored in `record_commands`. If a network timeout occurs and the request is safely retried, the server returns the cached result without duplicate billing or double-decrementing stock.
Salon appointments enforce database-level conflict locks to guarantee that no stylist or chair can be double-booked across simultaneous browser tabs.
4. Sequential Receipt Identity & Printing
Every completed order is assigned a sequential receipt number (e.g., `BT-00000001`) via atomic database sequences (`workspace_document_sequences`).
Receipts include an immutable business snapshot (store name, city, tax details at time of print). Print and reprint events are logged in `receipt_events` for audit transparency.
5. Least-Privilege Runtime Roles
The production API connects to PostgreSQL using a dedicated non-owner role (`beetable_runtime`) that lacks DDL, table creation, or superuser permissions.
Database migrations (schema upgrades) are executed solely during explicit CI/CD deployment jobs via an isolated administrative account (`beetable_user`).
6. Cloud Infrastructure & Backups
Web and API services run in hardened Docker containers behind Caddy reverse proxy with automated TLS certificate management and HTTP/2 + HTTP/3 support.
Automated daily database dumps are created, verified for restore integrity, and synced to private Amazon S3 buckets.