# pancoded/repo-config-server architecture

> Architecture diagram of the GitHub repository pancoded/repo-config-server, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pancoded/repo-config-server
- Repository: https://github.com/pancoded/repo-config-server

## Overview

##### Project Type and Purpose
- This is a Spring Cloud–based microservices system. It comprises:
- Config Server (config-server) for centralized configuration
- Eureka Service Registry (eureka-sv) for service discovery
- API Gateway (api-gateway) for routing and cross-cutting concerns
- Domain microservices: cities-service and hotels-service
- The system’s goal is to serve city- and hotel-related data via a unified API front end.

##### File Structure Analysis
- Top-level directories:
- config-data: Holds external YAML configs for each app.
- config-server: Spring Cloud Config Server project.
- eureka-sv: Eureka registry project.
- api-gateway: Spring Cloud Gateway (or Zuul) for routing.
- cities-service & hotels-service: Two domain services, each Spring Boot apps with controllers, services, models, repositories.
- Patterns:
- Microservices registered to Eureka.
- Externalized configuration via Config Server.
- API Gateway handles client requests and delegates to services.
- Config files:
- application.properties/yml in each service.
- config-data/*.yml loaded by Config Server.

##### Essential Elements to Capture
- Configuration fetch flow
- Service discovery flow
- API request routing
- Inter-service call (if any)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Infrastructure"
        configData[("config-data")]:::repo
        configServer["Config Server"]:::infra
        Eureka["Eureka Service Registry"]:::infra
    end

    subgraph "Gateway Layer"
        apiGateway["API Gateway"]:::gateway
    end

    subgraph "Microservices"
        citiesService["cities-service"]:::micro
        hotelsService["hotels-service"]:::micro
    end

    client["Client (Web/Mobile)"]:::external

    %% Data flow and relationships
    configServer -->|"loads YAML from"| configData
    citiesService -->|"fetch config from"| configServer
    hotelsService -->|"fetch config from"| configServer
    apiGateway -->|"fetch config from"| configServer

    citiesService -->|"register to"| Eureka
    hotelsService -->|"register to"| Eureka
    apiGateway -->|"register to"| Eureka
    configServer -->|"register to"| Eureka

    client -->|"sends requests to"| apiGateway
    apiGateway -->|"routes to cities-service"| citiesService
    apiGateway -->|"routes to hotels-service"| hotelsService

    citiesService -->|"calls IHotelsAPI"| hotelsService

    %% Click events
    click configData "https://github.com/pancoded/repo-config-server/tree/main/config-data"
    click configServer "https://github.com/pancoded/repo-config-server/tree/main/config-server"
    click Eureka "https://github.com/pancoded/repo-config-server/tree/main/eureka-sv"
    click apiGateway "https://github.com/pancoded/repo-config-server/tree/main/api-gateway"
    click citiesService "https://github.com/pancoded/repo-config-server/tree/main/cities-service"
    click hotelsService "https://github.com/pancoded/repo-config-server/tree/main/hotels-service"

    %% Styles
    classDef infra fill:#D6EAF8,stroke:#1B4F72,stroke-width:2px
    classDef gateway fill:#FCF3CF,stroke:#B7950B,stroke-width:2px
    classDef micro fill:#D4EFDF,stroke:#186A3B,stroke-width:2px
    classDef external fill:#F2F3F4,stroke:#7B7D7D,stroke-width:2px
    classDef repo fill:#E8DAEF,stroke:#512E5F,stroke-width:2px,stroke-dasharray: 5 5
```
