Skip to content

RaviGit18/msa

Repository files navigation

Microservices Architecture (MSA) 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 inter-service communication.

Architecture Components

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
  • Zuul Edge Server - API gateway for routing and load balancing
  • Zipkin Tracing - Distributed tracing and monitoring

Technology Stack

Technology Stack Diagram

image
  • Java 11 or higher
  • Spring Boot 2.7.18
  • Spring Cloud 2021.0.8
  • Maven - Build tool and dependency management
  • H2 Database - In-memory database for development
  • Netflix Eureka - Service discovery
  • Zuul - API gateway
  • Zipkin - Distributed tracing
  • OpenFeign - HTTP client for inter-service communication

Project Structure

msa/
|-- pom.xml                           # Parent POM with common configuration
|-- README.md                         # This file
|-- docs/                            # Documentation
|   |-- project-overview.md          # Architecture overview
|   |-- development-guide.md         # Build, run, test procedures
|   |-- api-reference.md             # API documentation
|   `-- working-project-summary.md   # Project status
|-- 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
|-- zipkin-tracing/                   # Distributed tracing server
`-- zuul-edge-server/                 # API gateway

Project Structure Visualization

image

Quick Start

Prerequisites

  • Java 11 or higher
  • Maven 3.3 or higher

Clone Repository

git clone https://github.com/RaviGit18/msa.git
cd msa

Building the Project

# Build all modules
mvn clean install

# Skip tests for faster build
mvn clean install -DskipTests

# Build specific module
mvn clean install -pl employee-service

Running Services

Service Deployment Flow

image
  1. Start Infrastructure Services (in order):

    # Start Eureka Server
    cd eureka-naming-server
    java -jar target/eureka-naming-server-0.0.1-SNAPSHOT.jar
    
    # Start Config Server
    cd ../spring-cloud-config-server
    java -jar target/spring-cloud-config-server-0.0.1-SNAPSHOT.jar
    
    # Start Zipkin (optional)
    cd ../zipkin-tracing
    java -jar target/zipkin-tracing-0.0.1-SNAPSHOT.jar
  2. Start Business Services:

    # Start Role Service
    cd ../role-service
    java -jar target/role-service-0.0.1-SNAPSHOT.jar
    
    # Start Employee Service
    cd ../employee-service
    java -jar target/employee-service-0.0.1-SNAPSHOT.jar
    
    # Start Payroll Service
    cd ../employee-payroll-service
    java -jar target/employee-payroll-service-0.0.1-SNAPSHOT.jar
  3. Start Gateway:

    cd ../zuul-edge-server
    java -jar target/zuul-edge-server-0.0.1-SNAPSHOT.jar

Service Endpoints

Once all services are running, you can access:

Service Dependencies Graph

image

API Testing

Data Flow Architecture

image
# Test Role Service
curl http://localhost:8082/role/DEV

# Test Employee Service
curl http://localhost:8080/employee/1000

# Test Payroll Service
curl -X POST http://localhost:8081/employee/1000/role/DEV

# Test through Gateway
curl http://localhost:9090/role-service/role/DEV

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
mvn test

# Run tests for specific module
mvn test -pl role-service

# Run integration tests
mvn verify

Monitoring and Tracing

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

API Documentation

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

  • Swagger UI (if configured)
  • Direct HTTP requests
  • See docs/api-reference.md for complete API documentation

Documentation

Complete documentation is available in the docs/ directory:

  • project-overview.md: Architecture and setup information
  • development-guide.md: Build, run, and test procedures
  • api-reference.md: Complete API documentation
  • working-project-summary.md: Project status and quick start

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 documentation or create an issue in the repository.

Repository Structure

This repository uses a monorepo structure where all microservices are included as local directories (not Git submodules). This makes it easy to:

  • Clone and build the entire project with a single command
  • Navigate between services easily
  • Maintain consistent versions across all services
  • Test inter-service communication locally

About

Microservices application for employee payroll. Developed with Spring Boot, Eureka, Zuul, Zipkin, Spring cloud config, Hystrix, Feign client, RESTful webservice

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages