How leandro12rk/sistemadegestiondeinventario works
1. Repository shape
- This is a multi-module Maven monorepo for a Spring Boot microservices system.
- Top-level modules in the tree are: eureka-server, gateway-service, product-service, inventory-service, and purchase-service.
- A docker/ folder provides database bootstrap SQL and a Compose setup, so the runtime architecture includes both application services and dedicated PostgreSQL instances.
2. Overall request path
- The expected entry point for external clients is the Gateway Service.
- From there, requests are routed to the domain services rather than calling them directly.
- Service-to-service lookup is handled through Eureka discovery, so the services are designed to find each other dynamically.
3. Service discovery boundary
- eureka-server is the registry for the microservices.
- Each business service is a separate Spring Boot application and likely registers itself with Eureka at startup.
- This is the main infrastructure boundary that decouples routing from fixed host/port addresses.
4. Gateway boundary
- gateway-service is the single ingress layer.
- It sits between clients and the internal services, which is the primary edge boundary in the system.
- No domain logic is present here in the tree; its role is infrastructure routing.
5. Product service: master data and catalog
- product-service is the most feature-rich service and appears to be the source of truth for catalog/master data.
- It contains separate controller/service/repository layers for:
- product
- category
- supplier
- It also includes DTOs, projections, and centralized exception handling, which suggests this service exposes both CRUD-style APIs and read-optimized query endpoints.
6. Product service internal layering
- The package structure is classic Spring layered architecture:
- controller for HTTP APIs
- service for business rules
- repository for persistence
- model for JPA entities
- dto and projection for API/view shaping
- exception for consistent error responses
- This makes product-service the main domain boundary for master records.
7. Inventory service: stock and movement tracking
- inventory-service focuses on inventory state and auditability.
- Its controllers are split by use case:
- inventory
- stockMovements
- goodsReceipts
- The presence of StockMovementsModel and GoodReceiptsModel indicates the service stores both current stock and the events that affect it.
8. Inventory service dependency on Product service
- inventory-service includes a client/product/ProductClient.java, which indicates a Feign-style remote call dependency on the product service.
- It also has a ProductDTO, so inventory operations likely enrich or validate stock data against product metadata.
- This is a one-way dependency: inventory consumes product data, but product does not appear to depend on inventory.
9. Purchase service: procurement workflow
- purchase-service handles purchase orders and order details.
- Its controllers are split into:
- purchaseOrders
- purchaseOrderDetails
- The model/repository split follows the same pattern as the other services, suggesting purchase data is persisted and managed independently.
10. Purchase service dependencies
- purchase-service has Feign clients for both product and supplier.
- That means purchase flows likely resolve product and supplier information from external service APIs rather than duplicating those tables locally.
- This service is the main consumer of multiple master-data domains.
11. Persistence architecture
- The README and Docker files indicate a database-per-service approach.
- The Compose/SQL assets create separate PostgreSQL databases for:
- products
- inventory
- purchases
- This is an important architectural boundary: each service owns its own schema and lifecycle.
12. Technology and runtime
- The services are built with Java / Spring Boot, using Spring Data JPA for persistence.
- The README states Spring Cloud / OpenFeign / Eureka are part of the stack.
- The tree does not show a config server implementation, even though the README mentions one; in this repository snapshot, the concrete platform pieces present are Eureka, Gateway, and the business services.
13. Cross-service communication pattern
- The architecture is a mix of:
- synchronous HTTP calls between services via Feign clients
- registry-based service discovery via Eureka
- database isolation per service
- There is no evidence in the tree of messaging/queues or event streaming; the integration style appears primarily request/response.
14. Operational structure
- Every service has its own application.properties and test class, so each is independently runnable and testable.
- The repo is therefore organized for distributed deployment, but still manageable as a single source tree for development.
15. Diagramming summary
- A good architecture diagram should show:
- external clients entering through the gateway
- gateway routing through Eureka-discovered services
- product/inventory/purchase as separate bounded contexts
- Feign-based calls from inventory and purchase back to product and supplier data
- dedicated PostgreSQL databases per service under Docker
Main entry points: GatewayServiceApplication.java Gateway · purchase Purchase Core · ProductServiceApplication.java Product Service · EurekaServerApplication.java Eureka
Components 17
Runtime
Spring Boot services, gateway, and discovery registry.
- Gateway · Single ingress layer for client traffic.
gateway-service/src/main/java/io/github/leandro12rk/gateway/GatewayServiceApplication.java - Eureka · Service discovery registry used by the microservices.
eureka-server/src/main/java/io/github/leandro12rk/eureka_server/EurekaServerApplication.java - Product Service · Master data service for products, categories, and suppliers.
product-service/src/main/java/io/github/leandro12rk/product/ProductServiceApplication.java - Product APIs · HTTP endpoints for product, category, and supplier operations.
product-service/src/main/java/io/github/leandro12rk/product/controller - Product Core · Business logic, DTO shaping, projections, and exception handling.
product-service/src/main/java/io/github/leandro12rk/product/service - Product Data · JPA entities and repositories for product-domain storage.
product-service/src/main/java/io/github/leandro12rk/product/model - Inventory Service · Tracks inventory state, stock movements, and goods receipts.
inventory-service/src/main/java/io/github/leandro12rk/inventory/InventoryServiceApplication.java - Inventory APIs · Endpoints for inventory, stock movement, and goods receipt flows.
inventory-service/src/main/java/io/github/leandro12rk/inventory/controller - Inventory Core · Inventory models, repository-backed state, and product lookup client.
inventory-service/src/main/java/io/github/leandro12rk/inventory - Purchase Service · Manages purchase orders and order details.
purchase-service/src/main/java/io/github/leandro12rk/purchase/PurchaseServiceApplication.java - Purchase APIs · Endpoints for purchase orders and order details.
purchase-service/src/main/java/io/github/leandro12rk/purchase/controller - Purchase Core · Purchase models, repositories, and Feign clients to product and supplier services.
purchase-service/src/main/java/io/github/leandro12rk/purchase
Data
Database ownership and Docker bootstrap assets.
- Docker Assets · Compose and SQL bootstrap files for local infrastructure.
docker - Products DB · Dedicated PostgreSQL database for product-service.
docker/product_init.sql - Inventory DB · Dedicated PostgreSQL database for inventory-service.
docker/inventory_init.sql - Purchases DB · Dedicated PostgreSQL database for purchase-service.
docker/purchase_init.sql
Other components
- Clients · External consumers of the system.
Connections 25
- Clients → Gateway: HTTP requests · All external traffic enters through the gateway.
- Gateway → Eureka: discover services · Gateway relies on registry-based service discovery.
- Gateway → Product Service: route · Gateway forwards catalog requests to product-service.
- Gateway → Inventory Service: route · Gateway forwards inventory requests to inventory-service.
- Gateway → Purchase Service: route · Gateway forwards procurement requests to purchase-service.
- Product Service → Eureka: register · Product service participates in discovery.
- Inventory Service → Eureka: register · Inventory service participates in discovery.
- Purchase Service → Eureka: register · Purchase service participates in discovery.
- Product Service → Product APIs: exposes · Product service exposes its REST controllers.
- Product APIs → Product Core: delegates · Controllers delegate to business services and query shaping.
- Product Core → Product Data: persists via · Domain logic uses repositories and entities.
- Inventory Service → Inventory APIs: exposes · Inventory service exposes its REST controllers.
- Inventory APIs → Inventory Core: delegates · Controllers delegate to inventory logic and persistence.
- Inventory Core → Product Service: lookup · Inventory enriches or validates against product data.
- Purchase Service → Purchase APIs: exposes · Purchase service exposes its REST controllers.
- Purchase APIs → Purchase Core: delegates · Controllers delegate to purchase logic and persistence.
- Purchase Core → Product Service: lookup · Purchase flows resolve product data remotely.
- Purchase Core → Gateway: via discovery · Remote calls are supported by the shared discovery layer.
- Purchase Core → Eureka: discover services · Feign clients depend on registry-backed service resolution.
- Inventory Core → Inventory DB: stores in · Inventory state is kept in its own database.
- Product Data → Products DB: stores in · Product data is kept in its own database.
- Purchase Core → Purchases DB: stores in · Purchase data is kept in its own database.
- Docker Assets → Products DB: bootstraps · Docker assets provision the product database.
- Docker Assets → Inventory DB: bootstraps · Docker assets provision the inventory database.
- Docker Assets → Purchases DB: bootstraps · Docker assets provision the purchase database.