Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nelsoncg98/InnovaTech/llms.txt

Use this file to discover all available pages before exploring further.

The API Gateway is the single entry point for all client traffic in the InnovaTech SOA platform. Every request from the React frontends — whether for catalog browsing, inventory queries, or point-of-sale transactions — arrives here first. The gateway matches the request path against a set of configured routes and forwards it to the appropriate downstream microservice, decoupling clients from individual service addresses and centralizing cross-cutting concerns like CORS policy enforcement.

Overview

The gateway is built on Spring Cloud Gateway (Spring Cloud 2023.0.1), which uses a fully reactive, non-blocking I/O model powered by Project Reactor and Netty. This makes it well-suited as a perimeter router that can handle high concurrency without dedicating a thread per connection. It runs on port 8080 — the fixed address that all frontend applications are configured to call. Spring Boot Actuator is included to expose operational endpoints so that infrastructure tooling can verify the gateway’s health and collect metadata without requiring access to application logs.

Port

8080 — all frontend and client traffic targets this port

Spring Cloud Version

2023.0.1 — uses Spring Cloud Gateway (reactive)

Java Version

Java 17 with Spring Boot 3.2.4

Routing Model

Non-blocking, predicate-based path routing

Route Configuration

The gateway defines three named routes in application.yml. Each route maps a URL path prefix to a specific downstream service. Requests are forwarded verbatim — the path is not rewritten.
Route IDPath PredicateUpstream URI
ruta-catalogo/api/v1/catalogo/**http://localhost:8084
ruta-orquestador-pos/api/v1/ventas-pos/**http://localhost:8082
ruta-inventario/api/v1/inventario/**http://localhost:8081
The full application.yml for the gateway is:
server:
  port: 8080 # El Frontend siempre apuntara aqui

spring:
  application:
    name: api-gateway
  cloud:
    gateway:
      globalcors:
        cors-configurations:
          '[/**]':
            allowedOrigins: "*"
            allowedMethods:
              - GET
              - POST
              - PUT
              - DELETE
            allowedHeaders: "*"
      routes:
        # Ruta para el servicio de Luis
        - id: ruta-catalogo
          uri: http://localhost:8084
          predicates:
            - Path=/api/v1/catalogo/**

        # Ruta para nuestro Orquestador
        - id: ruta-orquestador-pos
          uri: http://localhost:8082
          predicates:
            - Path=/api/v1/ventas-pos/**

        # Ruta para nuestro Inventario
        - id: ruta-inventario
          uri: http://localhost:8081
          predicates:
            - Path=/api/v1/inventario/**

management:
  endpoints:
    web:
      exposure:
        include: health, info

CORS Policy

A global CORS configuration is applied to every route ([/**]). This ensures that browser-based clients running on any origin can make cross-origin requests to the gateway without being blocked by the browser’s same-origin policy.
SettingValueDescription
allowedOrigins*Accepts requests from any origin
allowedMethodsGET, POST, PUT, DELETEStandard CRUD HTTP verbs
allowedHeaders*Allows all request headers, including Authorization and Content-Type
In production, allowedOrigins: "*" should be replaced with an explicit allowlist of known frontend domains (e.g., https://app.innovatech.com). A wildcard origin prevents browsers from sending cookies or Authorization headers with credentialed requests and exposes the API to cross-site request abuse.

Health & Monitoring

Spring Boot Actuator is configured to expose two management endpoints over HTTP. These can be called by load balancers, container orchestrators, or CI pipelines to verify service availability.
EndpointMethodDescription
/actuator/healthGETReturns {"status":"UP"} when the gateway is running normally
/actuator/infoGETReturns application metadata defined in management.info.*
Example health check:
curl http://localhost:8080/actuator/health
# {"status":"UP"}

Configuration Reference

The following table lists every configuration property in application.yml along with its value and purpose.
PropertyValuePurpose
server.port8080Listening port for all inbound traffic
spring.application.nameapi-gatewayService name used in logs and Actuator info
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedOrigins*CORS: permitted request origins
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedMethodsGET, POST, PUT, DELETECORS: permitted HTTP methods
spring.cloud.gateway.globalcors.cors-configurations.[/**].allowedHeaders*CORS: permitted request headers
routes[0].idruta-catalogoRoute identifier for catalog service
routes[0].urihttp://localhost:8084Catalog service upstream address
routes[0].predicates[0]Path=/api/v1/catalogo/**Path predicate for catalog route
routes[1].idruta-orquestador-posRoute identifier for POS orchestrator
routes[1].urihttp://localhost:8082POS service upstream address
routes[1].predicates[0]Path=/api/v1/ventas-pos/**Path predicate for POS route
routes[2].idruta-inventarioRoute identifier for inventory service
routes[2].urihttp://localhost:8081Inventory service upstream address
routes[2].predicates[0]Path=/api/v1/inventario/**Path predicate for inventory route
management.endpoints.web.exposure.includehealth, infoActuator endpoints exposed over HTTP

Build docs developers (and LLMs) love