How nithack/insurance-service-api works
Project Type and Purpose
• This is a microservice that belongs to a larger insurance and client management ecosystem.
• Its main role is to manage insurance operations (creation, listing, simulation, contracting, and deletion) while interconnecting with an external “Cliente Service API” for client verification and to retrieve the CPF.
• The microservice is built using Spring Boot, integrates with a PostgreSQL database via Spring Data JPA, and uses Feign Client for RESTful calls to the external client service.
Analyzing the File Structure
• Top-Level Files/Directories: You have typical Maven files (pom.xml, mvnw scripts), Docker configuration (Dockerfile, docker-compose.yml), and the source code under src/main.
• Package Organization: The code is organized into several layers:
• Application Layer (under application, dto, exception, mapper, port, services): Implementing business logic, data transfer objects, exception handling, and adapters.
• Domain Layer (under domain/entity and domain/enums): Housing core business models and enums (e.g., InsuranceStatus).
• Infrastructure Layer (under infra): Splitting into database (models, repositories, services), HTTP (controller, configuration, documentation), and Feign integration (client, config, service). This separation highlights a clean architecture or hexagonal architecture pattern.
• Tests: Files under src/test validate both unit and integration aspects of the service.
• Configuration Files: The application.yml and environment variables in the README show that the microservice connects to a PostgreSQL database and a distinct external service.
Final Advice
• Be detailed in capturing all key interactions, especially the integration with the external Cliente Service API.
• Avoid oversimplification—capture as many interaction paths and dependencies as possible, including error-handling flows depicted in the GlobalExceptionHandler.