# repman-io/repman architecture

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

- Interactive diagram: https://gitdiagram.com/repman-io/repman
- Repository: https://github.com/repman-io/repman

## Overview

##### Main Components

a) Frontend Layer:
- Web Interface (Symfony-based templates in /templates)
- API Endpoints (in /src/Controller/Api)
- OAuth Integration Points (in /src/Controller/OAuth)

b) Application Core:
- Command Layer (/src/Command)
- Message System (/src/Message and /src/MessageHandler)
- Service Layer (/src/Service)
- Entity Layer (/src/Entity)

c) Infrastructure:
- PostgreSQL Database
- Message Queue System (Symfony Messenger)
- File Storage System (for package distributions)
- Email System
- Security Scanner

d) External Integrations:
- GitHub
- GitLab
- Bitbucket
- Packagist.org proxy

##### Relationships and Data Flow

- User requests flow through Nginx → PHP-FPM → Application
- Package synchronization flow from Git providers → Application → Storage
- Security scanning flow from Package Storage → Security Scanner → Database
- Async operations through Message Queue
- Proxy requests to packagist.org

##### Component Details

Frontend Layer:
**┌─────────────────────────┐**
- Nginx (Proxy)      │
- ┘
- ↓
**┌─────────────────────────┐**
- Symfony Frontend     │
- Web Interface        │
- API Endpoints        │
- OAuth Controllers    │
- ┘

Application Core:
**┌─────────────────────────┐**
- Message System       │
- Commands             │
- Message Handlers     │
- ┘
- ↕
**┌─────────────────────────┐**
- Service Layer        │
- Package Management   │
- Security Scanning    │
- User Management      │
- ┘
- ↕
**┌─────────────────────────┐**
- Entity Layer         │
- ┘

Infrastructure:
**┌─────────────────────────┐**
- PostgreSQL         │
- ┘
- ↕
**┌─────────────────────────┐**
- Message Queue        │
- ┘
- ↕
**┌─────────────────────────┐**
- File Storage         │
- ┘

##### Key Integration Points

Connections to:
- OAuth providers (GitHub, GitLab, Bitbucket)
- Package sources
- Email system
- Security scanning service

##### Important Notes

- Async nature of package synchronization and scanning
- Security boundaries
- Configuration points (environment variables)
- Scalable components (workers, storage)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        NGINX[Nginx Proxy]
        WEB["Web Interface"]:::frontend
        API["API Endpoints"]:::frontend
        OAUTH["OAuth Controllers"]:::frontend
    end

    subgraph Core
        CMD["Command Layer"]:::core
        MSG["Message System"]:::core
        SVC["Service Layer"]:::core
        ENT["Entity Layer"]:::core
    end

    subgraph Infrastructure
        DB[(PostgreSQL)]:::infra
        MQ["Message Queue"]:::infra
        FS["File Storage"]:::infra
        EMAIL["Email System"]:::infra
        SCAN["Security Scanner"]:::infra
    end

    subgraph "External Services"
        GH["GitHub"]:::external
        GL["GitLab"]:::external
        BB["Bitbucket"]:::external
        PKG["Packagist.org"]:::external
    end

    subgraph Security
        SEC["Security System"]:::security
        AUTH["Authentication"]:::security
        APISEC["API Security"]:::security
    end

    %% Frontend Flow
    NGINX --> WEB
    NGINX --> API
    NGINX --> OAUTH

    %% Core Integration
    WEB --> CMD
    API --> CMD
    OAUTH --> CMD
    CMD --> MSG
    MSG --> SVC
    SVC --> ENT
    ENT --> DB

    %% Infrastructure Integration
    SVC --> MQ
    SVC --> FS
    SVC --> EMAIL
    FS --> SCAN
    SCAN --> DB

    %% External Service Integration
    SVC --> GH
    SVC --> GL
    SVC --> BB
    SVC --> PKG

    %% Security Integration
    SEC --> WEB
    SEC --> API
    AUTH --> SEC
    APISEC --> SEC

    %% Click Events
    click WEB "https://github.com/repman-io/repman/tree/master/templates/"
    click API "https://github.com/repman-io/repman/tree/master/src/Controller/Api/"
    click OAUTH "https://github.com/repman-io/repman/tree/master/src/Controller/OAuth/"
    click CMD "https://github.com/repman-io/repman/tree/master/src/Command/"
    click MSG "https://github.com/repman-io/repman/tree/master/src/Message/"
    click SVC "https://github.com/repman-io/repman/tree/master/src/Service/"
    click ENT "https://github.com/repman-io/repman/tree/master/src/Entity/"
    click DB "https://github.com/repman-io/repman/tree/master/ansible/roles/postgresql/"
    click MQ "https://github.com/repman-io/repman/blob/master/config/packages/messenger.yaml"
    click FS "https://github.com/repman-io/repman/tree/master/src/Service/Dist/"
    click EMAIL "https://github.com/repman-io/repman/tree/master/src/Service/Mailer/"
    click SCAN "https://github.com/repman-io/repman/tree/master/src/Service/Security/PackageScanner/"
    click GH "https://github.com/repman-io/repman/tree/master/src/Service/Integration/GitHubApi/"
    click GL "https://github.com/repman-io/repman/tree/master/src/Service/Integration/GitLabApi/"
    click BB "https://github.com/repman-io/repman/tree/master/src/Service/Integration/BitbucketApi/"
    click PKG "https://github.com/repman-io/repman/tree/master/src/Service/Proxy/"
    click SEC "https://github.com/repman-io/repman/tree/master/src/Security/"
    click AUTH "https://github.com/repman-io/repman/blob/master/src/Security/LoginFormAuthenticator.php"
    click APISEC "https://github.com/repman-io/repman/blob/master/src/Security/ApiTokenAuthenticator.php"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef infra fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#9b59b6,stroke:#8e44ad,color:white
```
