Markdown Editor

Mobile App Architecture Template

Mobile app architecture: native vs cross-platform, MVVM/Clean layers, offline sync, secure storage, auth, privacy, releases, testing

ArchitectureFullOWASP MASVS v2.1.0; RFC 8252 (BCP 212)CC BY-SA 4.0mobile

How to use: Use when designing a new mobile app or a major rework. Fill users, devices and connectivity first, since offline needs drive most decisions. The main pitfall is having no forced-update or remote-config path at launch; you cannot roll back code on users' phones.

Preview

Mobile App Architecture: [App name]

Architecture document for a mobile application: platforms and development approach, app architecture pattern, modules, networking and offline sync, local storage and encryption, push notifications, authentication, analytics and privacy, performance targets, release management (store review, phased rollout, forced update), crash reporting, testing and a security baseline mapped to the OWASP Mobile Application Security Verification Standard (MASVS) v2.1.0. Native app sign-in follows RFC 8252 (OAuth 2.0 for Native Apps, BCP 212). Platform topics follow the published guidance from Apple and Google. Replace every [bracketed] value and every row marked Example; the examples follow Northwind Field Services, a fictional company whose field-service app is used by technicians with poor connectivity. The privacy section is a design summary, not legal advice.

Document control

FieldValue
Document ID[MOB-ARCH-001]
App[Name, bundle ID / application ID]
Version[0.1]
Status[Draft / In review / Approved / Superseded]
Owner[@mobile-lead]
Approvers / reviewers[@architect], [@security], [@backend-lead], [@privacy-officer]
Last updatedYYYY-MM-DD
Classification[Internal]
Supported platforms[Example: iOS 17 and later, Android 12 and later]
Security baseline[OWASP MASVS v2.1.0, MASTG profile chosen in section 13]
Next reviewYYYY-MM-DD (at least yearly, and before each major OS release)
Related[architecture/mobile-backend-design], [architecture/rest-api-specification], [security/threat-model], [compliance/dpia], [dev/release-checklist], [ADRs]

Approvals

RoleNameDecisionDate
Mobile lead (owner)[@name][Approved / Changes requested]YYYY-MM-DD
Solution architect[@name][Decision]YYYY-MM-DD
Security lead[@name][Decision]YYYY-MM-DD
Backend lead[@name][Decision]YYYY-MM-DD
Privacy officer[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange
0.1 (Example)YYYY-MM-DD[@mobile-lead]First draft: drivers, approach and module structure
0.2 (Example)YYYY-MM-DD[@mobile-lead]Offline sync and storage added after security review; test profiles set to MAS-L1 and MAS-P, plus MAS-R for the scanner module
1.0 (Example)YYYY-MM-DD[@mobile-lead]Approved for first store release

Contents

1. Context and drivers

ItemValue
UsersExample: 3,500 field technicians; 40,000 customers using the booking feature
DevicesExample: Company Android rugged devices (Android 12+), personal iPhones (iOS 17+)
ConnectivityExample: Often offline in basements and rural sites for up to 8 hours
Key journeysView job list, complete checklist, capture photos and signature, sync
Key requirementsFull offline job completion; no data loss; photos up to 30 per job
IDDriverTarget
MOB-01Example: Offline completion of a job100% of job steps work without network
MOB-02Example: Data safetyZero lost job records; sync conflicts resolved without user data loss
MOB-03Example: Time to release a fixCritical fix in users' hands within 48 h
[MOB-nn][Driver][Target]

2. Platforms and development approach

OptionStrengthsWeaknessesFit
Native (Swift / Kotlin)Best platform fidelity and API access; best performanceTwo codebases and teamsExample: Medium
Cross-platform with native rendering (for example Flutter, React Native)One codebase for most UI and logicBridge or engine overhead; native modules still neededExample: High
Shared logic only (for example Kotlin Multiplatform)Shared domain and data layers; native UITwo UI codebasesExample: Medium
Web or PWAOne codebase; no store reviewLimited background sync and device APIs on iOSLow for offline-heavy use

Decision: [approach, framework and version policy, ADR link]. Example: cross-platform framework for UI and logic, with native modules for the barcode scanner and background upload; minimum OS versions iOS 17 and Android 12 (ADR-014).

3. App architecture pattern and modules

Pattern: [e.g. MVVM with Clean Architecture layers]. Dependencies point inwards: UI depends on view models, view models on use cases, use cases on repository interfaces; data sources implement those interfaces.

ModuleResponsibilityOwner
core-domainExample: Entities, use cases, validation rules[@team]
core-dataRepositories, local database, API client, sync engine[@team]
feature-jobsJob list and job detail screens[@team]
feature-checklistChecklists, photos, signature[@team]
platform-servicesCamera, location, push, secure storage wrappers[@team]
design-systemTokens and shared components[@team]
[module][Responsibility][@team]

4. Networking and offline sync

TopicDesign
API styleExample: REST over HTTPS via the mobile BFF; JSON; gzip
Timeouts and retriesConnect 10 s, read 30 s; exponential backoff with jitter; retry only idempotent calls or calls with an idempotency key
Offline modelLocal database is the source for the UI; writes go to local database and an outbound sync queue
Sync triggerOn connectivity change, app foreground, and background task every 15 min where the OS allows
DownloadDelta sync using updated_since cursor; jobs for the next 3 days pre-fetched
UploadQueue processed in order per job; photos uploaded in chunks with resume
Conflict resolutionExample: Server wins for job assignment; field-level merge for checklist answers; user prompted only when the same answer differs
Certificate handlingSystem trust store; certificate pinning considered and rejected because of rotation risk (ADR-016)

5. Local storage and encryption

DataStoreProtectionRetention
Example: Jobs, checklistsSQLite databaseEncrypted with a key held in Keychain or Android KeystoreDeleted 7 days after sync
Example: PhotosApp sandbox filesFile protection class "complete until first user authentication" (iOS); app-level encryption with a key held in Android Keystore (Android)Deleted after confirmed upload
Example: TokensKeychain / KeystoreHardware-backed where availableUntil logout or expiry
Example: PreferencesPlatform preferencesNot sensitiveApp lifetime

Rules: no personal or business data in logs; screenshots blocked on screens with customer data where policy requires; remote wipe of app data on device unenrolment through mobile device management.

6. Push notifications

TopicDesign
ProvidersAPNs (iOS) and Firebase Cloud Messaging (Android) via [notification service]
PayloadExample: Notification text plus job ID; no customer data in payload
PermissionRequested in context after the first job assignment, not at first launch
Deep linksapp://jobs/{id} handled by router; verified universal links / app links for web URLs
Silent pushesUsed to trigger sync; app tolerates them being throttled by the OS
Token managementRegistered at login; removed at logout; refreshed on change

7. Authentication and authorisation

TopicDesign
FlowExample: OAuth 2.0 authorisation code with PKCE in the system browser (ASWebAuthenticationSession, Custom Tabs)
TokensShort-lived access token (15 min); refresh token rotated on use, stored in secure storage
OfflineApp usable offline for up to 72 h after last successful refresh; then re-authentication required
Device unlockOptional biometric unlock of the local session
AuthorisationEnforced by the API; app hides actions the role cannot perform

8. Analytics and privacy

TopicDesign
Events collectedExample: Screen views, sync success and failure, job completion time; no free text, no location trails
ConsentAnalytics off until consent where required; choice changeable in settings
TrackingNo cross-app tracking; App Tracking Transparency prompt therefore not needed
Store declarationsApple privacy nutrition labels and Google Play Data safety form updated with every change to data collection
Privacy manifestiOS privacy manifest lists required-reason APIs and SDKs
Third-party SDKsAllow-list reviewed for data collection; versions pinned

9. Performance targets

MetricTargetMeasured on
Cold start to interactiveExample: p90 <= 2.0 sLow-end supported Android device
Screen transitionp90 <= 300 msBoth platforms
Frame rendering< 1% slow frames on job listBoth platforms
Crash-free sessions>= 99.8%Production
ANR rate (Android)Below Google Play's bad-behaviour threshold; Example: internal target 0.2%Android vitals
App download size<= 40 MBStore listing
Full sync of 3 days of jobs<= 20 s on 4GField test

10. Release management

TopicDesign
CadenceExample: Every two weeks; release branch cut on Monday
Store reviewSubmit 3 working days before target date; expedited review only for critical fixes
Phased rolloutiOS phased release over 7 days; Google Play staged rollout 5%, 20%, 50%, 100%
Rollout gatesHalt if crash-free sessions fall below 99.5% or sync failure rate doubles
Feature flags and remote configNew features shipped dark and enabled remotely; kill switch per feature
Forced updateBackend returns minimum supported version; app shows blocking update screen below it, soft prompt below recommended version
API compatibilityBackend supports the last 3 app versions or 90 days, whichever is longer
SigningKeys held in CI secrets and platform signing services; access limited to release managers

11. Crash reporting and monitoring

TopicDesign
Crash reportingExample: [Crash reporting SDK] with dSYM and mapping file upload in CI
Non-fatal errorsSync failures and API errors reported with error code and app version
Personal dataScrubbed from breadcrumbs and logs before sending
AlertingNew crash cluster affecting > 0.1% of sessions pages the mobile on-call
TriageDaily during rollout; weekly otherwise

12. Testing

LayerScopeToolingWhen
UnitUse cases, view models, sync logicExample: Platform unit test frameworksEvery pull request
IntegrationRepositories with local database and mocked APITest containers or mock serverEvery pull request
UIKey journeysPlatform UI testing frameworksNightly
Device matrix8 devices covering min OS, small screens, low memoryDevice cloudBefore release
Offline and syncAirplane mode, flaky network, conflictsNetwork conditioner and scripted scenariosBefore release
UpgradeInstall previous version, create data, upgradeScriptedBefore release
AccessibilityScreen readers, dynamic type, contrastVoiceOver, TalkBack, scannersEach release

13. Security baseline (OWASP MASVS)

OWASP MASVS v2.1.0 (released January 2024; check the current release at https://github.com/OWASP/masvs/releases) organises mobile security controls into eight groups. The OWASP Mobile Application Security Testing Guide (MASTG) describes how to test them. In MASVS v2 the former verification levels moved into the MAS testing profiles, which say which tests apply. As listed in October 2026 the default profiles are MAS-L1 (essential security), MAS-L2 (advanced security), MAS-R (resilience) and MAS-P (baseline privacy), with specialised profiles for particular contexts and a custom profile from a threat model recommended for the highest assurance; check the current list at https://mas.owasp.org/Profiles/. Record the profile here and justify it from the data and threat model.

Profile chosen: [Example: MAS-L1 and MAS-P for the whole app, plus MAS-R (resilience) for the barcode scanner module because a tampered scanner could falsify asset readings. Rationale in ADR-021 and the threat model.]

MASVS groupWhat it covers (summary)Design decision in this documentVerificationStatus
MASVS-STORAGESensitive data at rest on the deviceExample: Section 5: encrypted database, key in Keychain or Keystore, data deleted 7 days after syncMOB-SEC-001: storage inspection on a rooted test device[Met / Partly / Gap]
MASVS-CRYPTOCorrect use of cryptography and key managementExample: Platform crypto APIs only; no keys or secrets in the binaryMOB-SEC-002: binary scan for embedded secrets[Status]
MASVS-AUTHAuthentication and authorisationExample: Section 7: OAuth 2.0 with PKCE in the system browser; server-side authorisationMOB-SEC-003: token storage and session expiry tests[Status]
MASVS-NETWORKSecure data in transitExample: Section 4: TLS only, system trust store, no cleartext exceptionsMOB-SEC-004: proxy interception test[Status]
MASVS-PLATFORMSafe use of the operating system, deep links and inter-app communicationExample: Section 6: verified universal links and app links; no data in push payloadsMOB-SEC-005: deep-link fuzzing[Status]
MASVS-CODEUp-to-date dependencies, input validation, supported OS versionsExample: Section 10: forced-update path; pinned SDK versions reviewed each releaseMOB-SEC-006: dependency scan in CI[Status]
MASVS-RESILIENCEResistance to reverse engineering and tamperingExample: Scanner module only: integrity check and attestation verdict sent to the backend as a risk signalMOB-SEC-007: repackaging test[Status]
MASVS-PRIVACYData minimisation, transparency and user controlExample: Section 8: minimal events, consent before analytics, store declarations kept currentMOB-SEC-008: network capture compared with store declarations[Status]

Treat every gap as a tracked risk with an owner and a date, and record it in the threat model (security/threat-model). The backend's share of each group is described in architecture/mobile-backend-design.

14. References

ReferenceVersion or dateUsed for
OWASP Mobile Application Security Verification Standard (MASVS), https://mas.owasp.org/MASVS/v2.1.0 (January 2024), checked 2026-10-29Section 13 control groups
OWASP Mobile Application Security Testing Guide (MASTG), https://mas.owasp.org/MASTG/Current online editionTest cases for section 13
OWASP MAS testing profiles, https://mas.owasp.org/Profiles/L1, L2, R and P listed, checked 2026-10-29Section 13 profile choice
IETF RFC 8252, OAuth 2.0 for Native Apps (BCP 212), https://www.rfc-editor.org/info/rfc8252October 2017, checked 2026-10-29Section 7 sign-in flow
Apple App Store Review Guidelines and App privacy details, https://developer.apple.com/app-store/review/guidelines/Current version at each releaseSections 8 and 10
Google Play Data safety and Android vitals, https://support.google.com/googleplay/android-developer/Current version at each releaseSections 8, 9 and 10
[Internal API specification][Version]Sections 4 and 7
[Threat model][Version]Section 13

Related templates in this collection: architecture/mobile-backend-design (server side and BFF), architecture/rest-api-specification (endpoint contract), security/threat-model, compliance/dpia (privacy impact), dev/release-checklist and dev/adr.

Standard and licence note

Based on common industry practice for mobile application architecture, on IETF RFC 8252 (BCP 212) and on public platform guidance from Apple and Google (store review, phased or staged rollout, privacy declarations). Section 13 uses the control group identifiers of the OWASP Mobile Application Security Verification Standard (MASVS) v2.1.0 by the OWASP Mobile Application Security project, licensed under CC BY-SA 4.0; only the group identifiers are used and the summaries and mapping text are original. If you adapt or redistribute material from the MASVS itself, attribute OWASP and share your adaptation under CC BY-SA 4.0 (ShareAlike). Store policies, thresholds and standard versions change; check the current official versions before each release. Original text written for this collection; examples are illustrative and not legal advice. Apple, iOS, Google, Android and Firebase are trademarks of their owners; this template is not affiliated with or endorsed by them. Template licence: MIT.

Related templates