# 0xamirreza/ocserv-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/0xamirreza/ocserv-dashboard
- Repository: https://github.com/0xamirreza/ocserv-dashboard

## Overview

Ocserv Dashboard is a web-based control panel and customer-insights product for an OpenConnect VPN server. Administrators enter through the dashboard to manage VPN users and groups, monitor server activity, review reports, configure system services, and administer Telegram features; customers can view account usage. The repository also contains separate bot, live-log, expiry, and webhook services. The sampled frontend establishes app startup and route dispatch, while README capabilities describe several unsampled service boundaries; those links are marked unverified rather than presented as inspected calls.

Main entry points: [`services/api/internal/providers/routing/routes.go`](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/providers/routing/routes.go) (API routing), [`web/src/main.ts`](https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/main.ts) (Dashboard app), [`services/common/ocserv`](https://github.com/0xamirreza/ocserv-dashboard/tree/main/services/common/ocserv) (Ocserv operations), [`web/src/router/MainRoutes.ts`](https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/router/MainRoutes.ts) (Dashboard routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web dashboard"]
  node_frontend["Dashboard app<br/>[main.ts]"]
  node_routes["Dashboard routes<br/>[MainRoutes.ts]"]
  node_views["Dashboard features"]
  node_api_clients["API clients"]
end

subgraph group_api["Management API"]
  node_api_routes["API routing<br/>[routes.go]"]
  node_system_api["System and auth<br/>[controller.go]"]
  node_user_api["VPN user management<br/>[controller.go]"]
  node_group_api["VPN group management<br/>[controller.go]"]
  node_customer_api["Customer insights<br/>[controller.go]"]
  node_home_api["Dashboard monitoring<br/>[controller.go]"]
  node_reports["Reports and statistics<br/>[controller.go]"]
  node_telegram_api["Telegram administration<br/>[controller.go]"]
  node_backup["Backup and restore<br/>[controller.go]"]
end

subgraph group_vpn["VPN operations"]
  node_vpn_common["Ocserv operations"]
  node_occtl["Occtl commands<br/>[occtl.go]"]
end

subgraph group_integrations["Bot and integrations"]
  node_bot["Telegram bot<br/>[hub.go]"]
  node_bot_repo["Bot repository<br/>[repository.go]"]
  node_log_stream["Live log stream<br/>[service.go]"]
  node_log_stats["Usage statistics<br/>[service.go]"]
  node_expiry["User expiry service<br/>[service.go]"]
  node_webhook["Occtl webhook<br/>[webhook.go]"]
end

subgraph group_shared["Shared services"]
  node_database[("Application database<br/>[database.go]")]
end

node_admin(("Administrator"))
node_customer(("Customer"))

node_admin -->|"opens"| node_frontend
node_customer -->|"views usage"| node_frontend
node_frontend -->|"starts router"| node_routes
node_routes -->|"dispatches"| node_views
node_frontend -.->|"uses API"| node_api_clients
node_api_clients -.->|"requests"| node_api_routes
node_api_routes -.->|"routes to"| node_system_api
node_api_routes -.->|"routes to"| node_user_api
node_api_routes -.->|"routes to"| node_group_api
node_api_routes -.->|"routes to"| node_customer_api
node_api_routes -.->|"routes to"| node_home_api
node_api_routes -.->|"routes to"| node_reports
node_api_routes -.->|"routes to"| node_telegram_api
node_api_routes -.->|"routes to"| node_backup
node_user_api -.->|"manages users"| node_vpn_common
node_group_api -.->|"manages groups"| node_vpn_common
node_occtl -.->|"operates server"| node_vpn_common
node_bot -.->|"uses repository"| node_bot_repo

click node_frontend "https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/main.ts"
click node_routes "https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/router/MainRoutes.ts"
click node_views "https://github.com/0xamirreza/ocserv-dashboard/tree/main/web/src/views"
click node_api_clients "https://github.com/0xamirreza/ocserv-dashboard/tree/main/web/src/api"
click node_api_routes "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/providers/routing/routes.go"
click node_system_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/system/controller.go"
click node_user_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/ocserv_user/controller.go"
click node_group_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/ocserv_group/controller.go"
click node_customer_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/customer/controller.go"
click node_home_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/home/controller.go"
click node_reports "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/report/controller.go"
click node_telegram_api "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/telegram/controller.go"
click node_backup "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/backup/controller.go"
click node_vpn_common "https://github.com/0xamirreza/ocserv-dashboard/tree/main/services/common/ocserv"
click node_occtl "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/ocserv/occtl/occtl.go"
click node_database "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/pkg/database/database.go"
click node_bot "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/telegram_bot/internal/bot/handlers/hub.go"
click node_bot_repo "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/telegram_bot/internal/repository/repository.go"
click node_log_stream "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/log_stream/internal/sse/service.go"
click node_log_stats "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/log_stream/internal/stats/service.go"
click node_expiry "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/user_expiry/internal/service/service.go"
click node_webhook "https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/occtl_docker/webhook.go"

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_frontend,node_routes,node_views,node_api_clients toneBlue
class node_api_routes,node_system_api,node_user_api,node_group_api,node_customer_api,node_home_api,node_reports,node_telegram_api,node_backup toneAmber
class node_vpn_common,node_occtl toneMint
class node_bot,node_bot_repo,node_log_stream,node_log_stats,node_expiry,node_webhook toneRose
class node_database,node_admin,node_customer toneIndigo
```

## Components

### Web dashboard

- [Dashboard app](https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/main.ts): `web/src/main.ts`
- [Dashboard routes](https://github.com/0xamirreza/ocserv-dashboard/blob/main/web/src/router/MainRoutes.ts): `web/src/router/MainRoutes.ts`
- [Dashboard features](https://github.com/0xamirreza/ocserv-dashboard/tree/main/web/src/views): `web/src/views`
- [API clients](https://github.com/0xamirreza/ocserv-dashboard/tree/main/web/src/api): `web/src/api`

### Management API

- [API routing](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/providers/routing/routes.go): `services/api/internal/providers/routing/routes.go`
- [System and auth](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/system/controller.go): `services/api/internal/services/system/controller.go`
- [VPN user management](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/ocserv_user/controller.go): `services/api/internal/services/ocserv_user/controller.go`
- [VPN group management](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/ocserv_group/controller.go): `services/api/internal/services/ocserv_group/controller.go`
- [Customer insights](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/customer/controller.go): `services/api/internal/services/customer/controller.go`
- [Dashboard monitoring](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/home/controller.go): `services/api/internal/services/home/controller.go`
- [Reports and statistics](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/report/controller.go): `services/api/internal/services/report/controller.go`
- [Telegram administration](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/telegram/controller.go): `services/api/internal/services/telegram/controller.go`
- [Backup and restore](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/api/internal/services/backup/controller.go): `services/api/internal/services/backup/controller.go`

### VPN operations

- [Ocserv operations](https://github.com/0xamirreza/ocserv-dashboard/tree/main/services/common/ocserv): `services/common/ocserv`
- [Occtl commands](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/ocserv/occtl/occtl.go): `services/common/ocserv/occtl/occtl.go`

### Bot and integrations

- [Telegram bot](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/telegram_bot/internal/bot/handlers/hub.go): `services/telegram_bot/internal/bot/handlers/hub.go`
- [Bot repository](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/telegram_bot/internal/repository/repository.go): `services/telegram_bot/internal/repository/repository.go`
- [Live log stream](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/log_stream/internal/sse/service.go): `services/log_stream/internal/sse/service.go`
- [Usage statistics](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/log_stream/internal/stats/service.go): `services/log_stream/internal/stats/service.go`
- [User expiry service](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/user_expiry/internal/service/service.go): `services/user_expiry/internal/service/service.go`
- [Occtl webhook](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/occtl_docker/webhook.go): `services/common/occtl_docker/webhook.go`

### Shared services

- [Application database](https://github.com/0xamirreza/ocserv-dashboard/blob/main/services/common/pkg/database/database.go): `services/common/pkg/database/database.go`

### Other components

- **Administrator**
- **Customer**

## Connections

- Administrator → Dashboard app: opens (evidence: `README.md`)
- Customer → Dashboard app: views usage (evidence: `README.md`)
- Dashboard app → Dashboard routes: starts router (evidence: `web/src/main.ts`)
- Dashboard routes → Dashboard features: dispatches (evidence: `web/src/router/MainRoutes.ts`)
- Dashboard app → API clients: uses API
- API clients → API routing: requests
- API routing → System and auth: routes to
- API routing → VPN user management: routes to
- API routing → VPN group management: routes to
- API routing → Customer insights: routes to
- API routing → Dashboard monitoring: routes to
- API routing → Reports and statistics: routes to
- API routing → Telegram administration: routes to
- API routing → Backup and restore: routes to
- VPN user management → Ocserv operations: manages users
- VPN group management → Ocserv operations: manages groups
- Occtl commands → Ocserv operations: operates server
- Telegram bot → Bot repository: uses repository
