|
| 1 | +# Spring Microservices |
| 2 | + |
1 | 3 | 
|
| 4 | + |
| 5 | +## About |
| 6 | + |
| 7 | +This repository demonstrates the implementation of a microservices architecture using the Spring framework. |
| 8 | + |
| 9 | +## Structure |
| 10 | + |
| 11 | +The repository contains the following main components: |
| 12 | + |
| 13 | +### 1. Services |
| 14 | +- **Customer Service**: Located in the `customer` directory. |
| 15 | +- **Fraud Service**: Located in the `fraud` directory. |
| 16 | +- **Eureka Server**: Located in the `eureka-server` directory. |
| 17 | + |
| 18 | +### 2. Configuration Files |
| 19 | +- **Docker Compose**: `docker-compose.yml` for container orchestration. |
| 20 | +- **Maven Build File**: `pom.xml` for managing dependencies. |
| 21 | + |
| 22 | +## Features |
| 23 | + |
| 24 | +- **Service Discovery**: Using Eureka Server for registering and discovering microservices. |
| 25 | +- **Docker**: Containerization of services. |
| 26 | +- **Kubernetes**: Deployment configurations for managing containerized applications. |
| 27 | +- **RabbitMQ**: Messaging between services. |
| 28 | +- **PostgreSQL**: Database for storing service data. |
| 29 | +- **Spring Security**: Securing the microservices. |
| 30 | +- **Spring Boot**: Framework for creating production-ready applications. |
| 31 | +- **Zipkin**: Distributed tracing system for monitoring and troubleshooting. |
| 32 | +- **Spring Cloud**: Tools for building cloud-native applications. |
| 33 | +- **Kafka**: Messaging system for building real-time data pipelines and streaming apps. |
| 34 | +- **Spring Data JPA**: Data access abstraction. |
| 35 | + |
| 36 | +## API Documentation |
| 37 | + |
| 38 | +### Customer Service API |
| 39 | + |
| 40 | +#### `POST /api/v1/customers` |
| 41 | +Creates a new customer. |
| 42 | + |
| 43 | +- **Request Body**: `CustomerRequest` |
| 44 | +- **Response**: `201 Created` with `CustomerResponse` |
| 45 | + |
| 46 | +#### `GET /api/v1/customers/{id}` |
| 47 | +Retrieves customer details by ID. |
| 48 | + |
| 49 | +- **Path Variable**: `id` (long) |
| 50 | +- **Response**: `200 OK` with `CustomerResponse` |
| 51 | + |
| 52 | +### Fraud Service API |
| 53 | + |
| 54 | +#### `GET /api/v1/fraud-check/{customerId}` |
| 55 | +Checks if a customer is fraudulent. |
| 56 | + |
| 57 | +- **Path Variable**: `customerId` (long) |
| 58 | +- **Response**: `200 OK` with `FraudCheckResponse` |
| 59 | + |
| 60 | +### Eureka Server |
| 61 | + |
| 62 | +The Eureka Server does not expose REST APIs for client interaction. It is used for service discovery within the microservices architecture. |
| 63 | + |
| 64 | +## How to Use |
| 65 | + |
| 66 | +1. **Clone the repository**: |
| 67 | + ```sh |
| 68 | + git clone https://github.com/ahmedrafat-SW/spring-microservices.git |
0 commit comments