Skip to main content

SalesArck Documentation

This documentation reflects the code that exists today in salesarck-monorepo.

What is SalesArck?

SalesArck is a multi-tenant loyalty platform with three current runtime apps:

  • apps/api for the Hono backend and scheduled jobs
  • apps/web for the React portal used by consumers, merchants, POS operators, and admins
  • apps/workers as a scaffold for future background processing

The shared packages carry the actual domain logic: auth helpers, tenant resolution, RBAC, reward calculation, observability, and the Drizzle schema.


Start Here​


Current Stack​

PropertyValue
Primary StackNode.js 20, TypeScript, Hono, React 18, Vite, Supabase, Drizzle
POS ProvidersSquare and Clover
AuthSupabase JWTs and OTP sign-in
Tenant ModelServer-derived tenant membership and URL-scoped tenant access
RewardsVersioned reward rules with append-only ledger records
DeploymentRender for API, Cloudflare Pages for web
Background WorkIn-process async webhook handling plus cron endpoints

Roles​

Consumer ─── Earns and redeems points across merchant wallets
Client ─── Merchant operator: configures rules, views analytics, manages POS
Admin ─── SalesArck platform operator: global access, fraud controls, support

Core Guardrails​

Security rules that must never be broken
  1. Tenant identity is resolved server-side from JWT claims and URL tenant IDs.
  2. Write paths that touch payment or reward state are protected by idempotency or DB uniqueness.
  3. Wallet ledger history is append-only.
  4. Admin actions write immutable audit logs.
  5. Tenant-scoped queries must filter by tenant_id.

Developer Summary​

The implementation treats POS as an input source, not the system of record. The API owns tenant resolution, reward calculation, wallet mutation, and auditability. The frontend mostly renders data already shaped by the backend, and the shared packages hold the actual domain rules.

Written byDhruv Doshi