# mosip/android-registration-client architecture

> Architecture diagram of the GitHub repository mosip/android-registration-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mosip/android-registration-client
- Repository: https://github.com/mosip/android-registration-client

## Overview

1. **Repository shape**
   This is a Flutter-based MOSIP Registration Client with heavy Android native integration. The root `lib/` directory contains the cross-platform UI and app flow, while `android/` hosts several native Java libraries and the Android host app. The repo also includes iOS/macOS/Windows/Linux/web shells, but the architectural center of gravity is Android + Flutter.

2. **Top-level runtime boundary**
   The user-facing app runs in Flutter/Dart. Platform-specific work is delegated through generated Pigeon channels into Android native code. The bridge layer is explicit in `pigeon/` and the Android-side host API wiring in `android/app/...` and the native manager libraries under `android/`.

3. **Flutter presentation layer**
   `lib/ui/` contains the screen hierarchy for login, onboarding, registration, post-registration, packet export, settings, scanner, profile, and approval flows. `lib/provider/` holds state orchestration for these screens, and `lib/model/` defines the data structures passed through the UI. This layer is responsible for navigation, form state, and rendering across mobile/tablet layouts.

4. **Platform service layer in Dart**
   `lib/platform_spi/` defines abstract capabilities such as authentication, demographics, biometrics, packet, registration, transliteration, sync, and machine-key services. `lib/platform_android/` provides the Android implementations that talk to native code. This makes the Flutter app largely platform-agnostic at the UI level while keeping device-specific behavior behind service interfaces.

5. **Native Android host app**
   `android/app/` is the main Android application shell. It contains `MainActivity`, a background upload service, and Dagger-style bootstrap modules/components. It also declares Android resources and manifests for runtime behavior. This layer is the entry point for Android OS integration, lifecycle handling, and background execution.

6. **Client manager subsystem**
   `android/clientmanager/` is the largest native subsystem and acts like the application’s business and infrastructure core. It includes:
   - configuration/bootstrap (`config/`)
   - local persistence (`entity/`, `dao/`, `repository/`, `RoomModule`, `ClientDatabase`)
   - business services (`service/`, `spi/`)
   - scheduled jobs (`jobs/`)
   - HTTP APIs (`api_services/`)
   - utility and crypto helpers (`util/`)
   
   This module encapsulates most registration-client domain logic and data synchronization.

7. **Data persistence boundary**
   The client manager persists local state in a Room database through entities, DAOs, and repositories. It stores user details, machine/configuration data, audit records, registration artifacts, sync job definitions, templates, location hierarchies, and other operational metadata. Local persistence is central because the client must operate reliably with intermittent connectivity and later sync state to backend services.

8. **Backend and sync flows**
   Native API service classes and the Dart platform services communicate with MOSIP backend endpoints for authentication, global config, master data sync, registration, packet status, dashboard data, and related lookups. The architecture supports a synchronization model: data is captured locally, enriched with master/config data, and then uploaded or polled asynchronously via jobs and background services.

9. **Registration and packet composition**
   Two dedicated native libraries support core domain workflows:
   - `android/packetmanager/` builds and manages registration packets, document/biometric payloads, packet structure, hashing, storage, and encryption-related handling.
   - `android/transliterationmanager/` handles transliteration logic for multilingual name/address capture.
   
   These libraries feed the packet creation pipeline used by registration and export/upload flows.

10. **Security and cryptography**
   `android/keymanager/` manages key storage, certificate handling, crypto operations, and trust-related functions. It provides the cryptographic boundary for signing, verification, certificate retrieval, and secure local operations. On the Flutter side, secure storage and secure-screen utilities support device-level hardening and sensitive state handling.

11. **Biometric capture and device integration**
   Biometric capture is designed as a hardware integration boundary. The repo includes a bundled biometric SDK artifact in `android/clientmanager/src/main/assets/biosdk/` and a `matchsdk` AAR under `android/matchsdk/`. The app also references Mock SBI / Mock MDS style flows in docs, indicating that biometric device interaction is abstracted so the client can use either real hardware or test substitutes.

12. **Background and scheduled processing**
   The client manager defines jobs such as config sync, packet status sync, audit cleanup, and registration deletion. The Android app also has an upload background service. Together these form the app’s asynchronous execution layer for deferred network work, housekeeping, and retryable operations when the device is idle or network availability changes.

13. **Native-to-Flutter contract**
   The `pigeon/` definitions and generated platform bindings are the contract between Flutter and Android. This boundary is important: Flutter screens call typed service abstractions, which map to Android native APIs for registration data, authentication, documents, biometrics, machine identity, and config. The architecture is intentionally split so that UI logic stays in Dart and device/backend mechanics stay in Java.

14. **Testing and delivery**
   The repository has strong test coverage at multiple levels: Flutter widget/unit tests in `test/`, extensive JVM tests under each Android module, and a separate `ui-test/` automation project for end-to-end flows. CI is handled through GitHub Actions workflows for Android and client builds. This suggests a layered architecture where UI, native libraries, and integration behaviors are validated independently.

15. **Operational picture**
   End users interact with the Flutter UI; the UI requests data and actions through platform services; Android native modules perform secure local processing, device access, packet construction, and network sync; backend MOSIP services provide config, auth, and registration endpoints; and biometric hardware or mock devices supply capture inputs. The main architectural boundaries are UI vs native, local store vs remote services, and synchronous user interaction vs asynchronous job processing.

