Convert Figma logo to code with AI

apache logoapisix

The Cloud-Native API Gateway

14,434
2,509
14,434
486

Top Related Projects

39,056

🦍 The Cloud-Native API Gateway and AI Gateway.

24,693

Cloud-native high-performance edge/middle/service proxy

50,858

The Cloud Native Application Proxy

24,812

The official NGINX Open Source repository.

35,857

Connect, secure, control, and observe services.

23,924

An open source trusted cloud native registry project that stores, signs, and scans content.

Quick Overview

Apache APISIX is a dynamic, real-time, high-performance API gateway that provides rich traffic management features and a plugin system to extend its functionality. It is designed to be used as the Kubernetes Ingress controller, as well as a standalone API gateway/microservices proxy.

Pros

  • High Performance: Apache APISIX is built on top of NGINX and OpenResty, providing high-performance and low-latency API gateway capabilities.
  • Flexible Plugin System: APISIX has a powerful plugin system that allows users to easily customize and extend its functionality.
  • Dynamic Configuration: APISIX supports dynamic configuration updates without the need to restart the service, making it easy to manage and update.
  • Scalable and Reliable: APISIX is designed to be highly scalable and reliable, with features like load balancing, circuit breaking, and fault tolerance.

Cons

  • Steep Learning Curve: The plugin system and configuration management in APISIX can have a steep learning curve for new users.
  • Limited Documentation: While the documentation is improving, some users may find it lacking in certain areas, especially for advanced use cases.
  • Dependency on OpenResty: APISIX is heavily dependent on OpenResty, which may be a concern for users who prefer to use a more traditional NGINX setup.
  • Limited Community Support: Compared to some other API gateways, the APISIX community may be smaller, which could impact the availability of resources and support.

Code Examples

Here are a few code examples demonstrating the usage of Apache APISIX:

Creating a Route

-- Create a new route
curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "uri": "/hello",
  "upstream": {
    "type": "roundrobin",
    "nodes": {
      "127.0.0.1:1980": 1
    }
  }
}'

This example creates a new route in APISIX that forwards requests to the /hello endpoint to an upstream service running on 127.0.0.1:1980.

Enabling the Rate Limiting Plugin

-- Enable the rate limiting plugin
curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "uri": "/hello",
  "plugins": {
    "rate-limiting": {
      "count": 2,
      "time_window": 60,
      "rejected_code": 429
    }
  },
  "upstream": {
    "type": "roundrobin",
    "nodes": {
      "127.0.0.1:1980": 1
    }
  }
}'

This example enables the rate limiting plugin on the /hello route, limiting the number of requests to 2 per minute.

Configuring the Prometheus Plugin

-- Enable the Prometheus plugin
curl http://127.0.0.1:9080/apisix/admin/routes/1 \
  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
{
  "uri": "/metrics",
  "plugins": {
    "prometheus": {}
  }
}'

This example enables the Prometheus plugin on the /metrics route, allowing you to collect and expose APISIX metrics.

Getting Started

To get started with Apache APISIX, follow these steps:

  1. Install Docker and Docker Compose on your system.
  2. Clone the APISIX repository:
    git clone https://github.com/apache/apisix.git
    
  3. Navigate to the apisix directory and start the APISIX service using Docker Compose:
    cd apisix
    docker-compose
    

Competitor Comparisons

39,056

🦍 The Cloud-Native API Gateway and AI Gateway.

Pros of Kong

  • More mature and established project with a larger community and ecosystem
  • Offers a wider range of plugins and integrations out-of-the-box
  • Provides a user-friendly GUI for easier management and configuration

Cons of Kong

  • Higher resource consumption, especially in large-scale deployments
  • More complex setup and configuration process
  • Steeper learning curve for beginners

Code Comparison

Kong (Lua):

local kong = kong
local request_uri = ngx.var.request_uri

if string.match(request_uri, "^/api/") then
    kong.service.request.set_path("/v1" .. request_uri)
end

APISIX (Lua):

local core = require("apisix.core")
local ctx = ngx.ctx

if string.match(ctx.var.uri, "^/api/") then
    ctx.var.upstream_uri = "/v1" .. ctx.var.uri
end

Both examples show how to rewrite the request path, but APISIX's approach is more concise and uses its core module for better performance and integration with the framework.

