native-update 3.1.2 → 3.1.4

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 (206) 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/cli/AGENTS.md +1 -1
  6. package/cli/CLAUDE.md +1 -1
  7. package/cli/commands/bundle-create.js +2 -2
  8. package/cli/index.js +11 -0
  9. package/dist/esm/definitions.d.ts +8 -0
  10. package/dist/esm/plugin.js +16 -2
  11. package/dist/plugin.cjs.js +1 -1
  12. package/dist/plugin.esm.js +1 -1
  13. package/dist/plugin.js +2 -2
  14. package/docs/CHANGELOG.md +90 -0
  15. package/docs/KNOWN_LIMITATIONS.md +2 -2
  16. package/docs/MIGRATION.md +1 -1
  17. package/ios/Plugin/LiveUpdate/LiveUpdatePlugin.swift +64 -8
  18. package/ios/Plugin/NativeUpdatePlugin.swift +39 -13
  19. package/package.json +8 -3
  20. package/docs/AGENTS.md +0 -47
  21. package/docs/APP_REVIEW_GUIDE.md +0 -768
  22. package/docs/BUNDLE_SIGNING.md +0 -277
  23. package/docs/CLAUDE.md +0 -110
  24. package/docs/COMPREHENSIVE_AUDIT_REPORT.md +0 -526
  25. package/docs/DEPLOY_NOTES.md +0 -116
  26. package/docs/EXAMPLE_APPS_SIMPLIFICATION_PLAN.md +0 -384
  27. package/docs/EXAMPLE_APPS_SIMPLIFICATION_TRACKER.md +0 -390
  28. package/docs/LIVE_UPDATES_GUIDE.md +0 -675
  29. package/docs/MANUAL-TASKS.md +0 -30
  30. package/docs/MARKETING_WEBSITE_TRACKER.md +0 -677
  31. package/docs/NATIVE_UPDATES_GUIDE.md +0 -695
  32. package/docs/PACKAGES.md +0 -167
  33. package/docs/PERFORMANCE.md +0 -110
  34. package/docs/PROJECT_COMPLETION_TRACKER.md +0 -411
  35. package/docs/QUICK_START.md +0 -595
  36. package/docs/README.md +0 -130
  37. package/docs/REMAINING_FEATURES.md +0 -192
  38. package/docs/ROADMAP.md +0 -295
  39. package/docs/SECURITY-IF-REPO-PUBLIC.md +0 -232
  40. package/docs/SECURITY.md +0 -356
  41. package/docs/TESTING_REQUIREMENTS.md +0 -201
  42. package/docs/ai-knowledge-base/00-project-profile.md +0 -38
  43. package/docs/ai-knowledge-base/01-features.md +0 -46
  44. package/docs/ai-knowledge-base/02-routes.md +0 -72
  45. package/docs/ai-knowledge-base/03-tech-stack.md +0 -57
  46. package/docs/ai-knowledge-base/README.md +0 -23
  47. package/docs/analytics-tracking.md +0 -37
  48. package/docs/api/API.md +0 -558
  49. package/docs/api/FEATURES.md +0 -414
  50. package/docs/api/app-review-api.md +0 -239
  51. package/docs/api/app-update-api.md +0 -154
  52. package/docs/api/background-update-api.md +0 -170
  53. package/docs/api/events-api.md +0 -323
  54. package/docs/api/live-update-api.md +0 -258
  55. package/docs/archive/MARKETING_WEBSITE_PLAN.md +0 -659
  56. package/docs/background-updates.md +0 -392
  57. package/docs/capacitor-official-plugins.md +0 -46
  58. package/docs/capawesome-plugins.md +0 -29
  59. package/docs/cli-reference.md +0 -321
  60. package/docs/deployment/HOSTINGER_DEPLOY.md +0 -370
  61. package/docs/deployment/PRODUCTION-DEPLOY-CHECKLIST.md +0 -184
  62. package/docs/docs-site/plan.md +0 -201
  63. package/docs/docs-site/scope.md +0 -127
  64. package/docs/docs-site/tracker.json +0 -235
  65. package/docs/error-handling-tracking.md +0 -37
  66. package/docs/examples/advanced-scenarios.md +0 -394
  67. package/docs/examples/android-manifest-example.xml +0 -77
  68. package/docs/examples/basic-usage.md +0 -206
  69. package/docs/examples/node-express-backend-example.md +0 -28
  70. package/docs/examples/react-capacitor-example.md +0 -29
  71. package/docs/features/app-reviews.md +0 -975
  72. package/docs/features/app-updates.md +0 -785
  73. package/docs/features/e2e-full-verification/00-overview.md +0 -99
  74. package/docs/features/e2e-full-verification/00-tracker.json +0 -284
  75. package/docs/features/e2e-full-verification/phase01-backend-schema-fixes.md +0 -183
  76. package/docs/features/e2e-full-verification/phase02-test-auth.md +0 -176
  77. package/docs/features/e2e-full-verification/phase03-api-test-coverage.md +0 -63
  78. package/docs/features/e2e-full-verification/phase04-frontend-package-contract-audit.md +0 -73
  79. package/docs/features/e2e-full-verification/phase05-browser-e2e-matrix.md +0 -69
  80. package/docs/features/e2e-full-verification/phase06-deploy-prod-smoke.md +0 -51
  81. package/docs/features/e2e-full-verification/results/phase01-drift-report.md +0 -50
  82. package/docs/features/e2e-full-verification/results/phase03-coverage-matrix.md +0 -215
  83. package/docs/features/e2e-full-verification/results/phase04-frontend-contract.md +0 -139
  84. package/docs/features/e2e-full-verification/results/phase05-e2e-results.md +0 -99
  85. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-01-dashboard.png +0 -0
  86. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-02-signup.png +0 -0
  87. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-03-settings-persisted.png +0 -0
  88. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04a-app-created.png +0 -0
  89. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-04b-duplicate-bundle-422.png +0 -0
  90. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-05-plan-limit-403.png +0 -0
  91. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08a-upload-graceful-fail.png +0 -0
  92. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-08b-builds-list.png +0 -0
  93. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-10-rollout-25pct.png +0 -0
  94. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-11-analytics.png +0 -0
  95. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-12-drive-disconnected.png +0 -0
  96. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-13-pricing.png +0 -0
  97. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-14-isolation-403.png +0 -0
  98. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15a-admin-overview.png +0 -0
  99. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-15b-regular-user-admin-redirect.png +0 -0
  100. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-16a-delete-dialog.png +0 -0
  101. package/docs/features/e2e-full-verification/results/phase05-evidence/e2e-17-mobile-375.png +0 -0
  102. package/docs/features/e2e-full-verification/results/route-list.json +0 -1
  103. package/docs/features/laravel-nova-backend/ASSESSMENT-SUMMARY.md +0 -96
  104. package/docs/features/laravel-nova-backend/IMPLEMENTATION-PLAN.md +0 -504
  105. package/docs/features/laravel-nova-backend/progress-tracker.json +0 -184
  106. package/docs/features/live-updates.md +0 -642
  107. package/docs/features/queues-and-emails/00-overview.md +0 -41
  108. package/docs/features/queues-and-emails/00-tracker.json +0 -99
  109. package/docs/features/queues-and-emails/phase01-foundation.md +0 -15
  110. package/docs/features/queues-and-emails/phase02-queued-jobs.md +0 -19
  111. package/docs/features/queues-and-emails/phase03-transactional-emails.md +0 -16
  112. package/docs/features/queues-and-emails/phase04-quota-ops.md +0 -17
  113. package/docs/features/queues-and-emails/phase05-async-build-processing-DECISION.md +0 -16
  114. package/docs/features/queues-and-emails/phase06-verify-deploy.md +0 -17
  115. package/docs/getting-started/configuration.md +0 -469
  116. package/docs/getting-started/installation.md +0 -300
  117. package/docs/getting-started/quick-start.md +0 -430
  118. package/docs/guides/BACKEND_TEMPLATES_GUIDE.md +0 -183
  119. package/docs/guides/admin-panel.md +0 -268
  120. package/docs/guides/channel-management.md +0 -343
  121. package/docs/guides/dashboard-guide.md +0 -365
  122. package/docs/guides/deployment-guide.md +0 -335
  123. package/docs/guides/end-to-end-workflow.md +0 -491
  124. package/docs/guides/key-management.md +0 -284
  125. package/docs/guides/migration-from-codepush.md +0 -145
  126. package/docs/guides/security-best-practices.md +0 -1057
  127. package/docs/guides/testing-guide.md +0 -346
  128. package/docs/guides/troubleshooting.md +0 -482
  129. package/docs/package-audit.md +0 -41
  130. package/docs/plans/PLANNING_COMPLETE_SUMMARY.md +0 -361
  131. package/docs/plans/TASK_1_ANDROID_EXAMPLE_APP.md +0 -401
  132. package/docs/plans/TASK_2_API_ENDPOINTS.md +0 -856
  133. package/docs/plans/TASK_2_DASHBOARD_UI_UX.md +0 -820
  134. package/docs/plans/TASK_2_DATABASE_SCHEMA.md +0 -704
  135. package/docs/plans/TASK_2_GOOGLE_DRIVE_INTEGRATION.md +0 -646
  136. package/docs/plans/TASK_2_SAAS_ARCHITECTURE.md +0 -587
  137. package/docs/plans/TASK_2_USER_AUTHENTICATION.md +0 -600
  138. package/docs/play-store/ASO-METADATA.md +0 -5
  139. package/docs/play-store/DATA-SAFETY.md +0 -5
  140. package/docs/play-store/DECLARATIONS.md +0 -5
  141. package/docs/play-store/README.md +0 -27
  142. package/docs/play-store/RELEASE-NOTES.md +0 -99
  143. package/docs/play-store/RELEASE-STEPS.md +0 -6
  144. package/docs/play-store/STORE-LISTING.md +0 -7
  145. package/docs/play-store/SUBMISSION-CHECKLIST.md +0 -5
  146. package/docs/production-readiness.md +0 -475
  147. package/docs/project-audit/2026-05-16/00-FINALIZATION-PLAN.md +0 -123
  148. package/docs/project-audit/2026-05-16/01-BATCH-PLAN.md +0 -227
  149. package/docs/project-audit/2026-05-16/02-AUDIT-FINDINGS.md +0 -144
  150. package/docs/project-audit/2026-05-16/sessions/batch-01.md +0 -42
  151. package/docs/project-audit/2026-05-16/sessions/batch-02.md +0 -74
  152. package/docs/project-audit/2026-05-16/sessions/batch-03.md +0 -71
  153. package/docs/project-audit/2026-05-16/sessions/batch-04.md +0 -88
  154. package/docs/project-audit/2026-05-16/sessions/batch-05.md +0 -63
  155. package/docs/project-audit/2026-05-16/sessions/batch-06.md +0 -103
  156. package/docs/project-audit/2026-05-16/sessions/batch-07.md +0 -61
  157. package/docs/project-audit/2026-05-16/sessions/batch-08.md +0 -101
  158. package/docs/project-audit/2026-05-16/sessions/batch-09.md +0 -105
  159. package/docs/project-audit/2026-05-16/sessions/batch-10.md +0 -102
  160. package/docs/project-audit/AUDIT-HISTORY.md +0 -74
  161. package/docs/project-audit/BATCH-PLAN.md +0 -168
  162. package/docs/project-audit/MARKETING-WEBSITE-FINDINGS-2026-05-11.md +0 -73
  163. package/docs/project-audit/PRODUCTION-READINESS-AUDIT-2026-05-08.md +0 -275
  164. package/docs/project-finalization/00-tracker.json +0 -60
  165. package/docs/project-knowledge-base/01-system-overview.md +0 -227
  166. package/docs/project-knowledge-base/02-routes-pages-forms-users.md +0 -352
  167. package/docs/project-knowledge-base/03-tech-stack-modules-services.md +0 -379
  168. package/docs/project-knowledge-base/04-data-models-integrations.md +0 -244
  169. package/docs/project-knowledge-base/05-docs-corpus-inventory.md +0 -256
  170. package/docs/project-knowledge-base/06-operations-testing-legal-content.md +0 -208
  171. package/docs/project-knowledge-base/README.md +0 -103
  172. package/docs/project-profiles/native-update-capacitor-update-platform-project-profile-last-updated-2026-05-19.md +0 -81
  173. package/docs/reports/AUDIT_SUMMARY_2025-12-26.md +0 -203
  174. package/docs/reports/CLAUDE-CODE-COMPLETION-PROMPT.md +0 -403
  175. package/docs/reports/CLAUDE_CODE_PROMPT.md +0 -29
  176. package/docs/reports/CODEBASE_STATUS_REPORT.md +0 -272
  177. package/docs/reports/COMPLETE_VERIFICATION.md +0 -106
  178. package/docs/reports/COMPREHENSIVE-PROJECT-AUDIT-2026-02-24.md +0 -747
  179. package/docs/reports/EVENT_FLOW_VERIFICATION.md +0 -80
  180. package/docs/reports/EXAMPLE_APPS_SIMPLIFICATION_COMPLETE.md +0 -369
  181. package/docs/reports/FINAL_STATUS.md +0 -122
  182. package/docs/reports/FINAL_VERIFICATION_CHECKLIST.md +0 -425
  183. package/docs/reports/MARKETING_WEBSITE_COMPLETE.md +0 -466
  184. package/docs/reports/PACKAGE_COMPLETENESS_REPORT.md +0 -130
  185. package/docs/reports/PRODUCTION_STATUS.md +0 -115
  186. package/docs/reports/PROJECT_RESTRUCTURE_2025-12-27.md +0 -287
  187. package/docs/reports/PROJECT_RESTRUCTURE_FINAL_SUMMARY.md +0 -464
  188. package/docs/reports/PUBLISHING_VERIFICATION.md +0 -144
  189. package/docs/reports/RELEASE_READY_SUMMARY.md +0 -99
  190. package/docs/reports/claude-completion.json +0 -241
  191. package/docs/rules-tracker.md +0 -102
  192. package/docs/security/PRE-LAUNCH-PENTEST-CHECKLIST.md +0 -116
  193. package/docs/security/certificate-pinning.md +0 -122
  194. package/docs/seo-aeo-rules.json +0 -3043
  195. package/docs/social-media-marketing/README.md +0 -81
  196. package/docs/social-media-marketing/posts-batch-01.md +0 -613
  197. package/docs/social-media-marketing/posts-batch-02.md +0 -528
  198. package/docs/social-media-marketing/whatsapp-messages-batch-01.md +0 -458
  199. package/docs/social-media-marketing/whatsapp-status-batch-01.md +0 -355
  200. package/docs/tracking/IMPLEMENTATION_TRACKER.md +0 -303
  201. package/docs/tracking/capacitor-rollout-note-2026-03-01.md +0 -21
  202. package/docs/tracking/completion-tracker-2026-02-24.json +0 -174
  203. package/docs/tracking/finalization-2026-05-16-tracker.json +0 -346
  204. package/docs/tracking/full-audit-tracker.json +0 -121
  205. package/docs/tracking/production-readiness-audit-tracker.json +0 -429
  206. package/docs/tracking/seo-checklist-tracker.json +0 -333
