# linagora/crowdsieve architecture

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

- Interactive diagram: https://gitdiagram.com/linagora/crowdsieve
- Repository: https://github.com/linagora/crowdsieve

## Overview

CrowdSieve is a CrowdSec filtering proxy with a local dashboard. CrowdSec sends alerts to the proxy; it stores them locally, applies configured rules, and selectively forwards alerts to CAPI. The dashboard exposes local alerts, analytics, decisions, bouncer metrics, and analyzer controls; analyzers query Loki and can push bans to LAPI servers. The graph also shows the proxy’s database and validation layers. Some dashboard-to-proxy wiring and route internals are unsampled, so uncertain links are omitted or marked unverified.

Main entry points: [`src/proxy/server.ts`](https://github.com/linagora/crowdsieve/blob/master/src/proxy/server.ts) (Proxy server), [`src/analyzers/index.ts`](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/index.ts) (Analyzer scheduler), [`src/storage/index.ts`](https://github.com/linagora/crowdsieve/blob/master/src/storage/index.ts) (Alert and metrics storage), [`src/index.ts`](https://github.com/linagora/crowdsieve/blob/master/src/index.ts) (Application entry point)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_proxy["Proxy and filtering"]
  node_proxy_server["Proxy server<br/>[server.ts]"]
  node_signal_routes["Signal routes<br/>[signals.ts]"]
  node_api_routes["Proxy API routes<br/>[api.ts]"]
  node_metrics_routes["Usage metrics routes<br/>[usage-metrics.ts]"]
  node_filter_engine["Filter engine<br/>[expression.ts]"]
  node_config["Configuration<br/>[index.ts]"]
  node_validation["Client validation<br/>[index.ts]"]
end

subgraph group_analysis["Analysis and decisions"]
  node_analyzer_scheduler["Analyzer scheduler<br/>[index.ts]"]
  node_analyzer_rules["Analyzer rules<br/>[config.ts]"]
  node_loki["Loki source<br/>[loki.ts]"]
  node_detection["Detection engine<br/>[detection.ts]"]
  node_decision_pusher["Decision pusher<br/>[pusher.ts]"]
  node_replication["Decision replication<br/>[index.ts]"]
end

subgraph group_state["Persistence and enrichment"]
  node_alerts_store[("Alert and metrics storage<br/>[index.ts]")]
  node_database[("Database adapter<br/>[index.ts]")]
  node_geoip["GeoIP enrichment<br/>[index.ts]"]
end

subgraph group_dashboard["Dashboard and access"]
  node_dashboard_ui["Dashboard interface"]
  node_dashboard_api["Dashboard API"]
  node_dashboard_auth["Dashboard authentication"]
end

node_crowdsec(("CrowdSec LAPI clients"))
node_capi(("CrowdSec CAPI"))
node_lapi_servers(("CrowdSec LAPI servers"))
node_dashboard_user(("Dashboard user"))
node_oidc_provider(("OIDC provider"))
node_src_index["Application entry point<br/>[index.ts]"]

node_crowdsec -->|"sends requests"| node_proxy_server
node_proxy_server -->|"registers routes"| node_signal_routes
node_proxy_server -->|"registers routes"| node_api_routes
node_proxy_server -->|"registers routes"| node_metrics_routes
node_proxy_server -->|"uses filters"| node_filter_engine
node_proxy_server -->|"uses storage"| node_alerts_store
node_proxy_server -->|"uses validation"| node_validation
node_proxy_server -->|"uses replication"| node_replication
node_proxy_server -->|"uses config"| node_config
node_signal_routes -->|"forwards alerts"| node_capi
node_signal_routes -.->|"records alerts"| node_alerts_store
node_metrics_routes -.->|"records metrics"| node_alerts_store
node_alerts_store -->|"reads and writes"| node_database
node_alerts_store -->|"enriches IPs"| node_geoip
node_validation -->|"validates clients"| node_capi
node_src_index -->|"initializes database"| node_database
node_src_index -->|"starts server"| node_proxy_server
node_src_index -->|"starts analyzers"| node_analyzer_scheduler
node_src_index -->|"initializes GeoIP"| node_geoip
node_analyzer_scheduler -->|"loads rules"| node_analyzer_rules
node_analyzer_scheduler -->|"resolves source"| node_loki
node_analyzer_scheduler -->|"analyzes logs"| node_detection
node_analyzer_scheduler -->|"pushes decisions"| node_decision_pusher
node_loki -.->|"queries logs"| node_loki
node_decision_pusher -->|"pushes bans"| node_lapi_servers
node_signal_routes -.->|"replicates decisions"| node_replication
node_replication -->|"sends decisions"| node_lapi_servers
node_dashboard_user -->|"views dashboard"| node_dashboard_ui
node_dashboard_ui -.->|"requests data"| node_dashboard_api
node_dashboard_api -.->|"queries proxy"| node_proxy_server
node_dashboard_api -->|"queries decisions"| node_lapi_servers
node_dashboard_api -->|"sends manual bans"| node_lapi_servers
node_dashboard_user -->|"authenticates"| node_dashboard_auth
node_dashboard_auth -->|"uses OIDC"| node_oidc_provider

click node_proxy_server "https://github.com/linagora/crowdsieve/blob/master/src/proxy/server.ts"
click node_signal_routes "https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/signals.ts"
click node_api_routes "https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/api.ts"
click node_metrics_routes "https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/usage-metrics.ts"
click node_filter_engine "https://github.com/linagora/crowdsieve/blob/master/src/filters/implementations/expression.ts"
click node_config "https://github.com/linagora/crowdsieve/blob/master/src/config/index.ts"
click node_alerts_store "https://github.com/linagora/crowdsieve/blob/master/src/storage/index.ts"
click node_database "https://github.com/linagora/crowdsieve/blob/master/src/db/index.ts"
click node_validation "https://github.com/linagora/crowdsieve/blob/master/src/validation/index.ts"
click node_geoip "https://github.com/linagora/crowdsieve/blob/master/src/geoip/index.ts"
click node_analyzer_scheduler "https://github.com/linagora/crowdsieve/blob/master/src/analyzers/index.ts"
click node_analyzer_rules "https://github.com/linagora/crowdsieve/blob/master/src/analyzers/config.ts"
click node_loki "https://github.com/linagora/crowdsieve/blob/master/src/analyzers/sources/loki.ts"
click node_detection "https://github.com/linagora/crowdsieve/blob/master/src/analyzers/detection.ts"
click node_decision_pusher "https://github.com/linagora/crowdsieve/blob/master/src/analyzers/pusher.ts"
click node_replication "https://github.com/linagora/crowdsieve/blob/master/src/replication/index.ts"
click node_dashboard_ui "https://github.com/linagora/crowdsieve/tree/master/dashboard/components"
click node_dashboard_api "https://github.com/linagora/crowdsieve/tree/master/dashboard/app/api"
click node_dashboard_auth "https://github.com/linagora/crowdsieve/tree/master/dashboard/lib/oidc"
click node_src_index "https://github.com/linagora/crowdsieve/blob/master/src/index.ts"

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_proxy_server,node_signal_routes,node_api_routes,node_metrics_routes,node_filter_engine,node_config,node_validation,node_crowdsec,node_dashboard_user toneBlue
class node_analyzer_scheduler,node_analyzer_rules,node_loki,node_detection,node_decision_pusher,node_replication toneAmber
class node_alerts_store,node_database,node_geoip,node_capi,node_lapi_servers toneMint
class node_dashboard_ui,node_dashboard_api,node_dashboard_auth toneRose
class node_oidc_provider toneIndigo
class node_src_index toneTeal
```

## Components

### Proxy and filtering

- [Proxy server](https://github.com/linagora/crowdsieve/blob/master/src/proxy/server.ts): `src/proxy/server.ts`
- [Signal routes](https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/signals.ts): `src/proxy/routes/signals.ts`
- [Proxy API routes](https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/api.ts): `src/proxy/routes/api.ts`
- [Usage metrics routes](https://github.com/linagora/crowdsieve/blob/master/src/proxy/routes/usage-metrics.ts): `src/proxy/routes/usage-metrics.ts`
- [Filter engine](https://github.com/linagora/crowdsieve/blob/master/src/filters/implementations/expression.ts): `src/filters/implementations/expression.ts`
- [Configuration](https://github.com/linagora/crowdsieve/blob/master/src/config/index.ts): `src/config/index.ts`
- [Client validation](https://github.com/linagora/crowdsieve/blob/master/src/validation/index.ts): `src/validation/index.ts`

### Analysis and decisions

- [Analyzer scheduler](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/index.ts): `src/analyzers/index.ts`
- [Analyzer rules](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/config.ts): `src/analyzers/config.ts`
- [Loki source](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/sources/loki.ts): `src/analyzers/sources/loki.ts`
- [Detection engine](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/detection.ts): `src/analyzers/detection.ts`
- [Decision pusher](https://github.com/linagora/crowdsieve/blob/master/src/analyzers/pusher.ts): `src/analyzers/pusher.ts`
- [Decision replication](https://github.com/linagora/crowdsieve/blob/master/src/replication/index.ts): `src/replication/index.ts`

### Persistence and enrichment

- [Alert and metrics storage](https://github.com/linagora/crowdsieve/blob/master/src/storage/index.ts): `src/storage/index.ts`
- [Database adapter](https://github.com/linagora/crowdsieve/blob/master/src/db/index.ts): `src/db/index.ts`
- [GeoIP enrichment](https://github.com/linagora/crowdsieve/blob/master/src/geoip/index.ts): `src/geoip/index.ts`

### Dashboard and access

- [Dashboard interface](https://github.com/linagora/crowdsieve/tree/master/dashboard/components): `dashboard/components`
- [Dashboard API](https://github.com/linagora/crowdsieve/tree/master/dashboard/app/api): `dashboard/app/api`
- [Dashboard authentication](https://github.com/linagora/crowdsieve/tree/master/dashboard/lib/oidc): `dashboard/lib/oidc`

### Other components

- **CrowdSec LAPI clients**
- **CrowdSec CAPI**
- **CrowdSec LAPI servers**
- **Dashboard user**
- **OIDC provider**
- [Application entry point](https://github.com/linagora/crowdsieve/blob/master/src/index.ts): `src/index.ts`

## Connections

- CrowdSec LAPI clients → Proxy server: sends requests (evidence: `README.md`)
- Proxy server → Signal routes: registers routes (evidence: `src/proxy/server.ts`)
- Proxy server → Proxy API routes: registers routes (evidence: `src/proxy/server.ts`)
- Proxy server → Usage metrics routes: registers routes (evidence: `src/proxy/server.ts`)
- Proxy server → Filter engine: uses filters (evidence: `src/proxy/server.ts`)
- Proxy server → Alert and metrics storage: uses storage (evidence: `src/proxy/server.ts`)
- Proxy server → Client validation: uses validation (evidence: `src/proxy/server.ts`)
- Proxy server → Decision replication: uses replication (evidence: `src/proxy/server.ts`)
- Proxy server → Configuration: uses config (evidence: `src/proxy/server.ts`)
- Signal routes → CrowdSec CAPI: forwards alerts (evidence: `README.md`)
- Signal routes → Alert and metrics storage: records alerts
- Usage metrics routes → Alert and metrics storage: records metrics
- Alert and metrics storage → Database adapter: reads and writes (evidence: `src/storage/index.ts`)
- Alert and metrics storage → GeoIP enrichment: enriches IPs (evidence: `src/storage/index.ts`)
- Client validation → CrowdSec CAPI: validates clients (evidence: `src/validation/index.ts`)
- Application entry point → Database adapter: initializes database (evidence: `src/index.ts`)
- Application entry point → Proxy server: starts server (evidence: `src/index.ts`)
- Application entry point → Analyzer scheduler: starts analyzers (evidence: `src/index.ts`)
- Application entry point → GeoIP enrichment: initializes GeoIP (evidence: `src/index.ts`)
- Analyzer scheduler → Analyzer rules: loads rules (evidence: `src/analyzers/index.ts`)
- Analyzer scheduler → Loki source: resolves source (evidence: `src/analyzers/index.ts`)
- Analyzer scheduler → Detection engine: analyzes logs (evidence: `src/analyzers/index.ts`)
- Analyzer scheduler → Decision pusher: pushes decisions (evidence: `src/analyzers/index.ts`)
- Loki source → Loki source: queries logs (evidence: `src/analyzers/sources/loki.ts`)
- Decision pusher → CrowdSec LAPI servers: pushes bans (evidence: `README.md`)
- Signal routes → Decision replication: replicates decisions (evidence: `README.md`)
- Decision replication → CrowdSec LAPI servers: sends decisions (evidence: `src/replication/index.ts`)
- Dashboard user → Dashboard interface: views dashboard (evidence: `README.md`)
- Dashboard interface → Dashboard API: requests data
- Dashboard API → Proxy server: queries proxy
- Dashboard API → CrowdSec LAPI servers: queries decisions (evidence: `README.md`)
- Dashboard API → CrowdSec LAPI servers: sends manual bans (evidence: `README.md`)
- Dashboard user → Dashboard authentication: authenticates (evidence: `README.md`)
- Dashboard authentication → OIDC provider: uses OIDC (evidence: `README.md`)
