# tron01/hrsystem architecture

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

- Interactive diagram: https://gitdiagram.com/tron01/hrsystem
- Repository: https://github.com/tron01/hrsystem

## Overview

##### Project Type and Purpose
- This is a microservices-based HR System implemented in Spring Boot and Spring Cloud.
- It serves to manage user authentication, job postings, resume parsing, and application submissions through a unified API Gateway, with service discovery via Eureka, asynchronous events via Kafka, and centralized monitoring via Spring Boot Admin.

##### File Structure Analysis
- Top-level folders correspond to individual microservices:
- eureka-server (service discovery)
- api-gateway (Spring Cloud Gateway + security)
- auth-service (JWT auth)
- job-posting-service (job lifecycle)
- application-submit-service (application handling + Kafka producer)
- resume-parser-service (Kafka consumer + parsing logic)
- spring-boot-admin (monitoring UI)
- Shared config/build files: docker-compose.yml (Kafka+Zookeeper), service-specific Dockerfiles, Maven wrappers, application.yml.
- Each service follows a layered package structure (config, controller, service, repository, model, dto, filter, exception).

##### README Highlights
- Ports: Eureka (8761), Gateway (8080), Auth (8084), Job (8081), App Submit (8082), Resume Parser (8083), Admin UI (9090).
- Communication:
- Synchronous REST via API Gateway + Feign clients
- Asynchronous events: application-submit → Kafka topic → resume-parser
- Security: JWT enforced at Gateway and in each service via filters.
- Monitoring: Spring Boot Admin + Actuator endpoints.

##### Core Components
a. Gateway Layer
- API Gateway (Spring Cloud Gateway)
- JWT Authentication Filter
b. Service Discovery
- Eureka Server (registers all microservices)
c. Microservices
- Auth Service (handles /api/auth)
- Job Posting Service (/api/jobs)
- Application Submit Service (/api/applications)
- Resume Parser Service (Kafka consumer)
d. Messaging
- Kafka Broker + Zookeeper
- ResumeParseEvent topic
e. Monitoring
- Spring Boot Admin
- Actuator endpoints on each service
f. Data Stores

##### Relationships & Data Flows
- User → HTTP → API Gateway → routes to Auth/Job/Application endpoints → respective service
- Services register themselves on startup with Eureka → Eureka Dashboard
- Application Submit Service publishes ResumeParseEvent to Kafka when a new application is submitted
- Resume Parser Service subscribes to that Kafka topic, processes PDF, persists parsed resume
- Feign clients allow inter-service REST calls (e.g., Application Submit may call Job Service or Auth Service directly via Eureka)
- Spring Boot Admin periodically polls/receives events from all services’ Actuator endpoints

