@wazir-dev/cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (629) hide show
  1. package/AGENTS.md +111 -0
  2. package/CHANGELOG.md +14 -0
  3. package/CONTRIBUTING.md +101 -0
  4. package/LICENSE +21 -0
  5. package/README.md +314 -0
  6. package/assets/composition-engine.mmd +34 -0
  7. package/assets/demo-script.sh +17 -0
  8. package/assets/logo-dark.svg +14 -0
  9. package/assets/logo.svg +14 -0
  10. package/assets/pipeline.mmd +39 -0
  11. package/assets/record-demo.sh +51 -0
  12. package/docs/README.md +51 -0
  13. package/docs/adapters/context-mode.md +60 -0
  14. package/docs/concepts/architecture.md +87 -0
  15. package/docs/concepts/artifact-model.md +60 -0
  16. package/docs/concepts/composition-engine.md +36 -0
  17. package/docs/concepts/indexing-and-recall.md +160 -0
  18. package/docs/concepts/observability.md +41 -0
  19. package/docs/concepts/roles-and-workflows.md +59 -0
  20. package/docs/concepts/terminology-policy.md +27 -0
  21. package/docs/getting-started/01-installation.md +78 -0
  22. package/docs/getting-started/02-first-run.md +102 -0
  23. package/docs/getting-started/03-adding-to-project.md +15 -0
  24. package/docs/getting-started/04-host-setup.md +15 -0
  25. package/docs/guides/ci-integration.md +15 -0
  26. package/docs/guides/creating-skills.md +15 -0
  27. package/docs/guides/expertise-module-authoring.md +15 -0
  28. package/docs/guides/hook-development.md +15 -0
  29. package/docs/guides/memory-and-learnings.md +34 -0
  30. package/docs/guides/multi-host-export.md +15 -0
  31. package/docs/guides/troubleshooting.md +101 -0
  32. package/docs/guides/writing-custom-roles.md +15 -0
  33. package/docs/plans/2026-03-15-cli-pipeline-integration-design.md +592 -0
  34. package/docs/plans/2026-03-15-cli-pipeline-integration-plan.md +598 -0
  35. package/docs/plans/2026-03-15-docs-enforcement-plan.md +238 -0
  36. package/docs/readmes/INDEX.md +99 -0
  37. package/docs/readmes/features/expertise/README.md +171 -0
  38. package/docs/readmes/features/exports/README.md +222 -0
  39. package/docs/readmes/features/hooks/README.md +103 -0
  40. package/docs/readmes/features/hooks/loop-cap-guard.md +133 -0
  41. package/docs/readmes/features/hooks/post-tool-capture.md +121 -0
  42. package/docs/readmes/features/hooks/post-tool-lint.md +130 -0
  43. package/docs/readmes/features/hooks/pre-compact-summary.md +122 -0
  44. package/docs/readmes/features/hooks/pre-tool-capture-route.md +100 -0
  45. package/docs/readmes/features/hooks/protected-path-write-guard.md +128 -0
  46. package/docs/readmes/features/hooks/session-start.md +119 -0
  47. package/docs/readmes/features/hooks/stop-handoff-harvest.md +125 -0
  48. package/docs/readmes/features/roles/README.md +157 -0
  49. package/docs/readmes/features/roles/clarifier.md +152 -0
  50. package/docs/readmes/features/roles/content-author.md +190 -0
  51. package/docs/readmes/features/roles/designer.md +193 -0
  52. package/docs/readmes/features/roles/executor.md +184 -0
  53. package/docs/readmes/features/roles/learner.md +210 -0
  54. package/docs/readmes/features/roles/planner.md +182 -0
  55. package/docs/readmes/features/roles/researcher.md +164 -0
  56. package/docs/readmes/features/roles/reviewer.md +184 -0
  57. package/docs/readmes/features/roles/specifier.md +162 -0
  58. package/docs/readmes/features/roles/verifier.md +215 -0
  59. package/docs/readmes/features/schemas/README.md +178 -0
  60. package/docs/readmes/features/skills/README.md +63 -0
  61. package/docs/readmes/features/skills/brainstorming.md +96 -0
  62. package/docs/readmes/features/skills/debugging.md +148 -0
  63. package/docs/readmes/features/skills/design.md +120 -0
  64. package/docs/readmes/features/skills/prepare-next.md +109 -0
  65. package/docs/readmes/features/skills/run-audit.md +159 -0
  66. package/docs/readmes/features/skills/scan-project.md +109 -0
  67. package/docs/readmes/features/skills/self-audit.md +176 -0
  68. package/docs/readmes/features/skills/tdd.md +137 -0
  69. package/docs/readmes/features/skills/using-skills.md +92 -0
  70. package/docs/readmes/features/skills/verification.md +120 -0
  71. package/docs/readmes/features/skills/writing-plans.md +104 -0
  72. package/docs/readmes/features/tooling/README.md +320 -0
  73. package/docs/readmes/features/workflows/README.md +186 -0
  74. package/docs/readmes/features/workflows/author.md +181 -0
  75. package/docs/readmes/features/workflows/clarify.md +154 -0
  76. package/docs/readmes/features/workflows/design-review.md +171 -0
  77. package/docs/readmes/features/workflows/design.md +169 -0
  78. package/docs/readmes/features/workflows/discover.md +162 -0
  79. package/docs/readmes/features/workflows/execute.md +173 -0
  80. package/docs/readmes/features/workflows/learn.md +167 -0
  81. package/docs/readmes/features/workflows/plan-review.md +165 -0
  82. package/docs/readmes/features/workflows/plan.md +170 -0
  83. package/docs/readmes/features/workflows/prepare-next.md +167 -0
  84. package/docs/readmes/features/workflows/review.md +169 -0
  85. package/docs/readmes/features/workflows/run-audit.md +191 -0
  86. package/docs/readmes/features/workflows/spec-challenge.md +159 -0
  87. package/docs/readmes/features/workflows/specify.md +160 -0
  88. package/docs/readmes/features/workflows/verify.md +177 -0
  89. package/docs/readmes/packages/README.md +50 -0
  90. package/docs/readmes/packages/ajv.md +117 -0
  91. package/docs/readmes/packages/context-mode.md +118 -0
  92. package/docs/readmes/packages/gray-matter.md +116 -0
  93. package/docs/readmes/packages/node-test.md +137 -0
  94. package/docs/readmes/packages/yaml.md +112 -0
  95. package/docs/reference/configuration-reference.md +159 -0
  96. package/docs/reference/expertise-index.md +52 -0
  97. package/docs/reference/git-flow.md +43 -0
  98. package/docs/reference/hooks.md +87 -0
  99. package/docs/reference/host-exports.md +50 -0
  100. package/docs/reference/launch-checklist.md +172 -0
  101. package/docs/reference/marketplace-listings.md +76 -0
  102. package/docs/reference/release-process.md +34 -0
  103. package/docs/reference/roles-reference.md +77 -0
  104. package/docs/reference/skills.md +33 -0
  105. package/docs/reference/templates.md +29 -0
  106. package/docs/reference/tooling-cli.md +94 -0
  107. package/docs/truth-claims.yaml +222 -0
  108. package/expertise/PROGRESS.md +63 -0
  109. package/expertise/README.md +18 -0
  110. package/expertise/antipatterns/PROGRESS.md +56 -0
  111. package/expertise/antipatterns/backend/api-design-antipatterns.md +1271 -0
  112. package/expertise/antipatterns/backend/auth-antipatterns.md +1195 -0
  113. package/expertise/antipatterns/backend/caching-antipatterns.md +622 -0
  114. package/expertise/antipatterns/backend/database-antipatterns.md +1038 -0
  115. package/expertise/antipatterns/backend/index.md +24 -0
  116. package/expertise/antipatterns/backend/microservices-antipatterns.md +850 -0
  117. package/expertise/antipatterns/code/architecture-antipatterns.md +919 -0
  118. package/expertise/antipatterns/code/async-antipatterns.md +622 -0
  119. package/expertise/antipatterns/code/code-smells.md +1186 -0
  120. package/expertise/antipatterns/code/dependency-antipatterns.md +1209 -0
  121. package/expertise/antipatterns/code/error-handling-antipatterns.md +1360 -0
  122. package/expertise/antipatterns/code/index.md +27 -0
  123. package/expertise/antipatterns/code/naming-and-abstraction.md +1118 -0
  124. package/expertise/antipatterns/code/state-management-antipatterns.md +1076 -0
  125. package/expertise/antipatterns/code/testing-antipatterns.md +1053 -0
  126. package/expertise/antipatterns/design/accessibility-antipatterns.md +1136 -0
  127. package/expertise/antipatterns/design/dark-patterns.md +1121 -0
  128. package/expertise/antipatterns/design/index.md +22 -0
  129. package/expertise/antipatterns/design/ui-antipatterns.md +1202 -0
  130. package/expertise/antipatterns/design/ux-antipatterns.md +680 -0
  131. package/expertise/antipatterns/frontend/css-layout-antipatterns.md +691 -0
  132. package/expertise/antipatterns/frontend/flutter-antipatterns.md +1827 -0
  133. package/expertise/antipatterns/frontend/index.md +23 -0
  134. package/expertise/antipatterns/frontend/mobile-antipatterns.md +573 -0
  135. package/expertise/antipatterns/frontend/react-antipatterns.md +1128 -0
  136. package/expertise/antipatterns/frontend/spa-antipatterns.md +1235 -0
  137. package/expertise/antipatterns/index.md +31 -0
  138. package/expertise/antipatterns/performance/index.md +20 -0
  139. package/expertise/antipatterns/performance/performance-antipatterns.md +1013 -0
  140. package/expertise/antipatterns/performance/premature-optimization.md +623 -0
  141. package/expertise/antipatterns/performance/scaling-antipatterns.md +785 -0
  142. package/expertise/antipatterns/process/ai-coding-antipatterns.md +853 -0
  143. package/expertise/antipatterns/process/code-review-antipatterns.md +656 -0
  144. package/expertise/antipatterns/process/deployment-antipatterns.md +920 -0
  145. package/expertise/antipatterns/process/index.md +23 -0
  146. package/expertise/antipatterns/process/technical-debt-antipatterns.md +647 -0
  147. package/expertise/antipatterns/security/index.md +20 -0
  148. package/expertise/antipatterns/security/secrets-antipatterns.md +849 -0
  149. package/expertise/antipatterns/security/security-theater.md +843 -0
  150. package/expertise/antipatterns/security/vulnerability-patterns.md +801 -0
  151. package/expertise/architecture/PROGRESS.md +70 -0
  152. package/expertise/architecture/data/caching-architecture.md +671 -0
  153. package/expertise/architecture/data/data-consistency.md +574 -0
  154. package/expertise/architecture/data/data-modeling.md +536 -0
  155. package/expertise/architecture/data/event-streams-and-queues.md +634 -0
  156. package/expertise/architecture/data/index.md +25 -0
  157. package/expertise/architecture/data/search-architecture.md +663 -0
  158. package/expertise/architecture/data/sql-vs-nosql.md +708 -0
  159. package/expertise/architecture/decisions/architecture-decision-records.md +640 -0
  160. package/expertise/architecture/decisions/build-vs-buy.md +616 -0
  161. package/expertise/architecture/decisions/index.md +23 -0
  162. package/expertise/architecture/decisions/monolith-to-microservices.md +790 -0
  163. package/expertise/architecture/decisions/technology-selection.md +616 -0
  164. package/expertise/architecture/distributed/cap-theorem-and-tradeoffs.md +800 -0
  165. package/expertise/architecture/distributed/circuit-breaker-bulkhead.md +741 -0
  166. package/expertise/architecture/distributed/consensus-and-coordination.md +796 -0
  167. package/expertise/architecture/distributed/distributed-systems-fundamentals.md +564 -0
  168. package/expertise/architecture/distributed/idempotency-and-retry.md +796 -0
  169. package/expertise/architecture/distributed/index.md +25 -0
  170. package/expertise/architecture/distributed/saga-pattern.md +797 -0
  171. package/expertise/architecture/foundations/architectural-thinking.md +460 -0
  172. package/expertise/architecture/foundations/coupling-and-cohesion.md +770 -0
  173. package/expertise/architecture/foundations/design-principles-solid.md +649 -0
  174. package/expertise/architecture/foundations/domain-driven-design.md +719 -0
  175. package/expertise/architecture/foundations/index.md +25 -0
  176. package/expertise/architecture/foundations/separation-of-concerns.md +472 -0
  177. package/expertise/architecture/foundations/twelve-factor-app.md +797 -0
  178. package/expertise/architecture/index.md +34 -0
  179. package/expertise/architecture/integration/api-design-graphql.md +638 -0
  180. package/expertise/architecture/integration/api-design-grpc.md +804 -0
  181. package/expertise/architecture/integration/api-design-rest.md +892 -0
  182. package/expertise/architecture/integration/index.md +25 -0
  183. package/expertise/architecture/integration/third-party-integration.md +795 -0
  184. package/expertise/architecture/integration/webhooks-and-callbacks.md +1152 -0
  185. package/expertise/architecture/integration/websockets-realtime.md +791 -0
  186. package/expertise/architecture/mobile-architecture/index.md +22 -0
  187. package/expertise/architecture/mobile-architecture/mobile-app-architecture.md +780 -0
  188. package/expertise/architecture/mobile-architecture/mobile-backend-for-frontend.md +670 -0
  189. package/expertise/architecture/mobile-architecture/offline-first.md +719 -0
  190. package/expertise/architecture/mobile-architecture/push-and-sync.md +782 -0
  191. package/expertise/architecture/patterns/cqrs-event-sourcing.md +717 -0
  192. package/expertise/architecture/patterns/event-driven.md +797 -0
  193. package/expertise/architecture/patterns/hexagonal-clean-architecture.md +870 -0
  194. package/expertise/architecture/patterns/index.md +27 -0
  195. package/expertise/architecture/patterns/layered-architecture.md +736 -0
  196. package/expertise/architecture/patterns/microservices.md +753 -0
  197. package/expertise/architecture/patterns/modular-monolith.md +692 -0
  198. package/expertise/architecture/patterns/monolith.md +626 -0
  199. package/expertise/architecture/patterns/plugin-architecture.md +735 -0
  200. package/expertise/architecture/patterns/serverless.md +780 -0
  201. package/expertise/architecture/scaling/database-scaling.md +615 -0
  202. package/expertise/architecture/scaling/feature-flags-and-rollouts.md +757 -0
  203. package/expertise/architecture/scaling/horizontal-vs-vertical.md +606 -0
  204. package/expertise/architecture/scaling/index.md +24 -0
  205. package/expertise/architecture/scaling/multi-tenancy.md +800 -0
  206. package/expertise/architecture/scaling/stateless-design.md +787 -0
  207. package/expertise/backend/embedded-firmware.md +625 -0
  208. package/expertise/backend/go.md +853 -0
  209. package/expertise/backend/index.md +24 -0
  210. package/expertise/backend/java-spring.md +448 -0
  211. package/expertise/backend/node-typescript.md +625 -0
  212. package/expertise/backend/python-fastapi.md +724 -0
  213. package/expertise/backend/rust.md +458 -0
  214. package/expertise/backend/solidity.md +711 -0
  215. package/expertise/composition-map.yaml +443 -0
  216. package/expertise/content/foundations/content-modeling.md +395 -0
  217. package/expertise/content/foundations/editorial-standards.md +449 -0
  218. package/expertise/content/foundations/index.md +24 -0
  219. package/expertise/content/foundations/microcopy.md +455 -0
  220. package/expertise/content/foundations/terminology-governance.md +509 -0
  221. package/expertise/content/index.md +34 -0
  222. package/expertise/content/patterns/accessibility-copy.md +518 -0
  223. package/expertise/content/patterns/index.md +24 -0
  224. package/expertise/content/patterns/notification-content.md +433 -0
  225. package/expertise/content/patterns/sample-content.md +486 -0
  226. package/expertise/content/patterns/state-copy.md +439 -0
  227. package/expertise/design/PROGRESS.md +58 -0
  228. package/expertise/design/disciplines/dark-mode-theming.md +577 -0
  229. package/expertise/design/disciplines/design-systems.md +595 -0
  230. package/expertise/design/disciplines/index.md +25 -0
  231. package/expertise/design/disciplines/information-architecture.md +800 -0
  232. package/expertise/design/disciplines/interaction-design.md +788 -0
  233. package/expertise/design/disciplines/responsive-design.md +552 -0
  234. package/expertise/design/disciplines/usability-testing.md +516 -0
  235. package/expertise/design/disciplines/user-research.md +792 -0
  236. package/expertise/design/foundations/accessibility-design.md +796 -0
  237. package/expertise/design/foundations/color-theory.md +797 -0
  238. package/expertise/design/foundations/iconography.md +795 -0
  239. package/expertise/design/foundations/index.md +26 -0
  240. package/expertise/design/foundations/motion-and-animation.md +653 -0
  241. package/expertise/design/foundations/rtl-design.md +585 -0
  242. package/expertise/design/foundations/spacing-and-layout.md +607 -0
  243. package/expertise/design/foundations/typography.md +800 -0
  244. package/expertise/design/foundations/visual-hierarchy.md +761 -0
  245. package/expertise/design/index.md +32 -0
  246. package/expertise/design/patterns/authentication-flows.md +474 -0
  247. package/expertise/design/patterns/content-consumption.md +789 -0
  248. package/expertise/design/patterns/data-display.md +618 -0
  249. package/expertise/design/patterns/e-commerce.md +1494 -0
  250. package/expertise/design/patterns/feedback-and-states.md +642 -0
  251. package/expertise/design/patterns/forms-and-input.md +819 -0
  252. package/expertise/design/patterns/gamification.md +801 -0
  253. package/expertise/design/patterns/index.md +31 -0
  254. package/expertise/design/patterns/microinteractions.md +449 -0
  255. package/expertise/design/patterns/navigation.md +800 -0
  256. package/expertise/design/patterns/notifications.md +705 -0
  257. package/expertise/design/patterns/onboarding.md +700 -0
  258. package/expertise/design/patterns/search-and-filter.md +601 -0
  259. package/expertise/design/patterns/settings-and-preferences.md +768 -0
  260. package/expertise/design/patterns/social-and-community.md +748 -0
  261. package/expertise/design/platforms/desktop-native.md +612 -0
  262. package/expertise/design/platforms/index.md +25 -0
  263. package/expertise/design/platforms/mobile-android.md +825 -0
  264. package/expertise/design/platforms/mobile-cross-platform.md +983 -0
  265. package/expertise/design/platforms/mobile-ios.md +699 -0
  266. package/expertise/design/platforms/tablet.md +794 -0
  267. package/expertise/design/platforms/web-dashboard.md +790 -0
  268. package/expertise/design/platforms/web-responsive.md +550 -0
  269. package/expertise/design/psychology/behavioral-nudges.md +449 -0
  270. package/expertise/design/psychology/cognitive-load.md +1191 -0
  271. package/expertise/design/psychology/error-psychology.md +778 -0
  272. package/expertise/design/psychology/index.md +22 -0
  273. package/expertise/design/psychology/persuasive-design.md +736 -0
  274. package/expertise/design/psychology/user-mental-models.md +623 -0
  275. package/expertise/design/tooling/open-pencil.md +266 -0
  276. package/expertise/frontend/angular.md +1073 -0
  277. package/expertise/frontend/desktop-electron.md +546 -0
  278. package/expertise/frontend/flutter.md +782 -0
  279. package/expertise/frontend/index.md +27 -0
  280. package/expertise/frontend/native-android.md +409 -0
  281. package/expertise/frontend/native-ios.md +490 -0
  282. package/expertise/frontend/react-native.md +1160 -0
  283. package/expertise/frontend/react.md +808 -0
  284. package/expertise/frontend/vue.md +1089 -0
  285. package/expertise/humanize/domain-rules-code.md +79 -0
  286. package/expertise/humanize/domain-rules-content.md +67 -0
  287. package/expertise/humanize/domain-rules-technical-docs.md +56 -0
  288. package/expertise/humanize/index.md +35 -0
  289. package/expertise/humanize/self-audit-checklist.md +87 -0
  290. package/expertise/humanize/sentence-patterns.md +218 -0
  291. package/expertise/humanize/vocabulary-blacklist.md +105 -0
  292. package/expertise/i18n/PROGRESS.md +65 -0
  293. package/expertise/i18n/advanced/accessibility-and-i18n.md +28 -0
  294. package/expertise/i18n/advanced/bidirectional-text-algorithm.md +38 -0
  295. package/expertise/i18n/advanced/complex-scripts.md +30 -0
  296. package/expertise/i18n/advanced/performance-and-i18n.md +27 -0
  297. package/expertise/i18n/advanced/testing-i18n.md +28 -0
  298. package/expertise/i18n/content/content-adaptation.md +23 -0
  299. package/expertise/i18n/content/locale-specific-formatting.md +23 -0
  300. package/expertise/i18n/content/machine-translation-integration.md +28 -0
  301. package/expertise/i18n/content/translation-management.md +29 -0
  302. package/expertise/i18n/foundations/date-time-calendars.md +67 -0
  303. package/expertise/i18n/foundations/i18n-architecture.md +272 -0
  304. package/expertise/i18n/foundations/locale-and-language-tags.md +79 -0
  305. package/expertise/i18n/foundations/numbers-currency-units.md +61 -0
  306. package/expertise/i18n/foundations/pluralization-and-gender.md +109 -0
  307. package/expertise/i18n/foundations/string-externalization.md +236 -0
  308. package/expertise/i18n/foundations/text-direction-bidi.md +241 -0
  309. package/expertise/i18n/foundations/unicode-and-encoding.md +86 -0
  310. package/expertise/i18n/index.md +38 -0
  311. package/expertise/i18n/platform/backend-i18n.md +31 -0
  312. package/expertise/i18n/platform/flutter-i18n.md +148 -0
  313. package/expertise/i18n/platform/native-android-i18n.md +36 -0
  314. package/expertise/i18n/platform/native-ios-i18n.md +36 -0
  315. package/expertise/i18n/platform/react-i18n.md +103 -0
  316. package/expertise/i18n/platform/web-css-i18n.md +81 -0
  317. package/expertise/i18n/rtl/arabic-specific.md +175 -0
  318. package/expertise/i18n/rtl/hebrew-specific.md +149 -0
  319. package/expertise/i18n/rtl/rtl-animations-and-transitions.md +111 -0
  320. package/expertise/i18n/rtl/rtl-forms-and-input.md +161 -0
  321. package/expertise/i18n/rtl/rtl-fundamentals.md +211 -0
  322. package/expertise/i18n/rtl/rtl-icons-and-images.md +181 -0
  323. package/expertise/i18n/rtl/rtl-layout-mirroring.md +252 -0
  324. package/expertise/i18n/rtl/rtl-navigation-and-gestures.md +107 -0
  325. package/expertise/i18n/rtl/rtl-testing-and-qa.md +147 -0
  326. package/expertise/i18n/rtl/rtl-typography.md +160 -0
  327. package/expertise/index.md +113 -0
  328. package/expertise/index.yaml +216 -0
  329. package/expertise/infrastructure/cloud-aws.md +597 -0
  330. package/expertise/infrastructure/cloud-gcp.md +599 -0
  331. package/expertise/infrastructure/cybersecurity.md +816 -0
  332. package/expertise/infrastructure/database-mongodb.md +447 -0
  333. package/expertise/infrastructure/database-postgres.md +400 -0
  334. package/expertise/infrastructure/devops-cicd.md +787 -0
  335. package/expertise/infrastructure/index.md +27 -0
  336. package/expertise/performance/PROGRESS.md +50 -0
  337. package/expertise/performance/backend/api-latency.md +1204 -0
  338. package/expertise/performance/backend/background-jobs.md +506 -0
  339. package/expertise/performance/backend/connection-pooling.md +1209 -0
  340. package/expertise/performance/backend/database-query-optimization.md +515 -0
  341. package/expertise/performance/backend/index.md +23 -0
  342. package/expertise/performance/backend/rate-limiting-and-throttling.md +971 -0
  343. package/expertise/performance/foundations/algorithmic-complexity.md +954 -0
  344. package/expertise/performance/foundations/caching-strategies.md +489 -0
  345. package/expertise/performance/foundations/concurrency-and-parallelism.md +847 -0
  346. package/expertise/performance/foundations/index.md +24 -0
  347. package/expertise/performance/foundations/measuring-and-profiling.md +440 -0
  348. package/expertise/performance/foundations/memory-management.md +964 -0
  349. package/expertise/performance/foundations/performance-budgets.md +1314 -0
  350. package/expertise/performance/index.md +31 -0
  351. package/expertise/performance/infrastructure/auto-scaling.md +1059 -0
  352. package/expertise/performance/infrastructure/cdn-and-edge.md +1081 -0
  353. package/expertise/performance/infrastructure/index.md +22 -0
  354. package/expertise/performance/infrastructure/load-balancing.md +1081 -0
  355. package/expertise/performance/infrastructure/observability.md +1079 -0
  356. package/expertise/performance/mobile/index.md +23 -0
  357. package/expertise/performance/mobile/mobile-animations.md +544 -0
  358. package/expertise/performance/mobile/mobile-memory-battery.md +416 -0
  359. package/expertise/performance/mobile/mobile-network.md +452 -0
  360. package/expertise/performance/mobile/mobile-rendering.md +599 -0
  361. package/expertise/performance/mobile/mobile-startup-time.md +505 -0
  362. package/expertise/performance/platform-specific/flutter-performance.md +647 -0
  363. package/expertise/performance/platform-specific/index.md +22 -0
  364. package/expertise/performance/platform-specific/node-performance.md +1307 -0
  365. package/expertise/performance/platform-specific/postgres-performance.md +1366 -0
  366. package/expertise/performance/platform-specific/react-performance.md +1403 -0
  367. package/expertise/performance/web/bundle-optimization.md +1239 -0
  368. package/expertise/performance/web/image-and-media.md +636 -0
  369. package/expertise/performance/web/index.md +24 -0
  370. package/expertise/performance/web/network-optimization.md +1133 -0
  371. package/expertise/performance/web/rendering-performance.md +1098 -0
  372. package/expertise/performance/web/ssr-and-hydration.md +918 -0
  373. package/expertise/performance/web/web-vitals.md +1374 -0
  374. package/expertise/quality/accessibility.md +985 -0
  375. package/expertise/quality/evidence-based-verification.md +499 -0
  376. package/expertise/quality/index.md +24 -0
  377. package/expertise/quality/ml-model-audit.md +614 -0
  378. package/expertise/quality/performance.md +600 -0
  379. package/expertise/quality/testing-api.md +891 -0
  380. package/expertise/quality/testing-mobile.md +496 -0
  381. package/expertise/quality/testing-web.md +849 -0
  382. package/expertise/security/PROGRESS.md +54 -0
  383. package/expertise/security/agentic-identity.md +540 -0
  384. package/expertise/security/compliance-frameworks.md +601 -0
  385. package/expertise/security/data/data-encryption.md +364 -0
  386. package/expertise/security/data/data-privacy-gdpr.md +692 -0
  387. package/expertise/security/data/database-security.md +1171 -0
  388. package/expertise/security/data/index.md +22 -0
  389. package/expertise/security/data/pii-handling.md +531 -0
  390. package/expertise/security/foundations/authentication.md +1041 -0
  391. package/expertise/security/foundations/authorization.md +603 -0
  392. package/expertise/security/foundations/cryptography.md +1001 -0
  393. package/expertise/security/foundations/index.md +25 -0
  394. package/expertise/security/foundations/owasp-top-10.md +1354 -0
  395. package/expertise/security/foundations/secrets-management.md +1217 -0
  396. package/expertise/security/foundations/secure-sdlc.md +700 -0
  397. package/expertise/security/foundations/supply-chain-security.md +698 -0
  398. package/expertise/security/index.md +31 -0
  399. package/expertise/security/infrastructure/cloud-security-aws.md +1296 -0
  400. package/expertise/security/infrastructure/cloud-security-gcp.md +1376 -0
  401. package/expertise/security/infrastructure/container-security.md +721 -0
  402. package/expertise/security/infrastructure/incident-response.md +1295 -0
  403. package/expertise/security/infrastructure/index.md +24 -0
  404. package/expertise/security/infrastructure/logging-and-monitoring.md +1618 -0
  405. package/expertise/security/infrastructure/network-security.md +1337 -0
  406. package/expertise/security/mobile/index.md +23 -0
  407. package/expertise/security/mobile/mobile-android-security.md +1218 -0
  408. package/expertise/security/mobile/mobile-binary-protection.md +1229 -0
  409. package/expertise/security/mobile/mobile-data-storage.md +1265 -0
  410. package/expertise/security/mobile/mobile-ios-security.md +1401 -0
  411. package/expertise/security/mobile/mobile-network-security.md +1520 -0
  412. package/expertise/security/smart-contract-security.md +594 -0
  413. package/expertise/security/testing/index.md +22 -0
  414. package/expertise/security/testing/penetration-testing.md +1258 -0
  415. package/expertise/security/testing/security-code-review.md +1765 -0
  416. package/expertise/security/testing/threat-modeling.md +1074 -0
  417. package/expertise/security/testing/vulnerability-scanning.md +1062 -0
  418. package/expertise/security/web/api-security.md +586 -0
  419. package/expertise/security/web/cors-and-headers.md +433 -0
  420. package/expertise/security/web/csrf.md +562 -0
  421. package/expertise/security/web/file-upload.md +1477 -0
  422. package/expertise/security/web/index.md +25 -0
  423. package/expertise/security/web/injection.md +1375 -0
  424. package/expertise/security/web/session-management.md +1101 -0
  425. package/expertise/security/web/xss.md +1158 -0
  426. package/exports/README.md +17 -0
  427. package/exports/hosts/claude/.claude/agents/clarifier.md +42 -0
  428. package/exports/hosts/claude/.claude/agents/content-author.md +63 -0
  429. package/exports/hosts/claude/.claude/agents/designer.md +55 -0
  430. package/exports/hosts/claude/.claude/agents/executor.md +55 -0
  431. package/exports/hosts/claude/.claude/agents/learner.md +51 -0
  432. package/exports/hosts/claude/.claude/agents/planner.md +53 -0
  433. package/exports/hosts/claude/.claude/agents/researcher.md +43 -0
  434. package/exports/hosts/claude/.claude/agents/reviewer.md +54 -0
  435. package/exports/hosts/claude/.claude/agents/specifier.md +47 -0
  436. package/exports/hosts/claude/.claude/agents/verifier.md +71 -0
  437. package/exports/hosts/claude/.claude/commands/author.md +42 -0
  438. package/exports/hosts/claude/.claude/commands/clarify.md +38 -0
  439. package/exports/hosts/claude/.claude/commands/design-review.md +46 -0
  440. package/exports/hosts/claude/.claude/commands/design.md +44 -0
  441. package/exports/hosts/claude/.claude/commands/discover.md +37 -0
  442. package/exports/hosts/claude/.claude/commands/execute.md +48 -0
  443. package/exports/hosts/claude/.claude/commands/learn.md +38 -0
  444. package/exports/hosts/claude/.claude/commands/plan-review.md +42 -0
  445. package/exports/hosts/claude/.claude/commands/plan.md +39 -0
  446. package/exports/hosts/claude/.claude/commands/prepare-next.md +37 -0
  447. package/exports/hosts/claude/.claude/commands/review.md +40 -0
  448. package/exports/hosts/claude/.claude/commands/run-audit.md +41 -0
  449. package/exports/hosts/claude/.claude/commands/spec-challenge.md +41 -0
  450. package/exports/hosts/claude/.claude/commands/specify.md +38 -0
  451. package/exports/hosts/claude/.claude/commands/verify.md +37 -0
  452. package/exports/hosts/claude/.claude/settings.json +34 -0
  453. package/exports/hosts/claude/CLAUDE.md +19 -0
  454. package/exports/hosts/claude/export.manifest.json +38 -0
  455. package/exports/hosts/claude/host-package.json +67 -0
  456. package/exports/hosts/codex/AGENTS.md +19 -0
  457. package/exports/hosts/codex/export.manifest.json +38 -0
  458. package/exports/hosts/codex/host-package.json +41 -0
  459. package/exports/hosts/cursor/.cursor/hooks.json +16 -0
  460. package/exports/hosts/cursor/.cursor/rules/wazir-core.mdc +19 -0
  461. package/exports/hosts/cursor/export.manifest.json +38 -0
  462. package/exports/hosts/cursor/host-package.json +42 -0
  463. package/exports/hosts/gemini/GEMINI.md +19 -0
  464. package/exports/hosts/gemini/export.manifest.json +38 -0
  465. package/exports/hosts/gemini/host-package.json +41 -0
  466. package/hooks/README.md +18 -0
  467. package/hooks/definitions/loop_cap_guard.yaml +21 -0
  468. package/hooks/definitions/post_tool_capture.yaml +24 -0
  469. package/hooks/definitions/pre_compact_summary.yaml +19 -0
  470. package/hooks/definitions/pre_tool_capture_route.yaml +19 -0
  471. package/hooks/definitions/protected_path_write_guard.yaml +19 -0
  472. package/hooks/definitions/session_start.yaml +19 -0
  473. package/hooks/definitions/stop_handoff_harvest.yaml +20 -0
  474. package/hooks/loop-cap-guard +17 -0
  475. package/hooks/post-tool-lint +36 -0
  476. package/hooks/protected-path-write-guard +17 -0
  477. package/hooks/session-start +41 -0
  478. package/llms-full.txt +2355 -0
  479. package/llms.txt +43 -0
  480. package/package.json +79 -0
  481. package/roles/README.md +20 -0
  482. package/roles/clarifier.md +42 -0
  483. package/roles/content-author.md +63 -0
  484. package/roles/designer.md +55 -0
  485. package/roles/executor.md +55 -0
  486. package/roles/learner.md +51 -0
  487. package/roles/planner.md +53 -0
  488. package/roles/researcher.md +43 -0
  489. package/roles/reviewer.md +54 -0
  490. package/roles/specifier.md +47 -0
  491. package/roles/verifier.md +71 -0
  492. package/schemas/README.md +24 -0
  493. package/schemas/accepted-learning.schema.json +20 -0
  494. package/schemas/author-artifact.schema.json +156 -0
  495. package/schemas/clarification.schema.json +19 -0
  496. package/schemas/design-artifact.schema.json +80 -0
  497. package/schemas/docs-claim.schema.json +18 -0
  498. package/schemas/export-manifest.schema.json +20 -0
  499. package/schemas/hook.schema.json +67 -0
  500. package/schemas/host-export-package.schema.json +18 -0
  501. package/schemas/implementation-plan.schema.json +19 -0
  502. package/schemas/proposed-learning.schema.json +19 -0
  503. package/schemas/research.schema.json +18 -0
  504. package/schemas/review.schema.json +29 -0
  505. package/schemas/run-manifest.schema.json +18 -0
  506. package/schemas/spec-challenge.schema.json +18 -0
  507. package/schemas/spec.schema.json +20 -0
  508. package/schemas/usage.schema.json +102 -0
  509. package/schemas/verification-proof.schema.json +29 -0
  510. package/schemas/wazir-manifest.schema.json +173 -0
  511. package/skills/README.md +40 -0
  512. package/skills/brainstorming/SKILL.md +77 -0
  513. package/skills/debugging/SKILL.md +50 -0
  514. package/skills/design/SKILL.md +61 -0
  515. package/skills/dispatching-parallel-agents/SKILL.md +128 -0
  516. package/skills/executing-plans/SKILL.md +70 -0
  517. package/skills/finishing-a-development-branch/SKILL.md +169 -0
  518. package/skills/humanize/SKILL.md +123 -0
  519. package/skills/init-pipeline/SKILL.md +124 -0
  520. package/skills/prepare-next/SKILL.md +20 -0
  521. package/skills/receiving-code-review/SKILL.md +123 -0
  522. package/skills/requesting-code-review/SKILL.md +105 -0
  523. package/skills/requesting-code-review/code-reviewer.md +108 -0
  524. package/skills/run-audit/SKILL.md +197 -0
  525. package/skills/scan-project/SKILL.md +41 -0
  526. package/skills/self-audit/SKILL.md +153 -0
  527. package/skills/subagent-driven-development/SKILL.md +154 -0
  528. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
  529. package/skills/subagent-driven-development/implementer-prompt.md +102 -0
  530. package/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  531. package/skills/tdd/SKILL.md +23 -0
  532. package/skills/using-git-worktrees/SKILL.md +163 -0
  533. package/skills/using-skills/SKILL.md +95 -0
  534. package/skills/verification/SKILL.md +22 -0
  535. package/skills/wazir/SKILL.md +463 -0
  536. package/skills/writing-plans/SKILL.md +30 -0
  537. package/skills/writing-skills/SKILL.md +157 -0
  538. package/skills/writing-skills/anthropic-best-practices.md +122 -0
  539. package/skills/writing-skills/persuasion-principles.md +50 -0
  540. package/templates/README.md +20 -0
  541. package/templates/artifacts/README.md +10 -0
  542. package/templates/artifacts/accepted-learning.md +19 -0
  543. package/templates/artifacts/accepted-learning.template.json +12 -0
  544. package/templates/artifacts/author.md +74 -0
  545. package/templates/artifacts/author.template.json +19 -0
  546. package/templates/artifacts/clarification.md +21 -0
  547. package/templates/artifacts/clarification.template.json +12 -0
  548. package/templates/artifacts/execute-notes.md +19 -0
  549. package/templates/artifacts/implementation-plan.md +21 -0
  550. package/templates/artifacts/implementation-plan.template.json +11 -0
  551. package/templates/artifacts/learning-proposal.md +19 -0
  552. package/templates/artifacts/next-run-handoff.md +21 -0
  553. package/templates/artifacts/plan-review.md +19 -0
  554. package/templates/artifacts/proposed-learning.template.json +12 -0
  555. package/templates/artifacts/research.md +21 -0
  556. package/templates/artifacts/research.template.json +12 -0
  557. package/templates/artifacts/review-findings.md +19 -0
  558. package/templates/artifacts/review.template.json +11 -0
  559. package/templates/artifacts/run-manifest.template.json +8 -0
  560. package/templates/artifacts/spec-challenge.md +19 -0
  561. package/templates/artifacts/spec-challenge.template.json +11 -0
  562. package/templates/artifacts/spec.md +21 -0
  563. package/templates/artifacts/spec.template.json +12 -0
  564. package/templates/artifacts/verification-proof.md +19 -0
  565. package/templates/artifacts/verification-proof.template.json +11 -0
  566. package/templates/examples/accepted-learning.example.json +14 -0
  567. package/templates/examples/author.example.json +152 -0
  568. package/templates/examples/clarification.example.json +15 -0
  569. package/templates/examples/docs-claim.example.json +8 -0
  570. package/templates/examples/export-manifest.example.json +7 -0
  571. package/templates/examples/host-export-package.example.json +11 -0
  572. package/templates/examples/implementation-plan.example.json +17 -0
  573. package/templates/examples/proposed-learning.example.json +13 -0
  574. package/templates/examples/research.example.json +15 -0
  575. package/templates/examples/research.example.md +6 -0
  576. package/templates/examples/review.example.json +17 -0
  577. package/templates/examples/run-manifest.example.json +9 -0
  578. package/templates/examples/spec-challenge.example.json +14 -0
  579. package/templates/examples/spec.example.json +21 -0
  580. package/templates/examples/verification-proof.example.json +21 -0
  581. package/templates/examples/wazir-manifest.example.yaml +65 -0
  582. package/templates/task-definition-schema.md +99 -0
  583. package/tooling/README.md +20 -0
  584. package/tooling/src/adapters/context-mode.js +50 -0
  585. package/tooling/src/capture/command.js +376 -0
  586. package/tooling/src/capture/store.js +99 -0
  587. package/tooling/src/capture/usage.js +270 -0
  588. package/tooling/src/checks/branches.js +50 -0
  589. package/tooling/src/checks/brand-truth.js +110 -0
  590. package/tooling/src/checks/changelog.js +231 -0
  591. package/tooling/src/checks/command-registry.js +36 -0
  592. package/tooling/src/checks/commits.js +102 -0
  593. package/tooling/src/checks/docs-drift.js +103 -0
  594. package/tooling/src/checks/docs-truth.js +201 -0
  595. package/tooling/src/checks/runtime-surface.js +156 -0
  596. package/tooling/src/cli.js +116 -0
  597. package/tooling/src/command-options.js +56 -0
  598. package/tooling/src/commands/validate.js +320 -0
  599. package/tooling/src/doctor/command.js +91 -0
  600. package/tooling/src/export/command.js +77 -0
  601. package/tooling/src/export/compiler.js +498 -0
  602. package/tooling/src/guards/loop-cap-guard.js +52 -0
  603. package/tooling/src/guards/protected-path-write-guard.js +67 -0
  604. package/tooling/src/index/command.js +152 -0
  605. package/tooling/src/index/storage.js +1061 -0
  606. package/tooling/src/index/summarizers.js +261 -0
  607. package/tooling/src/loaders.js +18 -0
  608. package/tooling/src/project-root.js +22 -0
  609. package/tooling/src/recall/command.js +225 -0
  610. package/tooling/src/schema-validator.js +30 -0
  611. package/tooling/src/state-root.js +40 -0
  612. package/tooling/src/status/command.js +71 -0
  613. package/wazir.manifest.yaml +135 -0
  614. package/workflows/README.md +19 -0
  615. package/workflows/author.md +42 -0
  616. package/workflows/clarify.md +38 -0
  617. package/workflows/design-review.md +46 -0
  618. package/workflows/design.md +44 -0
  619. package/workflows/discover.md +37 -0
  620. package/workflows/execute.md +48 -0
  621. package/workflows/learn.md +38 -0
  622. package/workflows/plan-review.md +42 -0
  623. package/workflows/plan.md +39 -0
  624. package/workflows/prepare-next.md +37 -0
  625. package/workflows/review.md +40 -0
  626. package/workflows/run-audit.md +41 -0
  627. package/workflows/spec-challenge.md +41 -0
  628. package/workflows/specify.md +38 -0
  629. package/workflows/verify.md +37 -0