@@ -1,504 +0,0 @@
1
- # Native Update - Laravel + Nova Backend Implementation Plan
2
-
3
- **Created:** 2026-03-28
4
- **Status:** Planning Complete
5
- **Goal:** Transform native-update from a free Firebase-based system to a paid SaaS with Laravel + Nova backend
6
-
7
- ---
8
-
9
- ## Context
10
-
11
- ### Why This Change Is Needed
12
-
13
- The native-update project is currently a fully functional OTA update system for Capacitor apps using a "no-cost" architecture (Firebase Auth + Firestore + Google Drive). However, to become a **paid commercial service** like Ionic AppFlow, we need:
14
-
15
- 1. **Licensing & API Keys** - Secure server-side key validation
16
- 2. **Stripe Payments** - Subscription management, usage-based billing (MAU)
17
- 3. **Secure Downloads** - API key-authenticated bundle downloads
18
- 4. **Server-Side Signing** - Private RSA keys held server-side
19
- 5. **Admin Dashboard** - Nova-powered backend for management
20
-
21
- ### Current State Assessment
22
-
23
- | Component | Status | Production Ready |
24
- |-----------|--------|------------------|
25
- | TypeScript Plugin Core | Excellent | YES |
26
- | Android Native | Good (minor fixes) | YES |
27
- | iOS Native | Good (minor fixes) | YES |
28
- | Firestore Schema | Complete | YES |
29
- | Website (React) | Complete | YES |
30
- | Security (Crypto) | Excellent | YES |
31
-
32
- **The plugin itself is production-ready.** This plan focuses on the backend infrastructure for commercialization.
33
-
34
- ---
35
-
36
- ## Architecture Decision
37
-
38
- ### Keep vs Migrate
39
-
40
- | Component | Decision | Rationale |
41
- |-----------|----------|-----------|
42
- | **Frontend (React + Radix)** | KEEP | Working well, no migration needed |
43
- | **Firebase Auth** | KEEP | Google OAuth working, validate tokens in Laravel |
44
- | **Firestore** | MIGRATE to MySQL | Laravel needs relational data for billing |
45
- | **Google Drive Storage** | OPTIONAL | Keep for free tier, add S3/R2 for paid |
46
- | **Bundle Distribution** | MIGRATE | Laravel signed URLs for secure downloads |
47
-
48
- ### Final Architecture
49
-
50
- ```
51
- ┌─────────────────────────────────────────────────────────────────────┐
52
- │ FINAL ARCHITECTURE │
53
- ├─────────────────────────────────────────────────────────────────────┤
54
- │ │
55
- │ ┌─────────────┐ ┌─────────────────────┐ ┌──────────────┐ │
56
- │ │ React │────▶│ Laravel API │────▶│ MySQL │ │
57
- │ │ Dashboard │ │ (API + Nova Admin) │ │ Database │ │
58
- │ │ (existing) │ │ │ │ │ │
59
- │ └─────────────┘ │ - Stripe webhooks │ └──────────────┘ │
60
- │ │ │ - Bundle signing │ │ │
61
- │ │ │ - API key auth │ │ │
62
- │ ▼ │ - MAU tracking │ ▼ │
63
- │ ┌─────────────┐ └─────────────────────┘ ┌──────────────┐ │
64
- │ │ Firebase │ │ │ S3/R2 │ │
65
- │ │ Auth │ │ │ (bundles) │ │
66
- │ │ (keep) │ ▼ │ │ │
67
- │ └─────────────┘ ┌─────────────────────┐ └──────────────┘ │
68
- │ │ Mobile Apps │ │
69
- │ │ - API key auth │ │
70
- │ │ - Signed URL DL │ │
71
- │ └─────────────────────┘ │
72
- │ │
73
- └─────────────────────────────────────────────────────────────────────┘
74
- ```
75
-
76
- ---
77
-
78
- ## Implementation Phases
79
-
80
- ### Phase 1: Laravel Project Setup (Week 1)
81
-
82
- **Tasks:**
83
- 1. Create Laravel 11 project with Nova 5
84
- 2. Configure MySQL database
85
- 3. Set up authentication (Firebase token validation middleware)
86
- 4. Configure S3/Cloudflare R2 for bundle storage
87
- 5. Set up development environment
88
-
89
- **Files to Create:**
90
- ```
91
- backend/
92
- ├── app/
93
- │ ├── Http/
94
- │ │ ├── Middleware/
95
- │ │ │ ├── ValidateFirebaseToken.php
96
- │ │ │ ├── ValidateApiKey.php
97
- │ │ │ └── ValidateRequestSignature.php
98
- │ │ └── Controllers/
99
- │ │ └── Api/
100
- │ │ ├── UpdateController.php
101
- │ │ ├── BundleController.php
102
- │ │ └── AnalyticsController.php
103
- │ ├── Models/
104
- │ │ ├── User.php
105
- │ │ ├── App.php
106
- │ │ ├── Build.php
107
- │ │ ├── ApiKey.php
108
- │ │ ├── Subscription.php
109
- │ │ └── DeviceActivity.php
110
- │ ├── Services/
111
- │ │ ├── BundleSigningService.php
112
- │ │ ├── SignedUrlService.php
113
- │ │ └── MAUService.php
114
- │ └── Nova/
115
- │ ├── User.php
116
- │ ├── App.php
117
- │ ├── Build.php
118
- │ ├── Subscription.php
119
- │ └── Dashboards/
120
- │ └── Main.php
121
- ├── config/
122
- │ ├── firebase.php
123
- │ └── stripe.php
124
- ├── database/
125
- │ └── migrations/
126
- │ ├── create_users_table.php
127
- │ ├── create_apps_table.php
128
- │ ├── create_builds_table.php
129
- │ ├── create_api_keys_table.php
130
- │ ├── create_subscriptions_table.php
131
- │ └── create_device_activities_table.php
132
- └── routes/
133
- ├── api.php
134
- └── web.php
135
- ```
136
-
137
- ### Phase 2: Database Schema & Models (Week 1-2)
138
-
139
- **Core Tables:**
140
-
141
- ```sql
142
- -- users (synced from Firebase)
143
- CREATE TABLE users (
144
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
145
- firebase_uid VARCHAR(128) UNIQUE NOT NULL,
146
- email VARCHAR(255) UNIQUE NOT NULL,
147
- name VARCHAR(255),
148
- avatar_url TEXT,
149
- plan ENUM('free', 'pro', 'enterprise') DEFAULT 'free',
150
- stripe_customer_id VARCHAR(255),
151
- created_at TIMESTAMP,
152
- updated_at TIMESTAMP
153
- );
154
-
155
- -- apps
156
- CREATE TABLE apps (
157
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
158
- user_id BIGINT UNSIGNED NOT NULL,
159
- app_id VARCHAR(255) NOT NULL, -- com.example.app
160
- name VARCHAR(255) NOT NULL,
161
- platforms JSON, -- ['ios', 'android']
162
- channels JSON, -- {production: {}, staging: {}}
163
- public_key TEXT, -- RSA public key (auto-generated)
164
- created_at TIMESTAMP,
165
- updated_at TIMESTAMP,
166
- FOREIGN KEY (user_id) REFERENCES users(id),
167
- UNIQUE KEY (user_id, app_id)
168
- );
169
-
170
- -- api_keys
171
- CREATE TABLE api_keys (
172
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
173
- app_id BIGINT UNSIGNED NOT NULL,
174
- key_hash VARCHAR(64) NOT NULL, -- SHA-256 of full key
175
- key_prefix VARCHAR(20) NOT NULL, -- nu_app_abc123... (for display)
176
- name VARCHAR(255),
177
- type ENUM('app', 'admin') DEFAULT 'app',
178
- status ENUM('active', 'deprecated', 'revoked') DEFAULT 'active',
179
- permissions JSON,
180
- rate_limit INT DEFAULT 60,
181
- last_used_at TIMESTAMP,
182
- expires_at TIMESTAMP,
183
- created_at TIMESTAMP,
184
- updated_at TIMESTAMP,
185
- FOREIGN KEY (app_id) REFERENCES apps(id),
186
- INDEX (key_hash),
187
- INDEX (status)
188
- );
189
-
190
- -- builds
191
- CREATE TABLE builds (
192
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
193
- app_id BIGINT UNSIGNED NOT NULL,
194
- bundle_id VARCHAR(255) NOT NULL,
195
- version VARCHAR(50) NOT NULL,
196
- build_number INT,
197
- channel ENUM('production', 'staging', 'development') DEFAULT 'production',
198
- platform ENUM('ios', 'android', 'web', 'all') DEFAULT 'all',
199
- storage_path TEXT NOT NULL,
200
- storage_provider ENUM('s3', 'r2', 'drive') DEFAULT 's3',
201
- file_size BIGINT UNSIGNED,
202
- checksum VARCHAR(64) NOT NULL, -- SHA-256
203
- signature TEXT, -- RSA-PSS signature
204
- release_notes TEXT,
205
- mandatory BOOLEAN DEFAULT FALSE,
206
- min_native_version VARCHAR(50),
207
- rollout_percentage INT DEFAULT 100,
208
- status ENUM('uploading', 'processing', 'active', 'archived', 'failed') DEFAULT 'uploading',
209
- download_count INT DEFAULT 0,
210
- install_count INT DEFAULT 0,
211
- created_at TIMESTAMP,
212
- updated_at TIMESTAMP,
213
- FOREIGN KEY (app_id) REFERENCES apps(id),
214
- INDEX (channel, status),
215
- INDEX (version)
216
- );
217
-
218
- -- subscriptions
219
- CREATE TABLE subscriptions (
220
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
221
- user_id BIGINT UNSIGNED NOT NULL,
222
- stripe_subscription_id VARCHAR(255),
223
- stripe_price_id VARCHAR(255),
224
- plan ENUM('free', 'pro', 'enterprise') NOT NULL,
225
- status ENUM('active', 'canceled', 'past_due', 'trialing') DEFAULT 'active',
226
- mau_limit INT NOT NULL, -- Monthly active users limit
227
- apps_limit INT NOT NULL,
228
- current_period_start TIMESTAMP,
229
- current_period_end TIMESTAMP,
230
- canceled_at TIMESTAMP,
231
- created_at TIMESTAMP,
232
- updated_at TIMESTAMP,
233
- FOREIGN KEY (user_id) REFERENCES users(id)
234
- );
235
-
236
- -- device_activities (for MAU tracking)
237
- CREATE TABLE device_activities (
238
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
239
- app_id BIGINT UNSIGNED NOT NULL,
240
- device_hash VARCHAR(64) NOT NULL, -- SHA-256 of device ID
241
- platform ENUM('ios', 'android', 'web'),
242
- app_version VARCHAR(50),
243
- bundle_version VARCHAR(50),
244
- month_key VARCHAR(7) NOT NULL, -- '2026-03'
245
- last_seen_at TIMESTAMP,
246
- created_at TIMESTAMP,
247
- FOREIGN KEY (app_id) REFERENCES apps(id),
248
- UNIQUE KEY (app_id, device_hash, month_key),
249
- INDEX (month_key)
250
- );
251
-
252
- -- signing_keys (RSA key pairs per app)
253
- CREATE TABLE signing_keys (
254
- id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
255
- app_id BIGINT UNSIGNED NOT NULL,
256
- key_id VARCHAR(64) NOT NULL, -- fingerprint
257
- private_key_encrypted TEXT NOT NULL, -- AES-256 encrypted
258
- public_key TEXT NOT NULL,
259
- status ENUM('active', 'rotated', 'revoked') DEFAULT 'active',
260
- created_at TIMESTAMP,
261
- rotated_at TIMESTAMP,
262
- FOREIGN KEY (app_id) REFERENCES apps(id),
263
- UNIQUE KEY (app_id, key_id)
264
- );
265
- ```
266
-
267
- ### Phase 3: API Endpoints (Week 2)
268
-
269
- **Mobile App API (API Key Auth):**
270
-
271
- | Method | Endpoint | Description |
272
- |--------|----------|-------------|
273
- | GET | `/api/v1/updates/check` | Check for available updates |
274
- | GET | `/api/v1/bundles/{id}/download` | Download bundle (signed URL redirect) |
275
- | POST | `/api/v1/analytics/mau` | Report device activity |
276
-
277
- **Dashboard API (Firebase Token Auth):**
278
-
279
- | Method | Endpoint | Description |
280
- |--------|----------|-------------|
281
- | GET | `/api/dashboard/apps` | List user's apps |
282
- | POST | `/api/dashboard/apps` | Create new app |
283
- | GET | `/api/dashboard/apps/{id}/builds` | List builds |
284
- | POST | `/api/dashboard/apps/{id}/builds` | Upload new build |
285
- | GET | `/api/dashboard/apps/{id}/keys` | List API keys |
286
- | POST | `/api/dashboard/apps/{id}/keys` | Generate API key |
287
- | GET | `/api/dashboard/subscription` | Get subscription status |
288
- | POST | `/api/dashboard/subscription/checkout` | Create Stripe checkout |
289
-
290
- **Webhook Endpoints:**
291
-
292
- | Method | Endpoint | Description |
293
- |--------|----------|-------------|
294
- | POST | `/webhooks/stripe` | Stripe payment events |
295
-
296
- ### Phase 4: Stripe Integration (Week 2-3)
297
-
298
- **Pricing Tiers:**
299
-
300
- | Plan | Price | MAU Limit | Apps | Features |
301
- |------|-------|-----------|------|----------|
302
- | Free | $0 | 1,000 | 1 | Basic updates, community support |
303
- | Pro | $29/mo | 10,000 | 5 | Rollouts, analytics, email support |
304
- | Enterprise | $199/mo | 100,000 | Unlimited | Delta updates, SLA, priority support |
305
-
306
- **MAU Overage:** $0.005 per MAU above limit
307
-
308
- **Implementation:**
309
- - Laravel Cashier for subscription management
310
- - Stripe Checkout for self-serve signup
311
- - Stripe Customer Portal for self-serve management
312
- - Webhook handling for subscription lifecycle
313
-
314
- ### Phase 5: Bundle Signing & Security (Week 3)
315
-
316
- **Server-Side Signing Flow:**
317
-
318
- 1. User uploads bundle via dashboard
319
- 2. Laravel receives file, stores in S3/R2
320
- 3. Calculate SHA-256 checksum
321
- 4. Sign with app's private RSA key (RSA-PSS, SHA-256)
322
- 5. Store signature in builds table
323
- 6. Return signed metadata to mobile apps
324
-
325
- **Download Security:**
326
-
327
- 1. Mobile app requests update check with API key
328
- 2. Server validates API key + device eligibility
329
- 3. Generate time-limited signed URL (5 minutes)
330
- 4. URL bound to device ID hash
331
- 5. One-time download token
332
- 6. Mobile app downloads and verifies checksum + signature
333
-
334
- ### Phase 6: Nova Admin Panel (Week 3-4)
335
-
336
- **Nova Resources:**
337
- - Users - View all users, subscriptions, apps
338
- - Apps - All apps across users
339
- - Builds - All builds, status management
340
- - Subscriptions - Revenue, plan management
341
- - ApiKeys - Key management, revocation
342
- - DeviceActivities - MAU reports
343
-
344
- **Nova Dashboards:**
345
- - Revenue Overview (MRR, churn, growth)
346
- - Usage Metrics (MAU, downloads, installs)
347
- - Build Analytics (success rate, rollback rate)
348
-
349
- **Nova Actions:**
350
- - Suspend User
351
- - Adjust Plan
352
- - Revoke API Key
353
- - Archive Build
354
- - Force Rollback
355
-
356
- ### Phase 7: Plugin Updates (Week 4)
357
-
358
- **Changes to TypeScript Plugin:**
359
-
360
- 1. Add `apiKey` to `PluginInitConfig`
361
- 2. Add API key header to HTTP requests
362
- 3. Add request signing (optional, for replay protection)
363
- 4. Add MAU ping endpoint call
364
-
365
- **Files to Modify:**
366
- - `src/definitions.ts` - Add config interfaces
367
- - `src/plugin.ts` - Add headers to fetch requests
368
- - `src/core/config.ts` - API key validation
369
-
370
- **Native Changes (minimal):**
371
- - Store API key in secure storage (already supported)
372
- - No other changes needed
373
-
374
- ### Phase 8: Migration & Testing (Week 4-5)
375
-
376
- **Migration Strategy:**
377
-
378
- 1. Deploy Laravel backend alongside existing Firestore
379
- 2. Sync Firebase users to MySQL
380
- 3. Add HTTP backend support to plugin (already exists)
381
- 4. Migrate apps one-by-one
382
- 5. Deprecate Firestore (keep as fallback for 90 days)
383
- 6. Full cutover
384
-
385
- **Testing Checklist:**
386
- - [ ] API key generation and validation
387
- - [ ] Bundle upload and signing
388
- - [ ] Secure download URLs
389
- - [ ] MAU tracking accuracy
390
- - [ ] Stripe subscription flow
391
- - [ ] Stripe webhook handling
392
- - [ ] Nova admin operations
393
- - [ ] Rate limiting
394
- - [ ] Error handling
395
-
396
- ---
397
-
398
- ## Security Architecture
399
-
400
- ### API Key Format
401
-
402
- ```
403
- nu_{type}_{random}_{checksum}
404
-
405
- Example: nu_app_a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890_f7d8
406
- ```
407
-
408
- - `nu_` - Namespace prefix
409
- - `app_` or `adm_` - Key type
410
- - 64 hex chars - Cryptographically secure random
411
- - 4 hex chars - CRC-32 checksum
412
-
413
- ### Request Authentication
414
-
415
- **Mobile Apps:**
416
- ```http
417
- GET /api/v1/updates/check HTTP/1.1
418
- Host: api.nativeupdate.dev
419
- X-API-Key: nu_app_...
420
- X-Device-ID: device_hash
421
- X-Current-Version: 1.2.3
422
- X-Platform: ios
423
- ```
424
-
425
- **Dashboard:**
426
- ```http
427
- GET /api/dashboard/apps HTTP/1.1
428
- Host: api.nativeupdate.dev
429
- Authorization: Bearer {firebase_id_token}
430
- ```
431
-
432
- ### Bundle Signature Flow
433
-
434
- ```
435
- 1. Upload: bundle.zip
436
- 2. Server: checksum = SHA-256(bundle.zip)
437
- 3. Server: signature = RSA-PSS(checksum, private_key)
438
- 4. Store: {checksum, signature, key_id}
439
- 5. Mobile: verify RSA-PSS(checksum, signature, public_key)
440
- ```
441
-
442
- ---
443
-
444
- ## File References
445
-
446
- ### Critical Plugin Files
447
- - `/src/definitions.ts` - Add apiKey config
448
- - `/src/plugin.ts` - Add auth headers (lines 362-368)
449
- - `/src/core/security.ts` - Signature verification (existing)
450
- - `/ios/Plugin/Security/SecurityManager.swift` - iOS secure storage
451
- - `/android/.../SecurityManager.kt` - Android secure storage
452
-
453
- ### Website Files to Update
454
- - `/website/src/services/bundle-upload-service.ts` - Change to Laravel API
455
- - `/website/src/services/auth-service.ts` - Keep Firebase, add token forwarding
456
- - `/website/src/stores/appsStore.ts` - Update API calls
457
-
458
- ---
459
-
460
- ## Verification Plan
461
-
462
- ### Unit Tests
463
- - API key validation middleware
464
- - Bundle signing service
465
- - MAU calculation
466
- - Subscription tier enforcement
467
-
468
- ### Integration Tests
469
- - Full upload → download flow
470
- - Stripe checkout → subscription active
471
- - MAU tracking → billing calculation
472
- - API key rotation
473
-
474
- ### End-to-End Tests
475
- - Mobile app update check
476
- - Mobile app bundle download
477
- - Dashboard app creation
478
- - Dashboard build upload
479
-
480
- ---
481
-
482
- ## Timeline Summary
483
-
484
- | Week | Phase | Deliverables |
485
- |------|-------|--------------|
486
- | 1 | Setup + Schema | Laravel project, database, models |
487
- | 2 | APIs | Mobile + Dashboard API endpoints |
488
- | 2-3 | Stripe | Billing, subscriptions, webhooks |
489
- | 3 | Security | Signing, secure downloads |
490
- | 3-4 | Nova | Admin panel, dashboards |
491
- | 4 | Plugin | TypeScript + native updates |
492
- | 4-5 | Migration | Testing, gradual rollout |
493
-
494
- **Total: 5 weeks to production**
495
-
496
- ---
497
-
498
- ## Questions Resolved
499
-
500
- 1. **Keep Google Drive?** - Optional for free tier, S3/R2 for paid
501
- 2. **Keep Firebase Auth?** - YES, validate tokens in Laravel
502
- 3. **Mobile auth?** - API keys with signed URLs for downloads
503
- 4. **MAU tracking?** - Device hash + monthly aggregation
504
- 5. **Admin panel?** - Nova with full resource management
@@ -1,184 +0,0 @@
1
- {
2
- "feature": "Laravel + Nova Backend for Native Update",
3
- "created": "2026-03-28",
4
- "lastUpdated": "2026-03-28",
5
- "status": "in_progress",
6
- "estimatedWeeks": 5,
7
- "currentPhase": 3,
8
- "phases": [
9
- {
10
- "id": 1,
11
- "name": "Laravel Project Setup",
12
- "status": "completed",
13
- "completedAt": "2026-03-28",
14
- "estimatedDays": 5,
15
- "tasks": [
16
- { "task": "Create Laravel 11 project", "status": "completed" },
17
- { "task": "Install and configure Nova 5", "status": "completed" },
18
- { "task": "Configure MySQL database", "status": "completed", "note": "Using SQLite for dev, MySQL for production" },
19
- { "task": "Set up Firebase token validation middleware", "status": "completed" },
20
- { "task": "Configure S3/Cloudflare R2 storage", "status": "partial", "note": "Config added, needs keys" },
21
- { "task": "Set up development environment (.env)", "status": "completed" }
22
- ]
23
- },
24
- {
25
- "id": 2,
26
- "name": "Database Schema & Models",
27
- "status": "completed",
28
- "completedAt": "2026-03-28",
29
- "estimatedDays": 4,
30
- "tasks": [
31
- { "task": "Create users migration and model", "status": "completed" },
32
- { "task": "Create apps migration and model", "status": "completed" },
33
- { "task": "Create builds migration and model", "status": "completed" },
34
- { "task": "Create api_keys migration and model", "status": "completed" },
35
- { "task": "Create subscriptions migration and model", "status": "completed" },
36
- { "task": "Create device_activities migration and model", "status": "completed" },
37
- { "task": "Create signing_keys migration and model", "status": "completed" },
38
- { "task": "Set up model relationships", "status": "completed" }
39
- ]
40
- },
41
- {
42
- "id": 3,
43
- "name": "API Endpoints",
44
- "status": "in_progress",
45
- "estimatedDays": 5,
46
- "tasks": [
47
- { "task": "Create ValidateApiKey middleware", "status": "completed" },
48
- { "task": "Create ValidateFirebaseToken middleware", "status": "completed" },
49
- { "task": "Create UpdateController (check for updates)", "status": "completed" },
50
- { "task": "Create BundleController (upload, download)", "status": "completed" },
51
- { "task": "Create AnalyticsController (MAU ping)", "status": "completed" },
52
- { "task": "Create AppController (dashboard CRUD)", "status": "pending" },
53
- { "task": "Create ApiKeyController (key management)", "status": "pending" },
54
- { "task": "Create SubscriptionController (billing)", "status": "pending" },
55
- { "task": "Set up API routes", "status": "completed" },
56
- { "task": "Add rate limiting", "status": "pending" }
57
- ]
58
- },
59
- {
60
- "id": 4,
61
- "name": "Stripe Integration",
62
- "status": "partial",
63
- "estimatedDays": 4,
64
- "tasks": [
65
- { "task": "Install Laravel Cashier", "status": "completed" },
66
- { "task": "Configure Stripe API keys", "status": "pending", "note": "Config added, needs keys" },
67
- { "task": "Create pricing plans in Stripe", "status": "pending" },
68
- { "task": "Implement checkout session creation", "status": "pending" },
69
- { "task": "Implement customer portal redirect", "status": "pending" },
70
- { "task": "Create webhook handler", "status": "pending" },
71
- { "task": "Handle subscription lifecycle events", "status": "pending" },
72
- { "task": "Implement MAU overage billing", "status": "pending" }
73
- ]
74
- },
75
- {
76
- "id": 5,
77
- "name": "Bundle Signing & Security",
78
- "status": "completed",
79
- "completedAt": "2026-03-28",
80
- "estimatedDays": 4,
81
- "tasks": [
82
- { "task": "Create BundleSigningService", "status": "completed", "note": "In SigningKey model" },
83
- { "task": "Implement RSA key pair generation", "status": "completed" },
84
- { "task": "Implement RSA-PSS signing", "status": "completed" },
85
- { "task": "Create SignedUrlService", "status": "completed", "note": "Using Laravel's built-in signed URLs" },
86
- { "task": "Implement time-limited download URLs", "status": "completed" },
87
- { "task": "Add device binding to URLs", "status": "completed" },
88
- { "task": "Implement one-time download tokens", "status": "pending" },
89
- { "task": "Add request signature validation (replay protection)", "status": "pending" }
90
- ]
91
- },
92
- {
93
- "id": 6,
94
- "name": "Nova Admin Panel",
95
- "status": "pending",
96
- "estimatedDays": 4,
97
- "tasks": [
98
- { "task": "Create User Nova resource", "status": "completed", "note": "Auto-generated by Nova install" },
99
- { "task": "Create App Nova resource", "status": "pending" },
100
- { "task": "Create Build Nova resource", "status": "pending" },
101
- { "task": "Create Subscription Nova resource", "status": "pending" },
102
- { "task": "Create ApiKey Nova resource", "status": "pending" },
103
- { "task": "Create Main dashboard (revenue, usage)", "status": "pending" },
104
- { "task": "Add admin actions (suspend, adjust plan)", "status": "pending" },
105
- { "task": "Add metrics cards and charts", "status": "pending" }
106
- ]
107
- },
108
- {
109
- "id": 7,
110
- "name": "Plugin Updates",
111
- "status": "pending",
112
- "estimatedDays": 3,
113
- "tasks": [
114
- { "task": "Add apiKey to PluginInitConfig in definitions.ts", "status": "pending" },
115
- { "task": "Add X-API-Key header to HTTP requests in plugin.ts", "status": "pending" },
116
- { "task": "Add MAU ping endpoint call", "status": "pending" },
117
- { "task": "Update iOS SecureStorage for API key", "status": "pending" },
118
- { "task": "Update Android SecureStorage for API key", "status": "pending" },
119
- { "task": "Update documentation", "status": "pending" }
120
- ]
121
- },
122
- {
123
- "id": 8,
124
- "name": "Migration & Testing",
125
- "status": "pending",
126
- "estimatedDays": 5,
127
- "tasks": [
128
- { "task": "Write unit tests for API key validation", "status": "pending" },
129
- { "task": "Write unit tests for bundle signing", "status": "pending" },
130
- { "task": "Write unit tests for MAU calculation", "status": "pending" },
131
- { "task": "Write integration tests for upload flow", "status": "pending" },
132
- { "task": "Write integration tests for download flow", "status": "pending" },
133
- { "task": "Write integration tests for Stripe flow", "status": "pending" },
134
- { "task": "Create Firebase user sync script", "status": "pending" },
135
- { "task": "Deploy to staging environment", "status": "pending" },
136
- { "task": "Perform end-to-end testing", "status": "pending" },
137
- { "task": "Deploy to production", "status": "pending" },
138
- { "task": "Monitor and fix issues", "status": "pending" }
139
- ]
140
- }
141
- ],
142
- "decisions": {
143
- "keepFirebaseAuth": true,
144
- "keepGoogleDrive": "optional-free-tier",
145
- "primaryStorage": "s3-or-r2",
146
- "adminPanel": "laravel-nova",
147
- "paymentProcessor": "stripe",
148
- "mauTracking": "device-hash-monthly"
149
- },
150
- "pricingTiers": [
151
- { "name": "Free", "price": 0, "mauLimit": 1000, "appsLimit": 1 },
152
- { "name": "Pro", "price": 29, "mauLimit": 10000, "appsLimit": 5 },
153
- { "name": "Enterprise", "price": 199, "mauLimit": 100000, "appsLimit": -1 }
154
- ],
155
- "securityFeatures": [
156
- "api-key-authentication",
157
- "firebase-token-validation",
158
- "rsa-pss-bundle-signing",
159
- "signed-download-urls",
160
- "device-binding",
161
- "rate-limiting",
162
- "replay-attack-prevention"
163
- ],
164
- "completedToday": [
165
- "Laravel 11 + Nova 5 project created in /backend",
166
- "All database migrations created and run",
167
- "All models with relationships created",
168
- "API key validation middleware created",
169
- "Firebase token validation middleware created",
170
- "Update check API endpoint created",
171
- "Bundle download API with signed URLs created",
172
- "Analytics/MAU tracking API created",
173
- "RSA key generation and signing in SigningKey model",
174
- "Laravel Cashier, Firebase SDK, AWS SDK installed"
175
- ],
176
- "blockers": [],
177
- "notes": [
178
- "Nova license configured globally",
179
- "Stripe API keys needed",
180
- "Firebase service account JSON needed",
181
- "S3/R2 bucket and keys needed",
182
- "Current plugin already supports HTTP backend - minimal changes needed"
183
- ]
184
- }