Skip to content

Instantly share code, notes, and snippets.

@aungkyawminn
Created October 15, 2025 08:14
Show Gist options
  • Save aungkyawminn/33dee9765e28bfafc30474a21fa22dc6 to your computer and use it in GitHub Desktop.
Save aungkyawminn/33dee9765e28bfafc30474a21fa22dc6 to your computer and use it in GitHub Desktop.

🧩 WSO2 API Manager β€” Overview for Developers

WSO2 API Manager (APIM) is an open-source API management platform.
It helps organizations design, publish, secure, monitor, and manage APIs easily β€” whether for internal microservices or public developer portals.


🌍 What is API Management?

When multiple services or systems expose data through APIs, we need to:

  • Control who can access what
  • Protect against unauthorized or heavy usage
  • Track analytics and usage
  • Support developer onboarding (documentation, keys, testing)
  • Enable governance and versioning

That’s where WSO2 API Manager comes in.


🧱 Core Components

1. Publisher Portal

Where API developers and architects create, design, and publish APIs.
Used for:

  • Defining endpoints (REST/SOAP/GraphQL)
  • Adding documentation, tags, and categories
  • Versioning and promoting APIs to production

2. Developer Portal (Dev Portal / Store)

Where API consumers (developers, partners, teams) discover and subscribe to APIs.
They can:

  • Explore API documentation
  • Generate access tokens
  • Test APIs directly from the portal

3. Gateway (API Gateway)

The runtime component that actually receives and routes API calls.
It enforces:

  • Security policies (OAuth2, JWT, Mutual TLS, API Key)
  • Rate limiting / throttling
  • Logging, transformation, and mediation

4. Key Manager

Handles authentication and token issuance.
Integrated with WSO2 Identity Server, it manages:

  • OAuth2 / OpenID Connect tokens
  • API keys and JWT signing
  • User/role-based access

5. Traffic Manager

Responsible for rate limiting and quotas.
Helps apply policies like:

  • β€œMax 100 requests per minute per user”
  • β€œFree vs. Premium subscription levels”

6. Analytics (Optional)

Collects logs and metrics:

  • API usage per consumer
  • Response time & error rates
  • Dashboards for performance and adoption

🧭 Basic Architecture

flowchart LR
  subgraph DevOps["Developer (Publisher)"]
    PUBLISHER[Publisher Portal]
  end

  subgraph User["API Consumer (Developer)"]
    DEVPORTAL[Developer Portal]
  end

  subgraph Runtime["Runtime Layer"]
    GW[API Gateway]
    KM[Key Manager]
    TM[Traffic Manager]
  end

  subgraph Storage["Data Stores"]
    REGISTRY[(API Metadata)]
    ANALYTICS[(Logs & Metrics)]
  end

  PUBLISHER --> REGISTRY
  REGISTRY --> GW
  DEVPORTAL --> GW
  GW --> KM
  GW --> TM
  GW --> ANALYTICS
Loading

🧩 Flow:

  1. API Developer designs API in Publisher
  2. Metadata is stored in Registry/Database
  3. Gateway serves requests
  4. Key Manager issues tokens & validates credentials
  5. Traffic Manager enforces rate limits
  6. Logs sent to Analytics

🚦 API Lifecycle

graph LR
  A[Create] --> B[Publish]
  B --> C[Deprecate]
  C --> D[Retire]
  B --> E[Re-Publish (New Version)]
Loading
  • Create: API defined and documented
  • Publish: API becomes visible in Dev Portal
  • Deprecate: Old version still accessible but discouraged
  • Retire: API removed from public access

βš™οΈ Typical Deployment Modes

graph TD
  A[All-in-One] -->|"Single Node"| B[Development/Testing]
  C[Distributed Deployment] -->|"Separate Gateway, KeyManager, Publisher, DevPortal"| D[Production Scale]
  E[Hybrid Deployment] -->|"Control Plane + Data Plane"| F[Multi-Cloud / Regional]
Loading

Common Modes:

  • All-in-One: Easy for testing; everything runs on one server.
  • Distributed: Each component runs separately for scalability.
  • Hybrid (Control Plane & Data Plane): Central management with regional or cloud-specific gateways.

πŸ—οΈ Hybrid Deployment β€” Control Plane vs Data Plane

In large organizations or multi-cloud setups, WSO2 APIM supports hybrid deployment.
This separates management (control) from execution (data) for better scalability and security.

flowchart TB
  subgraph CP["Control Plane (Management Layer)"]
    PUB[Publisher Portal]
    DEV[Developer Portal]
    KM[Key Manager]
    TM[Traffic Manager]
  end

  subgraph DP1["Data Plane - Region A"]
    GW1[API Gateway A]
    ANA1[Analytics Node A]
  end

  subgraph DP2["Data Plane - Region B"]
    GW2[API Gateway B]
    ANA2[Analytics Node B]
  end

  PUB --> KM
  DEV --> KM
  KM --> TM
  CP -->|API Deployment| DP1
  CP -->|API Deployment| DP2
  GW1 --> KM
  GW2 --> KM
  GW1 --> ANA1
  GW2 --> ANA2
Loading

🧩 How it works

  • Control Plane manages:
    • API design, publishing, key management, throttling, and analytics setup
    • Central governance and configuration
  • Data Plane(s) handle:
    • Actual API traffic (runtime gateway)
    • Regional or cloud-local deployments close to users
  • Communication between planes is secured (token-based or mTLS)

🌐 Typical Use Case

  • Control Plane in Head Office / Cloud HQ
  • Multiple Data Planes in regional data centers (e.g., Singapore, Myanmar, EU)
  • Each Data Plane processes API calls locally β†’ low latency, high resilience

βœ… Advantages

  • Scalability β€” Add new regions easily
  • Security β€” Keep customer data within region
  • Reliability β€” Failures in one plane don’t affect others
  • Governance β€” Central control, decentralized execution

πŸ” Security Overview

WSO2 supports multiple authentication methods:

  • OAuth2 / OpenID Connect
  • API Keys
  • Mutual TLS (mTLS)
  • JWT validation
  • External IDPs (Keycloak, Azure AD, etc.)

Policies and access control can be applied per API, per application, or per user role.


🧰 Example Use Case

Scenario:
A bank wants to expose its internal payment APIs securely to partner fintechs.

  1. API team publishes /v1/payments in Publisher
  2. Partners register apps in Dev Portal and get tokens
  3. Partners call the API via Gateway
  4. Key Manager validates tokens
  5. Traffic Manager enforces rate limits
  6. Analytics shows API usage dashboard

πŸͺ„ Summary Table

Component Role Typical User
Publisher Create & manage APIs API Developer / Architect
Dev Portal Discover & subscribe External/Internal Dev
Gateway Secure & route traffic System / Runtime
Key Manager Issue tokens, auth Security / IAM
Traffic Manager Throttling, quotas Ops / Infra
Analytics Insights & reports Product Owner / Ops

πŸ“˜ Quick Facts

  • Developed by WSO2 (Open Source)
  • Built on Java with Carbon framework
  • Supports REST, SOAP, GraphQL, WebSocket APIs
  • Integrates easily with Kubernetes, Docker, and CI/CD
  • Latest stable version: WSO2 API Manager 4.x

πŸ’‘ Tips for Beginners

  • Use All-in-One for local testing (docker-compose is available)
  • Always configure HTTPS and tokens before going public
  • Use Publisher β†’ Dev Portal β†’ Gateway mental model
  • Check logs under /repository/logs/ when debugging

🧠 In short:
WSO2 API Manager = β€œControl who, how, and how much can call your APIs β€” safely and visibly.”


References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment