# faisalilhami27/go-skeleton architecture

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

## Overview

##### Main Architectural Components

a. External Layer (Entry Points):
- Routes (HTTP endpoints)
- Controllers (Request handlers)
- Middlewares (Cross-cutting concerns)

b. Business Layer:
- Services (Business logic)
- Domain (Core business rules)
- DTOs (Data Transfer Objects)
- Models (Domain entities)

c. Data Layer:
- Repositories (Data access abstraction)

d. Infrastructure Layer:
- Clients (External service clients)
- Config (Application configuration)
- Common (Shared utilities)
- Constants (System-wide constants)

##### Specific Elements

**┌─ Routes**
- Controllers
- Middlewares

**┌─ Services**
- Domain
- Models
- DTOs

- Repositories

**┌─ Clients**
- Config
- Common
- Constants

##### Additional Infrastructure Components

Deployment-related components (marked in purple):
- Docker container
- Jenkins pipeline
- Docker Compose services

##### Flow Representation

Request flow through the system:

##### Technical Details

- Go module name (from go.mod)
- External service connections (from clients directory)
- Database connections (from repositories)
- Middleware chain order
- Configuration sources

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Component]
        L2[(Database)]
        L3{{"External System"}}
        L4([Infrastructure])
        style L1 fill:#f9f,stroke:#333
        style L2 fill:#acf,stroke:#333
        style L3 fill:#fda,stroke:#333
        style L4 fill:#ddd,stroke:#333
    end

    subgraph "External Layer"
        Routes["Routes"]:::external
        Controllers["Controllers"]:::external
        Middlewares["Middlewares"]:::external
    end

    subgraph "Business Layer"
        Services["Services"]:::business
        subgraph Domain
            Models["Domain Models"]:::business
            DTOs["Domain DTOs"]:::business
        end
    end

    subgraph "Data Layer"
        Repositories["Repositories"]:::data
    end

    subgraph "Infrastructure Layer"
        Clients["External Clients"]:::infra
        Config["Configuration"]:::infra
        Common["Common Utilities"]:::infra
        Constants["Constants"]:::infra
    end

    subgraph "Deployment"
        Docker["Dockerfile"]:::deploy
        Jenkins["Jenkins Pipeline"]:::deploy
        DockerCompose["Docker Compose"]:::deploy
        Main["Application Entry"]:::deploy
        Build["Build Config"]:::deploy
    end

    Routes --> Controllers
    Controllers --> Services
    Middlewares --> Controllers
    Services --> Models
    Services --> DTOs
    Services --> Repositories
    Repositories --> Models
    Clients --> Services
    Config --> Services
    Common --> Services
    Constants --> Services

    click Routes "https://github.com/faisalilhami27/go-skeleton/tree/main/routes"
    click Controllers "https://github.com/faisalilhami27/go-skeleton/tree/main/controllers"
    click Middlewares "https://github.com/faisalilhami27/go-skeleton/tree/main/middlewares"
    click Services "https://github.com/faisalilhami27/go-skeleton/tree/main/services"
    click Models "https://github.com/faisalilhami27/go-skeleton/tree/main/domain/models"
    click DTOs "https://github.com/faisalilhami27/go-skeleton/tree/main/domain/dto"
    click Repositories "https://github.com/faisalilhami27/go-skeleton/tree/main/repositories"
    click Clients "https://github.com/faisalilhami27/go-skeleton/tree/main/clients"
    click Config "https://github.com/faisalilhami27/go-skeleton/tree/main/config"
    click Common "https://github.com/faisalilhami27/go-skeleton/tree/main/common"
    click Constants "https://github.com/faisalilhami27/go-skeleton/tree/main/constants"
    click Docker "https://github.com/faisalilhami27/go-skeleton/tree/main/Dockerfile"
    click Jenkins "https://github.com/faisalilhami27/go-skeleton/tree/main/Jenkinsfile"
    click DockerCompose "https://github.com/faisalilhami27/go-skeleton/blob/main/docker-compose.yml"
    click Main "https://github.com/faisalilhami27/go-skeleton/blob/main/main.go"
    click Build "https://github.com/faisalilhami27/go-skeleton/tree/main/Makefile"

    classDef external fill:#ffb86c,stroke:#333
    classDef business fill:#50fa7b,stroke:#333
    classDef data fill:#8be9fd,stroke:#333
    classDef infra fill:#bfbfbf,stroke:#333
    classDef deploy fill:#ff79c6,stroke:#333
```
