# nike-inc/cerberus architecture

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

- Interactive diagram: https://gitdiagram.com/nike-inc/cerberus
- Repository: https://github.com/nike-inc/cerberus

## Overview

##### Main components
- Core Business Logic: Modules like “cerberus-core” and “cerberus-domain” contain the business logic, domain objects, validations, and data models used by the application.
- API Testing Suite: The “cerberus-api-tests” module contains integration tests to verify the APIs.
- Authentication Connectors: Separate connectors for Okta (“cerberus-auth-connector-okta”) and OneLogin (“cerberus-auth-connector-onelogin”) indicate pluggable authentication support.
- Audit Logging: The “cerberus-audit-logger-athena” module handles audit logging (likely outputting logs to S3/Athena or similar AWS services).
- External Integrations: There are various AWS integrations – such as AWS Secrets Manager (for “first secrets”), KMS (for encryption), S3 (for storing secrets or files), and possibly STS – which should be clearly represented.
- Infrastructure & Configuration: Dockerfiles, Gradle files, configuration YAMLs (especially the cerberus.yaml) and scripts (run.sh, debug.sh) are used for deployment and runtime configuration.

##### Relationships and interactions
- Within the Cerberus Web module, illustrate layers such as controllers, service classes, domain/DAO layers, and error-handling components.
- AWS Secrets Manager & KMS for secure key management and decryption of configuration/credentials.
- S3 (and Athena in the case of audit logging) for storing audit logs and other binary artifacts.
- Authentication connectors (Okta and OneLogin) as separate components that provide authentication data to the backend.
- API test module as a verification layer that simulates external calls to the Web API.

##### Architectural patterns and design principles
- Separation of concerns: the front end (dashboard) is decoupled from the backend API service.
- Use the layered architecture pattern within the Web application to separate controllers, business services, domain models, data access (DAO) layers, and error handling.
- That Cerberus employs modularization – each concern (audit logging, authentication, core business logic) is split into its own submodule or service.
- Use of dependency injection and Spring Boot’s auto-configuration, which are common in such applications.

##### Relevant technologies
- Spring Boot (cerberus-web)
- Gradle as the build tool (build.gradle), indicating the build and deployment process.
- MySQL for persistent storage.
- AWS SDK integrations (AWS Secrets Manager, KMS, S3, STS) as external cloud services.
- Potential front-end libraries (based on the presence of package.json and Node modules in cerberus-dashboard).
- Testing frameworks (JUnit/Spock/Groovy, as indicated by “.groovy” tests in various modules).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Cerberus Full-Stack Architecture"
        Dashboard["Cerberus Dashboard (Frontend)"]:::frontend
        WebAPI["Cerberus Web (Backend REST API)"]:::backend

        subgraph "Core Business Logic"
            Core["Cerberus Core"]:::business
            Domain["Cerberus Domain"]:::business
        end

        API_Tests["API Testing Suite"]:::test

        subgraph "Authentication Connectors"
            Okta["Okta Connector"]:::auth
            OneLogin["OneLogin Connector"]:::auth
        end

        Audit["Audit Logger"]:::backend

        DB["MySQL Database"]:::database

        subgraph "AWS & External Services"
            AWS["AWS Services"]:::aws
            AWS_STS["AWS STS"]:::aws
        end

        subgraph "Infrastructure & Configuration"
            Docker["Dockerfile.build"]:::infra
            Run["run.sh"]:::infra
            Debug["debug.sh"]:::infra
            Gradle["build.gradle"]:::infra
            Config["cerberus.yaml"]:::infra
        end
    end

    Dashboard -->|"calls"| WebAPI
    WebAPI -->|"invokes"| Core
    WebAPI -->|"invokes"| Domain
    WebAPI -->|"CRUD"| DB
    WebAPI -->|"integrates"| AWS
    AWS -->|"calls"| AWS_STS
    WebAPI -->|"logs"| Audit
    API_Tests -->|"tests"| WebAPI
    WebAPI -->|"auth-check"| Okta
    WebAPI -->|"auth-check"| OneLogin

    Docker -.-> WebAPI
    Run -.-> WebAPI
    Debug -.-> WebAPI
    Gradle -.-> WebAPI
    Config -.-> WebAPI

    click Dashboard "https://github.com/nike-inc/cerberus/tree/master/cerberus-dashboard"
    click WebAPI "https://github.com/nike-inc/cerberus/tree/master/cerberus-web"
    click Core "https://github.com/nike-inc/cerberus/tree/master/cerberus-core"
    click Domain "https://github.com/nike-inc/cerberus/tree/master/cerberus-domain"
    click API_Tests "https://github.com/nike-inc/cerberus/tree/master/cerberus-api-tests"
    click Okta "https://github.com/nike-inc/cerberus/tree/master/cerberus-auth-connector-okta"
    click OneLogin "https://github.com/nike-inc/cerberus/tree/master/cerberus-auth-connector-onelogin"
    click Audit "https://github.com/nike-inc/cerberus/tree/master/cerberus-audit-logger-athena"
    click AWS "https://github.com/nike-inc/cerberus/tree/master/cerberus-web/src/main/java/com/nike/cerberus/aws"
    click AWS_STS "https://github.com/nike-inc/cerberus/tree/master/cerberus-web/src/main/java/com/nike/cerberus/aws/sts"
    click Docker "https://github.com/nike-inc/cerberus/blob/master/Dockerfile.build"
    click Run "https://github.com/nike-inc/cerberus/blob/master/run.sh"
    click Debug "https://github.com/nike-inc/cerberus/blob/master/debug.sh"
    click Gradle "https://github.com/nike-inc/cerberus/blob/master/build.gradle"
    click Config "https://github.com/nike-inc/cerberus/blob/master/cerberus-web/src/main/resources/cerberus.yaml"

    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef business fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef test fill:#FFC0CB,stroke:#000,stroke-width:2px;
    classDef auth fill:#E6E6FA,stroke:#000,stroke-width:2px;
    classDef database fill:#FFCCCC,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5;
    classDef aws fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef infra fill:#FFFFE0,stroke:#000,stroke-width:2px;
```
