# ekino/v6y architecture

> Architecture diagram of the GitHub repository ekino/v6y, 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/ekino/v6y
- Repository: https://github.com/ekino/v6y

## Overview

##### Main Components and Their Purposes
- Frontend Applications:
- There are multiple front-end apps. For example, “front” (likely the public-facing application) and “front-bo” (a back-office dashboard). They provide user interfaces (login, dashboards, report pages) for monitoring code quality, performance, etc.
- Backend API Layer (BFF):
- The “bff” directory hosts the backend-for-frontend service where GraphQL resolvers are organized by domain (account, application, audit, dependency, etc.). This service exposes APIs consumed by the frontends.
- Auditor and Analyzer Services:
- Multiple auditor apps exist (devops auditor, dynamic auditor, static auditor, and main analyzer) that encapsulate logic for performing static analysis, runtime monitoring, and generating detailed code quality reports.
- Each auditor service has its own domain (e.g., “dora-metrics”, “lighthouse”, “code-security”) and is structured with dedicated workers, routes, and managers.
- Core Libraries:
- The “v6y-libs” folder contains important libraries such as “core-logic” (with helpers, database providers, APIs, models, and configuration) and “ui-kit”/“ui-guide” (which support the UI development).
- Infrastructure and Configuration:
- Configuration files (docker-compose, Dockerfile, environment templates) indicate containerized deployment and a robust CI/CD setup (see GitHub workflows, husky hooks, etc.).
- “v6y-database” and “v6y-config” hint at dedicated database management and configuration layers.
- Cross-Cutting Concerns:
- Logging, monitoring, and worker management (e.g., Workers under auditor apps and in “core-logic”) are crucial elements that integrate with the backend and services.

##### Relationships and Interactions
- User Interaction Flow:
- Users interact with the frontends (both “front” and “front-bo”) which communicate with the backend BFF.
- API Communication:
- The BFF service (in “bff/src/resolvers” and “bff/src/types”) handles requests from the UI and, in turn, communicates with auditor services.
- Auditors and Workers:
- Auditor applications (such as “bfb-devops-auditor”, “bfb-dynamic-auditor”, “bfb-static-auditor”) are designed with clear modules for analysis. Their workers (e.g., “DevOpsAnalysisWorker”, “LighthouseAnalysisWorker”) process tasks (like analysis or report generation) asynchronously.
- Shared Libraries:
- The core-logic library provides functions and database model definitions used by auditor services and probably by the backend to persist or fetch data.
- Data Flow:

##### Architectural Patterns and Design Principles
- Monorepo Structure:
- The entire project is managed using pnpm and Nx, indicating a shared dependency and modular design.
- Separation of Concerns:
- Clear segregation between UI (front, front-bo), API (bff), and multiple auditor/analysis services.
- Microservice-style Modules within the Monorepo:
- Each auditor service is self-contained, with dedicated configuration, worker processes, and domain-specific logic. The BFF acts as an aggregator.
- Use of Containerization and CI/CD:
- Docker configurations (docker-compose files, Dockerfile in v6y-config) and GitHub workflows are present to manage deployments and tests.

##### Relevant Technologies and Frameworks
- Frontend: Next.js (reference to next.config.mjs), React components, and Vite/Vitest setup.
- Backend: Node.js (with GraphQL resolvers), TypeScript (based on .ts and .tsx files), and Express-like servers.
- Libraries: Core-logic involves database ORM and utility functions; UI-kit/ui-guide provides a component library.
- Deployment: Docker and docker-compose, plus CI/CD configuration files under .github/workflows.
- Testing: Vitest and Jest configurations across apps.

## Diagram (Mermaid)