@@ -0,0 +1,780 @@
1
+ # Mobile App Architecture — Architecture Expertise Module
2
+
3
+ > Mobile app architecture encompasses the structural patterns for building iOS and Android applications, including the native vs cross-platform decision, state management approaches, and UI architecture patterns. The choice between native (Swift/Kotlin), cross-platform (Flutter/React Native), or hybrid significantly impacts team structure, performance, and long-term maintenance. As of 2025, cross-platform frameworks deliver 80-90% of native performance, and Flutter holds 42% market share compared to React Native's 38% (Statista), making this a genuine engineering decision rather than an obvious default.
4
+
5
+ > **Category:** Mobile Architecture
6
+ > **Complexity:** Moderate
7
+ > **Applies when:** Building mobile applications for iOS, Android, or both platforms
8
+
9
+ ---
10
+
11
+ ## What This Is
12
+
13
+ ### The Platform Spectrum
14
+
15
+ Mobile app development exists on a spectrum from fully native to fully abstracted, with meaningful trade-offs at every point.
16
+
17
+ **Native Development** means writing platform-specific code: Swift/SwiftUI for iOS, Kotlin/Jetpack Compose for Android. Each platform gets its own codebase, its own team (or at least its own expertise), and its own deployment pipeline. The app has unmediated access to every platform API, every hardware capability, and every new OS feature on day one. The cost is maintaining two codebases that must stay functionally equivalent.
18
+
19
+ **Cross-Platform Development** uses a single codebase that compiles to (or runs on) both platforms. Flutter compiles Dart to native ARM code and renders its own widget tree via Skia/Impeller — it does not use platform UI components at all. React Native executes JavaScript and maps React components to native platform views through its bridge (legacy) or JSI (new architecture). The cost is an abstraction layer that may not expose every platform capability and introduces its own performance characteristics.
20
+
21
+ **Hybrid Development** wraps a web application (HTML/CSS/JS) in a native container (Capacitor, formerly Cordova/PhoneGap). The app is essentially a WebView with native API bridges. Performance and UX are noticeably inferior to both native and cross-platform approaches. In 2025, hybrid is rarely recommended for new projects — it persists mainly in legacy codebases and internal enterprise tools where web skills are the only option.
22
+
23
+ **Kotlin Multiplatform (KMP)** occupies a distinct position: shared business logic in Kotlin with native UI on each platform. Google endorsed KMP at I/O 2024 as the recommended approach for sharing business logic between Android and iOS. Companies like McDonald's, Shopify, Forbes, and Cash App run KMP in production. KMP is not a UI framework — it shares networking, data, storage, and domain logic while leaving UI to SwiftUI and Jetpack Compose respectively.
24
+
25
+ ### UI Architecture Patterns
26
+
27
+ These patterns govern how data flows between the model (business logic/state) and the view (UI). They are framework-agnostic concepts, though each framework has natural affinities.
28
+
29
+ **MVC (Model-View-Controller)** — The original pattern. The Controller mediates between Model and View. In practice, iOS's UIKit-era MVC devolved into "Massive View Controller" because Apple's UIViewController combined controller and view responsibilities. Android's Activity-based MVC had similar problems. MVC is largely abandoned for new mobile projects but persists in legacy codebases.
30
+
31
+ **MVP (Model-View-Presenter)** — The View is passive and delegates all user actions to the Presenter, which updates the Model and tells the View what to render. Popular in pre-Compose Android development. Testable (the Presenter has no Android dependencies), but the Presenter tends to accumulate responsibilities and the View interface becomes bloated.
32
+
33
+ **MVVM (Model-View-ViewModel)** — The ViewModel exposes observable state that the View binds to. The View never calls methods on the ViewModel to update UI — it observes state changes reactively. MVVM is the dominant pattern in modern mobile development: SwiftUI uses it natively via `@Observable`/`@StateObject`, Android Architecture Components were built around it, and 46% of Android developers favor it (JetBrains survey). Works well for medium-complexity apps but can suffer from ViewModel bloat and ambiguous state transitions in complex workflows.
34
+
35
+ **MVI (Model-View-Intent)** — Unidirectional data flow with immutable state. The View emits Intents (user actions), a Reducer processes them against the current State, and a new State is emitted. The View renders the new State. This is essentially Redux for mobile. MVI naturally aligns with Jetpack Compose's declarative, state-driven rendering model. More boilerplate than MVVM but dramatically more predictable state management. Preferred for apps with complex state transitions — multi-step forms, real-time data, collaborative editing.
36
+
37
+ **BLoC (Business Logic Component)** — Flutter-specific pattern. Events flow in, States flow out, mediated by Streams. Conceptually identical to MVI but uses Dart's Stream primitives. BLoC enforces strict separation: widgets emit Events, the BLoC processes them, and new States are emitted. The `flutter_bloc` package is the de facto standard. BLoC Cubits are a simplified variant where you call methods directly instead of adding events to a stream — appropriate for simpler state transitions.
38
+
39
+ **TCA (The Composable Architecture)** — Point-Free's opinionated architecture for SwiftUI. State, Action, Reducer, and Store form the core. Features compose via the `Scope` reducer, enabling large apps to be built from small, testable feature modules. TCA uses Swift's `@ObservableState` (as of 2025) for seamless SwiftUI integration. Powerful for large apps but has a significant learning curve and performance overhead from the reducer chain. Some in the Swift community argue TCA over-engineers what SwiftUI handles natively.
40
+
41
+ **Redux/Flux Variants** — React Native inherits the React ecosystem's state management: Redux, Zustand, MobX, Recoil, Jotai. Redux is the most established but adds significant boilerplate. Zustand has gained rapid adoption for its simplicity. The choice often depends on the team's existing React experience rather than mobile-specific considerations.
42
+
43
+ ### State Management Approaches
44
+
45
+ State management is the central challenge of mobile architecture. Mobile apps face unique state challenges: background/foreground transitions, unreliable network, platform lifecycle events (rotation, memory pressure), and navigation state that must survive process death.
46
+
47
+ **Local Component State** — State owned by a single widget/view. Appropriate for UI-only concerns: animation state, form field focus, scroll position. Every framework supports this natively (SwiftUI `@State`, Compose `remember`, React Native `useState`, Flutter `StatefulWidget`).
48
+
49
+ **Scoped State** — State shared across a subtree of the component hierarchy. Flutter's `Provider`/`InheritedWidget`, React's Context, SwiftUI's `@EnvironmentObject`. Appropriate for theme data, authentication status, feature flags — things needed by many widgets but not truly global.
50
+
51
+ **Global Application State** — State that lives outside the component tree and is accessible anywhere. Redux stores, BLoC instances provided at the app root, Riverpod providers. Appropriate for user session, cart contents, cached API responses. The danger is making everything global — this is the "god state" antipattern.
52
+
53
+ **Server State** — State that originates from and is owned by a remote server. React Query/TanStack Query (React Native), Riverpod's `FutureProvider`/`StreamProvider` (Flutter), and similar libraries specialize in caching, invalidation, optimistic updates, and background refetching. Treating server state separately from UI state is a major architectural insight — they have different lifecycles, different staleness semantics, and different error modes.
54
+
55
+ ---
56
+
57
+ ## When to Use Native
58
+
59
+ ### The Qualifying Conditions
60
+
61
+ Build natively (Swift/Kotlin, separate codebases) when **two or more** of these are true:
62
+
63
+ **Maximum performance is non-negotiable.** Real-time audio/video processing, 3D rendering, AR experiences (ARKit/ARCore), computationally intensive ML inference on-device, or games requiring consistent 120fps. The abstraction layer of any cross-platform framework introduces overhead that matters in these domains. Instagram's camera pipeline, Snapchat's AR lenses, and Pokemon Go are native for performance reasons.
64
+
65
+ **Deep platform integration is a core feature.** System-level integrations like HealthKit/Health Connect, CallKit, SiriKit/Google Assistant routines, Widgets (iOS WidgetKit, Android App Widgets), Live Activities, Dynamic Island, or Watch connectivity. Cross-platform frameworks expose these through community plugins that may lag months behind OS releases and may not cover the full API surface.
66
+
67
+ **Single-platform app.** If you only need iOS or only need Android, there is no cost argument for cross-platform. Use SwiftUI or Jetpack Compose respectively. The tooling, documentation, and community support are superior to any cross-platform alternative for single-platform development.
68
+
69
+ **Team has deep platform expertise.** If your team has senior iOS and Android engineers who think in platform idioms, forcing them into Flutter/Dart or React Native/JavaScript may reduce velocity rather than increase it. The "write once" savings are offset by fighting the framework when platform-specific behavior is needed.
70
+
71
+ **App Store discoverability and review sensitivity.** Some categories (finance, health, government) face stricter App Store review. Native apps have fewer rejection vectors because they do not bundle a runtime or use non-standard rendering pipelines.
72
+
73
+ ### Real-World Native Architecture: SwiftUI + MVVM
74
+
75
+ SwiftUI's declarative paradigm naturally supports MVVM. Views are pure functions of state, ViewModels are `@Observable` classes, and the framework handles reactivity:
76
+
77
+ ```swift
78
+ // Domain Layer
79
+ struct Transaction: Identifiable {
80
+ let id: UUID
81
+ let amount: Decimal
82
+ let category: TransactionCategory
83
+ let date: Date
84
+ }
85
+
86
+ // Data Layer
87
+ protocol TransactionRepository {
88
+ func fetchRecent(limit: Int) async throws -> [Transaction]
89
+ func save(_ transaction: Transaction) async throws
90
+ }
91
+
92
+ // Presentation Layer
93
+ @Observable
94
+ class TransactionListViewModel {
95
+ private let repository: TransactionRepository
96
+ var transactions: [Transaction] = []
97
+ var isLoading = false
98
+ var error: AppError?
99
+
100
+ init(repository: TransactionRepository) {
101
+ self.repository = repository
102
+ }
103
+
104
+ func loadTransactions() async {
105
+ isLoading = true
106
+ defer { isLoading = false }
107
+ do {
108
+ transactions = try await repository.fetchRecent(limit: 50)
109
+ } catch {
110
+ self.error = .network(error)
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Real-World Native Architecture: Jetpack Compose + MVI
117
+
118
+ MVI aligns naturally with Compose's state-driven rendering:
119
+
120
+ ```kotlin
121
+ // State
122
+ data class TransactionListState(
123
+ val transactions: List<Transaction> = emptyList(),
124
+ val isLoading: Boolean = false,
125
+ val error: AppError? = null
126
+ )
127
+
128
+ // Intent (user actions)
129
+ sealed interface TransactionListIntent {
130
+ data object LoadTransactions : TransactionListIntent
131
+ data class DeleteTransaction(val id: String) : TransactionListIntent
132
+ data object RetryLoad : TransactionListIntent
133
+ }
134
+
135
+ // ViewModel as state machine
136
+ class TransactionListViewModel(
137
+ private val repository: TransactionRepository
138
+ ) : ViewModel() {
139
+
140
+ private val _state = MutableStateFlow(TransactionListState())
141
+ val state: StateFlow<TransactionListState> = _state.asStateFlow()
142
+
143
+ fun onIntent(intent: TransactionListIntent) {
144
+ when (intent) {
145
+ is TransactionListIntent.LoadTransactions -> loadTransactions()
146
+ is TransactionListIntent.DeleteTransaction -> deleteTransaction(intent.id)
147
+ is TransactionListIntent.RetryLoad -> loadTransactions()
148
+ }
149
+ }
150
+
151
+ private fun loadTransactions() {
152
+ viewModelScope.launch {
153
+ _state.update { it.copy(isLoading = true, error = null) }
154
+ repository.fetchRecent(limit = 50)
155
+ .onSuccess { txns ->
156
+ _state.update { it.copy(transactions = txns, isLoading = false) }
157
+ }
158
+ .onFailure { err ->
159
+ _state.update { it.copy(error = err.toAppError(), isLoading = false) }
160
+ }
161
+ }
162
+ }
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## When to Use Cross-Platform
169
+
170
+ ### Flutter: The 80% Solution
171
+
172
+ Flutter is appropriate for the majority of mobile applications — content-driven apps, e-commerce, social, productivity, internal tools, and CRUD-centric business apps. Use Flutter when:
173
+
174
+ **Small team, both platforms required.** A team of 3-5 engineers can ship and maintain both iOS and Android with Flutter. The same team doing native would need to double (or accept that one platform lags). This is the single most common reason teams choose Flutter.
175
+
176
+ **Pixel-perfect custom UI across platforms.** Flutter renders its own widget tree — it does not use platform UI components. This means the app looks identical on iOS and Android (or can be themed per platform). For brands that want exact visual consistency, Flutter delivers this by default. The trade-off is that Flutter apps do not automatically adopt platform conventions (iOS back-swipe gesture, Android material ripple effects) — these must be explicitly implemented.
177
+
178
+ **Rapid iteration and prototyping.** Flutter's hot reload is genuinely faster than any native development cycle. Stateful hot reload preserves app state while injecting code changes, enabling sub-second iteration on UI. This is a meaningful productivity advantage for UI-heavy development.
179
+
180
+ **Content-heavy and form-heavy applications.** News readers, e-commerce catalogs, social feeds, multi-step forms, dashboards — these are Flutter's sweet spot. The business logic is in the data layer, the UI is presentation, and there is minimal platform-specific integration needed.
181
+
182
+ ### React Native: The JavaScript Ecosystem Play
183
+
184
+ **Team has strong React/JavaScript expertise.** If your engineering organization is built on React, React Native leverages that investment. Engineers can move between web and mobile projects. Shared libraries (validation logic, API clients, design tokens) work across platforms.
185
+
186
+ **Brownfield integration.** React Native was designed to integrate into existing native apps. You can add React Native screens to an existing Swift/Kotlin app incrementally. Flutter's add-to-app story exists but is less mature.
187
+
188
+ **New Architecture (JSI) changes the calculus.** With React Native 0.76+, the New Architecture is enabled by default. JSI replaces the asynchronous bridge with synchronous C++ interop, Fabric replaces the old renderer, and TurboModules replace the old native module system. Meta reports that performance in production apps is now comparable to native in most scenarios. Hermes is the default JavaScript engine, replacing JavaScriptCore with better startup performance and lower memory usage.
189
+
190
+ ### Kotlin Multiplatform: Shared Logic, Native UI
191
+
192
+ **Existing native apps that want to reduce duplication.** KMP's strength is sharing business logic (networking, data processing, validation, domain rules) while keeping UI fully native. This is not a rewrite — it is an incremental adoption path. McDonald's expanded KMP across their entire application, reducing crashes and enabling a unified mobile team.
193
+
194
+ **Teams that refuse to compromise on native UI.** Some teams (and some designers) insist on platform-native UI behavior. KMP allows shared logic with SwiftUI on iOS and Jetpack Compose on Android. Each platform gets its native navigation, transitions, and interaction patterns.
195
+
196
+ **Strong Kotlin expertise.** KMP requires Kotlin expertise and comfort with Gradle. The iOS integration story improved significantly with Swift Export in 2025, which generates pure Swift APIs instead of going through Objective-C interop.
197
+
198
+ ---
199
+
200
+ ## When NOT to Use Cross-Platform
201
+
202
+ **Games and heavy 3D rendering.** Use Unity, Unreal, or native Metal/Vulkan. Cross-platform frameworks are not game engines. Flutter's Flame engine handles 2D games adequately but is not comparable to Unity for anything beyond casual games.
203
+
204
+ **AR/VR experiences.** ARKit and ARCore have deep platform integration. Cross-platform wrappers exist but lag behind native SDKs and do not expose the full API surface. If AR is a core feature (not a gimmick), go native.
205
+
206
+ **Platform-specific deep integrations.** Building a keyboard extension, a share extension, a custom camera pipeline, a CallKit-based VoIP app, or an Apple Watch companion requires native code. You can use cross-platform for the main app and native for extensions, but the extension itself must be native.
207
+
208
+ **Strict performance requirements.** Audio processing apps (DAWs, music instruments), video editing, real-time communication with custom codecs — these need direct access to platform audio/video pipelines without framework overhead.
209
+
210
+ **Regulated industries with native SDK requirements.** Some banking and healthcare SDKs are only distributed as native iOS/Android libraries. Integrating them into cross-platform frameworks is possible but adds friction, and the SDK vendor may not support cross-platform configurations.
211
+
212
+ ---
213
+
214
+ ## How It Works
215
+
216
+ ### Flutter: Widget Tree + State Management
217
+
218
+ Flutter's architecture is layered: Framework (Dart) -> Engine (C/C++, Skia/Impeller) -> Embedder (platform-specific).
219
+
220
+ The widget tree is the fundamental building block. Everything is a widget — layout, styling, gesture detection, animation. Widgets are immutable descriptions of UI. When state changes, Flutter rebuilds the widget tree, diffs it against the previous tree (via the Element tree), and only repaints what changed (via the RenderObject tree).
221
+
222
+ **Clean Architecture with BLoC** is the most common production Flutter architecture:
223
+
224
+ ```
225
+ lib/
226
+ core/
227
+ error/
228
+ failures.dart # Domain failure types
229
+ exceptions.dart # Infrastructure exceptions
230
+ network/
231
+ network_info.dart # Connectivity abstraction
232
+ usecases/
233
+ usecase.dart # Base UseCase interface
234
+ features/
235
+ transactions/
236
+ data/
237
+ datasources/
238
+ transaction_remote_datasource.dart
239
+ transaction_local_datasource.dart
240
+ models/
241
+ transaction_model.dart # DTO with fromJson/toJson
242
+ repositories/
243
+ transaction_repository_impl.dart
244
+ domain/
245
+ entities/
246
+ transaction.dart # Pure domain entity
247
+ repositories/
248
+ transaction_repository.dart # Abstract contract
249
+ usecases/
250
+ get_recent_transactions.dart
251
+ create_transaction.dart
252
+ presentation/
253
+ bloc/
254
+ transaction_bloc.dart
255
+ transaction_event.dart
256
+ transaction_state.dart
257
+ pages/
258
+ transaction_list_page.dart
259
+ widgets/
260
+ transaction_card.dart
261
+ injection_container.dart # Dependency injection setup
262
+ ```
263
+
264
+ **BLoC implementation:**
265
+
266
+ ```dart
267
+ // Events
268
+ abstract class TransactionEvent {}
269
+ class LoadTransactions extends TransactionEvent {}
270
+ class DeleteTransaction extends TransactionEvent {
271
+ final String id;
272
+ DeleteTransaction(this.id);
273
+ }
274
+
275
+ // States
276
+ abstract class TransactionState {}
277
+ class TransactionInitial extends TransactionState {}
278
+ class TransactionLoading extends TransactionState {}
279
+ class TransactionLoaded extends TransactionState {
280
+ final List<Transaction> transactions;
281
+ TransactionLoaded(this.transactions);
282
+ }
283
+ class TransactionError extends TransactionState {
284
+ final String message;
285
+ TransactionError(this.message);
286
+ }
287
+
288
+ // BLoC
289
+ class TransactionBloc extends Bloc<TransactionEvent, TransactionState> {
290
+ final GetRecentTransactions getRecentTransactions;
291
+
292
+ TransactionBloc({required this.getRecentTransactions})
293
+ : super(TransactionInitial()) {
294
+ on<LoadTransactions>((event, emit) async {
295
+ emit(TransactionLoading());
296
+ final result = await getRecentTransactions(Params(limit: 50));
297
+ result.fold(
298
+ (failure) => emit(TransactionError(failure.message)),
299
+ (transactions) => emit(TransactionLoaded(transactions)),
300
+ );
301
+ });
302
+ }
303
+ }
304
+ ```
305
+
306
+ ### React Native: JSI and the New Architecture
307
+
308
+ React Native's new architecture (default since 0.76) eliminates the asynchronous bridge:
309
+
310
+ **JSI (JavaScript Interface)** — JavaScript holds direct references to C++ host objects. Native methods are called synchronously without JSON serialization. This is the foundation that enables the performance improvements.
311
+
312
+ **Fabric** — The new rendering system. React components map to native views through a C++ layer instead of the old bridge. Layout calculation (Yoga) happens synchronously, eliminating the layout "flickering" that plagued the old architecture.
313
+
314
+ **TurboModules** — Native modules are loaded lazily (only when first accessed) and communicate via JSI instead of the bridge. This improves startup time and reduces memory usage.
315
+
316
+ **Hermes** — The default JavaScript engine, purpose-built for React Native. Ahead-of-time compilation of JavaScript to bytecode reduces startup time. Lower memory footprint than JavaScriptCore.
317
+
318
+ A typical React Native architecture in 2025 uses feature-based organization with a state management library:
319
+
320
+ ```
321
+ src/
322
+ features/
323
+ transactions/
324
+ api/
325
+ transactionApi.ts # API calls (React Query)
326
+ components/
327
+ TransactionCard.tsx
328
+ TransactionList.tsx
329
+ hooks/
330
+ useTransactions.ts # Custom hooks
331
+ screens/
332
+ TransactionListScreen.tsx
333
+ types/
334
+ transaction.ts
335
+ shared/
336
+ components/
337
+ hooks/
338
+ services/
339
+ api.ts # Axios/fetch configuration
340
+ storage.ts # AsyncStorage abstraction
341
+ navigation/
342
+ AppNavigator.tsx
343
+ types.ts
344
+ store/ # Global state (Zustand/Redux)
345
+ authStore.ts
346
+ appStore.ts
347
+ ```
348
+
349
+ ### Navigation Patterns
350
+
351
+ Navigation is one of the most architecturally significant decisions in mobile apps because it determines how screens are composed, how deep links work, and how state is preserved across the back stack.
352
+
353
+ **Stack Navigation** — Screens push onto and pop off a stack. The fundamental navigation pattern. Every framework supports this: `NavigationStack` (SwiftUI), `NavHost` (Compose), `Navigator` (Flutter), `Stack.Navigator` (React Navigation).
354
+
355
+ **Tab Navigation** — Bottom tab bar with independent navigation stacks per tab. Standard for most consumer apps. Each tab maintains its own navigation state — switching tabs preserves scroll position and back stack.
356
+
357
+ **Declarative/State-Driven Navigation** — The navigation state is a data structure that the framework renders. SwiftUI's `NavigationPath`, Flutter's Router/GoRouter, Compose Navigation's type-safe routes. This approach makes deep linking natural (a deep link is just a state) and simplifies testing (assert on navigation state, not UI).
358
+
359
+ **Coordinator/Router Pattern** — Navigation logic is extracted from individual screens into a coordinator object. Screens do not know about other screens — they emit navigation events that the coordinator handles. This decouples screens and makes the navigation graph explicitly visible. Popular in UIKit (pre-SwiftUI) and recommended for complex Flutter apps.
360
+
361
+ ### Dependency Injection
362
+
363
+ **Flutter:** `get_it` (service locator) + `injectable` (code generation) is the most common DI approach. Riverpod acts as both state management and DI. Flutter does not have a framework-level DI container.
364
+
365
+ **Android (Native):** Hilt (built on Dagger) is the standard. Koin is a lighter alternative that uses Kotlin DSL instead of annotation processing. Compose's `LocalCompositionProvider` handles scoped dependencies.
366
+
367
+ **iOS (Native):** Swift lacks a standard DI framework. Constructor injection is the most common approach. Swinject and Factory are popular third-party options. SwiftUI's `@Environment` handles framework-level injection.
368
+
369
+ **React Native:** No framework-level DI. Module imports serve as the dependency mechanism. Libraries like `tsyringe` or `inversify` exist but are rarely used. React Context is the primary injection mechanism for components.
370
+
371
+ ### Repository Pattern for Data
372
+
373
+ The repository pattern is nearly universal in mobile architecture because mobile apps typically consume data from multiple sources (remote API, local database, cache) and must handle connectivity gracefully.
374
+
375
+ ```
376
+ RemoteDataSource (API) ──┐
377
+ ├── Repository ── UseCase ── ViewModel/BLoC
378
+ LocalDataSource (DB) ───┘
379
+ ```
380
+
381
+ The repository decides whether to fetch from network or local storage, handles caching strategies, and maps data transfer objects (DTOs) to domain entities. This is the foundation of offline-first architecture.
382
+
383
+ ### Offline-First Considerations
384
+
385
+ Mobile apps operate in fundamentally unreliable network conditions. Offline-first architecture treats the local database as the single source of truth and synchronizes with the server in the background.
386
+
387
+ **Core principles:**
388
+ - All reads come from local storage. The UI never waits for a network call to display data.
389
+ - Writes are saved locally first and marked as "pending sync."
390
+ - A background sync mechanism (WorkManager on Android, BGTaskScheduler on iOS, or framework-level equivalents) reconciles local and remote state.
391
+ - Conflict resolution must be explicit: last-write-wins, server-wins, or manual merge.
392
+
393
+ **The Outbox Pattern** for writes: when the user creates or modifies data offline, the change is written to a local outbox table. A background worker processes the outbox when connectivity is available, sending changes to the server and removing them from the outbox on success.
394
+
395
+ **Optimistic UI** — the UI immediately reflects the user's action (as if it succeeded) while the actual network call happens asynchronously. If the call fails, the UI rolls back. This is essential for perceived performance on mobile.
396
+
397
+ ---
398
+
399
+ ## Trade-Offs Matrix
400
+
401
+ | Dimension | Native (Swift/Kotlin) | Flutter | React Native | KMP |
402
+ |---|---|---|---|---|
403
+ | **Performance** | Best. Direct platform access, no abstraction overhead | Near-native. Own rendering engine bypasses platform views | Good with New Architecture (JSI). Bridge overhead eliminated | Native. Shared logic compiles to native, UI is fully native |
404
+ | **Team cost** | 2x — separate iOS and Android teams required | 1x — single team, single codebase | 1x — single team, leverages React/JS skills | 1.5x — shared logic team + platform UI expertise |
405
+ | **Time to market** | Slowest. Two codebases, two review cycles | Fast. Single codebase, hot reload, one CI pipeline | Fast. Single codebase, fast refresh, large package ecosystem | Medium. Shared logic accelerates, but UI is still per-platform |
406
+ | **Platform API access** | Immediate. Day-one access to new OS features | Delayed. Depends on plugin ecosystem (1-6 month lag typical) | Delayed. Similar plugin lag, community-driven | Immediate for UI, shared logic may need `expect`/`actual` |
407
+ | **UI fidelity** | Perfect platform-native look and feel | Custom rendering — identical across platforms, not platform-native by default | Uses native platform views — natural platform feel | Fully platform-native (SwiftUI/Compose) |
408
+ | **Ecosystem maturity** | Most mature. Apple/Google first-party tooling | Mature. 200k+ packages on pub.dev, Google-backed | Mature. npm ecosystem, Meta-backed, large community | Growing rapidly. Google-endorsed, JetBrains-backed |
409
+ | **Hot reload/refresh** | SwiftUI Previews (limited), no true hot reload | Best-in-class hot reload with state preservation | Fast Refresh — good, though occasionally requires full reload | Native tooling — Compose previews, SwiftUI previews |
410
+ | **Long-term maintenance** | Stable. Platform SDKs have strong backward compatibility | Moderate. Flutter major versions occasionally require migration effort | Improving. New Architecture is stable, but upgrade path historically painful | Good. Kotlin is stable, shared logic evolves independently |
411
+ | **Hiring** | Separate iOS (Swift) and Android (Kotlin) pools | Growing Dart/Flutter pool, smaller than native | Large JavaScript/React pool, easiest to hire | Kotlin developers (plentiful), iOS devs need KMP training |
412
+ | **App size** | Smallest. No bundled runtime | Larger. Includes Flutter engine (~5-8 MB overhead) | Medium. Includes Hermes engine and runtime | Smallest. No bundled runtime (native compilation) |
413
+ | **Testing** | Platform-specific test frameworks, XCTest/JUnit | Single test framework, excellent widget testing, `bloc_test` | Jest for logic, Detox/Maestro for E2E | Shared logic testable with kotlin.test, UI tested per-platform |
414
+
415
+ ---
416
+
417
+ ## Evolution Path
418
+
419
+ ### Maturity Stages
420
+
421
+ **Stage 1: Single Platform MVP**
422
+ Start with one platform (whichever your users are on). Use the simplest architecture that works — MVVM with a repository layer. Do not over-engineer. Ship, learn, iterate. Most startups should launch on one platform and validate before investing in the second.
423
+
424
+ **Stage 2: Second Platform Decision**
425
+ When you need the second platform, evaluate: How much platform-specific integration do you need? How large is your team? How different should iOS and Android experiences be? This is where the native vs cross-platform decision is made. If you choose cross-platform, this is the point to rewrite — do not attempt to wrap the native app in a cross-platform framework.
426
+
427
+ **Stage 3: Feature-Based Modularization**
428
+ As the app grows beyond 10-15 screens, decompose into feature modules. Each feature owns its screens, state management, data sources, and navigation. Features communicate through well-defined interfaces, not direct imports. This enables parallel team development and faster build times.
429
+
430
+ **Stage 4: Shared Architecture Conventions**
431
+ Establish and enforce architectural conventions: where business logic lives, how errors propagate, how navigation works, how features are tested. Create project templates and linters that enforce these conventions. Without this, a 20-person mobile team will produce 20 different architectures.
432
+
433
+ **Stage 5: Platform Abstraction Layer**
434
+ For large teams (15+ mobile engineers), create an internal platform layer that handles cross-cutting concerns: analytics, feature flags, A/B testing, crash reporting, authentication, deep linking. Individual feature teams consume this platform layer and focus on their feature domain.
435
+
436
+ ### Migration Patterns
437
+
438
+ **Native to Cross-Platform:** Do not attempt an incremental migration. Cross-platform frameworks have fundamentally different rendering models. Plan a parallel rewrite, feature by feature, with a feature flag to route users between old and new implementations. Strangler Fig pattern applied to mobile.
439
+
440
+ **Cross-Platform to Native:** More feasible incrementally. React Native's brownfield support allows replacing screens one at a time. Flutter's add-to-app enables embedding native screens. KMP is purpose-built for gradual adoption — start by sharing one module (networking), expand from there.
441
+
442
+ **Architecture Pattern Migration (MVC to MVVM/MVI):** Migrate screen by screen. Create the new architecture for new features. Migrate existing screens during planned refactoring, not as a dedicated "architecture migration" project that competes with feature work.
443
+
444
+ ---
445
+
446
+ ## Failure Modes
447
+
448
+ ### Massive ViewModels / God BLoCs
449
+
450
+ **What happens:** All business logic for a screen accumulates in a single ViewModel or BLoC. A ViewModel with 500+ lines, 15 observable properties, and 20 methods is unreadable, untestable, and unmaintainable.
451
+
452
+ **Why it happens:** Developers treat the ViewModel as the dumping ground for "everything that is not UI." No use case layer exists to decompose operations. The repository returns raw data and the ViewModel does all transformation, validation, and orchestration.
453
+
454
+ **How to prevent:** Extract use cases (interactors) that encapsulate single operations. A ViewModel should orchestrate use cases, not implement business logic. Apply the single-responsibility principle: one BLoC per user-facing concern (not one per screen — a screen may have multiple BLoCs).
455
+
456
+ ### Tight Platform Coupling
457
+
458
+ **What happens:** Cross-platform code is littered with `Platform.isIOS` / `Platform.isAndroid` conditionals. Platform-specific behavior is scattered throughout the codebase instead of isolated behind abstractions.
459
+
460
+ **Why it happens:** No platform abstraction layer. Developers solve platform differences ad hoc as they encounter them.
461
+
462
+ **How to prevent:** Create platform interface abstractions (the `expect`/`actual` pattern in KMP, platform channels in Flutter with a Dart-side interface, `NativeModules` in React Native behind a TypeScript interface). Platform-specific code lives in exactly one place per concern.
463
+
464
+ ### Navigation Spaghetti
465
+
466
+ **What happens:** Screens navigate to other screens by direct reference. Deep links are broken or handled inconsistently. The back button behavior is unpredictable. Screen A knows about Screen B, which knows about Screen C, creating a tightly coupled navigation graph.
467
+
468
+ **Why it happens:** Navigation is treated as a UI concern instead of an architectural concern. No centralized navigation graph exists. Deep links are added as afterthoughts.
469
+
470
+ **How to prevent:** Use declarative navigation with a centralized route configuration. Implement the Coordinator pattern for complex flows. Define navigation contracts — a screen declares what navigation events it can emit, not what screen comes next. Test navigation independently from screen UI.
471
+
472
+ ### State Management Chaos
473
+
474
+ **What happens:** Some screens use BLoC, others use Provider, others use setState. State is duplicated across multiple managers. The same data exists in three different state containers with no synchronization. Race conditions between competing state updates cause UI flickering.
475
+
476
+ **Why it happens:** No team-level decision on state management. Each developer uses what they know. No architecture documentation or enforcement.
477
+
478
+ **How to prevent:** Pick one primary state management approach and document it. Allow a secondary approach for simple cases (e.g., BLoC for features, Riverpod for app-level state). Create code review checklists that enforce the decision. Use a dependency injection container to make state dependencies explicit.
479
+
480
+ ### Over-Engineering for Scale That Never Comes
481
+
482
+ **What happens:** A 5-screen app has a domain layer, a data layer, a presentation layer, use cases for every operation, repository interfaces with single implementations, and a full DI container. The architecture adds 3x the code for zero benefit at current scale.
483
+
484
+ **Why it happens:** Developers apply "clean architecture" patterns they read about without evaluating whether the complexity is justified. The app has no complex domain logic — it is a thin client over a REST API.
485
+
486
+ **How to prevent:** Match architecture complexity to app complexity. A CRUD app that fetches and displays data does not need use cases — the repository can serve the ViewModel directly. Add architectural layers when you feel pain from their absence, not preemptively. The repository pattern is almost always worth it (because data source switching is common in mobile). Use case objects are worth it when business logic is complex or shared across multiple ViewModels.
487
+
488
+ ### Ignoring Platform Lifecycle
489
+
490
+ **What happens:** State is lost on rotation (Android), the app crashes when restored from background (iOS memory pressure), background tasks are killed by the OS, or the app enters an inconsistent state after process death.
491
+
492
+ **Why it happens:** Developers test exclusively in happy-path scenarios — foreground, connected, no interruptions. Platform lifecycle management is treated as an edge case.
493
+
494
+ **How to prevent:** Test with "Don't Keep Activities" enabled on Android. Test background restoration on iOS. Use `SavedStateHandle` (Android) or state restoration APIs. Design state management to survive process death. Use platform-aware background task APIs (WorkManager, BGTaskScheduler) instead of raw threads.
495
+
496
+ ---
497
+
498
+ ## Technology Landscape (2025)
499
+
500
+ ### Cross-Platform Frameworks
501
+
502
+ | Framework | Language | Rendering | Market Share | Backed By | Maturity |
503
+ |---|---|---|---|---|---|
504
+ | **Flutter** | Dart | Own engine (Skia/Impeller) | 42% | Stable, 6 years in production |
505
+ | **React Native** | JavaScript/TypeScript | Native platform views via JSI | 38% | Meta | Stable, New Architecture default |
506
+ | **Kotlin Multiplatform** | Kotlin | Native (shared logic only) | Growing | Google + JetBrains | Stable for logic, Compose Multiplatform maturing |
507
+ | **.NET MAUI** | C# | Platform views via handlers | ~5% | Microsoft | Stable but limited adoption |
508
+ | **Capacitor/Ionic** | HTML/CSS/JS | WebView | Declining | Ionic | Stable but hybrid model shows its age |
509
+
510
+ ### Native Frameworks
511
+
512
+ | Framework | Platform | UI Paradigm | Status |
513
+ |---|---|---|---|
514
+ | **SwiftUI** | iOS/macOS/watchOS/tvOS | Declarative, state-driven | Primary for new iOS development (2025) |
515
+ | **UIKit** | iOS | Imperative, delegate-based | Maintenance mode, vast existing codebase |
516
+ | **Jetpack Compose** | Android | Declarative, state-driven | Primary for new Android development |
517
+ | **Android Views (XML)** | Android | Imperative, XML layouts | Legacy, new projects use Compose |
518
+
519
+ ### State Management Libraries
520
+
521
+ | Library | Framework | Pattern | When to Use |
522
+ |---|---|---|---|
523
+ | **flutter_bloc** | Flutter | BLoC/Cubit | Complex state, strict separation, large teams |
524
+ | **Riverpod** | Flutter | Provider-based, compile-safe | Medium complexity, type-safe DI, flexible |
525
+ | **Provider** | Flutter | InheritedWidget wrapper | Simple apps, Flutter team's recommendation for beginners |
526
+ | **GetX** | Flutter | Reactive controller | Rapid prototyping (controversial — encourages anti-patterns) |
527
+ | **Redux/Zustand** | React Native | Flux/store-based | Complex global state (Redux), simple global state (Zustand) |
528
+ | **MobX** | React Native | Observable/reactive | Teams preferring reactive programming |
529
+ | **TCA** | SwiftUI | Reducer/Store | Large apps needing composable features, heavy testing |
530
+ | **@Observable** | SwiftUI | MVVM (native) | Default for new SwiftUI apps |
531
+ | **StateFlow + MVI** | Compose | Unidirectional flow | Default for new Compose apps with complex state |
532
+
533
+ ---
534
+
535
+ ## Decision Tree
536
+
537
+ ```
538
+ Need mobile app?
539
+ ├── Single platform only?
540
+ │ ├── iOS only → SwiftUI + MVVM (@Observable)
541
+ │ └── Android only → Jetpack Compose + MVI (StateFlow)
542
+
543
+ ├── Both platforms needed
544
+ │ ├── Team size < 8 engineers?
545
+ │ │ ├── Team knows React/JavaScript well?
546
+ │ │ │ └── → React Native + Zustand/Redux
547
+ │ │ ├── Team knows Dart or is language-agnostic?
548
+ │ │ │ └── → Flutter + BLoC or Riverpod
549
+ │ │ └── Team knows Kotlin well?
550
+ │ │ └── → KMP (shared logic) + SwiftUI/Compose (UI)
551
+ │ │
552
+ │ ├── Team size 8-20 engineers?
553
+ │ │ ├── Need pixel-perfect custom UI across platforms?
554
+ │ │ │ └── → Flutter + Clean Architecture + BLoC
555
+ │ │ ├── Need platform-native look and feel?
556
+ │ │ │ └── → KMP (shared logic) + native UI per platform
557
+ │ │ └── Heavy platform integration (AR, HealthKit, etc.)?
558
+ │ │ └── → Native (separate codebases)
559
+ │ │
560
+ │ └── Team size > 20 engineers?
561
+ │ ├── Mostly CRUD / content app?
562
+ │ │ └── → Flutter or KMP with platform team + feature teams
563
+ │ └── Deep platform features per platform?
564
+ │ └── → Native with shared backend-for-frontend
565
+
566
+ ├── Performance-critical (games, AR, video)?
567
+ │ └── → Native or specialized engine (Unity, Unreal)
568
+
569
+ └── Internal enterprise tool?
570
+ ├── Web skills only? → Capacitor/Ionic (hybrid)
571
+ └── Mobile skills available? → Flutter (fastest cross-platform delivery)
572
+ ```
573
+
574
+ ---
575
+
576
+ ## Implementation Sketch: Flutter Clean Architecture with BLoC
577
+
578
+ ### Project Setup
579
+
580
+ ```yaml
581
+ # pubspec.yaml — key dependencies
582
+ dependencies:
583
+ flutter_bloc: ^8.1.0
584
+ get_it: ^7.6.0 # Service locator for DI
585
+ injectable: ^2.3.0 # Code-gen DI
586
+ dartz: ^0.10.1 # Functional programming (Either type)
587
+ dio: ^5.4.0 # HTTP client
588
+ floor: ^1.4.0 # SQLite abstraction (or drift/sqflite)
589
+ connectivity_plus: ^5.0.0
590
+ equatable: ^2.0.0 # Value equality for states
591
+
592
+ dev_dependencies:
593
+ bloc_test: ^9.1.0
594
+ mockito: ^5.4.0
595
+ build_runner: ^2.4.0
596
+ injectable_generator: ^2.4.0
597
+ ```
598
+
599
+ ### Dependency Injection
600
+
601
+ ```dart
602
+ // injection_container.dart
603
+ final sl = GetIt.instance;
604
+
605
+ Future<void> initDependencies() async {
606
+ // BLoCs
607
+ sl.registerFactory(() => TransactionBloc(
608
+ getRecentTransactions: sl(),
609
+ createTransaction: sl(),
610
+ ));
611
+
612
+ // Use Cases
613
+ sl.registerLazySingleton(() => GetRecentTransactions(sl()));
614
+ sl.registerLazySingleton(() => CreateTransaction(sl()));
615
+
616
+ // Repositories
617
+ sl.registerLazySingleton<TransactionRepository>(
618
+ () => TransactionRepositoryImpl(
619
+ remoteDataSource: sl(),
620
+ localDataSource: sl(),
621
+ networkInfo: sl(),
622
+ ),
623
+ );
624
+
625
+ // Data Sources
626
+ sl.registerLazySingleton<TransactionRemoteDataSource>(
627
+ () => TransactionRemoteDataSourceImpl(client: sl()),
628
+ );
629
+ sl.registerLazySingleton<TransactionLocalDataSource>(
630
+ () => TransactionLocalDataSourceImpl(database: sl()),
631
+ );
632
+
633
+ // Core
634
+ sl.registerLazySingleton<NetworkInfo>(
635
+ () => NetworkInfoImpl(sl()),
636
+ );
637
+ sl.registerLazySingleton(() => Dio());
638
+ }
639
+ ```
640
+
641
+ ### Repository with Offline Support
642
+
643
+ ```dart
644
+ class TransactionRepositoryImpl implements TransactionRepository {
645
+ final TransactionRemoteDataSource remoteDataSource;
646
+ final TransactionLocalDataSource localDataSource;
647
+ final NetworkInfo networkInfo;
648
+
649
+ TransactionRepositoryImpl({
650
+ required this.remoteDataSource,
651
+ required this.localDataSource,
652
+ required this.networkInfo,
653
+ });
654
+
655
+ @override
656
+ Future<Either<Failure, List<Transaction>>> getRecentTransactions({
657
+ required int limit,
658
+ }) async {
659
+ if (await networkInfo.isConnected) {
660
+ try {
661
+ final remoteTransactions = await remoteDataSource.getRecent(limit);
662
+ await localDataSource.cacheTransactions(remoteTransactions);
663
+ return Right(remoteTransactions.map((m) => m.toEntity()).toList());
664
+ } on ServerException catch (e) {
665
+ return Left(ServerFailure(e.message));
666
+ }
667
+ } else {
668
+ try {
669
+ final localTransactions = await localDataSource.getCachedTransactions();
670
+ return Right(localTransactions.map((m) => m.toEntity()).toList());
671
+ } on CacheException {
672
+ return Left(CacheFailure('No cached data available'));
673
+ }
674
+ }
675
+ }
676
+
677
+ @override
678
+ Future<Either<Failure, Transaction>> createTransaction(
679
+ TransactionParams params,
680
+ ) async {
681
+ // Offline-first: save locally, sync later
682
+ final model = TransactionModel.fromParams(params);
683
+ await localDataSource.saveTransaction(model, pendingSync: true);
684
+
685
+ if (await networkInfo.isConnected) {
686
+ try {
687
+ final remote = await remoteDataSource.create(model);
688
+ await localDataSource.markSynced(remote.id);
689
+ return Right(remote.toEntity());
690
+ } on ServerException {
691
+ // Saved locally, will sync later
692
+ return Right(model.toEntity());
693
+ }
694
+ }
695
+ return Right(model.toEntity());
696
+ }
697
+ }
698
+ ```
699
+
700
+ ### Testing the BLoC
701
+
702
+ ```dart
703
+ void main() {
704
+ late TransactionBloc bloc;
705
+ late MockGetRecentTransactions mockGetRecentTransactions;
706
+
707
+ setUp(() {
708
+ mockGetRecentTransactions = MockGetRecentTransactions();
709
+ bloc = TransactionBloc(
710
+ getRecentTransactions: mockGetRecentTransactions,
711
+ );
712
+ });
713
+
714
+ tearDown(() => bloc.close());
715
+
716
+ blocTest<TransactionBloc, TransactionState>(
717
+ 'emits [Loading, Loaded] when LoadTransactions succeeds',
718
+ build: () {
719
+ when(mockGetRecentTransactions(any))
720
+ .thenAnswer((_) async => Right(testTransactions));
721
+ return bloc;
722
+ },
723
+ act: (bloc) => bloc.add(LoadTransactions()),
724
+ expect: () => [
725
+ TransactionLoading(),
726
+ TransactionLoaded(testTransactions),
727
+ ],
728
+ );
729
+
730
+ blocTest<TransactionBloc, TransactionState>(
731
+ 'emits [Loading, Error] when LoadTransactions fails',
732
+ build: () {
733
+ when(mockGetRecentTransactions(any))
734
+ .thenAnswer((_) async => Left(ServerFailure('Network error')));
735
+ return bloc;
736
+ },
737
+ act: (bloc) => bloc.add(LoadTransactions()),
738
+ expect: () => [
739
+ TransactionLoading(),
740
+ TransactionError('Network error'),
741
+ ],
742
+ );
743
+ }
744
+ ```
745
+
746
+ ---
747
+
748
+ ## Cross-References
749
+
750
+ - **[Offline-First Architecture](../../patterns/offline-first.md)** — Deep dive into local-first data synchronization patterns, conflict resolution strategies, and the outbox pattern for mobile apps.
751
+ - **[Backend-for-Frontend (BFF)](../../patterns/backend-for-frontend.md)** — API gateway pattern that aggregates and transforms backend services for mobile consumption, reducing round trips and tailoring payloads to mobile screen needs.
752
+ - **[Hexagonal / Clean Architecture](../patterns/hexagonal-clean-architecture.md)** — The foundational pattern that underpins mobile clean architecture. Mobile implementations adapt the port/adapter concept with repositories as driven adapters and UI frameworks as driving adapters.
753
+ - **[Push and Sync](../../patterns/push-and-sync.md)** — Real-time data synchronization between server and mobile clients using WebSockets, Server-Sent Events, or push notifications combined with background sync.
754
+
755
+ ---
756
+
757
+ ## Sources
758
+
759
+ - [Comprehensive Guide to Mobile App Architecture 2025](https://www.einfochips.com/blog/mobile-app-architecture-a-comprehensive-guide-for-2025/)
760
+ - [9 Essential Mobile App Architecture Best Practices for 2025](https://nextnative.dev/blog/mobile-app-architecture-best-practices)
761
+ - [Modern Flutter Architecture Patterns](https://medium.com/@sharmapraveen91/modern-flutter-architecture-patterns-ed6882a11b7c)
762
+ - [Flutter 3.38 Clean Architecture: Modern Project Structure for 2025](https://medium.com/@flutter-app/flutter-3-38-clean-architecture-project-structure-for-2025-f6155ac40d87)
763
+ - [Building a Scalable Folder Structure in Flutter Using Clean Architecture + BLoC/Cubit](https://dev.to/alaminkarno/building-a-scalable-folder-structure-in-flutter-using-clean-architecture-bloccubit-530c)
764
+ - [React Native Architecture in 2025: What's New and What Matters](https://globaldev.tech/blog/react-native-architecture)
765
+ - [React Native's New Architecture in 2025: Fabric, TurboModules & JSI Explained](https://medium.com/react-native-journal/react-natives-new-architecture-in-2025-fabric-turbomodules-jsi-explained-bf84c446e5cd)
766
+ - [About the New Architecture — React Native](https://reactnative.dev/architecture/landing-page)
767
+ - [Native vs Cross-Platform Mobile Development in 2024](https://addjam.com/blog/2024-08-14/native-vs-cross-platform-mobile-development-2024/)
768
+ - [Native vs Cross-Platform Mobile Apps in 2025: CTO Guide](https://mobisoftinfotech.com/resources/blog/mobile/native-vs-cross-platform-apps-2025-ctos-guide)
769
+ - [Android Architecture Patterns: Comparing MVC, MVP, MVVM, and MVI](https://medium.com/@YodgorbekKomilo/android-architecture-patterns-comparing-mvc-mvp-mvvm-and-mvi-b282712cfb46)
770
+ - [Architecture Patterns in Mobile Development (2026): MVVM, MVI, and Clean Architecture](https://medium.com/@jyc.dev/architecture-patterns-in-mobile-development-2026-mvvm-mvi-and-clean-architecture-f26583f53522)
771
+ - [MVVM and MVI Explained: Key Differences for Android Developers](https://medium.com/@cabanas.ignacio/mvvm-and-mvi-explained-key-differences-for-android-developers-6ca09df77b21)
772
+ - [Composable Architecture in 2025: Building Scalable SwiftUI Apps the Right Way](https://commitstudiogs.medium.com/composable-architecture-in-2025-building-scalable-swiftui-apps-the-right-way-134199aff811)
773
+ - [GitHub — pointfreeco/swift-composable-architecture](https://github.com/pointfreeco/swift-composable-architecture)
774
+ - [Is Kotlin Multiplatform Ready for Production 2025?](https://guarana-technologies.com/blog/kotlin-multiplatform-production)
775
+ - [Top Apps Built with Kotlin Multiplatform (2025 Update)](https://www.netguru.com/blog/top-apps-built-with-kotlin-multiplatform)
776
+ - [Offline-First Support — Flutter](https://docs.flutter.dev/app-architecture/design-patterns/offline-first)
777
+ - [The Complete Guide to Offline-First Architecture in Android](https://androidengineers.substack.com/p/the-complete-guide-to-offline-first)
778
+ - [Build an Offline-First App — Android Developers](https://developer.android.com/topic/architecture/data-layer/offline-first)
779
+ - [Modern Android App Architecture in 2025: MVVM, MVI, and Clean Architecture with Jetpack Compose](https://medium.com/@androidlab/modern-android-app-architecture-in-2025-mvvm-mvi-and-clean-architecture-with-jetpack-compose-c0df3c727334)
780
+ - [Guide to App Architecture — Android Developers](https://developer.android.com/topic/architecture)