Repository navigation
Expand file tree
/
Copy pathRestaurant_Dashboard_Analysis.html
More file actions
1761 lines (1581 loc) · 79.6 KB
/
Copy pathRestaurant_Dashboard_Analysis.html
File metadata and controls
1761 lines (1581 loc) · 79.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SipSync Restaurant Analytics Dashboard - Comprehensive Analysis</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: #333;
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
background-color: #f5f5f5;
}
.container {
background-color: white;
padding: 60px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
header {
text-align: center;
margin-bottom: 50px;
padding-bottom: 30px;
border-bottom: 3px solid #8b0000;
}
h1 {
color: #8b0000;
font-size: 42px;
margin: 0 0 15px 0;
font-weight: 700;
}
.subtitle {
color: #666;
font-size: 18px;
font-style: italic;
}
.meta {
margin-top: 20px;
color: #999;
font-size: 14px;
}
h2 {
color: #8b0000;
font-size: 32px;
margin: 50px 0 20px 0;
padding-bottom: 10px;
border-bottom: 2px solid #ddd;
}
h3 {
color: #a10000;
font-size: 24px;
margin: 35px 0 15px 0;
}
h4 {
color: #333;
font-size: 18px;
margin: 25px 0 10px 0;
font-weight: 600;
}
p {
margin: 15px 0;
text-align: justify;
}
ul, ol {
margin: 15px 0;
padding-left: 30px;
}
li {
margin: 8px 0;
}
.section {
margin: 40px 0;
}
.highlight-box {
background-color: #fff9e6;
border-left: 4px solid #d4af37;
padding: 20px;
margin: 25px 0;
border-radius: 4px;
}
.warning-box {
background-color: #fff0f0;
border-left: 4px solid #8b0000;
padding: 20px;
margin: 25px 0;
border-radius: 4px;
}
.success-box {
background-color: #f0fff4;
border-left: 4px solid #2d7f2d;
padding: 20px;
margin: 25px 0;
border-radius: 4px;
}
table {
width: 100%;
border-collapse: collapse;
margin: 25px 0;
font-size: 14px;
}
th, td {
border: 1px solid #ddd;
padding: 12px;
text-align: left;
}
th {
background-color: #8b0000;
color: white;
font-weight: 600;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
.pros-cons {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 25px 0;
}
.pros, .cons {
padding: 20px;
border-radius: 6px;
}
.pros {
background-color: #f0fff4;
border: 2px solid #2d7f2d;
}
.cons {
background-color: #fff0f0;
border: 2px solid #cc0000;
}
.pros h4 {
color: #2d7f2d;
margin-top: 0;
}
.cons h4 {
color: #cc0000;
margin-top: 0;
}
code {
background-color: #f4f4f4;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 13px;
}
pre {
background-color: #f4f4f4;
padding: 15px;
border-radius: 6px;
overflow-x: auto;
font-size: 13px;
line-height: 1.4;
}
.page-break {
page-break-after: always;
}
.cost-breakdown {
background-color: #f9f9f9;
padding: 20px;
border-radius: 6px;
margin: 25px 0;
}
.phase-box {
background-color: #e6f3ff;
border: 2px solid #4169e1;
padding: 20px;
margin: 20px 0;
border-radius: 6px;
}
.recommendation {
background: linear-gradient(135deg, #8b0000 0%, #a10000 100%);
color: white;
padding: 25px;
border-radius: 8px;
margin: 30px 0;
}
.recommendation h3 {
color: white;
margin-top: 0;
}
@media print {
body {
background-color: white;
padding: 0;
}
.container {
box-shadow: none;
padding: 40px;
}
h2 {
page-break-after: avoid;
}
.section {
page-break-inside: avoid;
}
.pros-cons {
page-break-inside: avoid;
}
}
</style>
</head>
<body>
<div class="container">
<!-- Header -->
<header>
<h1>SipSync Restaurant Analytics Dashboard</h1>
<p class="subtitle">Comprehensive Feasibility Analysis & Implementation Plan</p>
<div class="meta">
<p>Document Date: February 1, 2026</p>
<p>Analysis Type: Technical Architecture, Cost-Benefit, Implementation Roadmap</p>
</div>
</header>
<!-- Executive Summary -->
<section class="section">
<h2>Executive Summary</h2>
<div class="highlight-box">
<p><strong>Bottom Line:</strong> Building a restaurant analytics dashboard for SipSync is <strong>highly feasible</strong> and represents a strategic opportunity to transition from a consumer-only platform to a B2B SaaS model. The existing infrastructure provides a foundation, but significant backend development is required for restaurant authentication, event tracking, and analytics aggregation.</p>
</div>
<h3>Key Findings</h3>
<ul>
<li><strong>Current State:</strong> SipSync currently tracks only saved wine pairings (user → restaurant interactions), with no restaurant-facing analytics, authentication, or sales tracking.</li>
<li><strong>Foundation Exists:</strong> Basic analytics endpoints are implemented (<code>/api/analytics</code>), wine/restaurant data models are mature, and Firebase Firestore provides flexible schema for expansion.</li>
<li><strong>Major Gaps:</strong> No restaurant authentication, no event tracking (views, searches), no sales/transaction data, no restaurant ownership model.</li>
<li><strong>Development Effort:</strong> Estimated 8-12 weeks for Phase 1 (authentication + basic analytics), with additional 4-6 weeks for advanced features (sales tracking, inventory management).</li>
<li><strong>Cost:</strong> Firebase costs remain minimal ($50-200/month for moderate scale), primary investment is development time (~$40-60k for full implementation).</li>
</ul>
<h3>Recommended Approach</h3>
<p>Implement a <strong>phased rollout</strong> starting with restaurant authentication and engagement analytics (no sales tracking initially), then add POS integration and inventory management as optional premium features. Focus on daily batch-processed dashboards to minimize Firebase query costs.</p>
<div class="recommendation">
<h3>Recommended Phase 1 (MVP)</h3>
<ul>
<li>Restaurant authentication system (email + password)</li>
<li>Basic analytics dashboard (engagement metrics from existing data)</li>
<li>Event tracking for wine list views and QR code scans</li>
<li>Daily aggregated reports (cached data, low cost)</li>
<li>Industry benchmarks (anonymized comparison data)</li>
</ul>
<p><strong>Timeline:</strong> 8-10 weeks | <strong>Cost:</strong> $40-50k development</p>
</div>
</section>
<div class="page-break"></div>
<!-- Current Infrastructure Assessment -->
<section class="section">
<h2>1. Current Infrastructure Assessment</h2>
<h3>What Already Exists</h3>
<h4>Database Structure (Firebase Firestore)</h4>
<pre><code>restaurants/{restaurantId}
├── name, city, location, qrCodeUrl, createdAt
├── wines/{wineId} (subcollection)
│ └── name, type, acidity, tannins, bodyWeight, flavorProfile,
│ sweetnessLevel, price, inventoryStatus, createdAt
├── foodItems/{foodItemId} (subcollection)
│ └── name, description, category, createdAt
└── pairings/{pairingId} (subcollection)
└── wineId, foodItemId, pairingScore, pairingReason, createdAt
users/{userId} (userId = phone number)
├── phoneNumber, name, createdAt
├── quizProfile, quizCompletedAt
├── savedPreferences[]
└── pairing_history/{historyId} (subcollection)
└── restaurantId, restaurantName, wineId, wineName,
foodItemId, foodName, matchScore, saved_at, notes</code></pre>
<h4>Existing API Endpoints</h4>
<table>
<thead>
<tr>
<th>Endpoint</th>
<th>Purpose</th>
<th>Relevant to Dashboard?</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>GET /api/analytics/restaurant-stats</code></td>
<td>Platform-wide statistics</td>
<td>Yes - needs per-restaurant filtering</td>
</tr>
<tr>
<td><code>GET /api/analytics/popular-wines</code></td>
<td>Most matched wines across platform</td>
<td>Yes - needs per-restaurant filtering</td>
</tr>
<tr>
<td><code>GET /api/analytics/preference-trends</code></td>
<td>User preference aggregations</td>
<td>Yes - can show customer preference trends</td>
</tr>
<tr>
<td><code>POST /api/pairings/save-pairing</code></td>
<td>User saves wine pairing to history</td>
<td>Yes - primary engagement metric</td>
</tr>
<tr>
<td><code>GET /api/auth/user/:userId/visited-restaurants</code></td>
<td>User's restaurant visits</td>
<td>Yes - can derive visit frequency</td>
</tr>
</tbody>
</table>
<h4>What Data Is Currently Tracked</h4>
<ul>
<li><strong>User Pairing Saves:</strong> When a user saves a wine recommendation, stored in <code>users/{userId}/pairing_history</code> with restaurantId, wineId, matchScore, timestamp</li>
<li><strong>User Preferences:</strong> Quiz results and manual slider adjustments stored per user</li>
<li><strong>Match Scores:</strong> Algorithmic compatibility scores calculated in real-time (not persisted)</li>
<li><strong>Wine Catalog:</strong> All wines per restaurant with characteristics and pricing</li>
</ul>
<h4>Critical Gaps</h4>
<div class="warning-box">
<h4>What's Missing for Restaurant Analytics</h4>
<ul>
<li><strong>Restaurant Authentication:</strong> No way for restaurants to log in or claim ownership</li>
<li><strong>Event Tracking:</strong> Wine list views, search queries, QR code scans not logged</li>
<li><strong>Sales/Transaction Data:</strong> No commerce, no revenue tracking</li>
<li><strong>Inventory Management:</strong> No stock levels, reorder alerts, or availability tracking</li>
<li><strong>Restaurant Ownership Model:</strong> No concept of restaurant "accounts" or user roles</li>
<li><strong>Aggregated Analytics:</strong> All analytics calculated on-demand (expensive at scale)</li>
</ul>
</div>
</section>
<div class="page-break"></div>
<!-- Restaurant Authentication System -->
<section class="section">
<h2>2. Restaurant Authentication System</h2>
<p>To enable restaurant dashboards, a complete authentication system must be built from scratch. This is a prerequisite for all other features.</p>
<h3>Architecture Overview</h3>
<h4>Database Schema Changes</h4>
<pre><code>restaurant_users/{restaurantUserId}
├── email: String (unique)
├── passwordHash: String (bcrypt hashed)
├── name: String
├── role: String (owner, manager, staff)
├── restaurantId: String (reference to restaurants collection)
├── createdAt: Timestamp
├── lastLoginAt: Timestamp
├── isActive: Boolean
└── permissions: Array (viewAnalytics, editWines, manageUsers, etc.)
restaurants/{restaurantId}
├── (existing fields)
├── ownerUserId: String (reference to restaurant_users)
├── claimedAt: Timestamp
├── accountStatus: String (active, suspended, pending)
└── subscriptionTier: String (free, basic, premium)</code></pre>
<h4>Authentication Flow</h4>
<ol>
<li><strong>Restaurant Sign-Up:</strong>
<ul>
<li>Restaurant owner provides email, password, restaurant name</li>
<li>System creates <code>restaurant_users</code> document</li>
<li>Send email verification link</li>
<li>Upon verification, allow restaurant claiming process</li>
</ul>
</li>
<li><strong>Restaurant Claiming:</strong>
<ul>
<li>Owner searches for their restaurant in existing <code>restaurants</code> collection</li>
<li>System verifies ownership (manual approval or verification code displayed at physical location)</li>
<li>Link <code>restaurantUserId</code> to <code>restaurants/{restaurantId}</code></li>
<li>Grant dashboard access</li>
</ul>
</li>
<li><strong>Login:</strong>
<ul>
<li>Email + password authentication</li>
<li>Generate JWT token with restaurantId and permissions</li>
<li>Token expires after 7 days (configurable)</li>
</ul>
</li>
<li><strong>Multi-User Support:</strong>
<ul>
<li>Restaurant owner can invite additional users (managers, staff)</li>
<li>Role-based permissions control dashboard access</li>
<li>Owner can revoke access at any time</li>
</ul>
</li>
</ol>
<h4>New API Endpoints Required</h4>
<table>
<thead>
<tr>
<th>Endpoint</th>
<th>Method</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>/api/restaurant-auth/signup</code></td>
<td>POST</td>
<td>Create restaurant user account</td>
</tr>
<tr>
<td><code>/api/restaurant-auth/login</code></td>
<td>POST</td>
<td>Authenticate restaurant user, return JWT</td>
</tr>
<tr>
<td><code>/api/restaurant-auth/verify-email</code></td>
<td>GET</td>
<td>Verify email via token link</td>
</tr>
<tr>
<td><code>/api/restaurant-auth/claim-restaurant</code></td>
<td>POST</td>
<td>Link user to restaurant, request approval</td>
</tr>
<tr>
<td><code>/api/restaurant-auth/invite-user</code></td>
<td>POST</td>
<td>Restaurant owner invites additional users</td>
</tr>
<tr>
<td><code>/api/restaurant-auth/reset-password</code></td>
<td>POST</td>
<td>Password reset flow</td>
</tr>
</tbody>
</table>
<h4>Security Considerations</h4>
<ul>
<li><strong>Password Hashing:</strong> Use bcrypt with salt rounds = 10</li>
<li><strong>JWT Tokens:</strong> Sign with secret key, include restaurantId + role claims</li>
<li><strong>Rate Limiting:</strong> Prevent brute-force attacks on login endpoint</li>
<li><strong>Email Verification:</strong> Required before restaurant claiming</li>
<li><strong>Restaurant Verification:</strong> Manual approval or QR code scan at physical location to prevent fraudulent claims</li>
</ul>
<h4>Development Effort</h4>
<div class="cost-breakdown">
<p><strong>Backend Development:</strong> 2-3 weeks</p>
<ul>
<li>Authentication endpoints (signup, login, token refresh)</li>
<li>Email verification system</li>
<li>Restaurant claiming workflow</li>
<li>Role-based permission middleware</li>
</ul>
<p><strong>Frontend Development:</strong> 1-2 weeks</p>
<ul>
<li>Restaurant signup/login forms</li>
<li>Restaurant claiming interface</li>
<li>Dashboard shell with authentication gating</li>
</ul>
<p><strong>Total Effort:</strong> 3-5 weeks (~$15-25k at $500/day developer rate)</p>
</div>
</section>
<div class="page-break"></div>
<!-- Sales Tracking Analysis -->
<section class="section">
<h2>3. Sales Tracking Analysis</h2>
<p>Currently, SipSync has <strong>zero sales tracking</strong>. To provide meaningful revenue analytics, one of three approaches must be implemented. Each has significant trade-offs.</p>
<h3>Option A: Manual Sales Entry (No POS Integration)</h3>
<h4>How It Works</h4>
<p>Restaurants manually log wine sales through the dashboard interface at end of day or shift.</p>
<div class="pros-cons">
<div class="pros">
<h4>Pros</h4>
<ul>
<li>Simple to implement (just add form + database)</li>
<li>No integration complexity</li>
<li>Works for any restaurant regardless of POS system</li>
<li>Low development cost ($5-8k)</li>
<li>No ongoing API fees</li>
</ul>
</div>
<div class="cons">
<h4>Cons</h4>
<ul>
<li><strong>Major adoption barrier:</strong> Restaurants unlikely to manually enter data daily</li>
<li>Data accuracy issues (human error, forgetfulness)</li>
<li>Incomplete data (staff may skip days)</li>
<li>Time-consuming for restaurant staff</li>
<li>No real-time analytics (delayed by manual entry)</li>
</ul>
</div>
</div>
<h4>Technical Implementation</h4>
<pre><code>sales_transactions/{restaurantId}/transactions/{transactionId}
├── wineId: String
├── quantity: Number
├── pricePerBottle: Number
├── totalRevenue: Number
├── soldAt: Timestamp
├── enteredBy: String (restaurantUserId)
└── enteredAt: Timestamp</code></pre>
<h4>Dashboard Features</h4>
<ul>
<li>Quick entry form: select wine, enter quantity, auto-calculate revenue</li>
<li>Bulk import from CSV</li>
<li>Daily sales log with edit/delete capabilities</li>
<li>Revenue reports based on manually entered data</li>
</ul>
<h4>Realistic Assessment</h4>
<div class="warning-box">
<p><strong>Low Adoption Risk:</strong> Industry data suggests <strong>less than 20%</strong> of restaurants will consistently use manual entry systems. Restaurants are busy, understaffed, and unlikely to add daily data entry tasks. This approach is only viable if SipSync has dedicated account managers who follow up with restaurants to ensure compliance.</p>
</div>
<hr>
<h3>Option B: POS Integration (Automatic Sales Tracking)</h3>
<h4>How It Works</h4>
<p>SipSync integrates with popular restaurant POS systems (Square, Toast, Clover, TouchBistro, etc.) via their APIs to automatically pull wine sales data nightly.</p>
<div class="pros-cons">
<div class="pros">
<h4>Pros</h4>
<ul>
<li><strong>Zero manual effort</strong> from restaurants</li>
<li>100% data accuracy (direct from source)</li>
<li>Real-time or near-real-time analytics</li>
<li>High adoption potential (set it and forget it)</li>
<li>Competitive advantage (few wine apps offer this)</li>
<li>Enables advanced features (inventory sync, predictive reordering)</li>
</ul>
</div>
<div class="cons">
<h4>Cons</h4>
<ul>
<li><strong>Significant development complexity</strong> (3-6 months per integration)</li>
<li>Must build separate integrations for each POS system</li>
<li>Ongoing API maintenance (breaking changes, version updates)</li>
<li>Restaurant must use supported POS (limits addressable market)</li>
<li>OAuth setup burden for restaurants</li>
<li>Potential API rate limits and costs</li>
</ul>
</div>
</div>
<h4>Popular POS Systems & Integration Difficulty</h4>
<table>
<thead>
<tr>
<th>POS System</th>
<th>Market Share (US Restaurants)</th>
<th>API Quality</th>
<th>Integration Difficulty</th>
<th>Estimated Dev Time</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Square</strong></td>
<td>~15%</td>
<td>Excellent</td>
<td>Easy</td>
<td>3-4 weeks</td>
</tr>
<tr>
<td><strong>Toast</strong></td>
<td>~12%</td>
<td>Good</td>
<td>Medium</td>
<td>4-6 weeks</td>
</tr>
<tr>
<td><strong>Clover</strong></td>
<td>~8%</td>
<td>Good</td>
<td>Medium</td>
<td>4-6 weeks</td>
</tr>
<tr>
<td><strong>TouchBistro</strong></td>
<td>~5%</td>
<td>Fair</td>
<td>Hard</td>
<td>6-8 weeks</td>
</tr>
<tr>
<td><strong>Lightspeed</strong></td>
<td>~4%</td>
<td>Good</td>
<td>Medium</td>
<td>4-6 weeks</td>
</tr>
<tr>
<td><strong>Others/Custom</strong></td>
<td>~56%</td>
<td>Varies</td>
<td>N/A</td>
<td>N/A</td>
</tr>
</tbody>
</table>
<h4>Technical Implementation</h4>
<pre><code>pos_integrations/{restaurantId}
├── posSystem: String (square, toast, clover, etc.)
├── accessToken: String (encrypted)
├── refreshToken: String (encrypted)
├── locationId: String (POS-specific restaurant identifier)
├── lastSyncAt: Timestamp
├── syncStatus: String (active, failed, disconnected)
└── webhookUrl: String (for real-time updates)
sales_transactions/{restaurantId}/transactions/{transactionId}
├── wineId: String (matched from wine catalog)
├── posItemId: String (original POS item ID)
├── quantity: Number
├── pricePerBottle: Number
├── totalRevenue: Number
├── soldAt: Timestamp
├── posTransactionId: String (for reconciliation)
└── source: String (pos_integration)</code></pre>
<h4>Integration Workflow</h4>
<ol>
<li><strong>Restaurant Connects POS:</strong> From dashboard, restaurant clicks "Connect Square" (OAuth flow)</li>
<li><strong>Authorization:</strong> Restaurant authorizes SipSync to read transaction data</li>
<li><strong>Item Matching:</strong> System maps POS item names to SipSync wine catalog (AI-assisted or manual)</li>
<li><strong>Nightly Sync:</strong> Cron job pulls previous day's transactions via POS API</li>
<li><strong>Data Processing:</strong> Extract wine sales, calculate revenue, store in Firestore</li>
<li><strong>Dashboard Update:</strong> Daily batch refresh shows updated sales metrics</li>
</ol>
<h4>Development Effort (Per POS Integration)</h4>
<div class="cost-breakdown">
<p><strong>Initial Integration Development:</strong> 4-8 weeks per POS</p>
<ul>
<li>OAuth flow implementation</li>
<li>API client for transactions endpoint</li>
<li>Item matching algorithm (wine name → catalog mapping)</li>
<li>Error handling and retry logic</li>
<li>Webhook setup for real-time sync (optional)</li>
</ul>
<p><strong>Ongoing Maintenance:</strong> ~$1,000-2,000/month per POS</p>
<ul>
<li>API version updates</li>
<li>Breaking change fixes</li>
<li>Restaurant support (connection issues)</li>
</ul>
<p><strong>Total for 3 POS Systems (Square, Toast, Clover):</strong> ~$60-90k initial + $3-6k/month ongoing</p>
</div>
<h4>Market Coverage Analysis</h4>
<p>Integrating with the top 3 POS systems (Square, Toast, Clover) covers approximately <strong>35% of US restaurants</strong>. To reach 60% coverage, you'd need to integrate 5-6 additional systems, multiplying development costs.</p>
<div class="warning-box">
<p><strong>Strategic Risk:</strong> High upfront investment with uncertain ROI. POS integrations are expensive to build and maintain, yet only cover a fraction of the restaurant market. Recommend starting with <strong>one POS integration (Square)</strong> as a pilot to validate demand before expanding.</p>
</div>
<hr>
<h3>Option C: Hybrid Approach (POS + Manual Entry)</h3>
<h4>How It Works</h4>
<p>Build POS integration for restaurants with supported systems, provide manual entry fallback for others. Let restaurants choose their tracking method.</p>
<div class="pros-cons">
<div class="pros">
<h4>Pros</h4>
<ul>
<li>Maximum market coverage (all restaurants can participate)</li>
<li>Restaurants with POS integrations get best experience</li>
<li>Manual entry as backup prevents complete exclusion</li>
<li>Can start with one POS, expand later based on demand</li>
<li>Tiered pricing opportunity (POS integration = premium tier)</li>
</ul>
</div>
<div class="cons">
<h4>Cons</h4>
<ul>
<li>Must build and maintain both systems</li>
<li>Manual entry users still have low adoption</li>
<li>Data inconsistency between automated vs manual</li>
<li>Support burden (two systems to troubleshoot)</li>
</ul>
</div>
</div>
<h4>Recommended Phasing</h4>
<div class="phase-box">
<h4>Phase 1: Manual Entry Only (MVP)</h4>
<p>Launch dashboard with manual sales entry to validate demand and gather feedback. Low cost, fast to market.</p>
<p><strong>Timeline:</strong> 2-3 weeks | <strong>Cost:</strong> $5-8k</p>
</div>
<div class="phase-box">
<h4>Phase 2: Square Integration (Pilot)</h4>
<p>Build integration with Square (largest market share, easiest API). Offer to 20-30 pilot restaurants for free in exchange for feedback.</p>
<p><strong>Timeline:</strong> 6-8 weeks | <strong>Cost:</strong> $20-30k</p>
</div>
<div class="phase-box">
<h4>Phase 3: Additional POS Integrations (Scale)</h4>
<p>If pilot succeeds and demand is validated, expand to Toast and Clover. Make POS integration a premium feature ($50-100/month).</p>
<p><strong>Timeline:</strong> 12-16 weeks | <strong>Cost:</strong> $40-60k</p>
</div>
<h4>Business Model Implication</h4>
<p>Sales tracking creates a natural <strong>freemium model</strong>:</p>
<ul>
<li><strong>Free Tier:</strong> Basic analytics (engagement metrics from pairing saves), manual sales entry</li>
<li><strong>Premium Tier ($50-100/month):</strong> Automatic POS integration, advanced analytics, inventory management, priority support</li>
</ul>
<hr>
<h3>Recommendation: Start with Manual, Add Square Integration</h3>
<div class="success-box">
<p><strong>Recommended Path:</strong> Launch MVP dashboard with manual sales entry to validate restaurant interest. If 50+ restaurants actively use manual entry for 3+ months, invest in Square integration as a premium feature. Avoid building multiple POS integrations until you have clear evidence of market demand and willingness to pay.</p>
<p><strong>Key Success Metrics to Watch:</strong></p>
<ul>
<li>% of restaurants who enable manual sales entry</li>
<li>Average days per month with sales data entered</li>
<li>% of restaurants requesting POS integration</li>
<li>Willingness to pay for premium tier with POS integration</li>
</ul>
</div>
</section>
<div class="page-break"></div>
<!-- Event Tracking System -->
<section class="section">
<h2>4. Event Tracking System</h2>
<p>To provide actionable analytics, SipSync must track user interactions beyond saved pairings. This enables "eyeballs" metrics (views, searches) in addition to "engagement" metrics (saves).</p>
<h3>Events to Track</h3>
<h4>1. Wine List Page Views</h4>
<p><strong>Trigger:</strong> User navigates to restaurant's wine discovery page</p>
<pre><code>analytics_events/{restaurantId}/events/{eventId}
├── eventType: "wine_list_view"
├── userId: String | null (if authenticated)
├── sessionId: String (anonymous user tracking)
├── timestamp: Timestamp
├── source: String (qr_code, search, direct_link)
└── metadata: Object (referrer, device type, location)</code></pre>
<h4>2. Individual Wine Detail Views</h4>
<p><strong>Trigger:</strong> User clicks on specific wine to see details</p>
<pre><code>analytics_events/{restaurantId}/events/{eventId}
├── eventType: "wine_view"
├── wineId: String
├── userId: String | null
├── sessionId: String
├── timestamp: Timestamp
├── viewDuration: Number (seconds, if tracked)
└── metadata: Object</code></pre>
<h4>3. QR Code Scans</h4>
<p><strong>Trigger:</strong> User scans restaurant's QR code</p>
<pre><code>analytics_events/{restaurantId}/events/{eventId}
├── eventType: "qr_code_scan"
├── userId: String | null
├── sessionId: String
├── timestamp: Timestamp
├── qrCodeId: String (for multi-location tracking)
└── metadata: Object (device type, scan location if available)</code></pre>
<h4>4. Search/Filter Interactions</h4>
<p><strong>Trigger:</strong> User adjusts preference sliders or selects wine type filters</p>
<pre><code>analytics_events/{restaurantId}/events/{eventId}
├── eventType: "search_query"
├── userId: String | null
├── sessionId: String
├── timestamp: Timestamp
├── preferences: Object (acidity, tannins, wineType, priceRange)
└── resultsCount: Number (wines matched)</code></pre>
<h3>Implementation Approach</h3>
<h4>Frontend Changes</h4>
<p>Add analytics tracking to existing components:</p>
<pre><code>// PairingDiscovery.js
useEffect(() => {
// Track wine list page view
trackEvent({
eventType: 'wine_list_view',
restaurantId: selectedRestaurant,
userId: user?.userId || null,
sessionId: getOrCreateSessionId(),
timestamp: new Date(),
source: getUrlParams().source || 'direct_link'
});
}, [selectedRestaurant]);
// Track individual wine view
const handleWineClick = (wine) => {
trackEvent({
eventType: 'wine_view',
restaurantId: selectedRestaurant,
wineId: wine.id,
userId: user?.userId || null,
sessionId: getOrCreateSessionId(),
timestamp: new Date()
});
// Show wine details modal
};</code></pre>
<h4>Backend Endpoint</h4>
<pre><code>POST /api/analytics/track-event
Body: {
restaurantId: String,
eventType: String,
userId?: String,
sessionId: String,
timestamp: Timestamp,
metadata: Object
}
Response: { success: true }</code></pre>
<h4>Batching & Performance</h4>
<p>To minimize Firebase writes (costly at scale), implement <strong>client-side batching</strong>:</p>
<ul>
<li>Buffer events in browser localStorage</li>
<li>Send batch of 10 events per API call</li>
<li>Flush buffer on page unload or every 30 seconds</li>
<li>Reduces Firebase write costs by 90%</li>
</ul>
<h3>Privacy & Compliance</h3>
<div class="warning-box">
<h4>GDPR & Privacy Considerations</h4>
<ul>
<li><strong>Anonymous Tracking:</strong> Use sessionId for non-authenticated users (no personal data)</li>
<li><strong>User Consent:</strong> Add cookie banner for analytics tracking (required in EU, CA)</li>
<li><strong>Data Retention:</strong> Auto-delete events older than 90 days (or allow restaurant to configure)</li>
<li><strong>Opt-Out:</strong> Provide mechanism for users to disable tracking</li>
</ul>
</div>
<h3>Development Effort</h3>
<div class="cost-breakdown">
<p><strong>Frontend Instrumentation:</strong> 1-2 weeks</p>
<ul>
<li>Add tracking calls to PairingDiscovery component</li>
<li>Session ID generation and management</li>
<li>Event batching logic</li>
<li>Privacy consent banner</li>
</ul>
<p><strong>Backend Analytics Endpoint:</strong> 1 week</p>
<ul>
<li>POST /api/analytics/track-event endpoint</li>
<li>Event validation and sanitization</li>
<li>Firestore write with proper indexing</li>
</ul>
<p><strong>Total Effort:</strong> 2-3 weeks (~$5-8k)</p>
</div>
</section>
<div class="page-break"></div>
<!-- Dashboard Features & Analytics -->
<section class="section">
<h2>5. Dashboard Features & Analytics</h2>
<h3>Core Metrics (Available with Current Data)</h3>
<h4>Engagement Metrics</h4>
<table>
<thead>
<tr>
<th>Metric</th>
<th>Data Source</th>
<th>Calculation</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Total Pairing Saves</strong></td>
<td>users/{userId}/pairing_history</td>
<td>Count where restaurantId matches</td>
</tr>
<tr>
<td><strong>Unique Visitors</strong></td>
<td>users/{userId}/pairing_history</td>
<td>Distinct userIds with saves at restaurant</td>
</tr>
<tr>
<td><strong>Repeat Visitors</strong></td>
<td>users/{userId}/pairing_history</td>
<td>Users with 2+ saved pairings, 7+ days apart</td>
</tr>
<tr>
<td><strong>Most Popular Wines</strong></td>
<td>users/{userId}/pairing_history</td>
<td>Top 10 wines by save frequency</td>
</tr>
<tr>
<td><strong>Average Match Score</strong></td>
<td>users/{userId}/pairing_history</td>
<td>Mean matchScore across all saves</td>
</tr>
</tbody>
</table>
<h4>Wine Performance</h4>
<table>
<thead>
<tr>
<th>Metric</th>
<th>Description</th>
<th>Use Case</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Save Rate</strong></td>
<td>Saves / Views for each wine</td>
<td>Which wines convert browsers to savers</td>
</tr>
<tr>
<td><strong>Price Performance</strong></td>
<td>Saves by price tier ($, $$, $$$)</td>
<td>Optimize price positioning</td>
</tr>
<tr>
<td><strong>Wine Type Distribution</strong></td>
<td>% saves by type (red, white, sparkling)</td>
<td>Understand customer preferences</td>
</tr>
<tr>
<td><strong>Flavor Profile Trends</strong></td>
<td>Most saved flavor notes</td>
<td>Guide wine purchasing decisions</td>
</tr>
</tbody>
</table>
<h4>Customer Insights</h4>
<ul>
<li><strong>Peak Activity Times:</strong> When do users browse wine lists? (day of week, hour)</li>
<li><strong>Customer Preference Segments:</strong> What wine profiles visit your restaurant? (quiz results aggregation)</li>
<li><strong>QR Code Effectiveness:</strong> How many scans convert to saves?</li>
<li><strong>Session Duration:</strong> Average time spent browsing wines</li>
</ul>
<h3>Dashboard Layout (Wireframe Description)</h3>
<h4>Top-Level KPI Cards (Daily Refresh)</h4>
<pre><code>┌──────────────────────────────────────────────────────────────┐
│ 🍷 Total Wines: 47 👥 Unique Visitors: 234 │
│ 💾 Total Saves: 128 📈 Avg Match Score: 8.2/10 │
│ 🔄 Repeat Rate: 42% 📊 Save Rate: 18.7% │
└──────────────────────────────────────────────────────────────┘</code></pre>
<h4>Time Series Charts</h4>
<ul>
<li><strong>Daily Saves Trend:</strong> Line chart showing saves per day (last 30/90 days)</li>
<li><strong>Traffic vs Engagement:</strong> Views vs Saves overlaid chart</li>
<li><strong>Day of Week Heatmap:</strong> When are customers most active?</li>
</ul>
<h4>Top Performers Tables</h4>
<pre><code>Top 10 Wines by Saves:
┌────────────────────────────────────────────────────────────┐
│ Wine Name Type Price Saves Match Score │
├────────────────────────────────────────────────────────────┤
│ 2019 Pinot Noir Red $45 23 8.9 │
│ Sauvignon Blanc White $32 19 8.4 │
│ Cabernet Blend Red $58 17 9.1 │
│ ... │
└────────────────────────────────────────────────────────────┘</code></pre>
<h4>Customer Insights Section</h4>