How membrane/api-gateway works
Membrane is an API gateway: a client request enters the gateway, configuration determines its processing, and routing forwards it to a backend. The README also documents OpenAPI deployment and validation, SOAP/WSDL integration, security, transformation, orchestration, traffic control, AI/MCP, and observability. The excerpts show router initialization, exchange representation, servlet request/response handling, and OAuth2 and ACME integrations; many feature links below are documented capabilities rather than inspected call paths.
Main entry points: Proxy.java Proxy and routing · DefaultRouter.java Gateway router · HttpServletHandler.java Servlet ingress · HttpClient.java HTTP client
Components 18
Gateway runtime
- Servlet ingress
war/src/main/java/com/predic8/membrane/servlet/embedded/HttpServletHandler.java - HTTP exchange
core/src/main/java/com/predic8/membrane/core/exchange/Exchange.java - Gateway router
core/src/main/java/com/predic8/membrane/core/router/DefaultRouter.java - Proxy and routing
core/src/main/java/com/predic8/membrane/core/proxies/Proxy.java - HTTP client
core/src/main/java/com/predic8/membrane/core/transport/http/HttpClient.java
Configuration
- YAML configuration
annot/src/main/java/com/predic8/membrane/annot/yaml/YamlLoader.java - Config annotations
annot/src/main/java/com/predic8/membrane/annot/MCElement.java
API capabilities
- OpenAPI support
core/src/main/java/com/predic8/membrane/core/openapi/validators/QueryParameterValidator.java - SOAP and WSDL
core/src/main/java/com/predic8/membrane/core/util/wsdl/parser/Service.java - Message transforms
core/src/main/java/com/predic8/membrane/core/lang/groovy/adapted/StreamingTemplateEngine.java - GraphQL protection
core/src/main/java/com/predic8/membrane/core/graphql/GraphQLProtectionInterceptor.java - AI and MCP
core/src/main/java/com/predic8/membrane/core/interceptor/mcp/McpSessionManager.java
Security
- OAuth2 authorization
core/src/main/java/com/predic8/membrane/core/interceptor/oauth2/authorizationservice/AuthorizationService.java - TLS certificates
core/src/main/java/com/predic8/membrane/core/config/security/acme/Acme.java
Traffic and operations
- Traffic control
core/src/main/java/com/predic8/membrane/core/interceptor/FlowController.java - Traffic storage
core/src/main/java/com/predic8/membrane/core/exchangestore/ExchangeStore.java
Other components
- API client
- API backend
Connections 18
- API client → Servlet ingress: sends request
- Servlet ingress → HTTP exchange: creates exchange
war/src/main/java/com/predic8/membrane/servlet/embedded/HttpServletHandler.java - Servlet ingress → Gateway router: dispatches request
- Gateway router → Proxy and routing: routes traffic
core/src/main/java/com/predic8/membrane/core/router/DefaultRouter.java - Proxy and routing → HTTP client: forwards request
- HTTP client → API backend: sends request
- API backend → API client: returns response
- YAML configuration → Gateway router: configures gateway
README.md - Config annotations → YAML configuration: describes settings
annot/src/main/java/com/predic8/membrane/annot/MCElement.java - Gateway router → OpenAPI support: deploys and validates
README.md - Proxy and routing → SOAP and WSDL: integrates services
README.md - Proxy and routing → Message transforms: transforms messages
README.md - Proxy and routing → GraphQL protection: protects requests
README.md - Proxy and routing → OAuth2 authorization: secures APIs
README.md - Gateway router → TLS certificates: secures transport
README.md - Gateway router → AI and MCP: provides AI gateway
README.md - Proxy and routing → Traffic control: controls traffic
README.md - Gateway router → Traffic storage: observes exchanges
README.md