# apache/apisix-dashboard architecture

> Architecture diagram of the GitHub repository apache/apisix-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apache/apisix-dashboard
- Repository: https://github.com/apache/apisix-dashboard

## Overview

1. Manager API (backend) – Located in the "api" directory. This component is written in Go and provides the REST APIs. It is responsible for parameter validation, configuration changes (including writing to etcd), and for interacting with Apache APISIX. Its structure (with subdirectories like internal/core, handler, filter, storage, etc.) suggests a modular design with clearly separated concerns, similar to standard MVC or layered architecture models.

2. Frontend Dashboard (web) – Found under the "web" directory. This part is the user interface implemented using modern web technologies (React with TypeScript, as evident from the file types and structure). It includes various UI components, pages, and integration tests (using Cypress, Jest), which indicate a dynamic, component-based architecture. It communicates with the backend APIs to drive the dashboard functions.

A. Main Components:
- Frontend (Dashboard UI):
- Represented by the "web" directory.
- Contains pages (Consumer, Route, SSL, etc.), components (ActionBar, HeaderDropdown, Plugin UI, etc.), and helper utilities.
- Includes extensive testing (e.g., Cypress tests under web/cypress) which you might include as ancillary details.
- Manager API (Backend):
- Represented by the "api" directory.
- Contains modules for configuration (conf), routing (handler), core logic (internal/core), server functionalities, filters (authentication, CORS, etc.), persistence/storage (etcd interactions), and testing.
- This component validates inputs from the frontend and interacts with etcd.
- Data Store (etcd):
- Although not part of the repository, it is a critical external dependency that stores the current configuration for Apache APISIX.
- Apache APISIX (Data Plane):
- The backend ultimately manipulates Apache APISIX resources. It can be shown as the target system that receives configuration updates.
- CI/CD & Deployment:
- Elements such as Dockerfile, GitHub Actions workflows, Makefile, and other build/deployment scripts as supporting infrastructure.
- Supporting Elements:
- External integrations such as APISIX Ingress Controller (not directly represented but can be annotated) and testing frameworks.

B. Relationships and Interactions:
- Where applicable, add connections showing data validation and routing logic inside the API (for instance, from various “handler” modules to “core” and “storage” components).

C. Architectural Patterns and Design Principles:
- Separation of concerns between the API and web UI.
- Modularity within the API (modules for authentication, routing, plugins, storage, etc.) and the careful use of REST APIs to facilitate clean separation.
- The use of configuration files (e.g., YAML files for GitHub workflows and API configurations in “conf”) can be noted as part of infrastructure as code principles.
- Demonstrate how testing is incorporated (with unit tests and end-to-end tests) by noting test directories in both API and web parts.

- For a full-stack application like this, represent the backend and frontend as separate but communicating components.
- Rectangles for both frontend and backend.
- UI → Manager API (HTTP/REST)
- Manager API → etcd (configuration storage)
- etcd → Apache APISIX (configuration applied)

E. Diagramming Guidelines:
1. Top-level components: Frontend (web) and Manager API (api).
2. External systems: etcd and Apache APISIX.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend: User Interface (React/TypeScript)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["Manager API: Request Validation & Configuration Management (Go)"]:::backend
        API_Handler["Handler Module"]:::backend
        API_Filter["Filter Module"]:::backend
        API_Core["Core Logic"]:::backend
        API_Storage["Storage Module"]:::backend
        API -->|"routes_to"| API_Handler
        API -->|"applies_filters"| API_Filter
        API -->|"executes"| API_Core
        API_Core -->|"stores_config"| API_Storage
    end

    %% External Systems
    ETCD["etcd: Configuration Data Store"]:::external
    APISIX["Apache APISIX: Data Plane"]:::external

    %% CI/CD & Deployment
    CICD["CI/CD & Deployment"]:::cicd

    %% Relationships between major components
    FE -->|"HTTP/REST"| API
    API -->|"updates_config"| ETCD
    ETCD -->|"applies_config"| APISIX
    CICD -->|"automated_deployments"| API

    %% Click Events
    click FE "https://github.com/apache/apisix-dashboard/tree/master/web/"
    click API "https://github.com/apache/apisix-dashboard/tree/master/api/"
    click API_Storage "https://github.com/apache/apisix-dashboard/blob/master/api/internal/core/storage/etcd.go"
    click CICD "https://github.com/apache/apisix-dashboard/tree/master/.github/"

    %% Styles
    classDef frontend fill:#f7c6c7,stroke:#b40000,stroke-width:2px;
    classDef backend fill:#c7d3ff,stroke:#0033cc,stroke-width:2px;
    classDef external fill:#d5f5e3,stroke:#2e7d32,stroke-width:2px;
    classDef cicd fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
