Skip to content

RaviGit18/msa-upgraded

Repository files navigation

Microservices Architecture (MSA-Upgraded) Project

A comprehensive microservices architecture implementation using Spring Boot, Spring Cloud, and related technologies.

Overview

This project demonstrates a complete microservices ecosystem with service discovery, configuration management, API gateway, distributed tracing, and security features.

Architecture Components

Microservices Architecture Flow Diagram

image

System Architecture Overview

image

Core Services

  • Employee Service - Manages employee information and operations
  • Employee Payroll Service - Handles payroll calculations and management
  • Role Service - Manages user roles and permissions

Infrastructure Services

  • Eureka Naming Server - Service discovery and registration
  • Spring Cloud Config Server - Centralized configuration management
  • Spring Cloud Gateway Server - API gateway for routing and load balancing
  • Micrometer Tracing - Distributed tracing and monitoring

Technology Stack

  • Java 17
  • Spring Boot 3.2.5
  • Spring Cloud 2023.0.1
  • Gradle - Build tool and dependency management
  • H2 Database - In-memory database for development
  • Eureka - Service discovery
  • Spring Cloud Gateway - API gateway
  • Micrometer Tracing - Distributed tracing
  • Spring Security - Authentication and authorization
  • Resilience4j - Circuit breaker pattern
  • SpringDoc OpenAPI - API documentation

Technology Stack Diagram

image

Project Structure

msa-upgraded/
├── build.gradle                      # Parent build configuration
├── settings.gradle                   # Gradle settings
├── README.md                         # This file
├── employee-payroll-service/         # Payroll management service
├── employee-service/                 # Employee management service
├── eureka-naming-server/             # Service discovery server
├── role-service/                     # Role management service
├── spring-cloud-config-server/       # Configuration server
├── micrometer-tracing/               # Distributed tracing server
└── spring-cloud-gateway-server/      # API gateway
image

Data Flow Diagram

image image

Quick Start

Prerequisites

  • Java 17 or higher
  • Gradle 8.0 or higher (or use provided wrapper)

Building the Project

# Build all modules
./gradlew clean build

# Build specific module
./gradlew :employee-service:clean :employee-service:build

# Skip tests during build
./gradlew clean build -x test

Gradle Build System Architecture

image

Running Services

image
  1. Start Infrastructure Services (in order):

    # Start Eureka Server
    cd eureka-naming-server
    ../gradlew bootRun
    
    # Start Config Server
    cd ../spring-cloud-config-server
    ../gradlew bootRun
    
    # Start Tracing (optional)
    cd ../micrometer-tracing
    ../gradlew bootRun
  2. Start Business Services:

    # Start Employee Service
    cd ../employee-service
    ../gradlew bootRun
    
    # Start Payroll Service
    cd ../employee-payroll-service
    ../gradlew bootRun
    
    # Start Role Service
    cd ../role-service
    ../gradlew bootRun
  3. Start Gateway:

    cd ../spring-cloud-gateway-server
    ../gradlew bootRun

Service Endpoints

Once all services are running, you can access:

Development

Configuration

All services use Spring Cloud Config for centralized configuration. Configuration files are located in the spring-cloud-config-server module.

Database

Services use H2 in-memory database by default. The database console is available at:

Default credentials:

  • URL: jdbc:h2:mem:testdb
  • Username: sa
  • Password: (empty)

Testing

# Run all tests
./gradlew test

# Run tests for specific module
./gradlew :employee-service:test

# Run integration tests
./gradlew check

Monitoring and Tracing

  • Micrometer Tracing provides distributed tracing across microservices
  • Spring Boot Actuator endpoints expose health and metrics information
  • Eureka provides service discovery and health monitoring
image

API Documentation

Each service exposes RESTful APIs. You can explore the APIs using:

  • Swagger UI (if configured)
  • Postman collections
  • Direct HTTP requests

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. Submit a pull request

License

This project is for educational and demonstration purposes.

Support

For questions or issues, please refer to the individual service documentation or create an issue in the repository.

About

A microservices project with service discovery, configuration management, API gateway, distributed tracing, and security features. Includes Employee Service, Payroll Service, Role Service, Eureka Naming Server, Spring Cloud Config Server, Spring Cloud Gateway, and Micrometer Tracing with detailed architecture diagrams and documentation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages