# keycloak/keycloak-client architecture

> Architecture diagram of the GitHub repository keycloak/keycloak-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/keycloak/keycloak-client
- Repository: https://github.com/keycloak/keycloak-client

## Overview

##### Main Components
- Client Libraries:
- admin-client: Provides functionality for invoking the Keycloak Admin REST API.
- authz-client: Provides functionality for invoking the Keycloak Authorization API.
- policy-enforcer: Implements the access decision enforcement logic and consumes the authorization-client.
- client-common-synced: Contains shared classes, utilities, and JSON mappings that are used by all client modules.
- Supporting Modules:
- docs: Contains guides and documentation for how the libraries are used.
- CI/CD and Build Infrastructure:
- .github directories (workflows, actions, and scripts) for automated builds, tests, sync operations, and release processes.
- Maven build configuration files (pom.xml in several modules, build scripts, etc.).

##### Establish Relationships & Data Flows
- Internal Library Dependencies:
- External Dependencies:

##### Architectural Patterns & Design Principles
- Modularization: The project is clearly divided into modules to separate concerns (API invocation, enforcement, utilities, tests, documentation).
- CI/CD Integration: Although not part of the business logic, the GitHub workflows and actions form an external pipeline that triggers builds, tests, and synchronization scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Systems
    ExternalKC["Keycloak Server"]:::external
    Upstream["Keycloak Server Repository (Upstream)"]:::external

    %% Core API Modules Subgraph
    subgraph "Core API Modules"
        AC["Admin REST API Client"]:::library
        AuthC["Authorization API Client"]:::library
        PE["Access Decision Enforcement Logic"]:::library
        CCS["Shared Utilities & JSON Mappings"]:::library
    end

    %% Supporting Modules & Infrastructure Subgraph
    subgraph "Supporting Modules & Infrastructure"
        Docs["Guides & Documentation"]:::infrastructure
        TS["Integration & White-Box Tests"]:::infrastructure
        CICD["CI/CD Pipelines"]:::infrastructure
    end

    %% Internal Dependencies
    AC -->|"depends_on"| CCS
    AuthC -->|"depends_on"| CCS
    PE -->|"consumes"| AuthC

    %% External Interactions
    AC -->|"API_calls"| ExternalKC
    AuthC -->|"API_calls"| ExternalKC
    TS -->|"tests_against"| ExternalKC

    %% Upstream synchronization arrow
    CCS -->|"UpstreamSync"| Upstream

    %% CI/CD interactions (build, test, sync)
    CICD -->|"triggers_build"| AC
    CICD -->|"triggers_build"| AuthC
    CICD -->|"triggers_tests"| TS
    CICD -->|"syncs"| CCS

    %% Click Events
    click AC "https://github.com/keycloak/keycloak-client/tree/main/admin-client"
    click AuthC "https://github.com/keycloak/keycloak-client/tree/main/authz-client"
    click PE "https://github.com/keycloak/keycloak-client/tree/main/policy-enforcer"
    click CCS "https://github.com/keycloak/keycloak-client/tree/main/client-common-synced"
    click Docs "https://github.com/keycloak/keycloak-client/tree/main/docs"
    click TS "https://github.com/keycloak/keycloak-client/tree/main/testsuite"
    click CICD "https://github.com/keycloak/keycloak-client/blob/main/.github"

    %% Styles
    classDef library fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef infrastructure fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#000,stroke-width:2px;
```
