# mosip/partner-management-services architecture

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

- Interactive diagram: https://gitdiagram.com/mosip/partner-management-services
- Repository: https://github.com/mosip/partner-management-services

## Overview

1. This repository is a multi-module Java 11 / Spring Boot workspace for MOSIP’s Partner Management Services (PMS). The top-level build produces several deployable artifacts, not a single application.

2. The two main runtime services are:
   - `partner-management-service`: manages partner onboarding and lifecycle, device/provider registration, certificates, API keys, OIDC/client data, MISP licensing, roles, and user-related workflows.
   - `policy-management-service`: manages policy groups, auth/data-share policies, policy status transitions, policy search/filtering, and policy/partner mapping workflows.

3. Both services are layered in the same way: REST controllers at the edge, service classes for business logic, repositories for persistence access, and DTO-heavy request/response models. This makes controller-to-service-to-database the primary internal data path.

4. `partner/pms-common` is the shared domain and infrastructure library. It contains:
   - shared entities and repositories for partners, policies, clients, MISP, devices, and summary/history tables,
   - common request/response wrappers,
   - search/filter/pagination helpers,
   - auditing, notification, REST, mapping, and template utilities,
   - shared validation and exception types.
   This module is the main boundary-crossing dependency used by both services.

5. `partner/policy-validator` is a separate validation component focused on policy schema checks. It validates policy JSON structures before they are accepted by the policy service, especially data-share and related policy definitions. It acts as a domain guardrail rather than a runtime service.

6. Persistence is database-centric. The `db_scripts` folder defines the PMS schema and seed data, while `db_upgrade_scripts` contains versioned migrations and rollback scripts. The schema includes partner, policy, device, auth policy, MISP, OIDC client, certificate, and history tables, so state and auditability are core architectural concerns.

7. The partner service has several distinct subdomains inside one service boundary:
   - partner lifecycle and contacts,
   - device/auth-device registration and status changes,
   - secure biometric interface and FTM chip workflows,
   - OAuth/OIDC client management,
   - MISP license management,
   - user and role management.
   This suggests the service is a coordination layer over multiple partner-related aggregates rather than a single narrow API.

8. The policy service centers on policy authoring and governance:
   - create/update/publish/deactivate flows,
   - policy group management,
   - search and filtering APIs,
   - mapping policies to partners or API keys,
   - audit and request/response wrapping.
   It also includes wrappers/config for request handling and API documentation, indicating a formal public API surface.

9. External integration points materially shape the design. The code references Keycloak, OAuth clients, internal auth, certificate handling, audit emission, and notification/websub-style publishing. These integrations are part of the service logic, not separate sidecars or adapters.

10. The repository also includes a large `api-test` module used for functional and integration testing. It is template-driven, with YAML scenario definitions and Handlebars request/response templates for many end-to-end cases. This module exercises the published APIs rather than unit-level internals.

11. Deployment is Kubernetes-oriented. The `helm` directory contains separate charts for `pms-partner` and `pms-policy`, each with deployment, service, service monitor, and virtual service manifests. The `deploy` scripts support install, delete, restart, and config management around K8s rollout.

12. CI/CD and release hygiene are part of the repo structure: GitHub Actions workflows handle lint/publish, database tests, release tagging/changelog generation, and push-triggered builds. A generated SBOM is also checked in, showing supply-chain tracking is expected.

13. A useful architecture diagram would show two independent Spring Boot services backed by a shared library, both persisting to the PMS database schema, with policy validation and functional tests as supporting components, and Helm/Kubernetes as the runtime deployment target.

Main entry points: [`db_scripts/mosip_pms/ddl.sql`](https://github.com/mosip/partner-management-services/blob/master/db_scripts/mosip_pms/ddl.sql) (DB Schema), [`partner/pms-common`](https://github.com/mosip/partner-management-services/tree/master/partner/pms-common) (PMS Common), [`partner/partner-management-service/src/main/java/io/mosip/pms`](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms) (Partner API), [`partner/pom.xml`](https://github.com/mosip/partner-management-services/blob/master/partner/pom.xml) (PMS Workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace"]
  node_root["PMS Workspace<br/>multi-module build<br/>[pom.xml]"]
end

subgraph group_runtime["Runtime services"]
  node_partner_service["Partner Service<br/>Spring Boot app"]
  node_policy_service["Policy Service<br/>Spring Boot app"]
  node_partner_api["Partner API<br/>REST edge"]
  node_partner_domain["Partner Domain<br/>business services"]
  node_device_domain["Device Domain<br/>device workflows"]
  node_oauth_domain["OIDC Clients<br/>client management"]
  node_misp_domain["MISP Licensing<br/>licensing workflow"]
  node_policy_api["Policy API<br/>REST edge"]
  node_policy_domain["Policy Domain<br/>governance service"]
end

subgraph group_shared["Shared modules"]
  node_common_lib["PMS Common<br/>shared library"]
  node_policy_validator["Policy Validator<br/>validation library"]
end

subgraph group_support["Supporting systems"]
  node_db_schema[("DB Schema<br/>SQL model<br/>[ddl.sql]")]
  node_db_migrations["Migrations<br/>upgrade scripts"]
  node_api_tests["API Tests<br/>functional test suite"]
  node_helm_partner["Partner Helm<br/>K8s chart"]
  node_helm_policy["Policy Helm<br/>K8s chart"]
  node_deploy_scripts["Deploy Scripts<br/>k8s ops scripts"]
end

node_root -->|"builds"| node_partner_service
node_root -->|"builds"| node_policy_service
node_root -->|"builds"| node_common_lib
node_root -->|"builds"| node_policy_validator
node_partner_service -->|"contains"| node_partner_api
node_partner_api -->|"calls"| node_partner_domain
node_partner_api -->|"calls"| node_device_domain
node_partner_api -->|"calls"| node_oauth_domain
node_partner_api -->|"calls"| node_misp_domain
node_partner_domain -->|"uses"| node_common_lib
node_device_domain -->|"uses"| node_common_lib
node_oauth_domain -->|"uses"| node_common_lib
node_misp_domain -->|"uses"| node_common_lib
node_policy_service -->|"contains"| node_policy_api
node_policy_api -->|"calls"| node_policy_domain
node_policy_domain -->|"uses"| node_common_lib
node_policy_domain -->|"guards with"| node_policy_validator
node_partner_domain -->|"persists to"| node_db_schema
node_device_domain -->|"persists to"| node_db_schema
node_oauth_domain -->|"persists to"| node_db_schema
node_misp_domain -->|"persists to"| node_db_schema
node_policy_domain -->|"persists to"| node_db_schema
node_db_schema -->|"evolves via"| node_db_migrations
node_api_tests -->|"exercises"| node_partner_service
node_api_tests -->|"exercises"| node_policy_service
node_helm_partner -->|"deploys"| node_partner_service
node_helm_policy -->|"deploys"| node_policy_service
node_deploy_scripts -->|"operates"| node_helm_partner
node_deploy_scripts -->|"operates"| node_helm_policy

click node_root "https://github.com/mosip/partner-management-services/blob/master/partner/pom.xml"
click node_partner_service "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service"
click node_policy_service "https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service"
click node_common_lib "https://github.com/mosip/partner-management-services/tree/master/partner/pms-common"
click node_policy_validator "https://github.com/mosip/partner-management-services/tree/master/partner/policy-validator"
click node_db_schema "https://github.com/mosip/partner-management-services/blob/master/db_scripts/mosip_pms/ddl.sql"
click node_db_migrations "https://github.com/mosip/partner-management-services/tree/master/db_upgrade_scripts/mosip_pms/sql"
click node_api_tests "https://github.com/mosip/partner-management-services/tree/master/api-test"
click node_helm_partner "https://github.com/mosip/partner-management-services/tree/master/helm/pms-partner"
click node_helm_policy "https://github.com/mosip/partner-management-services/tree/master/helm/pms-policy"
click node_deploy_scripts "https://github.com/mosip/partner-management-services/tree/master/deploy"
click node_partner_api "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms"
click node_partner_domain "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/partner"
click node_device_domain "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/device"
click node_oauth_domain "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/oauth/client"
click node_misp_domain "https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/partner/misp"
click node_policy_api "https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service/src/main/java/io/mosip/pms/policy"
click node_policy_domain "https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service"

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_root toneBlue
class node_partner_service,node_policy_service,node_partner_api,node_partner_domain,node_device_domain,node_oauth_domain,node_misp_domain,node_policy_api,node_policy_domain toneAmber
class node_common_lib,node_policy_validator toneMint
class node_db_schema,node_db_migrations,node_api_tests,node_helm_partner,node_helm_policy,node_deploy_scripts toneRose
```

## Components

### Workspace

Multi-module Maven build for PMS services and shared libraries.

- [PMS Workspace](https://github.com/mosip/partner-management-services/blob/master/partner/pom.xml): multi-module build · Top-level Java 11/Spring Boot workspace that produces multiple deployable artifacts. · `partner/pom.xml`

### Runtime services

Deployable Spring Boot services that expose the public APIs.

- [Partner Service](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service): Spring Boot app · Primary partner-management runtime for partner onboarding, lifecycle, device registration, certificates, API keys, OIDC clients, MISP licensing, roles, and user workflows. · `partner/partner-management-service`
- [Policy Service](https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service): Spring Boot app · Primary policy-management runtime for policy groups, policy authoring, status transitions, search, and partner/policy mapping. · `partner/policy-management-service`
- [Partner API](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms): REST edge · Controllers and request/response wrappers for partner lifecycle, devices, OIDC clients, MISP, roles, and users. · `partner/partner-management-service/src/main/java/io/mosip/pms`
- [Partner Domain](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/partner): business services · Service implementations coordinating partner aggregates and external integrations. · `partner/partner-management-service/src/main/java/io/mosip/pms/partner`
- [Device Domain](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/device): device workflows · Device, SBI, and FTM chip registration and status management flow. · `partner/partner-management-service/src/main/java/io/mosip/pms/device`
- [OIDC Clients](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/oauth/client): client management · OAuth/OIDC client lifecycle and related data handling. · `partner/partner-management-service/src/main/java/io/mosip/pms/oauth/client`
- [MISP Licensing](https://github.com/mosip/partner-management-services/tree/master/partner/partner-management-service/src/main/java/io/mosip/pms/partner/misp): licensing workflow · MISP/infrastructure provider license management and approval flows. · `partner/partner-management-service/src/main/java/io/mosip/pms/partner/misp`
- [Policy API](https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service/src/main/java/io/mosip/pms/policy): REST edge · Policy controllers and API surface for policy and policy group governance. · `partner/policy-management-service/src/main/java/io/mosip/pms/policy`
- [Policy Domain](https://github.com/mosip/partner-management-services/tree/master/partner/policy-management-service/src/main/java/io/mosip/pms/policy/service): governance service · Policy authoring, publishing, deactivation, search, filtering, and partner mapping logic. · `partner/policy-management-service/src/main/java/io/mosip/pms/policy/service`

### Shared modules

Cross-cutting library code reused by both services.

- [PMS Common](https://github.com/mosip/partner-management-services/tree/master/partner/pms-common): shared library · Shared domain, repositories, DTOs, helpers, validation, and infrastructure utilities used across both services. · `partner/pms-common`
- [Policy Validator](https://github.com/mosip/partner-management-services/tree/master/partner/policy-validator): validation library · Standalone policy schema validator used as a guardrail before policy acceptance. · `partner/policy-validator`

### Supporting systems

Validation, database assets, tests, and deployment artifacts.

- [DB Schema](https://github.com/mosip/partner-management-services/blob/master/db_scripts/mosip_pms/ddl.sql): SQL model · PMS database schema, seed data, and versioned upgrade/rollback scripts for partner, policy, device, MISP, OIDC, certificate, and history tables. · `db_scripts/mosip_pms/ddl.sql`
- [Migrations](https://github.com/mosip/partner-management-services/tree/master/db_upgrade_scripts/mosip_pms/sql): upgrade scripts · Versioned database upgrade and rollback scripts. · `db_upgrade_scripts/mosip_pms/sql`
- [API Tests](https://github.com/mosip/partner-management-services/tree/master/api-test): functional test suite · Template-driven end-to-end tests with YAML scenarios and Handlebars request/response templates. · `api-test`
- [Partner Helm](https://github.com/mosip/partner-management-services/tree/master/helm/pms-partner): K8s chart · Kubernetes packaging for the partner-management service. · `helm/pms-partner`
- [Policy Helm](https://github.com/mosip/partner-management-services/tree/master/helm/pms-policy): K8s chart · Kubernetes packaging for the policy-management service. · `helm/pms-policy`
- [Deploy Scripts](https://github.com/mosip/partner-management-services/tree/master/deploy): k8s ops scripts · Install, delete, restart, and config-copy scripts for rollout operations. · `deploy`

## Connections

- PMS Workspace → Partner Service: builds · Maven workspace produces the partner service artifact.
- PMS Workspace → Policy Service: builds · Maven workspace produces the policy service artifact.
- PMS Workspace → PMS Common: builds · Shared library is part of the workspace build.
- PMS Workspace → Policy Validator: builds · Validator module is built from the same workspace.
- Partner Service → Partner API: contains · Runtime service exposes its REST API layer.
- Partner API → Partner Domain: calls · Controllers delegate partner workflows to service implementations.
- Partner API → Device Domain: calls · Device-facing endpoints delegate registration and status workflows.
- Partner API → OIDC Clients: calls · Client-management endpoints delegate to OIDC client services.
- Partner API → MISP Licensing: calls · MISP license endpoints delegate to licensing services.
- Partner Domain → PMS Common: uses · Partner workflows reuse shared entities, repositories, DTOs, and utilities.
- Device Domain → PMS Common: uses · Device workflows reuse shared persistence and helper code.
- OIDC Clients → PMS Common: uses · Client workflows reuse shared domain and request/response models.
- MISP Licensing → PMS Common: uses · MISP workflows reuse shared license and partner persistence models.
- Policy Service → Policy API: contains · Runtime service exposes its policy REST API layer.
- Policy API → Policy Domain: calls · Controllers delegate policy governance logic to services.
- Policy Domain → PMS Common: uses · Policy service reuses shared search, persistence, and response wrappers.
- Policy Domain → Policy Validator: guards with · Policy acceptance is checked by the schema validator.
- Partner Domain → DB Schema: persists to · Partner aggregates are stored in the PMS schema.
- Device Domain → DB Schema: persists to · Device and SBI/FTM state is stored in the PMS schema.
- OIDC Clients → DB Schema: persists to · OIDC client state is stored in the PMS schema.
- MISP Licensing → DB Schema: persists to · MISP license state is stored in the PMS schema.
- Policy Domain → DB Schema: persists to · Policy and policy-group state is stored in the PMS schema.
- DB Schema → Migrations: evolves via · Schema changes are maintained through versioned migrations and rollbacks.
- API Tests → Partner Service: exercises · Functional scenarios target the partner service APIs.
- API Tests → Policy Service: exercises · Functional scenarios target the policy service APIs.
- Partner Helm → Partner Service: deploys · Helm chart packages the partner runtime.
- Policy Helm → Policy Service: deploys · Helm chart packages the policy runtime.
- Deploy Scripts → Partner Helm: operates · Deployment scripts manage the partner chart lifecycle.
- Deploy Scripts → Policy Helm: operates · Deployment scripts manage the policy chart lifecycle.
