How msrsiddik/apicorex works
ApiCoreX is a stateless, multi-tenant HTTP API gateway whose main workflow is client request → device-token resolution through Identity → trusted tenant-context injection and authorization → protected streaming proxy to a registered plugin. Its separate control plane registers plugins and pulls manifests; additional capabilities include merged OpenAPI docs, an operator dashboard, tenant-domain routing, and observability/resilience. The graph uses README statements and shown source references for relationships; unsampled implementation details are represented only where the tree supports a subsystem path.
Main entry points: http.go HTTP server · handlers.go Registration handlers · dispatcher.go Route and proxy · auth.go Token authentication
Components 20
Gateway data plane
- HTTP server
server/http.go - Tenant domain routing
server/domain_resolve.go - Product host routing
server/product_host.go - Token authentication
internal/middleware/auth.go - Route authorization
internal/middleware - Route and proxy
internal/dispatcher/dispatcher.go - Resilience controls
internal/protection
Plugin control plane
- Plugin registry
internal/registry/registry.go - Registration handlers
internal/controlplane/handlers.go - Plugin manifest
internal/manifest/manifest.go
Operations and docs
- OpenAPI merger
internal/openapi/injector.go - Admin dashboard UI
cmd/apicorex/admin/app/page.tsx - Dashboard serving
cmd/apicorex/dashboard.go
Runtime services
- Metrics and health
internal/protection/metrics.go - Distributed tracing
internal/tracing/tracing.go - On-demand TLS gate
server/ondemand.go - Runtime configuration
internal/config/config.go
Other components
- API client
- Identity service
- HTTP plugin
Connections 23
- API client → HTTP server: sends requests
- HTTP server → Token authentication: applies auth
server/http.go - Token authentication → Identity service: introspects tokens
- Token authentication → Route authorization: provides identity
- HTTP server → Tenant domain routing: resolves domains
server/http.go - Tenant domain routing → Identity service: resolves domain
server/domain_resolve.go - HTTP server → Product host routing: rewrites host paths
- HTTP server → Route and proxy: routes requests
server/http.go - Route and proxy → HTTP plugin: streams requests
- Route and proxy → Resilience controls: enforces limits
internal/dispatcher/dispatcher.go - Registration handlers → Plugin registry: registers plugins
internal/controlplane/handlers.go - Registration handlers → Route and proxy: adds routes
internal/controlplane/handlers.go - Registration handlers → OpenAPI merger: updates specs
internal/controlplane/handlers.go - Registration handlers → HTTP plugin: pulls manifest
internal/controlplane/handlers.go - HTTP plugin → Registration handlers: registers and heartbeats
- Plugin registry → Plugin manifest: stores manifest
internal/registry/registry.go - HTTP server → OpenAPI merger: serves merged docs
server/http.go - HTTP server → Dashboard serving: serves dashboard
server/http.go - Admin dashboard UI → Registration handlers: uses admin endpoints
- HTTP server → Metrics and health: exposes metrics
server/http.go - Route and proxy → Distributed tracing: starts proxy spans
internal/dispatcher/dispatcher.go - On-demand TLS gate → Identity service: checks host claims
server/ondemand.go - Runtime configuration → Resilience controls: configures limits