Main entry points: [`android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service`](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service) (Business services), [`android/clientmanager/src/main/java/io/mosip/registration/clientmanager`](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager) (Client core), [`lib/ui`](https://github.com/mosip/android-registration-client/tree/master/lib/ui) (Screens), [`lib/provider`](https://github.com/mosip/android-registration-client/tree/master/lib/provider) (State layer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_flutter["Flutter app"]
  node_main["App entry<br/>Flutter bootstrap<br/>[main.dart]"]
  node_router["Routing<br/>navigation<br/>[app_router.dart]"]
  node_ui["Screens<br/>presentation"]
  node_providers["State layer<br/>state orchestration"]
  node_models["Domain models<br/>data model"]
  node_spi["Service SPI<br/>abstract services"]
  node_platform_android["Android adapters<br/>platform impl"]
  node_pigeon["Bridge contract<br/>channel schema"]
end

subgraph group_android["Android native"]
  node_android_app["Android host<br/>host app"]
  node_app_api["Host APIs<br/>native APIs"]
  node_client_core["Client core<br/>domain infrastructure"]
  node_client_db[("Local DB<br/>Room database")]
  node_client_services["Business services<br/>service layer"]
  node_client_repos["Repositories<br/>persistence access"]
  node_client_daos["DAOs<br/>data access"]
  node_client_jobs["Jobs"]
  node_client_api["Backend APIs<br/>HTTP clients"]
end

subgraph group_libs["Native libraries"]
  node_keymanager["Key manager<br/>crypto module"]
  node_packetmanager["Packet manager<br/>packet module"]
  node_translit["Transliteration<br/>language module"]
end

subgraph group_test["Validation"]
  node_uitest["UI tests<br/>e2e suite"]
end

node_main -->|"starts"| node_router
node_router -->|"navigates"| node_ui
node_ui -->|"reads state"| node_providers
node_providers -->|"maps data"| node_models
node_providers -->|"calls"| node_spi
node_spi -->|"implemented by"| node_platform_android
node_platform_android -->|"bridges via"| node_pigeon
node_pigeon -->|"delivers to"| node_android_app
node_android_app -->|"exposes"| node_app_api
node_app_api -->|"delegates"| node_client_core
node_client_core -->|"persists in"| node_client_db
node_client_core -->|"orchestrates"| node_client_services
node_client_services -->|"uses"| node_client_repos
node_client_repos -->|"queries"| node_client_daos
node_client_services -->|"syncs with"| node_client_api
node_client_core -->|"schedules"| node_client_jobs
node_client_services -->|"uses crypto"| node_keymanager
node_client_services -->|"builds packets"| node_packetmanager
node_client_services -->|"transliterates"| node_translit
node_platform_android -->|"invokes"| node_client_services
node_ui -.->|"covered by"| node_uitest

click node_main "https://github.com/mosip/android-registration-client/blob/master/lib/main.dart"
click node_router "https://github.com/mosip/android-registration-client/blob/master/lib/app_router.dart"
click node_ui "https://github.com/mosip/android-registration-client/tree/master/lib/ui"
click node_providers "https://github.com/mosip/android-registration-client/tree/master/lib/provider"
click node_models "https://github.com/mosip/android-registration-client/tree/master/lib/model"
click node_spi "https://github.com/mosip/android-registration-client/tree/master/lib/platform_spi"
click node_platform_android "https://github.com/mosip/android-registration-client/tree/master/lib/platform_android"
click node_pigeon "https://github.com/mosip/android-registration-client/tree/master/pigeon"
click node_android_app "https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client"
click node_app_api "https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client/api_services"
click node_client_core "https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager"
click node_client_db "https://github.com/mosip/android-registration-client/blob/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/config/ClientDatabase.java"
click node_client_services "https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service"
click node_client_repos "https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/repository"
click node_client_daos "https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dao"
click node_client_jobs "https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/jobs"
click node_client_api "https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client/api_services"
click node_keymanager "https://github.com/mosip/android-registration-client/tree/master/android/keymanager/src/main/java/io/mosip/registration/keymanager"
click node_packetmanager "https://github.com/mosip/android-registration-client/tree/master/android/packetmanager/src/main/java/io/mosip/registration/packetmanager"
click node_translit "https://github.com/mosip/android-registration-client/tree/master/android/transliterationmanager/src/main/java/io/mosip/registration/transliterationmanager"
click node_uitest "https://github.com/mosip/android-registration-client/tree/master/ui-test/src/main/java/regclient"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_router,node_ui,node_providers,node_models,node_spi,node_platform_android,node_pigeon toneBlue
class node_android_app,node_app_api,node_client_core,node_client_db,node_client_services,node_client_repos,node_client_daos,node_client_jobs,node_client_api toneAmber
class node_keymanager,node_packetmanager,node_translit toneMint
class node_uitest toneRose
```

## Components

### Flutter app

Cross-platform UI, state, and platform-agnostic service contracts.

- [App entry](https://github.com/mosip/android-registration-client/blob/master/lib/main.dart): Flutter bootstrap · Application startup and router wiring. · `lib/main.dart`
- [Routing](https://github.com/mosip/android-registration-client/blob/master/lib/app_router.dart): navigation · Top-level app routing and flow selection. · `lib/app_router.dart`
- [Screens](https://github.com/mosip/android-registration-client/tree/master/lib/ui): presentation · Primary UI flows for login, onboarding, registration, export, settings, profile, scanner, and approval. · `lib/ui`
- [State layer](https://github.com/mosip/android-registration-client/tree/master/lib/provider): state orchestration · Provider-based coordination for app screens and workflows. · `lib/provider`
- [Domain models](https://github.com/mosip/android-registration-client/tree/master/lib/model): data model · Flutter-side data structures used across UI and service boundaries. · `lib/model`
- [Service SPI](https://github.com/mosip/android-registration-client/tree/master/lib/platform_spi): abstract services · Platform-neutral service interfaces for auth, biometrics, packet, sync, config, and registration. · `lib/platform_spi`
- [Android adapters](https://github.com/mosip/android-registration-client/tree/master/lib/platform_android): platform impl · Flutter-side implementations that bridge SPI calls into Android native code. · `lib/platform_android`
- [Bridge contract](https://github.com/mosip/android-registration-client/tree/master/pigeon): channel schema · Typed Flutter-to-Android API definitions and generated contract surface. · `pigeon`

### Android native

Android host app and native business/service layers.

- [Android host](https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client): host app · Main Android application shell with activity, background service, and DI bootstrap. · `android/app/src/main/java/io/mosip/registration_client`
- [Host APIs](https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client/api_services): native APIs · Android-side API handlers exposed to Flutter via generated bindings. · `android/app/src/main/java/io/mosip/registration_client/api_services`
- [Client core](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager): domain infrastructure · Main native subsystem for config, persistence, services, jobs, and sync. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager`
- [Local DB](https://github.com/mosip/android-registration-client/blob/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/config/ClientDatabase.java): Room database · Room-backed persistence boundary for operational and registration state. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager/config/ClientDatabase.java`
- [Business services](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service): service layer · Registration, login, master-data, packet, validation, onboarding, and sync services. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service`
- [Repositories](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/repository): persistence access · Repository layer mediating between DAOs, entities, and services. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager/repository`
- [DAOs](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dao): data access · Room data access objects for local persistence tables and lookups. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dao`
- [Jobs](https://github.com/mosip/android-registration-client/tree/master/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/jobs): background jobs · Scheduled sync, cleanup, and packet-status tasks. · `android/clientmanager/src/main/java/io/mosip/registration/clientmanager/jobs`
- [Backend APIs](https://github.com/mosip/android-registration-client/tree/master/android/app/src/main/java/io/mosip/registration_client/api_services): HTTP clients · Native service clients for MOSIP auth, config, master data, registration, and status operations. · `android/app/src/main/java/io/mosip/registration_client/api_services`

### Native libraries

Specialized Android modules for packet, crypto, and transliteration.

- [Key manager](https://github.com/mosip/android-registration-client/tree/master/android/keymanager/src/main/java/io/mosip/registration/keymanager): crypto module · Certificate, trust, and cryptographic operations with local key storage. · `android/keymanager/src/main/java/io/mosip/registration/keymanager`
- [Packet manager](https://github.com/mosip/android-registration-client/tree/master/android/packetmanager/src/main/java/io/mosip/registration/packetmanager): packet module · Registration packet composition, hashing, storage, and encryption handling. · `android/packetmanager/src/main/java/io/mosip/registration/packetmanager`
- [Transliteration](https://github.com/mosip/android-registration-client/tree/master/android/transliterationmanager/src/main/java/io/mosip/registration/transliterationmanager): language module · Multilingual transliteration service used during capture and registration. · `android/transliterationmanager/src/main/java/io/mosip/registration/transliterationmanager`

### Validation

Automated tests and end-to-end delivery checks.

- [UI tests](https://github.com/mosip/android-registration-client/tree/master/ui-test/src/main/java/regclient): e2e suite · Separate end-to-end automation project covering major user journeys. · `ui-test/src/main/java/regclient`

## Connections

- App entry → Routing: starts · App entry initializes routing and top-level flow.
- Routing → Screens: navigates · Routing selects the active screen flow.
- Screens → State layer: reads state · Screens consume provider-managed workflow state.
- State layer → Domain models: maps data · UI state is shaped through shared data models.
- State layer → Service SPI: calls · Providers depend on platform-neutral service abstractions.
- Service SPI → Android adapters: implemented by · SPI contracts are fulfilled by Android-specific adapters.
- Android adapters → Bridge contract: bridges via · Dart adapters invoke typed native contracts.
- Bridge contract → Android host: delivers to · Generated channel bindings reach the Android host APIs.
- Android host → Host APIs: exposes · Host app wires native APIs and lifecycle entry points.
- Host APIs → Client core: delegates · Android host calls into the native client core.
- Client core → Local DB: persists in · Core services rely on Room-backed local storage.
- Client core → Business services: orchestrates · Core subsystem coordinates business services.
- Business services → Repositories: uses · Services access repositories for durable state.
- Repositories → DAOs: queries · Repositories read and write through DAOs.
- Business services → Backend APIs: syncs with · Services call backend-facing HTTP clients.
- Client core → Jobs: schedules · Background jobs handle sync and maintenance tasks.
- Business services → Key manager: uses crypto · Security-sensitive operations depend on key management.
- Business services → Packet manager: builds packets · Registration services rely on packet composition.
- Business services → Transliteration: transliterates · Language conversion supports registration capture.
- Android adapters → Business services: invokes · Flutter platform adapters reach the native service layer.
- Screens → UI tests: covered by · Major flows are exercised by the external UI automation suite.
