TorbatYar/frontend/docs/loyalty-frontend-architecture.md
Mortezakoohjani d579d0b142 feat(loyalty): add Loyalty Platform Frontend module
Add frontend/modules/loyalty with types, API client, design system, feature pages and thin App Router routes under app/loyalty/. BFF proxy at app/api/loyalty/. Include loyalty frontend docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 10:50:55 +03:30

30 lines
1.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Loyalty Frontend Architecture
**Status:** Production scaffold — connected to Loyalty service 7.07.6
**Package:** `frontend/modules/loyalty/`
**Routes:** `frontend/app/loyalty/` (thin App Router only)
**BFF:** `frontend/app/api/loyalty/[...path]``:8004`
## Layers
1. **App Router**`page.tsx` / `layout.tsx` / `loading.tsx` / `error.tsx` / `not-found.tsx` only
2. **Module package** — features, components, services, design-system, constants
3. **Shared DS**`@/components/ds` + module tokens `--loyalty-*`
4. **BFF** — same-origin proxy with `Authorization` + `X-Tenant-ID`
## Portal
Single portal `engage` under `/loyalty/engage/*` with shell navigation. Hub at `/loyalty/hub`.
## API client
`loyaltyApi` in `modules/loyalty/services/loyalty-api.ts` covers programs, tiers, members (+lifecycle), point accounts (+ledger ops), rewards/redemptions, campaigns (+lifecycle), referrals, wallets, audit, health.
## Query keys
`["loyalty", tenantId, resource, ...]`
## Out-of-scope honesty
Screens without backend APIs (gift cards 7.7, gamification entities, segments, partners, branches, API keys) use `LoyaltyScopeNotice` — no fake CRUD.