# shokirjonmk/firesec-uz architecture

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

- Interactive diagram: https://gitdiagram.com/shokirjonmk/firesec-uz
- Repository: https://github.com/shokirjonmk/firesec-uz

## Overview

Firesec is a centralized IT and security management platform: operators manage infrastructure through the web console or fsctl, while gateway agents enforce firewall policy and collectors ingest gateway and external syslog. The console also provides authentication, licensing, audit, and operational services. The graph emphasizes those documented product stages and the sampled log pipeline. Some subsystem connections are documented only at product level; those edges cite the README rather than implying unsampled implementation details were inspected.

Main entry points: [`console/core/api/api.go`](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/api/api.go) (REST API), [`console/cmd/firesec-console/main.go`](https://github.com/shokirjonmk/firesec-uz/blob/main/console/cmd/firesec-console/main.go) (Console runtime), [`console/core/logstore/searchservice.go`](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/logstore/searchservice.go) (Log search), [`gateway/compile/compile.go`](https://github.com/shokirjonmk/firesec-uz/blob/main/gateway/compile/compile.go) (Policy compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operator_ui["Operator interfaces"]
  node_web_console["Web console<br/>[routes.tsx]"]
  node_firewall_ui["Firewall screens<br/>[RulesScreen.tsx]"]
  node_ui_api["UI API client<br/>[client.ts]"]
  node_fsctl["fsctl CLI<br/>[root.go]"]
end

subgraph group_console_services["Console services"]
  node_console_app["Console runtime<br/>[main.go]"]
  node_console_api["REST API<br/>[api.go]"]
  node_identity["Identity services<br/>[service.go]"]
  node_license["License service<br/>[service.go]"]
  node_logs_search["Log search<br/>[searchservice.go]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_gateway_enforcement["Gateway enforcement"]
  node_gateway_agent["Gateway agent<br/>[main.go]"]
  node_policy_compiler["Policy compiler<br/>[compile.go]"]
  node_nftables["nftables"]
end

subgraph group_telemetry["Log telemetry"]
  node_clickhouse[("ClickHouse")]
  node_collector["Syslog collector<br/>[main.go]"]
  node_log_pipeline["Ingest pipeline<br/>[pipeline.go]"]
  node_log_sink["ClickHouse sink<br/>[chsink.go]"]
  node_disk_spool["Disk spool<br/>[spool.go]"]
end

subgraph group_shared_domain["Shared domain"]
  node_policy_model["Policy model<br/>[model.go]"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_web_console
node_operator -->|"uses"| node_fsctl
node_web_console -->|"routes to"| node_firewall_ui
node_firewall_ui -.->|"requests"| node_ui_api
node_ui_api -.->|"calls"| node_console_api
node_fsctl -->|"manages through"| node_console_api
node_console_app -->|"configures"| node_console_api
node_console_app -->|"initializes"| node_identity
node_console_app -->|"initializes"| node_license
node_console_api -->|"serves license requests"| node_license
node_console_api -.->|"serves log search"| node_logs_search
node_logs_search -->|"queries"| node_clickhouse
node_logs_search -->|"resolves rule links"| node_postgres
node_gateway_agent -->|"compiles policy"| node_policy_compiler
node_policy_compiler -->|"compiles"| node_policy_model
node_policy_compiler -->|"generates rules for"| node_nftables
node_console_api -.->|"controls remotely"| node_gateway_agent
node_collector -->|"starts"| node_log_pipeline
node_log_pipeline -->|"writes batches"| node_log_sink
node_log_pipeline -->|"buffers overflow"| node_disk_spool
node_log_sink -.->|"stores logs"| node_clickhouse

click node_web_console "https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/routes.tsx"
click node_firewall_ui "https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/firewall/RulesScreen.tsx"
click node_ui_api "https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/api/client.ts"
click node_fsctl "https://github.com/shokirjonmk/firesec-uz/blob/main/cli/internal/cmd/root.go"
click node_console_app "https://github.com/shokirjonmk/firesec-uz/blob/main/console/cmd/firesec-console/main.go"
click node_console_api "https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/api/api.go"
click node_identity "https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/auth/service.go"
click node_license "https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/lls/service.go"
click node_logs_search "https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/logstore/searchservice.go"
click node_gateway_agent "https://github.com/shokirjonmk/firesec-uz/blob/main/gateway/cmd/gwagent/main.go"
click node_policy_compiler "https://github.com/shokirjonmk/firesec-uz/blob/main/gateway/compile/compile.go"
click node_collector "https://github.com/shokirjonmk/firesec-uz/blob/main/collector/cmd/firesec-collector/main.go"
click node_log_pipeline "https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/pipeline/pipeline.go"
click node_log_sink "https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/chsink/chsink.go"
click node_disk_spool "https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/spool/spool.go"
click node_policy_model "https://github.com/shokirjonmk/firesec-uz/blob/main/pkg/policy/model.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_web_console,node_firewall_ui,node_ui_api,node_fsctl toneBlue
class node_console_app,node_console_api,node_identity,node_license,node_logs_search,node_postgres toneAmber
class node_gateway_agent,node_policy_compiler,node_nftables toneMint
class node_clickhouse,node_collector,node_log_pipeline,node_log_sink,node_disk_spool toneRose
class node_policy_model,node_operator toneIndigo
```

## Components

### Operator interfaces

- [Web console](https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/routes.tsx): `ui/src/routes.tsx`
- [Firewall screens](https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/firewall/RulesScreen.tsx): `ui/src/firewall/RulesScreen.tsx`
- [UI API client](https://github.com/shokirjonmk/firesec-uz/blob/main/ui/src/api/client.ts): `ui/src/api/client.ts`
- [fsctl CLI](https://github.com/shokirjonmk/firesec-uz/blob/main/cli/internal/cmd/root.go): `cli/internal/cmd/root.go`

### Console services

- [Console runtime](https://github.com/shokirjonmk/firesec-uz/blob/main/console/cmd/firesec-console/main.go): `console/cmd/firesec-console/main.go`
- [REST API](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/api/api.go): `console/core/api/api.go`
- [Identity services](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/auth/service.go): `console/core/auth/service.go`
- [License service](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/lls/service.go): `console/core/lls/service.go`
- [Log search](https://github.com/shokirjonmk/firesec-uz/blob/main/console/core/logstore/searchservice.go): `console/core/logstore/searchservice.go`
- **PostgreSQL**

### Gateway enforcement

- [Gateway agent](https://github.com/shokirjonmk/firesec-uz/blob/main/gateway/cmd/gwagent/main.go): `gateway/cmd/gwagent/main.go`
- [Policy compiler](https://github.com/shokirjonmk/firesec-uz/blob/main/gateway/compile/compile.go): `gateway/compile/compile.go`
- **nftables**

### Log telemetry

- **ClickHouse**
- [Syslog collector](https://github.com/shokirjonmk/firesec-uz/blob/main/collector/cmd/firesec-collector/main.go): `collector/cmd/firesec-collector/main.go`
- [Ingest pipeline](https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/pipeline/pipeline.go): `collector/internal/pipeline/pipeline.go`
- [ClickHouse sink](https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/chsink/chsink.go): `collector/internal/chsink/chsink.go`
- [Disk spool](https://github.com/shokirjonmk/firesec-uz/blob/main/collector/internal/spool/spool.go): `collector/internal/spool/spool.go`

### Shared domain

- [Policy model](https://github.com/shokirjonmk/firesec-uz/blob/main/pkg/policy/model.go): `pkg/policy/model.go`

### Other components

- **Operator**

## Connections

- Operator → Web console: uses (evidence: `README.md`)
- Operator → fsctl CLI: uses (evidence: `README.md`)
- Web console → Firewall screens: routes to (evidence: `ui/src/routes.tsx`)
- Firewall screens → UI API client: requests
- UI API client → REST API: calls
- fsctl CLI → REST API: manages through (evidence: `README.md`)
- Console runtime → REST API: configures (evidence: `console/cmd/firesec-console/main.go`)
- Console runtime → Identity services: initializes (evidence: `console/cmd/firesec-console/main.go`)
- Console runtime → License service: initializes (evidence: `console/cmd/firesec-console/main.go`)
- REST API → License service: serves license requests
- REST API → Log search: serves log search
- Log search → ClickHouse: queries (evidence: `console/core/logstore/searchservice.go`)
- Log search → PostgreSQL: resolves rule links (evidence: `console/core/logstore/searchservice.go`)
- Gateway agent → Policy compiler: compiles policy (evidence: `gateway/cmd/gwagent/main.go`)
- Policy compiler → Policy model: compiles (evidence: `README.md`)
- Policy compiler → nftables: generates rules for (evidence: `README.md`)
- REST API → Gateway agent: controls remotely
- Syslog collector → Ingest pipeline: starts (evidence: `collector/cmd/firesec-collector/main.go`)
- Ingest pipeline → ClickHouse sink: writes batches (evidence: `collector/internal/pipeline/pipeline.go`)
- Ingest pipeline → Disk spool: buffers overflow (evidence: `collector/internal/pipeline/pipeline.go`)
- ClickHouse sink → ClickHouse: stores logs
