How ikeem12/prueba_microservicio works
Project type and purpose
• This is a two-microservice backend system (Service-Order and Service-Product), each implemented in Python.
• Each service exposes a REST API (resources), encapsulates business logic (services), persists data (repository), and validates input (schema).
• They are designed to be deployed independently (Dockerfile in service-product, shared pattern in service-order).
File structure
Top-level:
• service-order/
– main.py (entry point)
– config.py (configuration)
– requirements.txt
– app/… (layered code)
• service-product/ (same pattern plus Dockerfile)
Inside each app/:
– resources/ (Flask/RESTful resources or controllers)
– services/ (business-rule implementations)
– repository/ (data access classes)
– interfaces/ (abstract interfaces for services + repositories)
– models/ (ORM or domain models)
– schema/ (Pydantic schemas for validation, only in service-order)
– utils/exceptions/extensions/logger (cross-cutting concerns)
This strongly suggests a layered (hexagonal) architecture with clear adapter boundaries.
README
• No content provided; our analysis relies on conventions and file organization.
a. Main components
– API Gateway (optional, for routing external clients)
– Service-Order microservice
· Order API (resources)
· Order Service (business logic)
· Order Repository (DB adapter)
· Order Database
– Service-Product microservice
· Product API
· Product Service
· Product Repository
· Product Database
– (Optional) Authentication service, Messaging broker, Monitoring/Logging
b. Relationships and interactions
– External client → API Gateway → Service-Order API
– Service-Order → Order Service → Order Repository → Order Database
– Service-Order may perform HTTP calls to Service-Product API when it needs product details
– Service-Product has analogous internal flow
– (Optional) Async events: new-order → message broker → other consumers
c. Architectural patterns & design principles
– Layered / Hexagonal architecture: Separation of API, business, persistence, and domain model
– Use of interfaces/abstractions to decouple implementation and enable easy mocking/testing
– Pydantic schemas for input validation and clear error handling
– Single Responsibility: each class/folder has a focused concern
d. Technologies & frameworks
– Python 3.x
– Flask (or Flask-RESTful) for resources
– SQLAlchemy or similar ORM in repository layer
– Pydantic for schema validation (service-order)
– Docker for containerization (at least in service-product)
– Logging via custom logger in each service
– requirements.txt for dependency management