How ali00209/loyaltypointssaas works
This is a multi-tenant loyalty and rewards platform: business operators configure programs and manage customers, products, and rules; customer or POS events earn points, which can later be redeemed, while dashboards and billing support ongoing operations. The clearest sampled runtime path is event submission through principal resolution, validation, customer lookup, and points application. The repository also contains customer portals, analytics, and platform billing/admin areas; their implementation paths are visible in the tree, but their internal wiring was not sampled.
Main entry points: index.ts PostgreSQL database · api-guard.ts Identity and access · rules.ts Event catalog and rules · route.ts Redemption rules
Components 25
Business operations
- Program dashboard
src/components/AppLedgerPage.tsx - Products and customers
src/app/api - Rule editor
src/components/ConditionSentenceEditor.tsx - Rule management
src/app/api/rules/route.ts - Redemption rules
src/app/api/redemption-rules/route.ts - Program analytics
src/app/api/analytics/route.ts
Loyalty engine
- Loyalty event intake
src/app/api/events/route.ts - Event catalog and rules
src/lib/rules.ts - Points processing
src/lib/points.ts - Redemption processing
src/lib/redemption.ts - Rule construction
src/lib/rule-builder.ts - Rule descriptions
src/lib/ruleSentence.ts
Customer experience
- Customer portal
src/app/p/[slug] - Customer services
src/app/api/customer
Platform services
- Subscriptions and invoices
src/app/api/billing - Platform administration
src/app/api/admin - Web API client
src/lib/api/client.ts - Web API modules
src/lib/api - Identity and access
src/lib/api-guard.ts - Authentication
src/lib/auth.ts - Client query hooks
src/lib/query/hooks.ts - Query exports
src/lib/query/index.ts
Persistence
- PostgreSQL database
src/db/index.ts - Domain schema
src/db/schema.ts
Other components
- Program operator
Connections 29
- Program operator → Program dashboard: uses
- Program dashboard → Web API modules: requests data
src/components/AppLedgerPage.tsx - Program dashboard → Query exports: uses hooks
src/components/AppLedgerPage.tsx - Rule editor → Rule descriptions: renders rules
src/components/ConditionSentenceEditor.tsx - Rule management → Identity and access: checks access
src/app/api/rules/route.ts - Rule management → Rule construction: uses
src/app/api/rules/route.ts - Rule management → Event catalog and rules: uses
src/app/api/rules/route.ts - Redemption rules → Identity and access: checks access
src/app/api/redemption-rules/route.ts - Redemption rules → Redemption processing: validates rules
src/app/api/redemption-rules/route.ts - Redemption rules → PostgreSQL database: reads and writes
src/app/api/redemption-rules/route.ts - Redemption rules → Domain schema: uses tables
src/app/api/redemption-rules/route.ts - Loyalty event intake → Identity and access: resolves principal
src/app/api/events/route.ts - Loyalty event intake → Event catalog and rules: checks event
src/app/api/events/route.ts - Loyalty event intake → Points processing: applies event
src/app/api/events/route.ts - Loyalty event intake → PostgreSQL database: looks up customer
src/app/api/events/route.ts - Points processing → Event catalog and rules: evaluates rules
src/lib/points.ts - Points processing → PostgreSQL database: records points
src/lib/points.ts - Points processing → Domain schema: uses tables
src/lib/points.ts - Rule construction → Event catalog and rules: uses
src/lib/rule-builder.ts - Customer portal → Customer services: loads portal data
- Program analytics → Identity and access: checks access
src/app/api/analytics/route.ts - Program analytics → PostgreSQL database: queries data
src/app/api/analytics/route.ts - Web API modules → Web API client: uses client
src/lib/api/index.ts - Web API client → Customer services: sends HTTP requests
- Query exports → Client query hooks: exports hooks
src/lib/query/index.ts - Identity and access → Authentication: resolves identity
src/lib/api-guard.ts - Authentication → PostgreSQL database: reads identity records
src/lib/auth.ts - PostgreSQL database → Domain schema: configures ORM
src/db/index.ts - Domain schema → Event catalog and rules: uses rule types
src/db/schema.ts