native-update 3.1.2 → 3.1.3

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.
Files changed (202) hide show
  1. package/AI-INTEGRATION-GUIDE.md +15 -10
  2. package/Readme.md +35 -35
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/LiveUpdatePlugin.kt +88 -12
  4. package/android/src/main/java/com/aoneahsan/nativeupdate/NativeUpdatePlugin.kt +45 -18
  5. package/dist/esm/definitions.d.ts +8 -0
  6. package/dist/esm/plugin.js +16 -2
  7. package/dist/plugin.cjs.js +1 -1
  8. package/dist/plugin.esm.js +1 -1
  9. package/dist/plugin.js +2 -2
  10. package/docs/CHANGELOG.md +73 -0
  11. package/docs/KNOWN_LIMITATIONS.md +2 -2
  12. package/docs/MIGRATION.md +1 -1
  13. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
  14. package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
  15. package/package.json +8 -3
  16. package/docs/AGENTS.md +0 -47
  17. package/docs/APP_REVIEW_GUIDE.md +0 -768
  18. package/docs/BUNDLE_SIGNING.md +0 -277
  19. package/docs/CLAUDE.md +0 -110
  20. package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
  21. package/docs/DEPLOY_NOTES.md +0 -116
  22. package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
  23. package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
  24. package/docs/LIVE_UPDATES_GUIDE.md +0 -675
  25. package/docs/MANUAL-TASKS.md +0 -30
  26. package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
  27. package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
  28. package/docs/PACKAGES.md +0 -167
  29. package/docs/PERFORMANCE.md +0 -110
  30. package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
  31. package/docs/QUICK_START.md +0 -595
  32. package/docs/README.md +0 -130
  33. package/docs/REMAINING_FEATURES.md +0 -192
  34. package/docs/ROADMAP.md +0 -295
  35. package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
  36. package/docs/SECURITY.md +0 -356
  37. package/docs/TESTING_REQUIREMENTS.md +0 -201
  38. package/docs/ai-knowledge-base/00-project-profile.md +0 -38
  39. package/docs/ai-knowledge-base/01-features.md +0 -46
  40. package/docs/ai-knowledge-base/02-routes.md +0 -72
  41. package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
  42. package/docs/ai-knowledge-base/README.md +0 -23
  43. package/docs/analytics-tracking.md +0 -37
  44. package/docs/api/API.md +0 -558
  45. package/docs/api/FEATURES.md +0 -414
  46. package/docs/api/app-review-api.md +0 -239
  47. package/docs/api/app-update-api.md +0 -154
  48. package/docs/api/background-update-api.md +0 -170
  49. package/docs/api/events-api.md +0 -323
  50. package/docs/api/live-update-api.md +0 -258
  51. package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
  52. package/docs/background-updates.md +0 -392
  53. package/docs/capacitor-official-plugins.md +0 -46
  54. package/docs/capawesome-plugins.md +0 -29
  55. package/docs/cli-reference.md +0 -321
  56. package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
  57. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
  58. package/docs/docs-site/plan.md +0 -201
  59. package/docs/docs-site/scope.md +0 -127
  60. package/docs/docs-site/tracker.json +0 -235
  61. package/docs/error-handling-tracking.md +0 -37
  62. package/docs/examples/advanced-scenarios.md +0 -394
  63. package/docs/examples/android-manifest-example.xml +0 -77
  64. package/docs/examples/basic-usage.md +0 -206
  65. package/docs/examples/node-express-backend-example.md +0 -28
  66. package/docs/examples/react-capacitor-example.md +0 -29
  67. package/docs/features/app-reviews.md +0 -975
  68. package/docs/features/app-updates.md +0 -785
  69. package/docs/features/e2e-full-verification/00-overview.md +0 -99
  70. package/docs/features/e2e-full-verification/00-tracker.json +0 -284
  71. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
  72. package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
  73. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
  74. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
  75. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
  76. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
  77. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
  78. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
  79. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
  80. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
  81. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  82. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  83. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  84. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  85. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  86. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  87. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  88. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  89. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  90. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  91. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  92. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  93. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  94. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  95. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  96. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  97. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  98. package/docs/features/e2e-full-verification/results/route-list.json +0 -1
  99. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
  100. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
  101. package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
  102. package/docs/features/live-updates.md +0 -642
  103. package/docs/features/queues-and-emails/00-overview.md +0 -41
  104. package/docs/features/queues-and-emails/00-tracker.json +0 -99
  105. package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
  106. package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
  107. package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
  108. package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
  109. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
  110. package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
  111. package/docs/getting-started/configuration.md +0 -469
  112. package/docs/getting-started/installation.md +0 -300
  113. package/docs/getting-started/quick-start.md +0 -430
  114. package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
  115. package/docs/guides/admin-panel.md +0 -268
  116. package/docs/guides/channel-management.md +0 -343
  117. package/docs/guides/dashboard-guide.md +0 -365
  118. package/docs/guides/deployment-guide.md +0 -335
  119. package/docs/guides/end-to-end-workflow.md +0 -491
  120. package/docs/guides/key-management.md +0 -284
  121. package/docs/guides/migration-from-codepush.md +0 -145
  122. package/docs/guides/security-best-practices.md +0 -1057
  123. package/docs/guides/testing-guide.md +0 -346
  124. package/docs/guides/troubleshooting.md +0 -482
  125. package/docs/package-audit.md +0 -41
  126. package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
  127. package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
  128. package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
  129. package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
  130. package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
  131. package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
  132. package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
  133. package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
  134. package/docs/play-store/ASO-METADATA.md +0 -5
  135. package/docs/play-store/DATA-SAFETY.md +0 -5
  136. package/docs/play-store/DECLARATIONS.md +0 -5
  137. package/docs/play-store/README.md +0 -27
  138. package/docs/play-store/RELEASE-NOTES.md +0 -99
  139. package/docs/play-store/RELEASE-STEPS.md +0 -6
  140. package/docs/play-store/STORE-LISTING.md +0 -7
  141. package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
  142. package/docs/production-readiness.md +0 -475
  143. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
  144. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
  145. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
  146. package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
  147. package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
  148. package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
  149. package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
  150. package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
  151. package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
  152. package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
  153. package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
  154. package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
  155. package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
  156. package/docs/project-audit/AUDIT-HISTORY.md +0 -74
  157. package/docs/project-audit/BATCH-PLAN.md +0 -168
  158. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
  159. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
  160. package/docs/project-finalization/00-tracker.json +0 -60
  161. package/docs/project-knowledge-base/01-system-overview.md +0 -227
  162. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
  163. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
  164. package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
  165. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
  166. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
  167. package/docs/project-knowledge-base/README.md +0 -103
  168. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
  169. package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
  170. package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
  171. package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
  172. package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
  173. package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
  174. package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
  175. package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
  176. package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
  177. package/docs/reports/FINAL_STATUS.md +0 -122
  178. package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
  179. package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
  180. package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
  181. package/docs/reports/PRODUCTION_STATUS.md +0 -115
  182. package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
  183. package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
  184. package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
  185. package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
  186. package/docs/reports/claude-completion.json +0 -241
  187. package/docs/rules-tracker.md +0 -102
  188. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
  189. package/docs/security/certificate-pinning.md +0 -122
  190. package/docs/seo-aeo-rules.json +0 -3043
  191. package/docs/social-media-marketing/README.md +0 -81
  192. package/docs/social-media-marketing/posts-batch-01.md +0 -613
  193. package/docs/social-media-marketing/posts-batch-02.md +0 -528
  194. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
  195. package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
  196. package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
  197. package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
  198. package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
  199. package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
  200. package/docs/tracking/full-audit-tracker.json +0 -121
  201. package/docs/tracking/production-readiness-audit-tracker.json +0 -429
  202. package/docs/tracking/seo-checklist-tracker.json +0 -333
