# cgaswin/zenith architecture

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

- Interactive diagram: https://gitdiagram.com/cgaswin/zenith
- Repository: https://github.com/cgaswin/zenith

## Overview

##### Main Components

a. Microservices Architecture:
- Gateway Service (API Gateway)
- Eureka Registry Service (Service Discovery)
- Auth Service
- User Service
- Event Service

b. External Components:
- AWS S3 (for file storage, indicated by S3FileUpload classes)
- Database instances for each service
- Client Applications (implied by the API structure)

##### Component Relationships to Highlight

a. Client → Gateway:
- All client requests go through the gateway
- Security boundary

b. Gateway → Services:
- Route paths to appropriate services
- Load balancing indication

c. Services → Eureka Registry:
- Service registration
- Service discovery connections

d. Inter-service Communication:
- Auth Service → User Service (via Feign Client)
- Event Service → User Service (implied by JWT handling)

##### Specific Service Details

Auth Service:
- JWT authentication flow
- Security configurations
- User authentication endpoints

User Service:
- Athlete management
- Coach management
- Coaching relationships
- Request handling

Event Service:
- Event management
- Event registration
- Results tracking
- Item management

##### Additional Elements

Include:
- Security zones
- Load balancers
- Database connections
- Async communication patterns
- Service discovery paths
- JWT token flow

##### Technical Stack Indicators

Show:
- Spring Boot/Cloud usage
- Maven build system
- AWS integration
- Database types
- REST APIs

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        WEB["Web Application"]
        MOB["Mobile Application"]
    end

    subgraph Infrastructure
        GATE["API Gateway"]:::gateway
        EUREKA["Service Registry"]:::registry
    end

    subgraph "Core Services"
        AUTH["Authentication Service"]:::auth
        USER["User Service"]:::user
        EVENT["Event Service"]:::event
    end

    subgraph "User Management"
        ATH["Athlete Management"]:::user
        COACH["Coach Management"]:::user
        REL["Coaching Relationships"]:::user
    end

    subgraph "Event Management"
        EH["Event Handler"]:::event
        REG["Registration"]:::event
        RES["Results"]:::event
    end

    subgraph "Security"
        JWT["JWT Authentication"]:::security
        SEC["Security Config"]:::security
    end

    subgraph "External Services"
        S3["AWS S3"]:::external
        DB1[(Auth DB)]:::db
        DB2[(User DB)]:::db
        DB3[(Event DB)]:::db
    end

    WEB & MOB --> GATE
    GATE --> AUTH & USER & EVENT
    AUTH & USER & EVENT --> EUREKA
    
    AUTH --> JWT
    AUTH --> SEC
    AUTH --> S3
    
    USER --> ATH & COACH & REL
    EVENT --> EH & REG & RES
    
    AUTH --> DB1
    USER --> DB2
    EVENT --> DB3
    
    classDef gateway fill:#90EE90
    classDef registry fill:#98FB98
    classDef auth fill:#FFB6C1
    classDef user fill:#87CEEB
    classDef event fill:#DDA0DD
    classDef security fill:#FF6B6B
    classDef external fill:#DEB887
    classDef db fill:#B8860B

    click GATE "https://github.com/cgaswin/zenith/blob/main/gateway/src/main/java/org/gateway/gateway/GatewayApplication.java"
    click EUREKA "https://github.com/cgaswin/zenith/blob/main/eureka-registry/src/main/java/org/registry/eurekaregistry/EurekaRegistryApplication.java"
    click AUTH "https://github.com/cgaswin/zenith/blob/main/Auth/src/main/java/org/auth/auth/AuthApplication.java"
    click USER "https://github.com/cgaswin/zenith/blob/main/User/src/main/java/org/user/user/UserApplication.java"
    click EVENT "https://github.com/cgaswin/zenith/blob/main/Event/src/main/java/org/event/event/EventApplication.java"
    click JWT "https://github.com/cgaswin/zenith/blob/main/Auth/src/main/java/org/auth/auth/filter/JwtAuthenticationFilter.java"
    click S3 "https://github.com/cgaswin/zenith/blob/main/Auth/src/main/java/org/auth/auth/config/AwsConfig.java"
    click ATH "https://github.com/cgaswin/zenith/blob/main/User/src/main/java/org/user/user/controller/AthleteController.java"
    click COACH "https://github.com/cgaswin/zenith/blob/main/User/src/main/java/org/user/user/controller/CoachController.java"
    click REL "https://github.com/cgaswin/zenith/blob/main/User/src/main/java/org/user/user/controller/CoachingRelationshipController.java"
    click EH "https://github.com/cgaswin/zenith/blob/main/Event/src/main/java/org/event/event/controller/EventController.java"
    click REG "https://github.com/cgaswin/zenith/blob/main/Event/src/main/java/org/event/event/controller/EventRegistrationController.java"
    click RES "https://github.com/cgaswin/zenith/blob/main/Event/src/main/java/org/event/event/controller/ResultController.java"
    click SEC "https://github.com/cgaswin/zenith/blob/main/Auth/src/main/java/org/auth/auth/config/SecurityConfig.java"
```