While Kong and APISIX are both powerful API gateways, Kong offers a more comprehensive feature set and ecosystem support, whereas APISIX provides better performance and flexibility for customization. The choice between them depends on specific project requirements and scalability needs.

24,693

Cloud-native high-performance edge/middle/service proxy

Pros of Envoy

  • More extensive feature set and broader ecosystem
  • Higher performance and scalability for large-scale deployments
  • Strong support for modern microservices architectures

Cons of Envoy

  • Steeper learning curve and more complex configuration
  • Heavier resource footprint, potentially overkill for smaller projects
  • Less focus on API management specific features

Code Comparison

APISIX configuration example:

routes:
  -
    uri: "/hello"
    upstream:
      type: roundrobin
      nodes:
        "127.0.0.1:1980": 1

Envoy configuration example:

static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 8080
    filter_chains:
    - filters:
      - name: envoy.filters.network.http_connection_manager
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          stat_prefix: ingress_http
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match:
                  prefix: "/"
                route:
                  cluster: some_service

Both APISIX and Envoy are powerful API gateways and proxies, but they cater to different use cases. APISIX is more focused on API management and easier to set up, while Envoy offers more advanced features and better performance at scale, albeit with increased complexity.

50,858

The Cloud Native Application Proxy

Pros of Traefik

  • Easier setup and configuration with automatic service discovery
  • Native support for Docker and other container orchestration platforms
  • More extensive built-in middleware options for common use cases

Cons of Traefik

  • Less flexible for complex custom configurations compared to APISIX
  • Limited plugin ecosystem and extensibility options
  • May have higher resource usage in certain scenarios

Code Comparison

APISIX route configuration:

local route = {
    uri = "/hello",
    upstream = {
        type = "roundrobin",
        nodes = {
            ["127.0.0.1:80"] = 1
        }
    }
}

Traefik route configuration:

http:
  routers:
    my-router:
      rule: "Path(`/hello`)"
      service: my-service
  services:
    my-service:
      loadBalancer:
        servers:
          - url: "http://127.0.0.1:80"

Both APISIX and Traefik are powerful API gateways and reverse proxies, but they cater to different use cases and preferences. APISIX offers more flexibility and extensibility, while Traefik provides easier setup and integration with container environments. The choice between them depends on specific project requirements and infrastructure setup.

24,812

The official NGINX Open Source repository.

Pros of NGINX

  • Mature and battle-tested web server with extensive documentation
  • Excellent performance and low resource usage
  • Wide adoption and large ecosystem of modules

Cons of NGINX

  • Less flexible for API gateway use cases
  • Limited built-in features for microservices architectures
  • Steeper learning curve for advanced configurations

Code Comparison

NGINX configuration:

http {
    server {
        listen 80;
        location / {
            proxy_pass http://backend;
        }
    }
}

APISIX configuration:

routes:
  - uri: /*
    upstream:
      type: roundrobin
      nodes:
        "backend:80": 1

Summary

NGINX is a robust web server and reverse proxy, excelling in performance and stability. APISIX, built on top of NGINX, focuses on API gateway functionality with additional features for microservices. APISIX offers a more user-friendly configuration syntax and built-in plugins for API management, while NGINX provides a broader range of general-purpose web server capabilities. The choice between them depends on specific use cases, with APISIX being more suitable for API-centric architectures and NGINX for general web serving and reverse proxy needs.

35,857

Connect, secure, control, and observe services.

Pros of Istio

  • More comprehensive service mesh solution with advanced traffic management, security, and observability features
  • Better suited for complex microservices architectures and multi-cluster deployments
  • Stronger integration with Kubernetes and cloud-native ecosystems

Cons of Istio

  • Steeper learning curve and more complex setup compared to APISIX
  • Higher resource consumption and potential performance overhead
  • Less flexibility for non-Kubernetes environments

Code Comparison

APISIX route configuration:

local _M = {
    version = 0.1,
    priority = 0,
    name = "example-plugin",
    schema = {
        type = "object",
        properties = {
            key = {type = "string"}
        }
    }
}

Istio virtual service configuration:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: reviews-route
spec:
  hosts:
  - reviews.prod.svc.cluster.local
  http:
  - route:
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v2

Both APISIX and Istio provide powerful routing capabilities, but Istio's configuration is more Kubernetes-native and offers more advanced traffic management features. APISIX's configuration is more lightweight and flexible, making it easier to use in various environments.

23,924

An open source trusted cloud native registry project that stores, signs, and scans content.

Pros of Harbor

  • Comprehensive container registry solution with built-in security scanning
  • Supports multi-tenancy and role-based access control
  • Provides replication and distribution features for global deployments

Cons of Harbor

  • More complex setup and maintenance compared to APISIX
  • Focused specifically on container registry, less versatile for general API management
  • Heavier resource requirements due to its comprehensive feature set

Code Comparison

Harbor (Go):

func (ra *RepositoryAPI) Delete() {
    repoName := ra.GetString(":repo")
    if len(repoName) == 0 {
        ra.SendBadRequestError(errors.New("repo name is empty"))
        return
    }
}

APISIX (Lua):

function _M.rewrite(conf, ctx)
    local uri = ctx.var.uri
    local upstream_uri = core.request.get_header(ctx, "X-Forwarded-Prefix") or ""
    ctx.var.upstream_uri = upstream_uri .. uri
end

Harbor focuses on container registry management with Go, while APISIX is a lightweight API gateway written in Lua. Harbor offers more built-in features for container management, security, and access control, but APISIX provides greater flexibility for general API routing and management. APISIX is easier to set up and maintain, making it more suitable for smaller deployments or those primarily focused on API gateway functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Apache APISIX API Gateway

APISIX logo

Build Status License Commit activity Average time to resolve an issue Percentage of issues still open Slack

Apache APISIX is a dynamic, real-time, high-performance API Gateway.

APISIX API Gateway provides rich traffic management features such as load balancing, dynamic upstream, canary release, circuit breaking, authentication, observability, and more.

You can use APISIX API Gateway to handle traditional north-south traffic, as well as east-west traffic between services. It can also be used as a k8s ingress controller.

The technical architecture of Apache APISIX:

Technical architecture of Apache APISIX

Community

Features

You can use APISIX API Gateway as a traffic entrance to process all business data, including dynamic routing, dynamic upstream, dynamic certificates, A/B testing, canary release, blue-green deployment, limit rate, defense against malicious attacks, metrics, monitoring alarms, service observability, service governance, etc.

  • All platforms

    • Cloud-Native: Platform agnostic, No vendor lock-in, APISIX API Gateway can run from bare-metal to Kubernetes.
    • Supports ARM64: Don't worry about the lock-in of the infra technology.
  • Multi protocols

  • Full Dynamic

    • Hot Updates And Hot Plugins: Continuously updates its configurations and plugins without restarts!
    • Proxy Rewrite: Support rewrite the host, uri, schema, method, headers of the request before send to upstream.
    • Response Rewrite: Set customized response status code, body and header to the client.
    • Dynamic Load Balancing: Round-robin load balancing with weight.
    • Hash-based Load Balancing: Load balance with consistent hashing sessions.
    • Health Checks: Enable health check on the upstream node and will automatically filter unhealthy nodes during load balancing to ensure system stability.
    • Circuit-Breaker: Intelligent tracking of unhealthy upstream services.
    • Proxy Mirror: Provides the ability to mirror client requests.
    • Traffic Split: Allows users to incrementally direct percentages of traffic between various upstreams.
  • Fine-grained routing

  • Security

  • OPS friendly

    • Zipkin tracing: Zipkin
    • Open source APM: support Apache SkyWalking
    • Works with external service discovery: In addition to the built-in etcd, it also supports Consul, Consul_kv, Nacos, Eureka and Zookeeper (CP).
    • Monitoring And Metrics: Prometheus
    • Clustering: APISIX nodes are stateless, creates clustering of the configuration center, please refer to etcd Clustering Guide.
    • High availability: Support to configure multiple etcd addresses in the same cluster.
    • Dashboard
    • Version Control: Supports rollbacks of operations.
    • CLI: start\stop\reload APISIX through the command line.
    • Standalone: Supports to load route rules from local YAML file, it is more friendly such as under the kubernetes(k8s).
    • Global Rule: Allows to run any plugin for all request, eg: limit rate, IP filter etc.
    • High performance: The single-core QPS reaches 18k with an average delay of fewer than 0.2 milliseconds.
    • Fault Injection
    • REST Admin API: Using the REST Admin API to control Apache APISIX, which only allows 127.0.0.1 access by default, you can modify the allow_admin field in conf/config.yaml to specify a list of IPs that are allowed to call the Admin API. Also, note that the Admin API uses key auth to verify the identity of the caller.
    • External Loggers: Export access logs to external log management tools. (HTTP Logger, TCP Logger, Kafka Logger, UDP Logger, RocketMQ Logger, SkyWalking Logger, Alibaba Cloud Logging(SLS), Google Cloud Logging, Splunk HEC Logging, File Logger, SolarWinds Loggly Logging, TencentCloud CLS).
    • ClickHouse: push logs to ClickHouse.
    • Elasticsearch: push logs to Elasticsearch.
    • Datadog: push custom metrics to the DogStatsD server, comes bundled with Datadog agent, over the UDP protocol. DogStatsD basically is an implementation of StatsD protocol which collects the custom metrics for Apache APISIX agent, aggregates it into a single data point and sends it to the configured Datadog server.
    • Helm charts
    • HashiCorp Vault: Support secret management solution for accessing secrets from Vault secure storage backed in a low trust environment. Currently, RS256 keys (public-private key pairs) or secret keys can be linked from vault in jwt-auth authentication plugin using APISIX Secret resource.
  • Highly scalable

  • Multi-Language support

    • Apache APISIX is a multi-language gateway for plugin development and provides support via RPC and Wasm. Multi Language Support into Apache APISIX
    • The RPC way, is the current way. Developers can choose the language according to their needs and after starting an independent process with the RPC, it exchanges data with APISIX through local RPC communication. Till this moment, APISIX has support for Java, Golang, Python and Node.js.
    • The Wasm or WebAssembly, is an experimental way. APISIX can load and run Wasm bytecode via APISIX wasm plugin written with the Proxy Wasm SDK. Developers only need to write the code according to the SDK and then compile it into a Wasm bytecode that runs on Wasm VM with APISIX.
  • Serverless

    • Lua functions: Invoke functions in each phase in APISIX.
    • AWS Lambda: Integration with AWS Lambda function as a dynamic upstream to proxy all requests for a particular URI to the AWS API gateway endpoint. Supports authorization via api key and AWS IAM access secret.
    • Azure Functions: Seamless integration with Azure Serverless Function as a dynamic upstream to proxy all requests for a particular URI to the Microsoft Azure cloud.
    • Apache OpenWhisk: Seamless integration with Apache OpenWhisk as a dynamic upstream to proxy all requests for a particular URI to your own OpenWhisk cluster.

Get Started

  1. Installation

    Please refer to install documentation.

  2. Getting started

    The getting started guide is a great way to learn the basics of APISIX. Just follow the steps in Getting Started.

    Further, you can follow the documentation to try more plugins.

  3. Admin API

    Apache APISIX provides REST Admin API to dynamically control the Apache APISIX cluster.

  4. Plugin development

    You can refer to plugin development guide, and sample plugin example-plugin's code implementation. Reading plugin concept would help you learn more about the plugin.

For more documents, please refer to Apache APISIX Documentation site

Benchmark

Using AWS's eight-core server, APISIX's QPS reaches 140,000 with a latency of only 0.2 ms.

Benchmark script has been open sourced, welcome to try and contribute.

APISIX also works perfectly in AWS graviton3 C7g.

User Stories

Who Uses APISIX API Gateway?

A wide variety of companies and organizations use APISIX API Gateway for research, production and commercial product, below are some of them:

  • Airwallex
  • Bilibili
  • CVTE
  • European eFactory Platform
  • European Copernicus Reference System
  • Geely
  • HONOR
  • Horizon Robotics
  • iQIYI
  • Lenovo
  • NASA JPL
  • Nayuki
  • OPPO
  • QingCloud
  • Swisscom
  • Tencent Game
  • Travelsky
  • vivo
  • Sina Weibo
  • WeCity
  • WPS
  • XPENG
  • Zoom

Logos

Acknowledgments

Inspired by Kong and Orange.

License

Apache 2.0 License