@@ -1,587 +0,0 @@
1
- # Task 2: SaaS Platform Architecture
2
-
3
- **Created:** 2025-12-27
4
- **Status:** 📝 Planning
5
- **Estimated Time:** 40-60 hours (full transformation)
6
-
7
- ---
8
-
9
- ## 🎯 Vision
10
-
11
- Transform the native-update marketing website from a static information site into a **full SaaS platform** where users can:
12
-
13
- 1. **Sign up and log in** to manage their update infrastructure
14
- 2. **Connect their Google Drive** account for build storage
15
- 3. **Upload app builds** (APK, IPA, web bundles) from the dashboard
16
- 4. **Generate configuration** to integrate updates into their app
17
- 5. **Manage multiple apps** and update channels from one dashboard
18
-
19
- **End Goal:** Users get a complete OTA update backend without setting up their own infrastructure.
20
-
21
- ---
22
-
23
- ## 🏗️ High-Level Architecture
24
-
25
- ### System Components
26
-
27
- ```
28
- ┌─────────────────────────────────────────────────────────────┐
29
- │ Marketing Website │
30
- │ (React 19 + RadixUI + Tailwind + Firebase + Router) │
31
- ├─────────────────────────────────────────────────────────────┤
32
- │ │
33
- │ ┌─────────────┐ ┌──────────────┐ ┌─────────────────┐ │
34
- │ │ Public │ │ Auth │ │ Dashboard │ │
35
- │ │ Pages │ │ Pages │ │ Pages │ │
36
- │ │ │ │ │ │ (Protected) │ │
37
- │ │ - Home │ │ - Login │ │ - Overview │ │
38
- │ │ - Features │ │ - Signup │ │ - Builds │ │
39
- │ │ - Pricing │ │ - Reset PW │ │ - Upload │ │
40
- │ │ - Docs │ │ │ │ - Config │ │
41
- │ │ - About │ │ │ │ - Settings │ │
42
- │ └─────────────┘ └──────────────┘ └─────────────────┘ │
43
- │ │
44
- └────────────────────┬────────────────────────────────────────┘
45
- │
46
- ▼
47
- ┌─────────────────────────────────────────────────────────────┐
48
- │ Firebase Backend │
49
- ├─────────────────────────────────────────────────────────────┤
50
- │ │
51
- │ ┌──────────────────┐ ┌─────────────────┐ │
52
- │ │ Authentication │ │ Firestore │ │
53
- │ │ │ │ │ │
54
- │ │ - Email/Password │ │ - users │ │
55
- │ │ - Google OAuth │ │ - builds │ │
56
- │ │ - Email Verify │ │ - apps │ │
57
- │ │ - Password Reset │ │ - drive_tokens │ │
58
- │ └──────────────────┘ └─────────────────┘ │
59
- │ │
60
- │ ┌──────────────────┐ ┌─────────────────┐ │
61
- │ │ Cloud Functions │ │ Storage │ │
62
- │ │ │ │ │ │
63
- │ │ - API Endpoints │ │ - Temp files │ │
64
- │ │ - Drive Upload │ │ - User uploads │ │
65
- │ │ - Config Gen │ │ │ │
66
- │ └──────────────────┘ └─────────────────┘ │
67
- │ │
68
- └────────────────────┬────────────────────────────────────────┘
69
- │
70
- ▼
71
- ┌─────────────────────────────────────────────────────────────┐
72
- │ Google Drive API │
73
- ├─────────────────────────────────────────────────────────────┤
74
- │ │
75
- │ User's Personal Google Drive │
76
- │ ├── NativeUpdate/ │
77
- │ │ ├── app-1/ │
78
- │ │ │ ├── production/ │
79
- │ │ │ │ ├── build-1.0.0.zip │
80
- │ │ │ │ └── build-1.0.1.zip │
81
- │ │ │ └── staging/ │
82
- │ │ └── app-2/ │
83
- │ │ └── production/ │
84
- │ │ └── build-2.0.0.zip │
85
- │ │
86
- └─────────────────────────────────────────────────────────────┘
87
- ```
88
-
89
- ---
90
-
91
- ## 🔐 Authentication Flow
92
-
93
- ### User Journey
94
-
95
- 1. **Landing Page** → Click "Get Started" or "Dashboard"
96
- 2. **Login/Signup Choice** → Email/password or Google OAuth
97
- 3. **Email Verification** (if email/password) → Confirm email
98
- 4. **Dashboard** → Access protected features
99
-
100
- ### Authentication States
101
-
102
- ```typescript
103
- type AuthState =
104
- | { status: 'unauthenticated' }
105
- | { status: 'loading' }
106
- | { status: 'authenticated', user: User }
107
- | { status: 'email-not-verified', user: User };
108
- ```
109
-
110
- ### Protected Routes
111
-
112
- ```typescript
113
- const routes = [
114
- // Public
115
- { path: '/', public: true },
116
- { path: '/features', public: true },
117
- { path: '/pricing', public: true },
118
-
119
- // Auth
120
- { path: '/login', public: true, authOnly: false },
121
- { path: '/signup', public: true, authOnly: false },
122
-
123
- // Protected
124
- { path: '/dashboard', protected: true },
125
- { path: '/dashboard/builds', protected: true },
126
- { path: '/dashboard/upload', protected: true },
127
- { path: '/dashboard/config', protected: true },
128
- { path: '/dashboard/settings', protected: true },
129
- ];
130
- ```
131
-
132
- ---
133
-
134
- ## 💾 Data Architecture
135
-
136
- ### Firestore Collections
137
-
138
- **1. `users` Collection**
139
- ```typescript
140
- interface User {
141
- uid: string; // Firebase Auth UID
142
- email: string;
143
- displayName: string | null;
144
- photoURL: string | null;
145
- createdAt: Timestamp;
146
- lastLogin: Timestamp;
147
-
148
- // Google Drive
149
- driveConnected: boolean;
150
- driveEmail: string | null;
151
-
152
- // Subscription (future)
153
- plan: 'free' | 'pro' | 'enterprise';
154
-
155
- // Settings
156
- preferences: {
157
- emailNotifications: boolean;
158
- updateNotifications: boolean;
159
- };
160
- }
161
- ```
162
-
163
- **2. `apps` Collection**
164
- ```typescript
165
- interface App {
166
- id: string; // Auto-generated
167
- userId: string; // Owner
168
- name: string; // App name
169
- packageId: string; // com.example.app
170
- platform: 'ios' | 'android' | 'web' | 'all';
171
- createdAt: Timestamp;
172
- updatedAt: Timestamp;
173
-
174
- // Update channels
175
- channels: {
176
- production: ChannelConfig;
177
- staging: ChannelConfig;
178
- development: ChannelConfig;
179
- };
180
- }
181
-
182
- interface ChannelConfig {
183
- enabled: boolean;
184
- autoUpdate: boolean;
185
- requireUserConsent: boolean;
186
- }
187
- ```
188
-
189
- **3. `builds` Collection**
190
- ```typescript
191
- interface Build {
192
- id: string; // Auto-generated
193
- userId: string;
194
- appId: string;
195
-
196
- // Build info
197
- version: string; // Semantic version
198
- buildNumber: number;
199
- channel: 'production' | 'staging' | 'development';
200
- platform: 'ios' | 'android' | 'web';
201
-
202
- // File info
203
- fileName: string;
204
- fileSize: number; // Bytes
205
- fileType: string; // .zip, .apk, .ipa
206
- checksum: string; // SHA-256
207
-
208
- // Google Drive
209
- driveFileId: string; // Google Drive file ID
210
- driveFileUrl: string; // Direct download URL
211
-
212
- // Metadata
213
- releaseNotes: string;
214
- uploadedAt: Timestamp;
215
- uploadedBy: string; // User email
216
-
217
- // Status
218
- status: 'uploading' | 'active' | 'archived' | 'failed';
219
- }
220
- ```
221
-
222
- **4. `drive_tokens` Collection** (Encrypted)
223
- ```typescript
224
- interface DriveToken {
225
- userId: string; // Document ID
226
- accessToken: string; // Encrypted
227
- refreshToken: string; // Encrypted
228
- expiresAt: Timestamp;
229
- scope: string[];
230
- updatedAt: Timestamp;
231
- }
232
- ```
233
-
234
- **5. `analytics` Collection** (Future)
235
- ```typescript
236
- interface AnalyticsEvent {
237
- userId: string;
238
- appId: string;
239
- buildId: string;
240
- eventType: 'download' | 'install' | 'rollback' | 'error';
241
- timestamp: Timestamp;
242
- metadata: Record<string, any>;
243
- }
244
- ```
245
-
246
- ### Security Rules
247
-
248
- ```javascript
249
- rules_version = '2';
250
- service cloud.firestore {
251
- match /databases/{database}/documents {
252
-
253
- // Helper functions
254
- function isAuthenticated() {
255
- return request.auth != null;
256
- }
257
-
258
- function isOwner(userId) {
259
- return isAuthenticated() && request.auth.uid == userId;
260
- }
261
-
262
- // Users collection
263
- match /users/{userId} {
264
- allow read: if isOwner(userId);
265
- allow write: if isOwner(userId);
266
- }
267
-
268
- // Apps collection
269
- match /apps/{appId} {
270
- allow read: if isOwner(resource.data.userId);
271
- allow create: if isAuthenticated();
272
- allow update, delete: if isOwner(resource.data.userId);
273
- }
274
-
275
- // Builds collection
276
- match /builds/{buildId} {
277
- allow read: if isOwner(resource.data.userId);
278
- allow create: if isAuthenticated();
279
- allow update, delete: if isOwner(resource.data.userId);
280
- }
281
-
282
- // Drive tokens (encrypted, very restricted)
283
- match /drive_tokens/{userId} {
284
- allow read, write: if isOwner(userId);
285
- }
286
- }
287
- }
288
- ```
289
-
290
- ---
291
-
292
- ## 🔌 API Endpoints (Firebase Functions)
293
-
294
- ### Authentication Endpoints
295
- - `POST /api/auth/signup` - Create new user
296
- - `POST /api/auth/login` - Login user
297
- - `POST /api/auth/logout` - Logout user
298
- - `POST /api/auth/reset-password` - Send reset email
299
- - `POST /api/auth/verify-email` - Send verification email
300
-
301
- ### User Endpoints
302
- - `GET /api/user/profile` - Get user profile
303
- - `PUT /api/user/profile` - Update profile
304
- - `DELETE /api/user/account` - Delete account
305
-
306
- ### App Endpoints
307
- - `GET /api/apps` - List user's apps
308
- - `POST /api/apps` - Create new app
309
- - `GET /api/apps/:appId` - Get app details
310
- - `PUT /api/apps/:appId` - Update app
311
- - `DELETE /api/apps/:appId` - Delete app
312
-
313
- ### Build Endpoints
314
- - `GET /api/builds` - List user's builds
315
- - `GET /api/builds/:buildId` - Get build details
316
- - `POST /api/builds/upload` - Upload new build
317
- - `DELETE /api/builds/:buildId` - Delete build
318
-
319
- ### Google Drive Endpoints
320
- - `POST /api/drive/connect` - Initiate OAuth flow
321
- - `POST /api/drive/callback` - Handle OAuth callback
322
- - `GET /api/drive/status` - Check connection status
323
- - `POST /api/drive/upload` - Upload file to Drive
324
- - `DELETE /api/drive/disconnect` - Revoke Drive access
325
-
326
- ### Configuration Endpoints
327
- - `GET /api/config/:appId` - Generate app configuration
328
- - `GET /api/config/:appId/download` - Download config JSON
329
-
330
- ### Public Endpoints (For End Users' Apps)
331
- - `GET /api/public/check-update/:appId/:channel` - Check for updates
332
- - `GET /api/public/download/:buildId` - Download build (proxy from Drive)
333
-
334
- ---
335
-
336
- ## 🎨 UI/UX Flow
337
-
338
- ### Page Structure
339
-
340
- ```
341
- Website Root
342
- ├── Public Pages (/)
343
- │ ├── Home
344
- │ ├── Features
345
- │ ├── Pricing
346
- │ ├── Examples
347
- │ ├── Docs
348
- │ ├── About
349
- │ └── Contact
350
- │
351
- ├── Auth Pages (/auth/)
352
- │ ├── Login
353
- │ ├── Signup
354
- │ ├── Reset Password
355
- │ └── Verify Email
356
- │
357
- └── Dashboard (/dashboard/)
358
- ├── Overview (default)
359
- ├── Apps
360
- │ ├── List all apps
361
- │ ├── Create new app
362
- │ └── App details/:appId
363
- │ ├── Builds list
364
- │ ├── Configuration
365
- │ └── Settings
366
- ├── Builds
367
- │ ├── All builds (across all apps)
368
- │ └── Upload new build
369
- ├── Google Drive
370
- │ ├── Connection status
371
- │ └── Connect/disconnect
372
- ├── Configuration
373
- │ └── Generate config for each app
374
- └── Settings
375
- ├── Profile
376
- ├── Preferences
377
- └── Account deletion
378
- ```
379
-
380
- ### Dashboard Layout
381
-
382
- ```
383
- ┌────────────────────────────────────────────────────────────┐
384
- │ Header (sticky) │
385
- │ Logo | Dashboard | [User Profile ▼] | [Logout] │
386
- └────────────────────────────────────────────────────────────┘
387
- ┌──────────────┬─────────────────────────────────────────────┐
388
- │ │ │
389
- │ Sidebar │ Main Content Area │
390
- │ (nav) │ │
391
- │ │ ┌─────────────────────────────────────┐ │
392
- │ ○ Overview │ │ │ │
393
- │ ○ Apps │ │ Page-specific content │ │
394
- │ ○ Builds │ │ │ │
395
- │ ○ Upload │ │ │ │
396
- │ ○ Drive │ │ │ │
397
- │ ○ Config │ └─────────────────────────────────────┘ │
398
- │ ○ Settings │ │
399
- │ │ │
400
- │ │ │
401
- │ │ │
402
- │ │ │
403
- └──────────────┴─────────────────────────────────────────────┘
404
- ```
405
-
406
- ---
407
-
408
- ## 🔄 User Workflows
409
-
410
- ### Workflow 1: New User Onboarding
411
-
412
- 1. **Visit website** → See marketing pages
413
- 2. **Click "Get Started"** → Redirect to /signup
414
- 3. **Fill signup form** → Email + password
415
- 4. **Receive verification email** → Click link
416
- 5. **Email verified** → Redirect to /dashboard
417
- 6. **See onboarding guide** → "Connect Google Drive first"
418
- 7. **Connect Google Drive** → OAuth flow
419
- 8. **Create first app** → Fill app details
420
- 9. **Upload first build** → Upload file
421
- 10. **Get configuration** → Copy config to use in app
422
-
423
- ### Workflow 2: Upload New Build
424
-
425
- 1. **Login to dashboard** → /dashboard
426
- 2. **Navigate to Upload** → /dashboard/upload
427
- 3. **Select app** → Dropdown with user's apps
428
- 4. **Choose channel** → Production/Staging/Development
429
- 5. **Fill build details** → Version, release notes
430
- 6. **Select file** → Drag & drop or file picker
431
- 7. **Upload** → Progress bar shows upload status
432
- 8. **Upload to Drive** → Backend uploads to user's Drive
433
- 9. **Save metadata** → Firestore stores build info
434
- 10. **Confirmation** → Build ready for distribution
435
-
436
- ### Workflow 3: Configure App for Updates
437
-
438
- 1. **Navigate to Configuration** → /dashboard/config
439
- 2. **Select app** → Choose from list
440
- 3. **View generated config** → Display JSON with syntax highlighting
441
- 4. **Copy config** → One-click copy button
442
- 5. **Follow integration guide** → Step-by-step instructions
443
- 6. **Test in app** → User integrates into their app
444
- 7. **Verify update works** → App checks for updates successfully
445
-
446
- ---
447
-
448
- ## 🔒 Security Considerations
449
-
450
- ### Data Protection
451
- - **Firebase Auth** handles password security (bcrypt)
452
- - **Google Drive tokens** encrypted before storing in Firestore
453
- - **HTTPS only** for all communications
454
- - **CORS** properly configured for frontend
455
- - **Rate limiting** on API endpoints
456
-
457
- ### Access Control
458
- - **User can only access their own data** (Firestore rules enforce)
459
- - **Google Drive files** stored in user's personal Drive (full control)
460
- - **No shared storage** between users
461
- - **Token refresh** handled automatically
462
-
463
- ### Privacy
464
- - **No access to user's Drive** beyond NativeUpdate folder
465
- - **User can disconnect Drive** anytime (revokes tokens)
466
- - **Account deletion** removes all data (GDPR compliant)
467
- - **Privacy policy** updated to reflect Drive usage
468
-
469
- ---
470
-
471
- ## 📊 Scalability & Performance
472
-
473
- ### Expected Load
474
- - **Free tier**: 100-1000 users (MVP)
475
- - **Average file size**: 10-50 MB per build
476
- - **Uploads per user**: 5-20 per month
477
- - **API requests**: 100-500 per user per month
478
-
479
- ### Optimization Strategies
480
- - **Chunked uploads** for large files (>10MB)
481
- - **Firebase Storage** for temporary staging (before Drive upload)
482
- - **Lazy loading** in dashboard (paginate builds list)
483
- - **Caching** of configuration (CDN distribution)
484
- - **Firestore indexes** for efficient queries
485
-
486
- ### Cost Estimates (Firebase Free Tier)
487
- - **Authentication**: 10k/month free ✅
488
- - **Firestore**: 50k reads/20k writes/day free ✅
489
- - **Storage**: 5GB free ✅
490
- - **Cloud Functions**: 2M invocations/month free ✅
491
- - **Google Drive API**: Free (user's quota) ✅
492
-
493
- **Expected to stay within free tier for MVP**
494
-
495
- ---
496
-
497
- ## 🧪 Testing Strategy
498
-
499
- ### Unit Tests
500
- - Firebase Functions (API endpoints)
501
- - React components (UI)
502
- - Utility functions (config generation)
503
-
504
- ### Integration Tests
505
- - Auth flow (signup → login → logout)
506
- - Drive integration (connect → upload → disconnect)
507
- - Build upload (file → metadata → Drive)
508
-
509
- ### E2E Tests
510
- - Complete user journey (signup → create app → upload → configure)
511
- - Error scenarios (network failures, invalid files)
512
- - Cross-browser testing (Chrome, Safari, Firefox)
513
-
514
- ### Manual Testing
515
- - Mobile responsiveness
516
- - File upload with various sizes
517
- - Google Drive folder structure
518
- - Configuration accuracy
519
-
520
- ---
521
-
522
- ## 📅 Implementation Timeline
523
-
524
- ### Phase 1: Foundation (Week 1)
525
- - Setup Firebase project
526
- - Configure authentication
527
- - Create database schema
528
- - Implement security rules
529
-
530
- ### Phase 2: Authentication (Week 2)
531
- - Build login/signup pages
532
- - Implement auth context
533
- - Add protected routes
534
- - Email verification
535
-
536
- ### Phase 3: Dashboard (Week 3)
537
- - Create dashboard layout
538
- - Build overview page
539
- - Build apps management
540
- - Navigation components
541
-
542
- ### Phase 4: Google Drive (Week 4)
543
- - Setup Google Cloud project
544
- - Implement OAuth flow
545
- - Build Drive service
546
- - Test file uploads
547
-
548
- ### Phase 5: Build Upload (Week 5)
549
- - Create upload UI
550
- - Implement chunked upload
551
- - Save to Drive
552
- - Store metadata
553
-
554
- ### Phase 6: Configuration (Week 6)
555
- - Build config generator
556
- - Create config UI
557
- - Add download option
558
- - Integration guide
559
-
560
- ### Phase 7: Testing & Polish (Week 7)
561
- - Bug fixes
562
- - UI polish
563
- - Documentation
564
- - Deployment
565
-
566
- **Total: ~7 weeks for full implementation**
567
-
568
- ---
569
-
570
- ## ✅ Success Criteria
571
-
572
- - [ ] Users can sign up and log in
573
- - [ ] Email verification works
574
- - [ ] Google Drive connects successfully
575
- - [ ] Files upload to user's Drive (not shared storage)
576
- - [ ] Builds metadata stored in Firestore
577
- - [ ] Configuration generates correctly
578
- - [ ] Dashboard is fully functional
579
- - [ ] Mobile responsive
580
- - [ ] Zero security vulnerabilities
581
- - [ ] Privacy policy updated
582
- - [ ] Documentation complete
583
-
584
- ---
585
-
586
- **Plan Status:** ✅ Complete and ready for detailed sub-plans
587
- **Next Steps:** Create detailed plans for each subsystem