##### Architectural Patterns & Principles
- Microservices with bounded contexts (Auth, Job, Application, Parsing)
- API Gateway for cross-cutting concerns (routing, security)
- Service Discovery (Eureka) for dynamic routing
- Event-driven communication (Kafka) for loose coupling
- Centralized monitoring (Spring Boot Admin + Actuator)

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef gateway fill:#D6E4FF,stroke:#333,stroke-width:1px
    classDef discovery fill:#D6E4FF,stroke:#333,stroke-width:1px
    classDef micro fill:#D4F4DD,stroke:#333,stroke-width:1px
    classDef message fill:#FFDDAA,stroke:#333,stroke-width:1px
    classDef db fill:#EEEEEE,stroke:#333,stroke-width:1px
    classDef monitoring fill:#EAD1DC,stroke:#333,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#333,stroke-dasharray: 5 5

    User["User/Client"]:::external

    subgraph "API & Discovery"
        Gateway["API Gateway\n(Spring Cloud Gateway)"]:::gateway
        JWTFilter["JwtAuthenticationFilter"]:::gateway
        Eureka["Eureka Server"]:::discovery
    end

    subgraph "Business Microservices"
        Auth["Auth Service\n/api/auth"]:::micro
        Job["Job Posting Service\n/api/jobs"]:::micro
        AppSubmit["Application Submit Service\n/api/applications"]:::micro
        Parser["Resume Parser Service"]:::micro
        ResumeProducer["ResumeParseProducer"]:::message
        ResumeEventProd["ResumeParseEvent\n(Producer DTO)"]:::micro
        JobFeign["JobFeignClient"]:::micro
        ResumeConsumer["ResumeParseConsumer"]:::message
        ResumeEventCons["ResumeParseEvent\n(Consumer DTO)"]:::micro
    end

    subgraph Messaging
        Zk["Zookeeper"]:::message
        Kafka["Kafka Broker"]:::message
        Topic["ResumeParseEvent Topic"]:::message
    end

    subgraph "Monitoring (Spring Boot Admin)"
        Admin["Spring Boot Admin UI"]:::monitoring
    end

    AuthDB["Auth DB"]:::db
    JobDB["Job DB"]:::db
    AppDB["Application DB"]:::db
    ParserDB["Parsed Resume DB"]:::db

    User -->|HTTP:8080| Gateway
    Gateway -->|JWT Filter| JWTFilter
    JWTFilter -->|routes /api/auth| Auth
    JWTFilter -->|routes /api/jobs| Job
    JWTFilter -->|routes /api/applications| AppSubmit

    Gateway -->|register/lookup| Eureka
    Auth -->|register/heartbeat| Eureka
    Job -->|register/heartbeat| Eureka
    AppSubmit -->|register/heartbeat| Eureka
    Parser -->|register/heartbeat| Eureka

    AppSubmit -->|publish Kafka:9092| Topic
    Topic -->|consume Kafka:9092| Parser

    AppSubmit -->|Feign| Job
    AppSubmit -->|Feign| Auth

    AppSubmit --> ResumeProducer
    ResumeProducer --> ResumeEventProd
    AppSubmit --> JobFeign

    Parser --> ResumeConsumer
    ResumeConsumer --> ResumeEventCons

    Auth -->|JDBC| AuthDB
    Job -->|JDBC| JobDB
    AppSubmit -->|JDBC| AppDB
    Parser -->|JDBC| ParserDB

    Zk -->|coordination| Kafka

    Admin -->|poll Actuator| Auth
    Admin -->|poll Actuator| Job
    Admin -->|poll Actuator| AppSubmit
    Admin -->|poll Actuator| Parser
    Admin -->|poll Actuator| Gateway
    Admin -->|poll Actuator| Eureka

    click Gateway "https://github.com/tron01/hrsystem/tree/main/api-gateway/"
    click JWTFilter "https://github.com/tron01/hrsystem/blob/main/api-gateway/src/main/java/com/Abhijith/api_gateway/filter/JwtAuthenticationFilter.java"
    click Eureka "https://github.com/tron01/hrsystem/tree/main/eureka-server/"
    click Auth "https://github.com/tron01/hrsystem/tree/main/auth-service/"
    click Job "https://github.com/tron01/hrsystem/tree/main/job-posting-service/"
    click AppSubmit "https://github.com/tron01/hrsystem/tree/main/application-submit-service/"
    click Parser "https://github.com/tron01/hrsystem/tree/main/resume-parser-service/"
    click ResumeProducer "https://github.com/tron01/hrsystem/blob/main/application-submit-service/src/main/java/com/Abhijith/application_submit_service/kafka/producer/ResumeParseProducer.java"
    click ResumeEventProd "https://github.com/tron01/hrsystem/blob/main/application-submit-service/src/main/java/com/Abhijith/application_submit_service/kafka/event/ResumeParseEvent.java"
    click JobFeign "https://github.com/tron01/hrsystem/blob/main/application-submit-service/src/main/java/com/Abhijith/application_submit_service/client/JobFeignClient.java"
    click ResumeConsumer "https://github.com/tron01/hrsystem/blob/main/resume-parser-service/src/main/java/com/Abhijith/resume_parser_service/kafka/consumer/ResumeParseConsumer.java"
    click ResumeEventCons "https://github.com/tron01/hrsystem/blob/main/resume-parser-service/src/main/java/com/Abhijith/resume_parser_service/kafka/event/ResumeParseEvent.java"
    click Admin "https://github.com/tron01/hrsystem/tree/main/spring-boot-admin/"
    click Zk "https://github.com/tron01/hrsystem/blob/main/docker-kafka.yml"
    click Kafka "https://github.com/tron01/hrsystem/blob/main/docker-compose.yml"
```
