# gamonoid/icehrm architecture

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

- Interactive diagram: https://gitdiagram.com/gamonoid/icehrm
- Repository: https://github.com/gamonoid/icehrm

## Overview

##### Main System Components

The system should be represented with these key components:

a) Frontend Layer:
- Web Interface (/web directory)
- Admin Module (/web/admin)
- User Module (/web/modules)
- Components (/web/components)
- Static Assets (CSS, JS, images)

b) Backend Layer:
- Core Application (/core)
- API Services (/app/api)
- Authentication System
- File Upload Service
- Extension System

c) Data Layer:
- Database (MySQL/MariaDB)
- File Storage System
- Cache System

##### Key Architectural Patterns to Highlight

a) MVC Architecture:
- Models (/core/src/*/Common/Model)
- Views (/web/modules/src)
- Controllers (/core/src/*/Admin/Api)

b) Module-based Architecture:
- Admin Modules
- User Modules
- Core Modules
- Custom Extensions

##### Integration Points

Connections for:
- REST API endpoints
- Database connections
- File system interactions
- External services (Google, SAML)

##### Specific Implementation Details

Specialized components:
- Migration System (/core/migrations)
- Cron Jobs (/core/crons)
- Extension System (/extensions)
- Multi-language Support (/core/lang)

**┌─────────────────────────────────────────────────────┐**
- Client Layer                       │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐   │
- Admin UI  │ │   User UI   │ │ Public Pages│   │
- ┘ └─────────────┘ └─────────────┘   │
- ┤
- Application Layer                  │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐   │
- Core API   │ │   Modules   │ │ Extensions  │   │
- ┘ └─────────────┘ └─────────────┘   │
- ┤
- Service Layer                      │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐   │
- Auth Service│ │File Service │ │ Job Service │   │
- ┘ └─────────────┘ └─────────────┘   │
- ┤
- Data Layer                         │
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐   │
- Database   │ │File Storage │ │   Cache     │   │
- ┘ └─────────────┘ └─────────────┘   │
- ┘

##### Connection Types

- Dependencies (thin lines)

##### Additional Elements

Include:
- Docker containers (from docker-compose files)
- Development tools
- Testing infrastructure
- Deployment paths

Remember to highlight the modular nature of the system and how it can be extended through the custom extension system, which is a key feature of IceHrm.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Client Layer
    subgraph ClientLayer
        WebUI["Web Interface"]:::frontend
        AdminUI["Admin Module"]:::frontend
        UserUI["User Module"]:::frontend
        Components["UI Components"]:::frontend
    end

    %% Application Layer
    subgraph AppLayer
        CoreApp["Core Application"]:::backend
        APIServices["API Services"]:::backend
        ExtSystem["Extension System"]:::backend
        MVCModels["MVC Models"]:::backend
        MVCViews["MVC Views"]:::backend
        MVCControllers["MVC Controllers"]:::backend
        RestAPI["REST API"]:::backend
    end

    %% Service Layer
    subgraph ServiceLayer
        AuthService["Authentication System"]:::security
        FileService["File Upload Service"]:::backend
        CronService["Cron System"]:::backend
        LangService["Multi-language Support"]:::backend
        Settings["Settings Management"]:::backend
        Permissions["Permission System"]:::security
    end

    %% Data Layer
    subgraph DataLayer
        DB[(Database)]:::data
        FileStorage["File Storage"]:::data
        Cache["Cache System"]:::data
        Migrations["Database Migrations"]:::data
    end

    %% Connections
    WebUI --> APIServices
    AdminUI --> APIServices
    UserUI --> APIServices
    Components --> WebUI
    Components --> AdminUI
    Components --> UserUI
    
    APIServices --> CoreApp
    CoreApp --> AuthService
    CoreApp --> FileService
    CoreApp --> ExtSystem
    
    CoreApp --> MVCModels
    CoreApp --> MVCControllers
    MVCControllers --> MVCViews
    
    AuthService --> DB
    FileService --> FileStorage
    CoreApp --> Cache
    Migrations --> DB
    
    RestAPI --> CoreApp
    Settings --> CoreApp
    Permissions --> AuthService

    %% Click Events
    click WebUI "https://github.com/gamonoid/icehrm/tree/master/web"
    click AdminUI "https://github.com/gamonoid/icehrm/tree/master/web/admin"
    click UserUI "https://github.com/gamonoid/icehrm/tree/master/web/modules"
    click Components "https://github.com/gamonoid/icehrm/tree/master/web/components"
    click CoreApp "https://github.com/gamonoid/icehrm/tree/master/core"
    click APIServices "https://github.com/gamonoid/icehrm/tree/master/app/api"
    click AuthService "https://github.com/gamonoid/icehrm/tree/master/core/src/Users"
    click FileService "https://github.com/gamonoid/icehrm/blob/master/core/fileupload.php"
    click ExtSystem "https://github.com/gamonoid/icehrm/tree/master/core/extensions"
    click Migrations "https://github.com/gamonoid/icehrm/tree/master/core/migrations"
    click CronService "https://github.com/gamonoid/icehrm/tree/master/core/crons"
    click LangService "https://github.com/gamonoid/icehrm/tree/master/core/lang"
    click MVCModels "https://github.com/gamonoid/icehrm/tree/master/core/src/*/Common/Model"
    click MVCViews "https://github.com/gamonoid/icehrm/tree/master/web/modules/src"
    click MVCControllers "https://github.com/gamonoid/icehrm/tree/master/core/src/*/Admin/Api"
    click RestAPI "https://github.com/gamonoid/icehrm/blob/master/core/api-rest.php"
    click FileStorage "https://github.com/gamonoid/icehrm/tree/master/app/data"
    click Cache "https://github.com/gamonoid/icehrm/blob/master/core/src/Classes/CacheService.php"
    click Settings "https://github.com/gamonoid/icehrm/tree/master/core/src/Settings"
    click Permissions "https://github.com/gamonoid/icehrm/tree/master/core/src/Permissions"
```
