Architecture
Architecture
System-level view: how the apps, backend, and external services fit together.
ProjectR is a three-piece system around one Convex backend and one Shopify store. This section documents the load-bearing flows — read Order to Rewards and Webhook Pipeline first; they are where production incidents have historically lived.
The invariants that shape everything
- One Shopify store for all environments. Every deployment that sets
SHOPIFY_WRITES_ALLOWED=1writes to the live store, and the rest refuse Admin API mutations. - The type contract — backend schema changes re-type both apps immediately; deploys are not atomic.
- Rewards basis is the subtotal. Stamp minimum spend is checked after discounts and excludes shipping and tax.
- Aggregates must be maintained — every insert/patch/delete on a tracked table updates its
@convex-dev/aggregatein the same transaction, or dashboard stats silently corrupt. - One notification pipeline — every producer funnels through
enqueueNotification.