```mermaid
graph TD
    U["User"]:::user

    subgraph "Frontend Applications"
        F1["Public UI"]:::frontend
        F2["Back Office Dashboard"]:::frontend
    end

    BFF["BFF API Layer"]:::backend

    subgraph "Auditor Services"
        A1["DevOps Auditor"]:::auditor
        A2["Dynamic Auditor"]:::auditor
        A3["Static Auditor"]:::auditor
        A4["Main Analyzer"]:::auditor
    end

    subgraph "Core Libraries"
        CL["Core-logic Library"]:::library
        subgraph "UI Libraries"
            UI1["UI-kit"]:::library
            UI2["UI-guide"]:::library
        end
    end

    DB["Database"]:::infra

    subgraph "Infrastructure & CI/CD"
        DCF["Dockerfile"]:::infra
        DC1["Docker Compose"]:::infra
        DC2["Docker Compose Base"]:::infra
        GH["GitHub Workflows"]:::infra
        HH["Husky Hooks"]:::infra
    end

    U -->|"triggers"| F1
    U -->|"triggers"| F2

    F1 -->|"requests"| BFF
    F2 -->|"requests"| BFF

    BFF -->|"calls"| A1
    BFF -->|"calls"| A2
    BFF -->|"calls"| A3
    BFF -->|"calls"| A4

    BFF -->|"uses"| CL
    A1 -->|"uses"| CL
    A2 -->|"uses"| CL
    A3 -->|"uses"| CL
    A4 -->|"uses"| CL

    F1 -->|"leverages"| UI1
    F1 -->|"leverages"| UI2
    F2 -->|"leverages"| UI1
    F2 -->|"leverages"| UI2

    BFF -->|"persists"| DB
    A1 -->|"persists"| DB
    A2 -->|"persists"| DB
    A3 -->|"persists"| DB
    A4 -->|"persists"| DB

    F1 -.->|"deploys"| DC1
    F2 -.->|"deploys"| DC1
    BFF -.->|"builds"| DCF
    A1 -.->|"builds"| GH
    A2 -.->|"builds"| GH
    A3 -.->|"builds"| GH
    A4 -.->|"builds"| GH
    CL -.->|"versioned"| HH

    classDef frontend fill:#AEDFF7,stroke:#039BE5,stroke-width:2px;
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef auditor fill:#FFE082,stroke:#FFA000,stroke-width:2px;
    classDef library fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px;
    classDef infra fill:#CFD8DC,stroke:#607D8B,stroke-width:2px;
    classDef user fill:#F48FB1,stroke:#C2185B,stroke-width:2px;

    click F1 "https://github.com/ekino/v6y/tree/main/v6y-apps/front"
    click F2 "https://github.com/ekino/v6y/tree/main/v6y-apps/front-bo"
    click BFF "https://github.com/ekino/v6y/tree/main/v6y-apps/bff"
    click A1 "https://github.com/ekino/v6y/tree/main/v6y-apps/bfb-devops-auditor"
    click A2 "https://github.com/ekino/v6y/tree/main/v6y-apps/bfb-dynamic-auditor"
    click A3 "https://github.com/ekino/v6y/tree/main/v6y-apps/bfb-static-auditor"
    click A4 "https://github.com/ekino/v6y/tree/main/v6y-apps/bfb-main-analyzer"
    click CL "https://github.com/ekino/v6y/tree/main/v6y-libs/core-logic"
    click UI1 "https://github.com/ekino/v6y/tree/main/v6y-libs/ui-kit"
    click UI2 "https://github.com/ekino/v6y/tree/main/v6y-libs/ui-guide"
    click DCF "https://github.com/ekino/v6y/tree/main/v6y-config/Dockerfile"
    click DC1 "https://github.com/ekino/v6y/blob/main/docker-compose.yml"
    click DC2 "https://github.com/ekino/v6y/blob/main/docker-compose.base.yml"
    click DB "https://github.com/ekino/v6y/tree/main/v6y-database"
    click GH "https://github.com/ekino/v6y/tree/main/.github/workflows"
    click HH "https://github.com/ekino/v6y/blob/main/.husky"
```
