dubs-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +280 -0
- package/CLAUDE.md +46 -0
- package/CONNECT4_PRODUCTION_DEPLOY.md +155 -0
- package/CURRENT_SESSION.md +171 -0
- package/CURRENT_SESSION_DRAW.md +516 -0
- package/MARCH_MADNESS_SURVIVOR.md +254 -0
- package/PANDA.md +166 -0
- package/Procfile +4 -0
- package/README.md +476 -0
- package/controllers/livescoresController.js +376 -0
- package/controllers/pickemController.js +554 -0
- package/controllers/survivorAdminController.js +887 -0
- package/controllers/survivorController.js +623 -0
- package/cron/oracleMonitor.js +77 -0
- package/cron/pickemOracleMonitor.js +73 -0
- package/data/jackpot-history.json +952 -0
- package/data/ncaaTeams.js +406 -0
- package/documentation/API_SECURITY_GUIDE.md +327 -0
- package/documentation/ARCADE_API.md +593 -0
- package/documentation/ARCADE_IMPLEMENTATION_SUMMARY.md +399 -0
- package/documentation/ARCADE_QUICKSTART.md +242 -0
- package/documentation/AUTOMATIC_MODE_ORACLE.md +321 -0
- package/documentation/BUG_FIX_COHORT_DATE_DISPLAY.md +171 -0
- package/documentation/CLAIM_MIGRATION_INSTRUCTIONS.md +52 -0
- package/documentation/CLAIM_STATUS_FIX.md +67 -0
- package/documentation/CLI_TOOL_GUIDE.md +372 -0
- package/documentation/COHORT_RETENTION_ANALYSIS.md +295 -0
- package/documentation/COHORT_RETENTION_IMPLEMENTATION_COMPLETE.md +461 -0
- package/documentation/COHORT_RETENTION_SUMMARY.md +204 -0
- package/documentation/COMPLETE_PROJECT_SUMMARY.md +490 -0
- package/documentation/DATABASE_QUERIES.md +269 -0
- package/documentation/DATABASE_RETENTION_POLICY.md +390 -0
- package/documentation/DATABASE_SETUP_GUIDE.md +361 -0
- package/documentation/DATABASE_SETUP_SUMMARY.md +247 -0
- package/documentation/DEMO_API_CURL_COMMANDS.md +656 -0
- package/documentation/DEPLOYMENT_SUMMARY.txt +100 -0
- package/documentation/DUPLICATE_NOTIFICATIONS_FIXED.md +201 -0
- package/documentation/EXCHANGE_RATES_INTEGRATION.md +371 -0
- package/documentation/FINAL_API_PROTECTION_TABLE.md +175 -0
- package/documentation/GAME_START_NOTIFICATIONS_DEPLOYMENT.md +256 -0
- package/documentation/GAME_START_NOTIFICATIONS_INTEGRATION.md +275 -0
- package/documentation/HEROKU_DEPLOYMENT.md +134 -0
- package/documentation/HEROKU_SCHEDULER_SETUP.md +271 -0
- package/documentation/JACKPOT_API.md +521 -0
- package/documentation/JACKPOT_DEPLOYMENT_GUIDE.md +362 -0
- package/documentation/JWT_IMPLEMENTATION_SUMMARY.md +373 -0
- package/documentation/JWT_QUICK_SETUP.md +268 -0
- package/documentation/JWT_TESTING_GUIDE.md +404 -0
- package/documentation/KEEPER_RECOVERY_GUIDE.md +381 -0
- package/documentation/KEEPER_SETUP.md +206 -0
- package/documentation/KEEPER_STATE_MACHINE.md +423 -0
- package/documentation/LATEST_PRODUCTION_SETUP.md +387 -0
- package/documentation/LOCAL_VOTING_TEST.md +279 -0
- package/documentation/ORACLE_FIXES_SUMMARY.md +188 -0
- package/documentation/ORACLE_POSTGRESQL_UPDATE.md +202 -0
- package/documentation/PAYMENT_DEPLOYMENT.md +209 -0
- package/documentation/PNL_TRACKING_SETUP.md +189 -0
- package/documentation/PREVENTING_LOCKUP_ERRORS.md +472 -0
- package/documentation/PRODUCTION_READY_SUMMARY.md +227 -0
- package/documentation/PUBLIC_VS_PRIVATE_ENDPOINTS.md +278 -0
- package/documentation/QUICK_AUTH_SETUP.md +99 -0
- package/documentation/QUICK_DEPLOY.md +224 -0
- package/documentation/QUICK_FIX.md +114 -0
- package/documentation/QUICK_START.md +152 -0
- package/documentation/REFEREE_MODE_GUIDE.md +392 -0
- package/documentation/RETENTION_CORE_ACTION_UPDATE.md +313 -0
- package/documentation/RETENTION_UPDATE_SUMMARY.md +108 -0
- package/documentation/RUN_MIGRATION_NOW.md +39 -0
- package/documentation/SCRIPTS_UPDATE_SUMMARY.md +251 -0
- package/documentation/SETUP_GUIDE.md +184 -0
- package/documentation/STATE_MACHINE_IMPLEMENTATION.md +250 -0
- package/documentation/TELEGRAM_NOTIFICATIONS_DIAGNOSIS.md +361 -0
- package/documentation/UNIFIED_ARCHITECTURE.md +231 -0
- package/documentation/VOTING_DEPLOYMENT_SUMMARY.md +392 -0
- package/documentation/WEBSOCKET_ARCHITECTURE.md +881 -0
- package/documentation/WHAT_WE_BUILT_TODAY.md +369 -0
- package/documentation/latest/LATEST_PRODUCTION_SETUP.md +865 -0
- package/ecosystem.config.js +65 -0
- package/env.template +125 -0
- package/middleware/apiKeyAuth.js +136 -0
- package/middleware/authenticate.js +214 -0
- package/middleware/developerUserAuth.js +76 -0
- package/middleware/socketAuth.js +69 -0
- package/package.json +49 -0
- package/postman/Dubs-API-v1-With-Voting.postman_collection.json +555 -0
- package/postman/Dubs-API-v1.postman_collection.json +205 -0
- package/postman/Dubs_Developer_API.postman_collection.json +662 -0
- package/postman/QUICKSTART.md +118 -0
- package/postman/QUICK_REFERENCE.md +246 -0
- package/postman/README.md +71 -0
- package/postman/VOTING_API_GUIDE.md +426 -0
- package/refactor/Animations.md +148 -0
- package/refactor/Chat.md +252 -0
- package/routes/actionsRoutes.js +699 -0
- package/routes/adminRoutes.js +370 -0
- package/routes/analyticsRoutes.js +1262 -0
- package/routes/arcadeRoutes.js +557 -0
- package/routes/authRoutes.js +2310 -0
- package/routes/avatarRoutes.js +85 -0
- package/routes/botRoutes.js +211 -0
- package/routes/chatRoutes.js +377 -0
- package/routes/cryptoPriceRoutes.js +105 -0
- package/routes/developerRoutes.js +4201 -0
- package/routes/deviceRoutes.js +214 -0
- package/routes/dmRoutes.js +167 -0
- package/routes/esportsRoutes.js +806 -0
- package/routes/exchangeRateRoutes.js +233 -0
- package/routes/gamesRoutes.js +3028 -0
- package/routes/jackpotRoutes.js +754 -0
- package/routes/keeperMonitoringRoutes.js +156 -0
- package/routes/keeperWebhookRoutes.js +466 -0
- package/routes/livescoresRoutes.js +31 -0
- package/routes/pickemAdminRoutes.js +199 -0
- package/routes/pickemRoutes.js +231 -0
- package/routes/playerStatsRoutes.js +147 -0
- package/routes/portfolioRoutes.js +217 -0
- package/routes/promoRoutes.js +418 -0
- package/routes/referralEarningsRoutes.js +392 -0
- package/routes/socialRoutes.js +459 -0
- package/routes/sportsRoutes.js +1271 -0
- package/routes/survivorAdminRoutes.js +345 -0
- package/routes/survivorRoutes.js +756 -0
- package/routes/uploadRoutes.js +256 -0
- package/routes/userProfileRoutes.js +244 -0
- package/routes/whatsNewRoutes.js +331 -0
- package/scripts/.claude/settings.local.json +15 -0
- package/scripts/README.md +170 -0
- package/scripts/RESTART_EVERYTHING.sh +104 -0
- package/scripts/add-claim-columns.sql +48 -0
- package/scripts/add-crypto-prices-cache.sql +27 -0
- package/scripts/add-exchange-rates-cache.sql +40 -0
- package/scripts/add-game-invite-column.sql +23 -0
- package/scripts/add-game-invite-notification.sql +33 -0
- package/scripts/add-game-invite-telegram-pref.sql +16 -0
- package/scripts/add-game-joined-notification.sql +16 -0
- package/scripts/add-game-joined-pref.js +40 -0
- package/scripts/add-game-joined-preference.sql +6 -0
- package/scripts/add-game-start-notifications.sql +41 -0
- package/scripts/add-notification-flags-to-games.sql +55 -0
- package/scripts/add-pending-game-dismissals.sql +19 -0
- package/scripts/add-preferred-currency.sql +34 -0
- package/scripts/add-winner-columns.js +61 -0
- package/scripts/add_mention_system.sql +53 -0
- package/scripts/add_payment_system.sql +96 -0
- package/scripts/add_sports_event_id_column.sql +22 -0
- package/scripts/analyze-cohort-data-heroku.js +276 -0
- package/scripts/analyze-cohort-data.js +295 -0
- package/scripts/analyze-prod-cohorts.sh +10 -0
- package/scripts/backfill-matchup-images.js +245 -0
- package/scripts/backfill-missing-signatures.js +175 -0
- package/scripts/backfill-referral-earnings.js +202 -0
- package/scripts/check-chat-schema.js +130 -0
- package/scripts/check-db.sh +14 -0
- package/scripts/check_oracle_in_game.js +54 -0
- package/scripts/cleanup-database.js +193 -0
- package/scripts/clear-notification-cache.js +85 -0
- package/scripts/convert-mnemonic.js +50 -0
- package/scripts/create-users-table.sql +44 -0
- package/scripts/debug-cohort-counts.js +248 -0
- package/scripts/debug-winner-calc.js +84 -0
- package/scripts/deploy-payment-system.sh +118 -0
- package/scripts/deploy-to-heroku.sh +63 -0
- package/scripts/diagnose-locked-round.js +143 -0
- package/scripts/dubs-cli.js +720 -0
- package/scripts/dump-account.js +65 -0
- package/scripts/find-vrf-offset.js +48 -0
- package/scripts/fix-chat-notifications-constraint.sql +122 -0
- package/scripts/fix-claim-columns.js +124 -0
- package/scripts/fix-constraint-now.js +44 -0
- package/scripts/fix-lock-timestamps.js +96 -0
- package/scripts/fix-locked-round.sh +126 -0
- package/scripts/fix-missing-badges.sql +91 -0
- package/scripts/fix-payment-notifications.sql +41 -0
- package/scripts/force-new-round.js +55 -0
- package/scripts/force-resolve-and-claim.js +278 -0
- package/scripts/important/README.md +115 -0
- package/scripts/important/authority-force-lock.js +197 -0
- package/scripts/important/authority-resolve-game.js +267 -0
- package/scripts/important/check-game-status.js +373 -0
- package/scripts/important/list-pending-games-by-version.js +270 -0
- package/scripts/important/reconcile-v1-v2-payouts.js +270 -0
- package/scripts/initialize-jackpot.js +111 -0
- package/scripts/jackpot/.claude/settings.local.json +10 -0
- package/scripts/jackpot/force-reset.js +84 -0
- package/scripts/jackpot/initialize-mainnet.js +100 -0
- package/scripts/jackpot/keeper.js +742 -0
- package/scripts/jackpot/status.js +107 -0
- package/scripts/jackpot/update-round-duration.js +143 -0
- package/scripts/keeper-bot.js +112 -0
- package/scripts/list-pending-games.js +131 -0
- package/scripts/migrate-chat-v2.js +127 -0
- package/scripts/migrate-chat-winners.js +84 -0
- package/scripts/migrate-chat.sh +17 -0
- package/scripts/migrate-game-invite.js +83 -0
- package/scripts/migrate-heroku-game-notifications.sh +159 -0
- package/scripts/migrations/001_analytics_tables.sql +422 -0
- package/scripts/migrations/002_add_matchup_image_url.sql +14 -0
- package/scripts/migrations/003_referral_earnings.sql +208 -0
- package/scripts/migrations/004_add_whats_new_notification_type.sql +62 -0
- package/scripts/migrations/005_add_connect4_your_turn_notification.sql +61 -0
- package/scripts/migrations/005_push_notifications.sql +55 -0
- package/scripts/migrations/006_add_draw_team_players.sql +28 -0
- package/scripts/migrations/006_add_game_cancelled_notification.sql +62 -0
- package/scripts/migrations/007_add_gif_url.sql +8 -0
- package/scripts/migrations/008_add_connect4_columns.sql +139 -0
- package/scripts/migrations/008_add_pool_tracking.sql +22 -0
- package/scripts/migrations/009_create_survivor_pool_tables.sql +174 -0
- package/scripts/migrations/010_add_survivor_pool_outcome.sql +28 -0
- package/scripts/migrations/011_create_developer_tables.sql +67 -0
- package/scripts/migrations/011_fix_keeper_tables.sql +85 -0
- package/scripts/migrations/012_create_developer_webhooks.sql +31 -0
- package/scripts/migrations/013_add_network_mode.sql +18 -0
- package/scripts/migrations/014_create_developer_app_users.sql +19 -0
- package/scripts/migrations/015_add_ui_config.sql +4 -0
- package/scripts/migrations/016_add_resolution_secret.sql +4 -0
- package/scripts/migrations/017_add_external_game_id.sql +3 -0
- package/scripts/migrations/018_create_pickem_tables.sql +115 -0
- package/scripts/migrations/019_expo_push_tokens.sql +19 -0
- package/scripts/migrations/create_whats_new_tables.sql +88 -0
- package/scripts/migrations/drop_live_games_tables.sql +34 -0
- package/scripts/open-jackpot-round.js +85 -0
- package/scripts/purge-all-data.sh +329 -0
- package/scripts/purge-all-data.sql +142 -0
- package/scripts/purge-heroku-data.sh +149 -0
- package/scripts/purge-heroku-data.sql +62 -0
- package/scripts/rebuild-heroku-database.sh +113 -0
- package/scripts/recover-funds.js +357 -0
- package/scripts/regenerate-epl-images.js +278 -0
- package/scripts/resize-s3-matchup-images.js +374 -0
- package/scripts/resolve-direct.js +88 -0
- package/scripts/resolve-mock-game.js +124 -0
- package/scripts/resolve-pickem-game.js +55 -0
- package/scripts/resolve-round-manual.js +83 -0
- package/scripts/resolve-stuck-game.js +382 -0
- package/scripts/resolve-stuck-round.js +42 -0
- package/scripts/run-connect4-migration.sh +16 -0
- package/scripts/run-mention-migration.sh +32 -0
- package/scripts/run-payment-migration.sh +51 -0
- package/scripts/run-preferred-currency-migration.sh +31 -0
- package/scripts/run-referral-earnings-migration.sh +32 -0
- package/scripts/run-survivor-outcome-migration.sh +16 -0
- package/scripts/seed-test-users.js +346 -0
- package/scripts/setup-auth-tables.js +78 -0
- package/scripts/setup-complete-database.sql +992 -0
- package/scripts/setup-database-fresh.sh +359 -0
- package/scripts/setup-heroku-keeper.sh +48 -0
- package/scripts/setup-keeper-database.js +83 -0
- package/scripts/setup-keeper-state-db.sql +110 -0
- package/scripts/setup-oracle.sh +39 -0
- package/scripts/setup-pnl-tracking.js +111 -0
- package/scripts/start-devnet.sh +14 -0
- package/scripts/test-arcade-devnet.sh +160 -0
- package/scripts/test-arcade-match.sh +109 -0
- package/scripts/test-automatic-mode.sh +239 -0
- package/scripts/test-connect4-cancel-claim.js +370 -0
- package/scripts/test-connect4-e2e.js +369 -0
- package/scripts/test-connect4-resolve.js +369 -0
- package/scripts/test-game-state-endpoint.js +136 -0
- package/scripts/test-invite-notification.js +86 -0
- package/scripts/test-jackpot-api.sh +71 -0
- package/scripts/test-poll-confirmation.js +267 -0
- package/scripts/test-resolve-game.js +271 -0
- package/scripts/test-resolve-signature.js +223 -0
- package/scripts/test-signature-preservation.js +124 -0
- package/scripts/test-state-machine.js +291 -0
- package/scripts/test-webhook-receiver.js +60 -0
- package/scripts/update-notification-constraint.js +52 -0
- package/scripts/verify-account-layout.js +145 -0
- package/scripts/verify-winner-algorithm.js +278 -0
- package/server.js +5259 -0
- package/services/arcadeMatchService.js +763 -0
- package/services/automaticGameOracle.js +1596 -0
- package/services/chatService.js +1612 -0
- package/services/connect4GameService.js +1049 -0
- package/services/connect4NotificationService.js +374 -0
- package/services/cryptoPriceService.js +223 -0
- package/services/customGameResolver.js +260 -0
- package/services/db.js +79 -0
- package/services/directMessageService.js +389 -0
- package/services/discordNotifications.js +160 -0
- package/services/exchangeRateService.js +289 -0
- package/services/expoPushService.js +314 -0
- package/services/gamesCacheService.js +539 -0
- package/services/jackpotHistory.js +331 -0
- package/services/jackpotService.js +856 -0
- package/services/keeperStateService.js +355 -0
- package/services/matchupImageService.js +591 -0
- package/services/notificationCacheService.js +407 -0
- package/services/pickemOracle.js +440 -0
- package/services/playerStatsService.js +389 -0
- package/services/portfolioService.js +555 -0
- package/services/promoService.js +757 -0
- package/services/promoTreasuryService.js +239 -0
- package/services/pushNotifications.js +353 -0
- package/services/redisService.js +422 -0
- package/services/referralEarningsService.js +728 -0
- package/services/s3Service.js +396 -0
- package/services/socialService.js +1202 -0
- package/services/survivorOracle.js +469 -0
- package/services/survivorSimulator.js +475 -0
- package/services/telegramNotifications.js +461 -0
- package/services/userProfileStatsService.js +1185 -0
- package/services/whatsNewService.js +388 -0
- package/utils/urlHelper.js +95 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# 🎮 Dubs CLI - Interactive Testing Tool
|
|
2
|
+
|
|
3
|
+
**Beautiful interactive menu for testing the Dubs voting system!**
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🚀 **Quick Start**
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cd dubs-server
|
|
11
|
+
npm run cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**That's it!** 🎉
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📋 **Features**
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
✅ Interactive menu (no typing curl commands!)
|
|
22
|
+
✅ Auto-save game IDs
|
|
23
|
+
✅ Track player addresses
|
|
24
|
+
✅ Colorful terminal output
|
|
25
|
+
✅ Complete voting workflows
|
|
26
|
+
✅ Automated test scenarios
|
|
27
|
+
✅ Pretty JSON responses
|
|
28
|
+
✅ Error handling
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🎮 **Main Menu**
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
╔═══════════════════════════════════════════════════════╗
|
|
37
|
+
║ 🎮 DUBS CLI - VOTING TESTER 🎮 ║
|
|
38
|
+
╚═══════════════════════════════════════════════════════╝
|
|
39
|
+
|
|
40
|
+
📡 Server: http://localhost:3001
|
|
41
|
+
🎮 Current Game: a1b2c3d4-e5f6-7890...
|
|
42
|
+
|
|
43
|
+
═══ GAME MANAGEMENT ═══
|
|
44
|
+
1. 📋 List Demo Wallets
|
|
45
|
+
2. 💸 Airdrop SOL to Player
|
|
46
|
+
3. 🎮 Create New Game
|
|
47
|
+
4. 📊 Get Game Info
|
|
48
|
+
|
|
49
|
+
═══ GAME PLAY ═══
|
|
50
|
+
5. 👥 Player Joins Game
|
|
51
|
+
6. 🗳️ Cast Vote (NEW!)
|
|
52
|
+
7. 🏆 Distribute by Vote (NEW!)
|
|
53
|
+
8. 💰 Distribute Manually
|
|
54
|
+
|
|
55
|
+
═══ QUICK TESTS ═══
|
|
56
|
+
9. 🚀 Full Voting Test (Auto)
|
|
57
|
+
10. 🎲 3-Way Tie Test
|
|
58
|
+
|
|
59
|
+
0. ❌ Exit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🎯 **How to Use**
|
|
65
|
+
|
|
66
|
+
### **Option 1: Manual Step-by-Step**
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
1. Run: npm run cli
|
|
70
|
+
2. Select: 1 (List Wallets)
|
|
71
|
+
→ See all demo wallets
|
|
72
|
+
3. Select: 3 (Create Game)
|
|
73
|
+
→ Enter buy-in, players, etc.
|
|
74
|
+
4. Select: 5 (Join Game) multiple times
|
|
75
|
+
→ Alice, Bob, Charlie join
|
|
76
|
+
5. Select: 4 (Get Game Info)
|
|
77
|
+
→ See player addresses
|
|
78
|
+
6. Select: 6 (Cast Vote) multiple times
|
|
79
|
+
→ Each player votes
|
|
80
|
+
7. Select: 7 (Distribute by Vote)
|
|
81
|
+
→ Winner determined democratically!
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### **Option 2: Automated Tests**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
1. Run: npm run cli
|
|
88
|
+
2. Select: 9 (Full Voting Test)
|
|
89
|
+
→ Runs complete flow automatically!
|
|
90
|
+
→ Creates game
|
|
91
|
+
→ Players join
|
|
92
|
+
→ Players vote
|
|
93
|
+
→ Distributes by vote
|
|
94
|
+
→ Shows results!
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### **Option 3: Tie Testing**
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
1. Run: npm run cli
|
|
101
|
+
2. Select: 10 (3-Way Tie Test)
|
|
102
|
+
→ Tests equal split scenario
|
|
103
|
+
→ Each player votes for themselves
|
|
104
|
+
→ All 3 tied at 1 vote
|
|
105
|
+
→ Prize split 3 ways!
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 📊 **What Each Option Does:**
|
|
111
|
+
|
|
112
|
+
### **1. List Demo Wallets**
|
|
113
|
+
```
|
|
114
|
+
Shows:
|
|
115
|
+
- Creator: address (balance)
|
|
116
|
+
- Alice: address (balance)
|
|
117
|
+
- Bob: address (balance)
|
|
118
|
+
- etc.
|
|
119
|
+
|
|
120
|
+
Auto-saves addresses for voting!
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### **2. Airdrop SOL**
|
|
124
|
+
```
|
|
125
|
+
Enter player name → Airdrops 2 SOL
|
|
126
|
+
Useful for funding test wallets
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### **3. Create Game**
|
|
130
|
+
```
|
|
131
|
+
Prompts for:
|
|
132
|
+
- Creator name
|
|
133
|
+
- Buy-in amount
|
|
134
|
+
- Max players
|
|
135
|
+
- Operator fee
|
|
136
|
+
- Operator player
|
|
137
|
+
|
|
138
|
+
Auto-saves game ID!
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### **4. Get Game Info**
|
|
142
|
+
```
|
|
143
|
+
Shows:
|
|
144
|
+
- Players list
|
|
145
|
+
- Pot amount
|
|
146
|
+
- Votes cast
|
|
147
|
+
- Voting status
|
|
148
|
+
- Majority progress
|
|
149
|
+
|
|
150
|
+
Auto-saves player addresses!
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### **5. Player Joins**
|
|
154
|
+
```
|
|
155
|
+
Enter:
|
|
156
|
+
- Player name (alice/bob/etc.)
|
|
157
|
+
- Game ID (uses current game)
|
|
158
|
+
|
|
159
|
+
Player joins game automatically!
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### **6. Cast Vote** 🗳️
|
|
163
|
+
```
|
|
164
|
+
Enter:
|
|
165
|
+
- Voter name
|
|
166
|
+
- Game ID
|
|
167
|
+
- Address to vote for (shows saved addresses!)
|
|
168
|
+
|
|
169
|
+
Vote cast on blockchain!
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### **7. Distribute by Vote** 🗳️
|
|
173
|
+
```
|
|
174
|
+
Enter:
|
|
175
|
+
- Game ID
|
|
176
|
+
|
|
177
|
+
Distributes based on votes!
|
|
178
|
+
Shows:
|
|
179
|
+
- Winners
|
|
180
|
+
- Vote counts
|
|
181
|
+
- Transaction signature
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### **8. Distribute Manually**
|
|
185
|
+
```
|
|
186
|
+
Enter:
|
|
187
|
+
- Game ID
|
|
188
|
+
- Winner addresses (comma-separated)
|
|
189
|
+
|
|
190
|
+
Creator chooses winners manually
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### **9. Full Voting Test** ⚡
|
|
194
|
+
```
|
|
195
|
+
Automated test:
|
|
196
|
+
✅ Creates game
|
|
197
|
+
✅ Alice & Bob join
|
|
198
|
+
✅ Creator votes for Alice
|
|
199
|
+
✅ Alice votes for herself (majority!)
|
|
200
|
+
✅ Distributes by vote
|
|
201
|
+
✅ Shows results
|
|
202
|
+
|
|
203
|
+
Perfect for quick testing!
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### **10. 3-Way Tie Test** ⚡
|
|
207
|
+
```
|
|
208
|
+
Automated test:
|
|
209
|
+
✅ Creates game
|
|
210
|
+
✅ 3 players join
|
|
211
|
+
✅ Each votes for themselves
|
|
212
|
+
✅ All tied at 1 vote
|
|
213
|
+
✅ Prize split equally!
|
|
214
|
+
|
|
215
|
+
Tests tie handling!
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 🎨 **Color Coding**
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
✅ Green = Success
|
|
224
|
+
❌ Red = Error
|
|
225
|
+
ℹ️ Blue = Info
|
|
226
|
+
🎮 Yellow = Game ID
|
|
227
|
+
📊 Cyan = JSON output
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## ⚙️ **Configuration**
|
|
233
|
+
|
|
234
|
+
### **Change Server URL:**
|
|
235
|
+
```bash
|
|
236
|
+
# Test against devnet (when Heroku is back)
|
|
237
|
+
DUBS_URL=https://dubs-server-dev-55d1fba09a97.herokuapp.com npm run cli
|
|
238
|
+
|
|
239
|
+
# Test locally (default)
|
|
240
|
+
npm run cli
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 🧪 **Testing Workflows**
|
|
246
|
+
|
|
247
|
+
### **Quick Smoke Test:**
|
|
248
|
+
```
|
|
249
|
+
1. npm run cli
|
|
250
|
+
2. Select: 9 (Full Voting Test)
|
|
251
|
+
3. Watch it run!
|
|
252
|
+
4. Done! ✅
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### **Manual Testing:**
|
|
256
|
+
```
|
|
257
|
+
1. List wallets (option 1)
|
|
258
|
+
2. Create game (option 3)
|
|
259
|
+
3. Join with multiple players (option 5)
|
|
260
|
+
4. Get game info to see addresses (option 4)
|
|
261
|
+
5. Cast votes (option 6)
|
|
262
|
+
6. Distribute by vote (option 7)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### **Tie Testing:**
|
|
266
|
+
```
|
|
267
|
+
1. Select: 10 (3-Way Tie Test)
|
|
268
|
+
2. Watch equal split in action!
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 🎯 **Pro Tips**
|
|
274
|
+
|
|
275
|
+
### **Game ID Auto-Save:**
|
|
276
|
+
```
|
|
277
|
+
Create a game → Game ID saved automatically
|
|
278
|
+
Future prompts → Press Enter to use current game
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### **Address Auto-Save:**
|
|
282
|
+
```
|
|
283
|
+
Get game info → Player addresses saved
|
|
284
|
+
Cast vote → Shows saved addresses to choose from
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### **Pretty Output:**
|
|
288
|
+
```
|
|
289
|
+
All JSON responses formatted beautifully
|
|
290
|
+
Color-coded for easy reading
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 🚀 **Usage Examples**
|
|
296
|
+
|
|
297
|
+
### **Example 1: Test Voting**
|
|
298
|
+
```bash
|
|
299
|
+
$ npm run cli
|
|
300
|
+
|
|
301
|
+
Select: 9
|
|
302
|
+
→ Full automated voting test runs
|
|
303
|
+
→ Alice wins by majority vote!
|
|
304
|
+
→ Results displayed beautifully
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
### **Example 2: Custom Game**
|
|
308
|
+
```bash
|
|
309
|
+
$ npm run cli
|
|
310
|
+
|
|
311
|
+
Select: 3 (Create Game)
|
|
312
|
+
Buy-in: 1.0
|
|
313
|
+
Max players: 4
|
|
314
|
+
|
|
315
|
+
Select: 5 (Join) - Alice
|
|
316
|
+
Select: 5 (Join) - Bob
|
|
317
|
+
Select: 5 (Join) - Charlie
|
|
318
|
+
|
|
319
|
+
Select: 4 (Game Info)
|
|
320
|
+
→ Copy addresses
|
|
321
|
+
|
|
322
|
+
Select: 6 (Vote) - Creator votes for Alice
|
|
323
|
+
Select: 6 (Vote) - Alice votes for Alice
|
|
324
|
+
Select: 6 (Vote) - Bob votes for Charlie
|
|
325
|
+
|
|
326
|
+
Select: 7 (Distribute by Vote)
|
|
327
|
+
→ Alice wins!
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## 📦 **Requirements**
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
Node.js 20.x (already have it!)
|
|
336
|
+
npm packages: (already installed!)
|
|
337
|
+
- node-fetch (built-in in Node 18+)
|
|
338
|
+
- readline (built-in)
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**No additional dependencies!**
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## 🎊 **Why This is Awesome**
|
|
346
|
+
|
|
347
|
+
```
|
|
348
|
+
✅ No Postman (AWS down anyway!)
|
|
349
|
+
✅ No manual curl commands
|
|
350
|
+
✅ Beautiful interactive menu
|
|
351
|
+
✅ Auto-saves everything
|
|
352
|
+
✅ Color-coded output
|
|
353
|
+
✅ Automated test scenarios
|
|
354
|
+
✅ Error handling
|
|
355
|
+
✅ Production-quality tool
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## 🎮 **Ready to Test!**
|
|
361
|
+
|
|
362
|
+
```bash
|
|
363
|
+
cd /Users/adamdahan/Developer/iheartsolana/solana-programs/dubs-server
|
|
364
|
+
npm run cli
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Select option 9 for instant voting test! 🗳️🚀**
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
**Enjoy your new CLI tool! 🎉**
|
|
372
|
+
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Cohort Retention Analysis - Implementation Plan
|
|
2
|
+
|
|
3
|
+
## Executive Summary
|
|
4
|
+
|
|
5
|
+
✅ **Cohort retention analysis is FEASIBLE** with current production data!
|
|
6
|
+
|
|
7
|
+
**Production Database Status:**
|
|
8
|
+
- **Total Users**: 19 registered users
|
|
9
|
+
- **Data Range**: Dec 14, 2025 - Jan 1, 2026 (17 days)
|
|
10
|
+
- **Registration Events**: 31 events tracked
|
|
11
|
+
- **Cohort Grouping**: Weekly cohorts working perfectly
|
|
12
|
+
|
|
13
|
+
## Current Data Structure
|
|
14
|
+
|
|
15
|
+
### Registration Events (audit_logs table)
|
|
16
|
+
```sql
|
|
17
|
+
SELECT
|
|
18
|
+
log_type,
|
|
19
|
+
user_id,
|
|
20
|
+
created_at,
|
|
21
|
+
metadata
|
|
22
|
+
FROM audit_logs
|
|
23
|
+
WHERE log_type IN ('registration_started', 'registration_completed', 'registration_submitted')
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Key Fields:**
|
|
27
|
+
- `user_id`: Wallet address (unique identifier)
|
|
28
|
+
- `created_at`: Timestamp of registration
|
|
29
|
+
- `metadata`: JSON with additional context (referralCode, username, etc.)
|
|
30
|
+
|
|
31
|
+
### Sample Cohort Retention Data (Production)
|
|
32
|
+
|
|
33
|
+
| Cohort Week | Users | D1 Users | D1% | D7 Users | D7% | D14 Users | D14% | D30 Users | D30% |
|
|
34
|
+
|-------------|-------|----------|-----|----------|-----|-----------|------|-----------|------|
|
|
35
|
+
| Dec 29, 2025 | 4 | 4 | 100.0% | 0 | 0.0% | 0 | 0.0% | 0 | 0.0% |
|
|
36
|
+
| Dec 22, 2025 | 9 | 5 | 55.6% | 0 | 0.0% | 0 | 0.0% | 0 | 0.0% |
|
|
37
|
+
| Dec 15, 2025 | 5 | 2 | 40.0% | 4 | 80.0% | 4 | 80.0% | 0 | 0.0% |
|
|
38
|
+
| Dec 8, 2025 | 1 | 1 | 100.0% | 1 | 100.0% | 1 | 100.0% | 0 | 0.0% |
|
|
39
|
+
|
|
40
|
+
## Metrics We Can Deliver
|
|
41
|
+
|
|
42
|
+
Based on your community manager's requirements:
|
|
43
|
+
|
|
44
|
+
### 1. **signup_cohort** ✅
|
|
45
|
+
- Weekly cohorts: `DATE_TRUNC('week', signup_date)`
|
|
46
|
+
- Monthly cohorts: `DATE_TRUNC('month', signup_date)`
|
|
47
|
+
- Format: "Week of Jan 1, 2026" or "January 2026"
|
|
48
|
+
|
|
49
|
+
### 2. **signup_date_range** ✅
|
|
50
|
+
- Weekly: "Jan 1-7, 2026"
|
|
51
|
+
- Monthly: "January 2026"
|
|
52
|
+
|
|
53
|
+
### 3. **total_signups** ✅
|
|
54
|
+
- Count of unique users who completed registration in cohort period
|
|
55
|
+
|
|
56
|
+
### 4. **d1_users, d1_pct** ✅
|
|
57
|
+
- Users who returned on Day 1 (24-48 hours after signup)
|
|
58
|
+
- Percentage: `(d1_users / total_signups) * 100`
|
|
59
|
+
|
|
60
|
+
### 5. **d7_users, d7_pct** ✅
|
|
61
|
+
- Users who returned on Day 7 (7-8 days after signup)
|
|
62
|
+
- Percentage: `(d7_users / total_signups) * 100`
|
|
63
|
+
|
|
64
|
+
### 6. **d14_users, d14_pct** ✅
|
|
65
|
+
- Users who returned on Day 14 (14-15 days after signup)
|
|
66
|
+
- Percentage: `(d14_users / total_signups) * 100`
|
|
67
|
+
|
|
68
|
+
### 7. **d30_users, d30_pct** ✅
|
|
69
|
+
- Users who returned on Day 30 (30-31 days after signup)
|
|
70
|
+
- Percentage: `(d30_users / total_signups) * 100`
|
|
71
|
+
|
|
72
|
+
### 8. **source** ⚠️ (Limited)
|
|
73
|
+
- Currently tracking: `metadata->>'hasReferralCode'`
|
|
74
|
+
- Can add: Referral code, UTM parameters, invite source
|
|
75
|
+
- **Recommendation**: Enhance registration tracking to capture source
|
|
76
|
+
|
|
77
|
+
## SQL Query for Cohort Retention
|
|
78
|
+
|
|
79
|
+
```sql
|
|
80
|
+
WITH signups AS (
|
|
81
|
+
-- Get first registration event per user
|
|
82
|
+
SELECT
|
|
83
|
+
user_id,
|
|
84
|
+
MIN(DATE(created_at)) as signup_date,
|
|
85
|
+
MIN(metadata->>'referralCode') as referral_code
|
|
86
|
+
FROM audit_logs
|
|
87
|
+
WHERE log_type = 'registration_completed'
|
|
88
|
+
AND user_id IS NOT NULL
|
|
89
|
+
GROUP BY user_id
|
|
90
|
+
),
|
|
91
|
+
weekly_cohorts AS (
|
|
92
|
+
-- Group signups into weekly cohorts
|
|
93
|
+
SELECT
|
|
94
|
+
DATE_TRUNC('week', signup_date) as cohort_week,
|
|
95
|
+
user_id,
|
|
96
|
+
signup_date,
|
|
97
|
+
CASE
|
|
98
|
+
WHEN referral_code IS NOT NULL THEN 'referral'
|
|
99
|
+
ELSE 'organic'
|
|
100
|
+
END as source
|
|
101
|
+
FROM signups
|
|
102
|
+
),
|
|
103
|
+
user_activity AS (
|
|
104
|
+
-- Get all user activity after signup
|
|
105
|
+
SELECT
|
|
106
|
+
wc.cohort_week,
|
|
107
|
+
wc.user_id,
|
|
108
|
+
wc.signup_date,
|
|
109
|
+
wc.source,
|
|
110
|
+
DATE(al.created_at) as activity_date,
|
|
111
|
+
al.created_at - wc.signup_date as time_since_signup
|
|
112
|
+
FROM weekly_cohorts wc
|
|
113
|
+
LEFT JOIN audit_logs al ON al.user_id = wc.user_id
|
|
114
|
+
AND DATE(al.created_at) >= wc.signup_date
|
|
115
|
+
),
|
|
116
|
+
retention_calc AS (
|
|
117
|
+
-- Calculate retention metrics
|
|
118
|
+
SELECT
|
|
119
|
+
cohort_week,
|
|
120
|
+
source,
|
|
121
|
+
COUNT(DISTINCT user_id) as total_users,
|
|
122
|
+
-- Day 1 retention (24-48 hours)
|
|
123
|
+
COUNT(DISTINCT CASE
|
|
124
|
+
WHEN time_since_signup >= INTERVAL '1 day'
|
|
125
|
+
AND time_since_signup < INTERVAL '2 days'
|
|
126
|
+
THEN user_id
|
|
127
|
+
END) as d1_users,
|
|
128
|
+
-- Day 7 retention (7-8 days)
|
|
129
|
+
COUNT(DISTINCT CASE
|
|
130
|
+
WHEN time_since_signup >= INTERVAL '7 days'
|
|
131
|
+
AND time_since_signup < INTERVAL '8 days'
|
|
132
|
+
THEN user_id
|
|
133
|
+
END) as d7_users,
|
|
134
|
+
-- Day 14 retention (14-15 days)
|
|
135
|
+
COUNT(DISTINCT CASE
|
|
136
|
+
WHEN time_since_signup >= INTERVAL '14 days'
|
|
137
|
+
AND time_since_signup < INTERVAL '15 days'
|
|
138
|
+
THEN user_id
|
|
139
|
+
END) as d14_users,
|
|
140
|
+
-- Day 30 retention (30-31 days)
|
|
141
|
+
COUNT(DISTINCT CASE
|
|
142
|
+
WHEN time_since_signup >= INTERVAL '30 days'
|
|
143
|
+
AND time_since_signup < INTERVAL '31 days'
|
|
144
|
+
THEN user_id
|
|
145
|
+
END) as d30_users
|
|
146
|
+
FROM user_activity
|
|
147
|
+
GROUP BY cohort_week, source
|
|
148
|
+
)
|
|
149
|
+
SELECT
|
|
150
|
+
cohort_week as signup_cohort,
|
|
151
|
+
TO_CHAR(cohort_week, 'Mon DD') || ' - ' || TO_CHAR(cohort_week + INTERVAL '6 days', 'Mon DD, YYYY') as signup_date_range,
|
|
152
|
+
total_users as total_signups,
|
|
153
|
+
d1_users,
|
|
154
|
+
ROUND(100.0 * d1_users / NULLIF(total_users, 0), 1) as d1_pct,
|
|
155
|
+
d7_users,
|
|
156
|
+
ROUND(100.0 * d7_users / NULLIF(total_users, 0), 1) as d7_pct,
|
|
157
|
+
d14_users,
|
|
158
|
+
ROUND(100.0 * d14_users / NULLIF(total_users, 0), 1) as d14_pct,
|
|
159
|
+
d30_users,
|
|
160
|
+
ROUND(100.0 * d30_users / NULLIF(total_users, 0), 1) as d30_pct,
|
|
161
|
+
source
|
|
162
|
+
FROM retention_calc
|
|
163
|
+
WHERE total_users > 0
|
|
164
|
+
ORDER BY cohort_week DESC, source;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Implementation Plan
|
|
168
|
+
|
|
169
|
+
### Phase 1: Backend API Endpoint ✅ READY
|
|
170
|
+
**File**: `routes/analyticsRoutes.js`
|
|
171
|
+
|
|
172
|
+
**Endpoint**: `GET /api/analytics/cohort-retention`
|
|
173
|
+
|
|
174
|
+
**Query Parameters**:
|
|
175
|
+
- `period`: 'weekly' | 'monthly' (default: 'weekly')
|
|
176
|
+
- `source`: 'all' | 'organic' | 'referral' (default: 'all')
|
|
177
|
+
- `limit`: number (default: 12 cohorts)
|
|
178
|
+
|
|
179
|
+
**Response**:
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"success": true,
|
|
183
|
+
"period": "weekly",
|
|
184
|
+
"cohorts": [
|
|
185
|
+
{
|
|
186
|
+
"signup_cohort": "2025-12-29T00:00:00.000Z",
|
|
187
|
+
"signup_date_range": "Dec 29 - Jan 04, 2026",
|
|
188
|
+
"total_signups": 4,
|
|
189
|
+
"d1_users": 4,
|
|
190
|
+
"d1_pct": 100.0,
|
|
191
|
+
"d7_users": 0,
|
|
192
|
+
"d7_pct": 0.0,
|
|
193
|
+
"d14_users": 0,
|
|
194
|
+
"d14_pct": 0.0,
|
|
195
|
+
"d30_users": 0,
|
|
196
|
+
"d30_pct": 0.0,
|
|
197
|
+
"source": "all"
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Phase 2: Frontend Dashboard Component
|
|
204
|
+
**File**: `dubs-jackpot-spa/app/v2/components/overlay/AnalyticsDashboard.tsx`
|
|
205
|
+
|
|
206
|
+
**Features**:
|
|
207
|
+
1. Cohort retention table (like examples provided)
|
|
208
|
+
2. Period selector (weekly/monthly)
|
|
209
|
+
3. Source filter (all/organic/referral)
|
|
210
|
+
4. CSV export button
|
|
211
|
+
5. Visual retention heatmap (color-coded percentages)
|
|
212
|
+
|
|
213
|
+
### Phase 3: CSV Export
|
|
214
|
+
**Format**: Matches community manager's requirements exactly
|
|
215
|
+
|
|
216
|
+
```csv
|
|
217
|
+
signup_cohort,signup_date_range,total_signups,d1_users,d1_pct,d7_users,d7_pct,d14_users,d14_pct,d30_users,d30_pct,source
|
|
218
|
+
"Week of Dec 29, 2025","Dec 29 - Jan 04, 2026",4,4,100.0,0,0.0,0,0.0,0,0.0,all
|
|
219
|
+
"Week of Dec 22, 2025","Dec 22 - Dec 28, 2025",9,5,55.6,0,0.0,0,0.0,0,0.0,all
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Analysis Scripts
|
|
223
|
+
|
|
224
|
+
### Development Database
|
|
225
|
+
```bash
|
|
226
|
+
cd /Users/adamdahan/Developer/iheartsolana/solana-programs/dubs-server
|
|
227
|
+
node scripts/analyze-cohort-data.js
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Production Database (Heroku)
|
|
231
|
+
```bash
|
|
232
|
+
cd /Users/adamdahan/Developer/iheartsolana/solana-programs/dubs-server
|
|
233
|
+
bash scripts/analyze-prod-cohorts.sh
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Recommendations
|
|
237
|
+
|
|
238
|
+
### 1. **Enhance Source Tracking** 🎯
|
|
239
|
+
Add to registration events:
|
|
240
|
+
```javascript
|
|
241
|
+
analytics.track('registration_completed', 'USER', {
|
|
242
|
+
username,
|
|
243
|
+
hasReferralCode: !!referralCode,
|
|
244
|
+
referralCode: referralCode || null,
|
|
245
|
+
// NEW: Add these
|
|
246
|
+
source: 'telegram' | 'twitter' | 'direct' | 'referral',
|
|
247
|
+
utm_source: params.get('utm_source'),
|
|
248
|
+
utm_medium: params.get('utm_medium'),
|
|
249
|
+
utm_campaign: params.get('utm_campaign'),
|
|
250
|
+
});
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 2. **Define "Active" User** 📊
|
|
254
|
+
Currently using ANY event as activity. Consider defining specific engagement events:
|
|
255
|
+
- Game created
|
|
256
|
+
- Game joined
|
|
257
|
+
- Bet placed
|
|
258
|
+
- Chat message sent
|
|
259
|
+
- Friend added
|
|
260
|
+
|
|
261
|
+
### 3. **Add Cohort Comparison** 📈
|
|
262
|
+
Compare cohorts side-by-side:
|
|
263
|
+
- Week 1 vs Week 2 retention curves
|
|
264
|
+
- Organic vs Referral retention
|
|
265
|
+
- Monthly trend analysis
|
|
266
|
+
|
|
267
|
+
### 4. **Automated Reports** 📧
|
|
268
|
+
Schedule weekly cohort reports for community manager:
|
|
269
|
+
- Email with CSV attachment
|
|
270
|
+
- Slack notification with key metrics
|
|
271
|
+
- Dashboard link
|
|
272
|
+
|
|
273
|
+
## Next Steps
|
|
274
|
+
|
|
275
|
+
1. ✅ **Data Analysis Complete** - Verified production data
|
|
276
|
+
2. 🔄 **Create API Endpoint** - `/api/analytics/cohort-retention`
|
|
277
|
+
3. 🔄 **Build Dashboard UI** - Cohort table in AnalyticsDashboard
|
|
278
|
+
4. 🔄 **Add CSV Export** - Download button for community manager
|
|
279
|
+
5. ⏳ **Test with Real Data** - Validate with production database
|
|
280
|
+
6. ⏳ **Deploy to Production** - Push to Heroku
|
|
281
|
+
|
|
282
|
+
## Questions for Community Manager
|
|
283
|
+
|
|
284
|
+
1. **Cohort Period**: Weekly or monthly preferred?
|
|
285
|
+
2. **Retention Definition**: Any activity, or specific actions (games played, bets placed)?
|
|
286
|
+
3. **Source Tracking**: What sources should we track? (Telegram, Twitter, Referrals, etc.)
|
|
287
|
+
4. **Export Format**: CSV sufficient, or need Google Sheets integration?
|
|
288
|
+
5. **Automated Reports**: Want scheduled reports? (Daily, weekly, monthly?)
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
**Status**: ✅ Ready to implement
|
|
293
|
+
**Estimated Time**: 4-6 hours for full implementation
|
|
294
|
+
**Dependencies**: None - all data available in production database
|
|
295
|
+
|