docs: migrate module documentation to single source of truth
Move 39 documentation files from top-level docs/ into each module's docs/ folder, accessible via symlinks from docs/modules/. Create data-model.md files for 10 modules with full schema documentation. Replace originals with redirect stubs. Remove empty guide stubs. Modules migrated: tenancy, billing, loyalty, marketplace, orders, messaging, cms, catalog, inventory, hosting, prospecting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,670 +1,3 @@
|
||||
# Loyalty Module Phase 2: Admin & Store Interfaces
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This document outlines the plan for building admin and store interfaces for the Loyalty Module, along with detailed user journeys for stamp-based and points-based loyalty programs. The design follows market best practices from leading loyalty platforms (Square Loyalty, Toast, Fivestars, Belly, Punchh).
|
||||
|
||||
---
|
||||
|
||||
## Part 1: Interface Design
|
||||
|
||||
### 1.1 Store Dashboard (Retail Store)
|
||||
|
||||
#### Main Loyalty Dashboard (`/store/loyalty`)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 🎯 Loyalty Program [Setup] │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────┐│
|
||||
│ │ 1,247 │ │ 892 │ │ 156 │ │ €2.3k ││
|
||||
│ │ Members │ │ Active │ │ Redeemed │ │ Saved ││
|
||||
│ │ Total │ │ 30 days │ │ This Month │ │ Value ││
|
||||
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────┘│
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────────────────┐│
|
||||
│ │ 📊 Activity Chart (Last 30 Days) ││
|
||||
│ │ [Stamps Issued] [Rewards Redeemed] [New Members] ││
|
||||
│ │ ═══════════════════════════════════════════════ ││
|
||||
│ └─────────────────────────────────────────────────────────────┘│
|
||||
│ │
|
||||
│ ┌─────────────────────────┐ ┌─────────────────────────────┐ │
|
||||
│ │ 🔥 Quick Actions │ │ 📋 Recent Activity │ │
|
||||
│ │ │ │ │ │
|
||||
│ │ [➕ Add Stamp] │ │ • John D. earned stamp #8 │ │
|
||||
│ │ [🎁 Redeem Reward] │ │ • Marie L. redeemed reward │ │
|
||||
│ │ [👤 Enroll Customer] │ │ • Alex K. joined program │ │
|
||||
│ │ [🔍 Look Up Card] │ │ • Sarah M. earned 50 pts │ │
|
||||
│ │ │ │ │ │
|
||||
│ └─────────────────────────┘ └─────────────────────────────┘ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### Stamp/Points Terminal (`/store/loyalty/terminal`)
|
||||
|
||||
**Primary interface for daily operations - optimized for tablet/touchscreen:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 🎯 Loyalty Terminal │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌───────────────────────────────────────────────────┐ │
|
||||
│ │ │ │
|
||||
│ │ 📷 SCAN QR CODE │ │
|
||||
│ │ │ │
|
||||
│ │ [Camera Viewfinder Area] │ │
|
||||
│ │ │ │
|
||||
│ │ or enter card number │ │
|
||||
│ │ ┌─────────────────────────┐ │ │
|
||||
│ │ │ Card Number... │ │ │
|
||||
│ │ └─────────────────────────┘ │ │
|
||||
│ └───────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ [Use Camera] [Enter Manually] [Recent Cards ▼] │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**After scanning - Customer Card View:**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ ← Back Customer Card │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────┐ │
|
||||
│ │ 👤 Marie Laurent │ │
|
||||
│ │ marie.laurent@email.com │ │
|
||||
│ │ Member since: Jan 2024 │ │
|
||||
│ └─────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────┐ │
|
||||
│ │ │ │
|
||||
│ │ ☕ ☕ ☕ ☕ ☕ ☕ ☕ ☕ ○ ○ │ │
|
||||
│ │ │ │
|
||||
│ │ 8 / 10 stamps │ │
|
||||
│ │ 2 more until FREE COFFEE │ │
|
||||
│ │ │ │
|
||||
│ └─────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────┐ │
|
||||
│ │ │ │
|
||||
│ │ [ ➕ ADD STAMP ] [ 🎁 REDEEM ] │ │
|
||||
│ │ │ │
|
||||
│ └─────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ⚠️ Next stamp available in 12 minutes │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**PIN Entry Modal (appears when adding stamp):**
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ Enter Staff PIN │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────────┐ │
|
||||
│ │ ● ● ● ● │ │
|
||||
│ └─────────────────┘ │
|
||||
│ │
|
||||
│ ┌─────┐ ┌─────┐ ┌─────┐ │
|
||||
│ │ 1 │ │ 2 │ │ 3 │ │
|
||||
│ └─────┘ └─────┘ └─────┘ │
|
||||
│ ┌─────┐ ┌─────┐ ┌─────┐ │
|
||||
│ │ 4 │ │ 5 │ │ 6 │ │
|
||||
│ └─────┘ └─────┘ └─────┘ │
|
||||
│ ┌─────┐ ┌─────┐ ┌─────┐ │
|
||||
│ │ 7 │ │ 8 │ │ 9 │ │
|
||||
│ └─────┘ └─────┘ └─────┘ │
|
||||
│ ┌─────┐ ┌─────┐ ┌─────┐ │
|
||||
│ │ ⌫ │ │ 0 │ │ ✓ │ │
|
||||
│ └─────┘ └─────┘ └─────┘ │
|
||||
│ │
|
||||
│ [Cancel] │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### Program Setup (`/store/loyalty/settings`)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ ⚙️ Loyalty Program Settings │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Program Type │
|
||||
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
||||
│ │ ☑️ Stamps │ │ ☐ Points │ │ ☐ Hybrid │ │
|
||||
│ │ Buy 10 Get 1 │ │ Earn per € │ │ Both systems │ │
|
||||
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
|
||||
│ │
|
||||
│ ───────────────────────────────────────────────────────────── │
|
||||
│ │
|
||||
│ Stamp Configuration │
|
||||
│ ┌─────────────────────────────────────────────────────────┐ │
|
||||
│ │ Stamps needed for reward: [ 10 ▼ ] │ │
|
||||
│ │ Reward description: [ Free coffee of choice ] │ │
|
||||
│ │ Reward value (optional): [ €4.50 ] │ │
|
||||
│ └─────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ───────────────────────────────────────────────────────────── │
|
||||
│ │
|
||||
│ 🛡️ Fraud Prevention │
|
||||
│ ┌─────────────────────────────────────────────────────────┐ │
|
||||
│ │ ☑️ Require staff PIN for operations │ │
|
||||
│ │ Cooldown between stamps: [ 15 ] minutes │ │
|
||||
│ │ Max stamps per day: [ 5 ] │ │
|
||||
│ └─────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ───────────────────────────────────────────────────────────── │
|
||||
│ │
|
||||
│ 🎨 Card Branding │
|
||||
│ ┌─────────────────────────────────────────────────────────┐ │
|
||||
│ │ Card name: [ Café Loyalty Card ] │ │
|
||||
│ │ Primary color: [████] #4F46E5 │ │
|
||||
│ │ Logo: [Upload] cafe-logo.png ✓ │ │
|
||||
│ │ │ │
|
||||
│ │ Preview: ┌────────────────────┐ │ │
|
||||
│ │ │ ☕ Café Loyalty │ │ │
|
||||
│ │ │ ████████░░ │ │ │
|
||||
│ │ │ 8/10 stamps │ │ │
|
||||
│ │ └────────────────────┘ │ │
|
||||
│ └─────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ [Cancel] [Save Changes] │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### Staff PIN Management (`/store/loyalty/pins`)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 🔐 Staff PINs [+ Add PIN] │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────────────┐ │
|
||||
│ │ 👤 Marie (Manager) [Edit] [🗑️] │ │
|
||||
│ │ Last used: Today, 14:32 │ │
|
||||
│ │ Status: ✅ Active │ │
|
||||
│ ├─────────────────────────────────────────────────────────┤ │
|
||||
│ │ 👤 Thomas (Staff) [Edit] [🗑️] │ │
|
||||
│ │ Last used: Today, 11:15 │ │
|
||||
│ │ Status: ✅ Active │ │
|
||||
│ ├─────────────────────────────────────────────────────────┤ │
|
||||
│ │ 👤 Julie (Staff) [Edit] [🗑️] │ │
|
||||
│ │ Last used: Yesterday │ │
|
||||
│ │ Status: 🔒 Locked (3 failed attempts) [Unlock] │ │
|
||||
│ └─────────────────────────────────────────────────────────┘ │
|
||||
│ │
|
||||
│ ℹ️ Staff PINs prevent unauthorized stamp/point operations. │
|
||||
│ PINs are locked after 5 failed attempts for 30 minutes. │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
#### Customer Cards List (`/store/loyalty/cards`)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 👥 Loyalty Members 🔍 [Search...] [Export]│
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ Filter: [All ▼] [Active ▼] [Has Reward Ready ▼] │
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────────────────┐│
|
||||
│ │ Customer │ Card # │ Stamps │ Last Visit │ ⋮ ││
|
||||
│ ├───────────────────┼──────────────┼────────┼────────────┼────┤│
|
||||
│ │ Marie Laurent │ 4821-7493 │ 8/10 ⭐│ Today │ ⋮ ││
|
||||
│ │ Jean Dupont │ 4821-2847 │ 10/10 🎁│ Yesterday │ ⋮ ││
|
||||
│ │ Sophie Martin │ 4821-9382 │ 3/10 │ 3 days ago │ ⋮ ││
|
||||
│ │ Pierre Bernard │ 4821-1029 │ 6/10 │ 1 week ago │ ⋮ ││
|
||||
│ │ ... │ ... │ ... │ ... │ ⋮ ││
|
||||
│ └─────────────────────────────────────────────────────────────┘│
|
||||
│ │
|
||||
│ Showing 1-20 of 1,247 members [← Prev] [1] [2] [Next →]│
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 1.2 Admin Dashboard (Platform)
|
||||
|
||||
#### Platform Loyalty Overview (`/admin/loyalty`)
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ 🎯 Loyalty Programs Platform │
|
||||
├─────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────┐│
|
||||
│ │ 47 │ │ 38 │ │ 12,847 │ │ €47k ││
|
||||
│ │ Programs │ │ Active │ │ Members │ │ Saved ││
|
||||
│ │ Total │ │ Programs │ │ Total │ │ Value ││
|
||||
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────┘│
|
||||
│ │
|
||||
│ Programs by Type: │
|
||||
│ ═══════════════════════════════════════ │
|
||||
│ Stamps: ████████████████████ 32 (68%) │
|
||||
│ Points: ███████ 11 (23%) │
|
||||
│ Hybrid: ████ 4 (9%) │
|
||||
│ │
|
||||
│ ┌─────────────────────────────────────────────────────────────┐│
|
||||
│ │ Store │ Type │ Members │ Activity │ Status ││
|
||||
│ ├───────────────────┼─────────┼─────────┼──────────┼──────────┤│
|
||||
│ │ Café du Coin │ Stamps │ 1,247 │ High │ ✅ Active││
|
||||
│ │ Boulangerie Paul │ Points │ 892 │ Medium │ ✅ Active││
|
||||
│ │ Pizza Roma │ Stamps │ 456 │ Low │ ⚠️ Setup ││
|
||||
│ │ ... │ ... │ ... │ ... │ ... ││
|
||||
│ └─────────────────────────────────────────────────────────────┘│
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Part 2: User Journeys
|
||||
|
||||
### 2.1 Stamp-Based Loyalty Journey
|
||||
|
||||
#### Customer Journey: Enrollment
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ STAMP LOYALTY - ENROLLMENT │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
|
||||
│ DISCOVER│────▶│ JOIN │────▶│ SAVE │────▶│ USE │
|
||||
└─────────┘ └─────────┘ └─────────┘ └─────────┘
|
||||
│ │ │ │
|
||||
▼ ▼ ▼ ▼
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ 1. Customer sees │ 2. Scans QR at │ 3. Card added │ 4. Ready to │
|
||||
│ sign at counter│ register or │ to Google/ │ collect │
|
||||
│ "Join our │ gives email │ Apple Wallet│ stamps! │
|
||||
│ loyalty!" │ to cashier │ │ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Detailed Steps:**
|
||||
|
||||
1. **Discovery** (In-Store)
|
||||
- Customer sees loyalty program signage/tent card
|
||||
- QR code displayed at counter
|
||||
- Staff mentions program during checkout
|
||||
|
||||
2. **Sign Up** (30 seconds)
|
||||
- Customer scans QR code with phone
|
||||
- Lands on mobile enrollment page
|
||||
- Enters: Email (required), Name (optional)
|
||||
- Accepts terms with checkbox
|
||||
- Submits
|
||||
|
||||
3. **Card Creation** (Instant)
|
||||
- System creates loyalty card
|
||||
- Generates unique card number & QR code
|
||||
- Shows "Add to Wallet" buttons
|
||||
- Sends welcome email with card link
|
||||
|
||||
4. **Wallet Save** (Optional but encouraged)
|
||||
- Customer taps "Add to Google Wallet" or "Add to Apple Wallet"
|
||||
- Pass appears in their wallet app
|
||||
- Always accessible, works offline
|
||||
|
||||
#### Customer Journey: Earning Stamps
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ STAMP LOYALTY - EARNING │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Customer Staff System Wallet
|
||||
│ │ │ │
|
||||
│ 1. Makes │ │ │
|
||||
│ purchase │ │ │
|
||||
│───────────────▶│ │ │
|
||||
│ │ │ │
|
||||
│ 2. Shows │ │ │
|
||||
│ loyalty card │ │ │
|
||||
│───────────────▶│ │ │
|
||||
│ │ 3. Scans QR │ │
|
||||
│ │─────────────────▶│ │
|
||||
│ │ │ │
|
||||
│ │ 4. Enters PIN │ │
|
||||
│ │─────────────────▶│ │
|
||||
│ │ │ │
|
||||
│ │ 5. Confirms │ │
|
||||
│ │◀─────────────────│ │
|
||||
│ │ "Stamp added!" │ │
|
||||
│ │ │ │
|
||||
│ 6. Verbal │ │ 7. Push │
|
||||
│ confirmation │ │ notification │
|
||||
│◀───────────────│ │────────────────▶│
|
||||
│ │ │ │
|
||||
│ │ 8. Pass updates│
|
||||
│◀───────────────────────────────────│────────────────▶│
|
||||
│ "8/10 stamps" │ │
|
||||
```
|
||||
|
||||
**Anti-Fraud Checks (Automatic):**
|
||||
|
||||
1. ✅ Card is active
|
||||
2. ✅ Program is active
|
||||
3. ✅ Staff PIN is valid
|
||||
4. ✅ Cooldown period elapsed (15 min since last stamp)
|
||||
5. ✅ Daily limit not reached (max 5/day)
|
||||
|
||||
**Success Response:**
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"stamp_count": 8,
|
||||
"stamps_target": 10,
|
||||
"stamps_until_reward": 2,
|
||||
"message": "2 more stamps until your free coffee!",
|
||||
"next_stamp_available": "2024-01-28T15:30:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### Customer Journey: Redeeming Reward
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ STAMP LOYALTY - REDEMPTION │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Customer Staff System
|
||||
│ │ │
|
||||
│ 1. "I'd like │ │
|
||||
│ to redeem my │ │
|
||||
│ free coffee" │ │
|
||||
│───────────────▶│ │
|
||||
│ │ │
|
||||
│ 2. Shows card │ │
|
||||
│ (10/10 stamps)│ │
|
||||
│───────────────▶│ │
|
||||
│ │ 3. Scans + sees │
|
||||
│ │ "REWARD READY" │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 4. Clicks │
|
||||
│ │ [REDEEM REWARD] │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 5. Enters PIN │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 6. Confirms │
|
||||
│ │◀─────────────────│
|
||||
│ │ "Reward redeemed"│
|
||||
│ │ Stamps reset: 0 │
|
||||
│ │ │
|
||||
│ 7. Gives free │ │
|
||||
│ coffee │ │
|
||||
│◀───────────────│ │
|
||||
│ │ │
|
||||
│ 🎉 HAPPY │ │
|
||||
│ CUSTOMER! │ │
|
||||
```
|
||||
|
||||
### 2.2 Points-Based Loyalty Journey
|
||||
|
||||
#### Customer Journey: Earning Points
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ POINTS LOYALTY - EARNING │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Customer Staff System
|
||||
│ │ │
|
||||
│ 1. Purchases │ │
|
||||
│ €25.00 order │ │
|
||||
│───────────────▶│ │
|
||||
│ │ │
|
||||
│ 2. Shows │ │
|
||||
│ loyalty card │ │
|
||||
│───────────────▶│ │
|
||||
│ │ 3. Scans card │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 4. Enters amount │
|
||||
│ │ €25.00 │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 5. Enters PIN │
|
||||
│ │─────────────────▶│
|
||||
│ │ │ ┌──────────┐
|
||||
│ │ │ │Calculate:│
|
||||
│ │ │ │€25 × 10 │
|
||||
│ │ │ │= 250 pts │
|
||||
│ │ │ └──────────┘
|
||||
│ │ 6. Confirms │
|
||||
│ │◀─────────────────│
|
||||
│ │ "+250 points!" │
|
||||
│ │ │
|
||||
│ 7. Receipt │ │
|
||||
│ shows points │ │
|
||||
│◀───────────────│ │
|
||||
```
|
||||
|
||||
**Points Calculation:**
|
||||
```
|
||||
Purchase: €25.00
|
||||
Rate: 10 points per euro
|
||||
Points Earned: 250 points
|
||||
New Balance: 750 points
|
||||
```
|
||||
|
||||
#### Customer Journey: Redeeming Points
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ POINTS LOYALTY - REDEMPTION │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Customer Staff System
|
||||
│ │ │
|
||||
│ 1. Views │ │
|
||||
│ rewards in │ │
|
||||
│ wallet app │ │
|
||||
│ │ │ │
|
||||
│ ▼ │ │
|
||||
│ ┌──────────┐ │ │
|
||||
│ │ REWARDS │ │ │
|
||||
│ │──────────│ │ │
|
||||
│ │ 500 pts │ │ │
|
||||
│ │ Free │ │ │
|
||||
│ │ Drink │ │ │
|
||||
│ │──────────│ │ │
|
||||
│ │ 1000 pts │ │ │
|
||||
│ │ Free │ │ │
|
||||
│ │ Meal │ │ │
|
||||
│ └──────────┘ │ │
|
||||
│ │ │
|
||||
│ 2. "I want to │ │
|
||||
│ redeem for │ │
|
||||
│ free drink" │ │
|
||||
│───────────────▶│ │
|
||||
│ │ 3. Scans card │
|
||||
│ │ Selects reward │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 4. Enters PIN │
|
||||
│ │─────────────────▶│
|
||||
│ │ │
|
||||
│ │ 5. Confirms │
|
||||
│ │◀─────────────────│
|
||||
│ │ "-500 points" │
|
||||
│ │ Balance: 250 pts │
|
||||
│ │ │
|
||||
│ 6. Gets free │ │
|
||||
│ drink │ │
|
||||
│◀───────────────│ │
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Part 3: Market Best Practices
|
||||
|
||||
### 3.1 Competitive Analysis
|
||||
|
||||
| Feature | Square Loyalty | Toast | Fivestars | **Orion** |
|
||||
|---------|---------------|-------|-----------|--------------|
|
||||
| Stamp cards | ✅ | ✅ | ✅ | ✅ |
|
||||
| Points system | ✅ | ✅ | ✅ | ✅ |
|
||||
| Google Wallet | ✅ | ❌ | ✅ | ✅ |
|
||||
| Apple Wallet | ✅ | ✅ | ✅ | ✅ |
|
||||
| Staff PIN | ❌ | ✅ | ✅ | ✅ |
|
||||
| Cooldown fraud protection | ❌ | ❌ | ✅ | ✅ |
|
||||
| Daily limits | ❌ | ❌ | ✅ | ✅ |
|
||||
| Tablet terminal | ✅ | ✅ | ✅ | ✅ (planned) |
|
||||
| Customer app | ✅ | ✅ | ✅ | Via Wallet |
|
||||
| Analytics dashboard | ✅ | ✅ | ✅ | ✅ |
|
||||
|
||||
### 3.2 Best Practices to Implement
|
||||
|
||||
#### UX Best Practices
|
||||
|
||||
1. **Instant gratification** - Show stamp/points immediately after transaction
|
||||
2. **Progress visualization** - Clear progress bars/stamp grids
|
||||
3. **Reward proximity** - "Only 2 more until your free coffee!"
|
||||
4. **Wallet-first** - Push customers to save to wallet
|
||||
5. **Offline support** - Card works even without internet (via wallet)
|
||||
|
||||
#### Fraud Prevention Best Practices
|
||||
|
||||
1. **Multi-layer security** - PIN + cooldown + daily limits
|
||||
2. **Staff accountability** - Every transaction tied to a staff PIN
|
||||
3. **Audit trail** - Complete history with IP/device info
|
||||
4. **Lockout protection** - Automatic PIN lockout after failures
|
||||
5. **Admin oversight** - Unlock and PIN management in dashboard
|
||||
|
||||
#### Engagement Best Practices
|
||||
|
||||
1. **Welcome bonus** - Give 1 stamp on enrollment (configurable)
|
||||
2. **Birthday rewards** - Extra stamps/points on customer birthday
|
||||
3. **Milestone notifications** - "Congrats! 50 stamps earned lifetime!"
|
||||
4. **Re-engagement** - Remind inactive customers via email
|
||||
5. **Double points days** - Promotional multipliers (future)
|
||||
|
||||
---
|
||||
|
||||
## Part 4: Implementation Roadmap
|
||||
|
||||
### Phase 2A: Store Interface (Priority)
|
||||
|
||||
| Task | Effort | Priority |
|
||||
|------|--------|----------|
|
||||
| Loyalty terminal (scan/stamp/redeem) | 3 days | P0 |
|
||||
| Program setup wizard | 2 days | P0 |
|
||||
| Staff PIN management | 1 day | P0 |
|
||||
| Customer cards list | 1 day | P1 |
|
||||
| Dashboard with stats | 2 days | P1 |
|
||||
| Export functionality | 1 day | P2 |
|
||||
|
||||
### Phase 2B: Admin Interface
|
||||
|
||||
| Task | Effort | Priority |
|
||||
|------|--------|----------|
|
||||
| Programs list view | 1 day | P1 |
|
||||
| Platform-wide stats | 1 day | P1 |
|
||||
| Program detail view | 0.5 day | P2 |
|
||||
|
||||
### Phase 2C: Customer Experience
|
||||
|
||||
| Task | Effort | Priority |
|
||||
|------|--------|----------|
|
||||
| Enrollment page (mobile) | 1 day | P0 |
|
||||
| Card detail page | 0.5 day | P1 |
|
||||
| Wallet pass polish | 1 day | P1 |
|
||||
| Email templates | 1 day | P2 |
|
||||
|
||||
### Phase 2D: Polish & Advanced
|
||||
|
||||
| Task | Effort | Priority |
|
||||
|------|--------|----------|
|
||||
| QR code scanner (JS) | 2 days | P0 |
|
||||
| Real-time updates (WebSocket) | 1 day | P2 |
|
||||
| Receipt printing | 1 day | P3 |
|
||||
| POS integration hooks | 2 days | P3 |
|
||||
|
||||
---
|
||||
|
||||
## Part 5: Technical Specifications
|
||||
|
||||
### Store Terminal Requirements
|
||||
|
||||
- **Responsive**: Works on tablet (primary), desktop, mobile
|
||||
- **Touch-friendly**: Large buttons, numpad for PIN
|
||||
- **Camera access**: For QR code scanning (WebRTC)
|
||||
- **Offline-capable**: Queue operations if network down (future)
|
||||
- **Real-time**: WebSocket for instant updates
|
||||
|
||||
### Frontend Stack
|
||||
|
||||
- **Framework**: React/Vue components (match existing stack)
|
||||
- **QR Scanner**: `html5-qrcode` or `@aspect-sdk/barcode-reader`
|
||||
- **Charts**: Existing charting library (Chart.js or similar)
|
||||
- **Animations**: CSS transitions for stamp animations
|
||||
|
||||
### API Considerations
|
||||
|
||||
- All store endpoints require `store_id` from auth token
|
||||
- Staff PIN passed in request body, not headers
|
||||
- Rate limiting on lookup/scan endpoints
|
||||
- Pagination on card list (default 50)
|
||||
|
||||
---
|
||||
|
||||
## Appendix: Mockup Reference Images
|
||||
|
||||
### Stamp Card Visual (Wallet Pass)
|
||||
|
||||
```
|
||||
┌────────────────────────────────────┐
|
||||
│ ☕ Café du Coin │
|
||||
│ │
|
||||
│ ████ ████ ████ ████ ████ │
|
||||
│ ████ ████ ████ ░░░░ ░░░░ │
|
||||
│ │
|
||||
│ 8/10 STAMPS │
|
||||
│ 2 more until FREE COFFEE │
|
||||
│ │
|
||||
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
|
||||
│ ▓▓▓▓▓▓▓▓ QR CODE ▓▓▓▓▓▓▓▓ │
|
||||
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
|
||||
│ │
|
||||
│ Card #4821-7493-2841 │
|
||||
└────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Points Card Visual (Wallet Pass)
|
||||
|
||||
```
|
||||
┌────────────────────────────────────┐
|
||||
│ 🍕 Pizza Roma Rewards │
|
||||
│ │
|
||||
│ ★ 750 ★ │
|
||||
│ POINTS │
|
||||
│ │
|
||||
│ ────────────────────── │
|
||||
│ Next reward: 500 pts │
|
||||
│ Free drink │
|
||||
│ ────────────────────── │
|
||||
│ │
|
||||
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
|
||||
│ ▓▓▓▓▓▓▓▓ QR CODE ▓▓▓▓▓▓▓▓ │
|
||||
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
|
||||
│ │
|
||||
│ Card #4821-2847-9283 │
|
||||
└────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*Document Version: 1.0*
|
||||
*Created: 2025-01-28*
|
||||
*Author: Orion Engineering*
|
||||
This document has moved to the loyalty module docs: [UI Design](../modules/loyalty/ui-design.md)
|
||||
|
||||
@@ -1,387 +1,3 @@
|
||||
# Loyalty Program Platform - Business Analysis
|
||||
|
||||
**Session Date:** 2026-01-13
|
||||
**Status:** Initial Analysis - Pending Discussion
|
||||
**Next Steps:** Resume discussion to clarify requirements
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
Multiple retailers have expressed interest in a loyalty program application. This document analyzes how the current OMS platform could be leveraged to provide a loyalty program offering as a new product line.
|
||||
|
||||
---
|
||||
|
||||
## Business Proposal Overview
|
||||
|
||||
### Concept
|
||||
- **Multi-platform offering**: Different platform tiers (A, B, C) with varying feature sets
|
||||
- **Target clients**: Merchants (retailers) with one or multiple shops
|
||||
- **Core functionality**:
|
||||
- Customer email collection
|
||||
- Promotions and campaigns
|
||||
- Discounts and rewards
|
||||
- Points accumulation
|
||||
|
||||
### Platform Architecture Vision
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ PLATFORM LEVEL │
|
||||
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
||||
│ │ Platform A │ │ Platform B │ │ Platform C │ ... │
|
||||
│ │ (Loyalty+) │ │ (Basic) │ │ (Enterprise) │ │
|
||||
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ CLIENT LEVEL (Merchant) │
|
||||
│ ┌──────────────────────────────────────────────────────────┐ │
|
||||
│ │ Retailer X (e.g., Bakery Chain) │ │
|
||||
│ │ ├── Shop 1 (Luxembourg City) │ │
|
||||
│ │ ├── Shop 2 (Esch) │ │
|
||||
│ │ └── Shop 3 (Differdange) │ │
|
||||
│ └──────────────────────────────────────────────────────────┘ │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────────────────────────┐
|
||||
│ CUSTOMER LEVEL │
|
||||
│ • Email collection • Points accumulation │
|
||||
│ • Promotions/Offers • Discounts/Rewards │
|
||||
│ • Purchase history • Tier status │
|
||||
└─────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Current OMS Architecture Leverage
|
||||
|
||||
The existing platform has several components that map directly to loyalty program needs:
|
||||
|
||||
| Current OMS Component | Loyalty Program Use |
|
||||
|-----------------------|---------------------|
|
||||
| `Merchant` model | Client (retailer chain) |
|
||||
| `Store` model | Individual shop/location |
|
||||
| `Customer` model | Loyalty member base |
|
||||
| `Order` model | Transaction for points calculation |
|
||||
| `User` (store role) | Shop staff for check-in/redemption |
|
||||
| Multi-tenant auth | Per-client data isolation |
|
||||
| Admin dashboard | Retailer management interface |
|
||||
| Store dashboard | Shop-level operations |
|
||||
| API infrastructure | Integration capabilities |
|
||||
|
||||
### Existing Infrastructure Benefits
|
||||
- Authentication & authorization system
|
||||
- Multi-tenant data isolation
|
||||
- Merchant → Store hierarchy
|
||||
- Customer management
|
||||
- Email/notification system (if exists)
|
||||
- Celery background tasks
|
||||
- API patterns established
|
||||
|
||||
---
|
||||
|
||||
## New Components Required
|
||||
|
||||
### 1. Core Loyalty Models
|
||||
|
||||
```python
|
||||
# New database models needed
|
||||
|
||||
LoyaltyProgram
|
||||
- id
|
||||
- merchant_id (FK)
|
||||
- name
|
||||
- points_per_euro (Decimal)
|
||||
- points_expiry_days (Integer, nullable)
|
||||
- is_active (Boolean)
|
||||
- settings (JSON) - flexible configuration
|
||||
|
||||
LoyaltyMember
|
||||
- id
|
||||
- customer_id (FK to existing Customer)
|
||||
- loyalty_program_id (FK)
|
||||
- points_balance (Integer)
|
||||
- lifetime_points (Integer)
|
||||
- tier_id (FK)
|
||||
- enrolled_at (DateTime)
|
||||
- last_activity_at (DateTime)
|
||||
|
||||
LoyaltyTier
|
||||
- id
|
||||
- loyalty_program_id (FK)
|
||||
- name (e.g., "Bronze", "Silver", "Gold")
|
||||
- min_points_required (Integer)
|
||||
- benefits (JSON)
|
||||
- sort_order (Integer)
|
||||
|
||||
LoyaltyTransaction
|
||||
- id
|
||||
- member_id (FK)
|
||||
- store_id (FK) - which shop
|
||||
- transaction_type (ENUM: earn, redeem, expire, adjust)
|
||||
- points (Integer, positive or negative)
|
||||
- reference_type (e.g., "order", "promotion", "manual")
|
||||
- reference_id (Integer, nullable)
|
||||
- description (String)
|
||||
- created_at (DateTime)
|
||||
- created_by_user_id (FK, nullable)
|
||||
|
||||
Promotion
|
||||
- id
|
||||
- loyalty_program_id (FK)
|
||||
- name
|
||||
- description
|
||||
- promotion_type (ENUM: bonus_points, discount_percent, discount_fixed, free_item)
|
||||
- value (Decimal)
|
||||
- conditions (JSON) - min spend, specific products, etc.
|
||||
- start_date (DateTime)
|
||||
- end_date (DateTime)
|
||||
- max_redemptions (Integer, nullable)
|
||||
- is_active (Boolean)
|
||||
|
||||
PromotionRedemption
|
||||
- id
|
||||
- promotion_id (FK)
|
||||
- member_id (FK)
|
||||
- store_id (FK)
|
||||
- redeemed_at (DateTime)
|
||||
- order_id (FK, nullable)
|
||||
|
||||
Reward
|
||||
- id
|
||||
- loyalty_program_id (FK)
|
||||
- name
|
||||
- description
|
||||
- points_cost (Integer)
|
||||
- reward_type (ENUM: discount, free_product, voucher)
|
||||
- value (Decimal or JSON)
|
||||
- is_active (Boolean)
|
||||
- stock (Integer, nullable) - for limited rewards
|
||||
```
|
||||
|
||||
### 2. Platform Offering Tiers
|
||||
|
||||
```python
|
||||
# Platform-level configuration
|
||||
|
||||
class PlatformOffering(Enum):
|
||||
BASIC = "basic"
|
||||
PLUS = "plus"
|
||||
ENTERPRISE = "enterprise"
|
||||
|
||||
# Feature matrix per offering
|
||||
OFFERING_FEATURES = {
|
||||
"basic": {
|
||||
"max_shops": 1,
|
||||
"points_earning": True,
|
||||
"basic_promotions": True,
|
||||
"tiers": False,
|
||||
"custom_rewards": False,
|
||||
"api_access": False,
|
||||
"white_label": False,
|
||||
"analytics": "basic",
|
||||
},
|
||||
"plus": {
|
||||
"max_shops": 10,
|
||||
"points_earning": True,
|
||||
"basic_promotions": True,
|
||||
"tiers": True,
|
||||
"custom_rewards": True,
|
||||
"api_access": False,
|
||||
"white_label": False,
|
||||
"analytics": "advanced",
|
||||
},
|
||||
"enterprise": {
|
||||
"max_shops": None, # Unlimited
|
||||
"points_earning": True,
|
||||
"basic_promotions": True,
|
||||
"tiers": True,
|
||||
"custom_rewards": True,
|
||||
"api_access": True,
|
||||
"white_label": True,
|
||||
"analytics": "full",
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Feature Matrix
|
||||
|
||||
| Feature | Basic | Plus | Enterprise |
|
||||
|---------|:-----:|:----:|:----------:|
|
||||
| Customer email collection | ✓ | ✓ | ✓ |
|
||||
| Points earning | ✓ | ✓ | ✓ |
|
||||
| Basic promotions | ✓ | ✓ | ✓ |
|
||||
| Multi-shop support | 1 shop | Up to 10 | Unlimited |
|
||||
| Tier system (Bronze/Silver/Gold) | - | ✓ | ✓ |
|
||||
| Custom rewards catalog | - | ✓ | ✓ |
|
||||
| API access | - | - | ✓ |
|
||||
| White-label branding | - | - | ✓ |
|
||||
| Analytics dashboard | Basic | Advanced | Full |
|
||||
| Customer segmentation | - | ✓ | ✓ |
|
||||
| Email campaigns | - | ✓ | ✓ |
|
||||
| Dedicated support | - | - | ✓ |
|
||||
|
||||
---
|
||||
|
||||
## Implementation Options
|
||||
|
||||
### Option A: Standalone Application
|
||||
- Separate codebase
|
||||
- Shares database patterns but independent deployment
|
||||
- **Pros**: Clean separation, can scale independently
|
||||
- **Cons**: Duplication of auth, admin patterns; more maintenance
|
||||
|
||||
### Option B: Module in Current OMS (Recommended)
|
||||
- Add loyalty as a feature module within existing platform
|
||||
- Leverages existing infrastructure
|
||||
|
||||
**Proposed directory structure:**
|
||||
```
|
||||
letzshop-product-import/
|
||||
├── app/
|
||||
│ ├── api/v1/
|
||||
│ │ ├── loyalty/ # NEW
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── programs.py # Program CRUD
|
||||
│ │ │ ├── members.py # Member management
|
||||
│ │ │ ├── transactions.py # Points transactions
|
||||
│ │ │ ├── promotions.py # Promotion management
|
||||
│ │ │ ├── rewards.py # Rewards catalog
|
||||
│ │ │ └── public.py # Customer-facing endpoints
|
||||
│ │ │
|
||||
│ ├── services/
|
||||
│ │ ├── loyalty/ # NEW
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── points_service.py # Points calculation logic
|
||||
│ │ │ ├── tier_service.py # Tier management
|
||||
│ │ │ ├── promotion_service.py # Promotion rules engine
|
||||
│ │ │ └── reward_service.py # Reward redemption
|
||||
│ │ │
|
||||
│ ├── templates/
|
||||
│ │ ├── loyalty/ # NEW - if web UI needed
|
||||
│ │ │ ├── admin/ # Platform admin views
|
||||
│ │ │ ├── retailer/ # Retailer dashboard
|
||||
│ │ │ └── member/ # Customer-facing portal
|
||||
│ │ │
|
||||
├── models/
|
||||
│ ├── database/
|
||||
│ │ ├── loyalty.py # NEW - All loyalty models
|
||||
│ ├── schema/
|
||||
│ │ ├── loyalty.py # NEW - Pydantic schemas
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Open Questions (To Discuss)
|
||||
|
||||
### 1. Points Model
|
||||
- **Q1.1**: Fixed points per euro spent? (e.g., 1 point = €0.10 spent)
|
||||
- **Q1.2**: Variable points by product category? (e.g., 2x points on bakery items)
|
||||
- **Q1.3**: Bonus points for specific actions? (e.g., sign-up bonus, birthday bonus)
|
||||
- **Q1.4**: Points expiration policy? (e.g., expire after 12 months of inactivity)
|
||||
|
||||
### 2. Redemption Methods
|
||||
- **Q2.1**: In-store redemption only? (requires POS integration or staff app)
|
||||
- **Q2.2**: Online shop redemption?
|
||||
- **Q2.3**: Both in-store and online?
|
||||
- **Q2.4**: What POS systems do target retailers use?
|
||||
|
||||
### 3. Customer Identification
|
||||
- **Q3.1**: Email only?
|
||||
- **Q3.2**: Phone number as alternative?
|
||||
- **Q3.3**: Physical loyalty card with barcode/QR?
|
||||
- **Q3.4**: Mobile app with digital card?
|
||||
- **Q3.5**: Integration with existing customer accounts?
|
||||
|
||||
### 4. Multi-Platform Architecture
|
||||
- **Q4.1**: Different domains per offering tier?
|
||||
- e.g., loyalty-basic.lu, loyalty-pro.lu, loyalty-enterprise.lu
|
||||
- **Q4.2**: Same domain with feature flags based on subscription?
|
||||
- **Q4.3**: White-label with custom domains for enterprise clients?
|
||||
|
||||
### 5. Data & Privacy
|
||||
- **Q5.1**: Can retailers see each other's customers? (Assumed: No)
|
||||
- **Q5.2**: Can a customer be enrolled in multiple loyalty programs? (Different retailers)
|
||||
- **Q5.3**: GDPR considerations for customer data?
|
||||
- **Q5.4**: Data export/portability requirements?
|
||||
|
||||
### 6. Business Model
|
||||
- **Q6.1**: Pricing model? (Monthly subscription, per-transaction fee, hybrid?)
|
||||
- **Q6.2**: Free trial period?
|
||||
- **Q6.3**: Upgrade/downgrade path between tiers?
|
||||
|
||||
### 7. Integration Requirements
|
||||
- **Q7.1**: POS system integrations needed?
|
||||
- **Q7.2**: Email marketing platform integration? (Mailchimp, SendGrid, etc.)
|
||||
- **Q7.3**: SMS notifications?
|
||||
- **Q7.4**: Accounting/invoicing integration?
|
||||
|
||||
### 8. MVP Scope
|
||||
- **Q8.1**: What is the minimum viable feature set for first launch?
|
||||
- **Q8.2**: Which offering tier to build first?
|
||||
- **Q8.3**: Target timeline?
|
||||
- **Q8.4**: Pilot retailers identified?
|
||||
|
||||
---
|
||||
|
||||
## Potential User Flows
|
||||
|
||||
### Retailer Onboarding Flow
|
||||
1. Retailer signs up on platform
|
||||
2. Selects offering tier (Basic/Plus/Enterprise)
|
||||
3. Configures loyalty program (name, points ratio, branding)
|
||||
4. Adds shop locations
|
||||
5. Invites staff members
|
||||
6. Sets up initial promotions
|
||||
7. Goes live
|
||||
|
||||
### Customer Enrollment Flow
|
||||
1. Customer visits shop or website
|
||||
2. Provides email (and optionally phone)
|
||||
3. Receives welcome email with member ID/card
|
||||
4. Starts earning points on purchases
|
||||
|
||||
### Points Earning Flow (In-Store)
|
||||
1. Customer makes purchase
|
||||
2. Staff asks for loyalty member ID (email, phone, or card scan)
|
||||
3. System calculates points based on purchase amount
|
||||
4. Points credited to member account
|
||||
5. Receipt shows points earned and balance
|
||||
|
||||
### Reward Redemption Flow
|
||||
1. Customer views available rewards (app/web/in-store)
|
||||
2. Selects reward to redeem
|
||||
3. System validates sufficient points
|
||||
4. Generates redemption code/voucher
|
||||
5. Customer uses at checkout
|
||||
6. Points deducted from balance
|
||||
|
||||
---
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Clarify requirements** - Answer open questions above
|
||||
2. **Define MVP scope** - What's the minimum for first launch?
|
||||
3. **Technical design** - Database schema, API design
|
||||
4. **UI/UX design** - Retailer dashboard, customer portal
|
||||
5. **Implementation plan** - Phased approach
|
||||
6. **Pilot program** - Identify first retailers for beta
|
||||
|
||||
---
|
||||
|
||||
## Session Notes
|
||||
|
||||
### 2026-01-13
|
||||
- Initial business proposal discussion
|
||||
- Analyzed current OMS architecture fit
|
||||
- Identified reusable components
|
||||
- Outlined new models needed
|
||||
- Documented open questions
|
||||
- **Action**: Resume discussion to clarify requirements
|
||||
|
||||
---
|
||||
|
||||
*Document created for session continuity. Update as discussions progress.*
|
||||
This document has moved to the loyalty module docs: [Program Analysis](../modules/loyalty/program-analysis.md)
|
||||
|
||||
242
docs/proposals/module-documentation-migration-plan.md
Normal file
242
docs/proposals/module-documentation-migration-plan.md
Normal file
@@ -0,0 +1,242 @@
|
||||
# Module Documentation Migration Plan
|
||||
|
||||
Migrate ~18,000 lines of module-specific documentation from top-level `docs/` into each module's `docs/` folder (source of truth), following the standard defined in [Module Documentation](../development/module-documentation.md).
|
||||
|
||||
## Current State
|
||||
|
||||
- 20 modules each have `docs/index.md` (overview page)
|
||||
- Only `prospecting` has additional docs (`database.md`, `scoring.md`, `research-findings.md`)
|
||||
- ~38 files across `docs/` are specific to a single module's internals but live in top-level directories
|
||||
- 2 files are empty stubs (`product-management.md`, `csv-import.md`)
|
||||
|
||||
## Migration Rules
|
||||
|
||||
1. **Move** the file into `app/modules/{name}/docs/` with a clear name
|
||||
2. **Update** the symlink-based `docs/modules/{name}/` nav in `mkdocs.yml`
|
||||
3. **Leave a redirect stub** in the original location (one-line with a link to the new path) so existing bookmarks still work
|
||||
4. **Update cross-references** in other docs that link to the moved file
|
||||
5. **Run `mkdocs build --strict`** after each phase to catch broken links
|
||||
|
||||
## Phase 1 — Tenancy (largest module, 12 models, 19 API routes)
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/architecture/tenancy-module-migration.md` (286 lines) | `app/modules/tenancy/docs/migration.md` | Migration plan & entity breakdown |
|
||||
| `docs/backend/store-rbac.md` (844 lines) | `app/modules/tenancy/docs/rbac.md` | Store RBAC system |
|
||||
| `docs/guides/user-management.md` (377 lines) | `app/modules/tenancy/docs/user-management.md` | User & team management guide |
|
||||
| `docs/features/store-onboarding.md` (191 lines) | `app/modules/tenancy/docs/onboarding.md` | Store onboarding wizard |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/tenancy/docs/data-model.md` | Entity diagram: Platform → Merchant → Store → AdminUser, domains, email verification |
|
||||
|
||||
**Expected result:** 6 docs in `app/modules/tenancy/docs/` (index + 5)
|
||||
|
||||
---
|
||||
|
||||
## Phase 2 — Billing (subscriptions, tiers, Stripe, scheduled tasks)
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/features/subscription-billing.md` (631 lines) | `app/modules/billing/docs/subscription-system.md` | Subscription architecture |
|
||||
| `docs/guides/subscription-tier-management.md` (135 lines) | `app/modules/billing/docs/tier-management.md` | Tier management guide |
|
||||
| `docs/implementation/subscription-workflow-plan.md` (454 lines) | `app/modules/billing/docs/subscription-workflow.md` | Subscription lifecycle |
|
||||
| `docs/implementation/feature-gating-system.md` (434 lines) | `app/modules/billing/docs/feature-gating.md` | Feature provider pattern |
|
||||
| `docs/deployment/stripe-integration.md` (617 lines) | `app/modules/billing/docs/stripe-integration.md` | Stripe setup & webhooks |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/billing/docs/data-model.md` | Schema: Subscription, MerchantSubscription, TierFeatureLimit |
|
||||
|
||||
**Expected result:** 7 docs in `app/modules/billing/docs/` (index + 6)
|
||||
|
||||
---
|
||||
|
||||
## Phase 3 — Loyalty (anti-fraud, wallet integration, scoring)
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/features/user-journeys/loyalty.md` (794 lines) | `app/modules/loyalty/docs/user-journeys.md` | User journey flows |
|
||||
| `docs/proposals/loyalty-program-analysis.md` (387 lines) | `app/modules/loyalty/docs/program-analysis.md` | Business analysis |
|
||||
| `docs/proposals/loyalty-phase2-interfaces-plan.md` (670 lines) | `app/modules/loyalty/docs/ui-design.md` | Admin/store interface design |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/loyalty/docs/data-model.md` | Schema: LoyaltyProgram, LoyaltyCard, LoyaltyTransaction, StaffPin, AppleDeviceRegistration |
|
||||
| `app/modules/loyalty/docs/business-logic.md` | Anti-fraud system, cooldown, daily limits, lockout, wallet sync |
|
||||
|
||||
**Expected result:** 6 docs in `app/modules/loyalty/docs/` (index + 5)
|
||||
|
||||
---
|
||||
|
||||
## Phase 4 — Marketplace (Letzshop sync, import jobs)
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/architecture/marketplace-integration.md` (1345 lines) | `app/modules/marketplace/docs/architecture.md` | Integration architecture |
|
||||
| `docs/guides/marketplace-integration.md` (808 lines) | `app/modules/marketplace/docs/integration-guide.md` | User guide |
|
||||
| `docs/guides/letzshop-marketplace-api.md` (322 lines) | `app/modules/marketplace/docs/api.md` | Letzshop API reference |
|
||||
| `docs/guides/letzshop-order-integration.md` (839 lines) | `app/modules/marketplace/docs/order-integration.md` | Order import/sync |
|
||||
| `docs/guides/letzshop-admin-management.md` (261 lines) | `app/modules/marketplace/docs/admin-guide.md` | Admin portal guide |
|
||||
| `docs/implementation/letzshop-order-import-improvements.md` (601 lines) | `app/modules/marketplace/docs/import-improvements.md` | GraphQL & field mapping |
|
||||
| `docs/implementation/letzshop-jobs-improvements.md` (716 lines) | `app/modules/marketplace/docs/job-queue.md` | Job queue improvements |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/marketplace/docs/data-model.md` | Schema: Letzshop, MarketplaceProduct, MarketplaceProductTranslation, MarketplaceImportJob |
|
||||
|
||||
**Expected result:** 9 docs in `app/modules/marketplace/docs/` (index + 8)
|
||||
|
||||
---
|
||||
|
||||
## Phase 5 — Orders (lifecycle, fulfillment, invoicing)
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/architecture/customer-orders-architecture.md` (345 lines) | `app/modules/orders/docs/architecture.md` | Customer-orders architecture |
|
||||
| `docs/implementation/unified-order-view.md` (275 lines) | `app/modules/orders/docs/unified-order-view.md` | Unified order schema |
|
||||
| `docs/implementation/order-item-exceptions.md` (288 lines) | `app/modules/orders/docs/exceptions.md` | Order item exception system |
|
||||
| `docs/implementation/oms-feature-plan.md` (662 lines) | `app/modules/orders/docs/oms-features.md` | OMS feature plan |
|
||||
| `docs/implementation/vat-invoice-feature.md` (734 lines) | `app/modules/orders/docs/vat-invoicing.md` | VAT invoice specification |
|
||||
| `docs/implementation/stock-management-integration.md` (371 lines) | `app/modules/orders/docs/stock-integration.md` | Order-inventory integration |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/orders/docs/data-model.md` | Schema: Order, Invoice, OrderItemException |
|
||||
|
||||
**Expected result:** 8 docs in `app/modules/orders/docs/` (index + 7)
|
||||
|
||||
---
|
||||
|
||||
## Phase 6 — Messaging & CMS (email system spans both)
|
||||
|
||||
The email system touches both modules. Migration decision:
|
||||
|
||||
| Topic | Module | Rationale |
|
||||
|-------|--------|-----------|
|
||||
| Email templates (content, rendering) | **cms** | Templates are content, managed via CMS admin |
|
||||
| Email delivery (providers, sending) | **messaging** | Provider config, SMTP, delivery tracking |
|
||||
| Email settings (provider config) | **messaging** | Provider selection, credentials, test sending |
|
||||
| Notifications (admin alerts) | **messaging** | Part of notification center |
|
||||
|
||||
### Messaging
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/implementation/messaging-system.md` (243 lines) | `app/modules/messaging/docs/architecture.md` | Messaging architecture |
|
||||
| `docs/implementation/admin-notification-system.md` (187 lines) | `app/modules/messaging/docs/notifications.md` | Notification system |
|
||||
| `docs/features/email-system.md` (331 lines) | `app/modules/messaging/docs/email-system.md` | Email delivery system |
|
||||
| `docs/guides/email-settings.md` (254 lines) | `app/modules/messaging/docs/email-settings.md` | Provider configuration |
|
||||
| `docs/implementation/email-settings.md` (exists) | `app/modules/messaging/docs/email-settings-impl.md` | Email settings implementation |
|
||||
|
||||
**Expected result:** 6 docs in `app/modules/messaging/docs/` (index + 5)
|
||||
|
||||
### CMS
|
||||
|
||||
**Files to migrate:**
|
||||
|
||||
| Source | Target | New Name |
|
||||
|--------|--------|----------|
|
||||
| `docs/features/content-management-system.md` (604 lines) | `app/modules/cms/docs/architecture.md` | CMS architecture |
|
||||
| `docs/features/cms-implementation-guide.md` (414 lines) | `app/modules/cms/docs/implementation.md` | Implementation checklist |
|
||||
| `docs/implementation/email-templates-architecture.md` (458 lines) | `app/modules/cms/docs/email-templates.md` | Email template system |
|
||||
| `docs/guides/email-templates.md` (287 lines) | `app/modules/cms/docs/email-templates-guide.md` | Template customisation guide |
|
||||
| `docs/guides/media-library.md` (182 lines) | `app/modules/cms/docs/media-library.md` | Media library guide |
|
||||
|
||||
**New files to create:**
|
||||
|
||||
| File | Content |
|
||||
|------|---------|
|
||||
| `app/modules/cms/docs/data-model.md` | Schema: ContentPage, Media, StoreTheme |
|
||||
|
||||
**Expected result:** 7 docs in `app/modules/cms/docs/` (index + 6)
|
||||
|
||||
---
|
||||
|
||||
## Phase 7 — Medium modules (catalog, inventory, hosting, prospecting)
|
||||
|
||||
### Catalog
|
||||
|
||||
| Source | Target |
|
||||
|--------|--------|
|
||||
| `docs/architecture/product-architecture.md` (291 lines) | `app/modules/catalog/docs/architecture.md` |
|
||||
| `docs/guides/product-management.md` (empty) | Delete |
|
||||
| `docs/guides/csv-import.md` (empty) | Delete |
|
||||
|
||||
Create: `app/modules/catalog/docs/data-model.md`
|
||||
|
||||
### Inventory
|
||||
|
||||
| Source | Target |
|
||||
|--------|--------|
|
||||
| `docs/guides/inventory-management.md` (366 lines) | `app/modules/inventory/docs/user-guide.md` |
|
||||
|
||||
Create: `app/modules/inventory/docs/data-model.md`
|
||||
|
||||
### Hosting
|
||||
|
||||
| Source | Target |
|
||||
|--------|--------|
|
||||
| `docs/features/user-journeys/hosting.md` (502 lines) | `app/modules/hosting/docs/user-journeys.md` |
|
||||
|
||||
### Prospecting
|
||||
|
||||
| Source | Target |
|
||||
|--------|--------|
|
||||
| `docs/features/user-journeys/prospecting.md` (435 lines) | `app/modules/prospecting/docs/user-journeys.md` |
|
||||
|
||||
---
|
||||
|
||||
## Phase 8 — Cleanup & verification
|
||||
|
||||
1. Remove empty redirect stubs that are older than one release cycle
|
||||
2. Verify all `mkdocs.yml` nav entries point to valid files
|
||||
3. Run `mkdocs build --strict` — zero warnings
|
||||
4. Update `docs/development/module-documentation.md` if conventions evolved
|
||||
5. Audit: every complex module should have at least `index.md` + `data-model.md`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Phase | Module(s) | Files Migrated | Files Created | Total Lines |
|
||||
|-------|-----------|---------------|---------------|-------------|
|
||||
| 1 | Tenancy | 4 | 1 | ~1,698 |
|
||||
| 2 | Billing | 5 | 1 | ~2,271 |
|
||||
| 3 | Loyalty | 3 | 2 | ~1,851 |
|
||||
| 4 | Marketplace | 7 | 1 | ~4,892 |
|
||||
| 5 | Orders | 6 | 1 | ~2,675 |
|
||||
| 6 | Messaging + CMS | 10 | 1 | ~2,960 |
|
||||
| 7 | Catalog + Inventory + Hosting + Prospecting | 3 + 2 delete | 2 | ~1,594 |
|
||||
| 8 | Cleanup | — | — | — |
|
||||
| **Total** | **10 modules** | **38 migrated** | **9 created** | **~17,941** |
|
||||
|
||||
## Execution Notes
|
||||
|
||||
- Each phase is independent and can be done in a single session
|
||||
- Always run `mkdocs build --strict` after each phase
|
||||
- Update the `mkdocs.yml` Modules nav section to include new docs
|
||||
- Leave redirect stubs so external links don't break immediately
|
||||
- Cross-references between modules should use relative paths from `docs/modules/`
|
||||
Reference in New Issue
Block a user