# looplj/axonhub architecture

> Architecture diagram of the GitHub repository looplj/axonhub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/looplj/axonhub
- Repository: https://github.com/looplj/axonhub

## Overview

AxonHub is an AI gateway and administration platform. A client sends a compatible AI request to the server; the gateway translates it for a configured model provider, routes across channels with retry/failover, and returns the result. The repository also includes a web console for authentication, channel/model configuration, access control, analytics, and storage settings. The sampled pipeline and routing code support the runtime shape, while several server integrations and frontend features are represented by documented capabilities or directory-level paths; those links are marked unverified where their implementation was not shown.

Main entry points: [`frontend/src/main.tsx`](https://github.com/looplj/axonhub/blob/unstable/frontend/src/main.tsx) (Admin Web App), [`internal/server/gql`](https://github.com/looplj/axonhub/tree/unstable/internal/server/gql) (GraphQL API), [`llm/pipeline/pipeline.go`](https://github.com/looplj/axonhub/blob/unstable/llm/pipeline/pipeline.go) (Request Pipeline), [`internal/server/routes.go`](https://github.com/looplj/axonhub/blob/unstable/internal/server/routes.go) (HTTP Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gateway["AI Gateway"]
  node_routes["HTTP Routes<br/>[routes.go]"]
  node_api["API Handlers"]
  node_pipeline["Request Pipeline<br/>[pipeline.go]"]
  node_transform["Protocol Transformers"]
  node_httpclient["Provider HTTP Client<br/>[client.go]"]
  node_channels["Provider Channels"]
end

subgraph group_admin["Management Console"]
  node_web["Admin Web App<br/>[main.tsx]"]
  node_authui["Sign-in And Setup"]
  node_channelui["Channel Management"]
  node_modelui["Model Catalog"]
  node_keyui["API Key Management"]
  node_analyticsui["Analytics Dashboard"]
  node_chatui["Chat Playground"]
  node_graphql["GraphQL API"]
  node_storageui["Storage Settings"]
  node_systemui["System Settings"]
end

subgraph group_access["Identity And Access"]
  node_auth["Authentication"]
  node_rbac["RBAC And Quotas"]
end

subgraph group_state["Persistence And Operations"]
  node_storagebiz["Storage Service<br/>[data_storage.go]"]
  node_storageentity["Storage Entity<br/>[data_storage.go]"]
  node_database[("SQL Database")]
  node_video["Video Storage Worker<br/>[worker.go]"]
end

node_client(("SDK Client"))
node_provider{{"Model Providers"}}

node_client -->|"sends requests"| node_routes
node_routes -->|"routes requests"| node_api
node_api -.->|"processes requests"| node_pipeline
node_pipeline -->|"transforms protocols"| node_transform
node_pipeline -->|"executes requests"| node_httpclient
node_httpclient -.->|"calls provider"| node_provider
node_pipeline -.->|"retries channels"| node_channels
node_routes -->|"protects routes"| node_auth
node_auth -.->|"checks permissions"| node_rbac
node_client -->|"administers platform"| node_web
node_web -.->|"offers sign-in"| node_authui
node_web -.->|"configures channels"| node_channelui
node_web -.->|"manages models"| node_modelui
node_web -.->|"manages keys"| node_keyui
node_web -.->|"views analytics"| node_analyticsui
node_web -.->|"opens playground"| node_chatui
node_channelui -.->|"configures channels"| node_graphql
node_modelui -.->|"manages models"| node_graphql
node_keyui -.->|"manages keys"| node_graphql
node_analyticsui -.->|"queries analytics"| node_graphql
node_chatui -.->|"sends chat requests"| node_graphql
node_storageui -->|"reads and writes"| node_graphql
node_graphql -.->|"manages storage"| node_storagebiz
node_storagebiz -->|"queries and updates"| node_storageentity
node_storageentity -->|"persists records"| node_database
node_video -->|"uses storage service"| node_storagebiz
node_web -.->|"configures system"| node_systemui
node_systemui -.->|"updates settings"| node_graphql

click node_routes "https://github.com/looplj/axonhub/blob/unstable/internal/server/routes.go"
click node_api "https://github.com/looplj/axonhub/tree/unstable/internal/server/api"
click node_pipeline "https://github.com/looplj/axonhub/blob/unstable/llm/pipeline/pipeline.go"
click node_transform "https://github.com/looplj/axonhub/tree/unstable/llm/transformer"
click node_httpclient "https://github.com/looplj/axonhub/blob/unstable/llm/httpclient/client.go"
click node_channels "https://github.com/looplj/axonhub/tree/unstable/internal/server/biz"
click node_web "https://github.com/looplj/axonhub/blob/unstable/frontend/src/main.tsx"
click node_authui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/auth"
click node_channelui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/channels"
click node_modelui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/models"
click node_keyui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/apikeys"
click node_analyticsui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/analytics"
click node_chatui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/chats"
click node_auth "https://github.com/looplj/axonhub/tree/unstable/internal/server/biz"
click node_rbac "https://github.com/looplj/axonhub/tree/unstable/internal/authz"
click node_graphql "https://github.com/looplj/axonhub/tree/unstable/internal/server/gql"
click node_storageui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/data-storages"
click node_storagebiz "https://github.com/looplj/axonhub/blob/unstable/internal/server/biz/data_storage.go"
click node_storageentity "https://github.com/looplj/axonhub/blob/unstable/internal/ent/schema/data_storage.go"
click node_video "https://github.com/looplj/axonhub/blob/unstable/internal/server/video_storage/worker.go"
click node_systemui "https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/system"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_routes,node_api,node_pipeline,node_transform,node_httpclient,node_channels,node_client toneBlue
class node_web,node_authui,node_channelui,node_modelui,node_keyui,node_analyticsui,node_chatui,node_graphql,node_storageui,node_systemui toneAmber
class node_auth,node_rbac toneMint
class node_storagebiz,node_storageentity,node_database,node_video toneRose
class node_provider toneIndigo
```

## Components

### AI Gateway

- [HTTP Routes](https://github.com/looplj/axonhub/blob/unstable/internal/server/routes.go): `internal/server/routes.go`
- [API Handlers](https://github.com/looplj/axonhub/tree/unstable/internal/server/api): `internal/server/api`
- [Request Pipeline](https://github.com/looplj/axonhub/blob/unstable/llm/pipeline/pipeline.go): `llm/pipeline/pipeline.go`
- [Protocol Transformers](https://github.com/looplj/axonhub/tree/unstable/llm/transformer): `llm/transformer`
- [Provider HTTP Client](https://github.com/looplj/axonhub/blob/unstable/llm/httpclient/client.go): `llm/httpclient/client.go`
- [Provider Channels](https://github.com/looplj/axonhub/tree/unstable/internal/server/biz): `internal/server/biz`

### Management Console

- [Admin Web App](https://github.com/looplj/axonhub/blob/unstable/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Sign-in And Setup](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/auth): `frontend/src/features/auth`
- [Channel Management](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/channels): `frontend/src/features/channels`
- [Model Catalog](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/models): `frontend/src/features/models`
- [API Key Management](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/apikeys): `frontend/src/features/apikeys`
- [Analytics Dashboard](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/analytics): `frontend/src/features/analytics`
- [Chat Playground](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/chats): `frontend/src/features/chats`
- [GraphQL API](https://github.com/looplj/axonhub/tree/unstable/internal/server/gql): `internal/server/gql`
- [Storage Settings](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/data-storages): `frontend/src/features/data-storages`
- [System Settings](https://github.com/looplj/axonhub/tree/unstable/frontend/src/features/system): `frontend/src/features/system`

### Identity And Access

- [Authentication](https://github.com/looplj/axonhub/tree/unstable/internal/server/biz): `internal/server/biz`
- [RBAC And Quotas](https://github.com/looplj/axonhub/tree/unstable/internal/authz): `internal/authz`

### Persistence And Operations

- [Storage Service](https://github.com/looplj/axonhub/blob/unstable/internal/server/biz/data_storage.go): `internal/server/biz/data_storage.go`
- [Storage Entity](https://github.com/looplj/axonhub/blob/unstable/internal/ent/schema/data_storage.go): `internal/ent/schema/data_storage.go`
- **SQL Database**
- [Video Storage Worker](https://github.com/looplj/axonhub/blob/unstable/internal/server/video_storage/worker.go): `internal/server/video_storage/worker.go`

### Other components

- **SDK Client**
- **Model Providers**

## Connections

- SDK Client → HTTP Routes: sends requests (evidence: `README.md`)
- HTTP Routes → API Handlers: routes requests (evidence: `internal/server/routes.go`)
- API Handlers → Request Pipeline: processes requests
- Request Pipeline → Protocol Transformers: transforms protocols (evidence: `llm/pipeline/pipeline.go`)
- Request Pipeline → Provider HTTP Client: executes requests (evidence: `llm/pipeline/pipeline.go`)
- Provider HTTP Client → Model Providers: calls provider
- Request Pipeline → Provider Channels: retries channels
- HTTP Routes → Authentication: protects routes (evidence: `internal/server/routes.go`)
- Authentication → RBAC And Quotas: checks permissions (evidence: `internal/server/biz/data_storage_internal.go`)
- SDK Client → Admin Web App: administers platform (evidence: `README.md`)
- Admin Web App → Sign-in And Setup: offers sign-in
- Admin Web App → Channel Management: configures channels
- Admin Web App → Model Catalog: manages models
- Admin Web App → API Key Management: manages keys
- Admin Web App → Analytics Dashboard: views analytics
- Admin Web App → Chat Playground: opens playground
- Channel Management → GraphQL API: configures channels
- Model Catalog → GraphQL API: manages models
- API Key Management → GraphQL API: manages keys
- Analytics Dashboard → GraphQL API: queries analytics
- Chat Playground → GraphQL API: sends chat requests
- Storage Settings → GraphQL API: reads and writes (evidence: `frontend/src/features/data-storages/data/data-storages.ts`)
- GraphQL API → Storage Service: manages storage
- Storage Service → Storage Entity: queries and updates (evidence: `internal/server/biz/data_storage.go`)
- Storage Entity → SQL Database: persists records (evidence: `internal/ent/schema/data_storage.go`)
- Video Storage Worker → Storage Service: uses storage service (evidence: `internal/server/video_storage/worker.go`)
- Admin Web App → System Settings: configures system
- System Settings → GraphQL API: updates settings
