# shvetgharework/redkross-sentinel architecture

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

- Interactive diagram: https://gitdiagram.com/shvetgharework/redkross-sentinel
- Repository: https://github.com/shvetgharework/redkross-sentinel

## Overview

RedKross Sentinel is a backend platform for registering infrastructure services, monitoring their health, recording incidents, and performing bounded self-healing. The documented operational flow probes targets, evaluates health and anomalies, then may dispatch a guarded recovery and verify it; operators also manage services and authenticate through the REST API. The sampled implementation confirms service registration, SSRF validation, audit logging, and JWT authentication. Monitoring and recovery internals are described in the README but are not present in the supplied tree, so those links are documented rather than source-verified.

Main entry points: [`backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java) (Service Management), [`backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/controller/AuthController.java) (Authentication API), [`backend/src/main/java/com/redkross/sentinel`](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel) (Health Evaluation), [`backend/src/main/java/com/redkross/sentinel/service/AuditService.java`](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/AuditService.java) (Audit Logging)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["API and Identity"]
  node_auth_api["Authentication API"]
  node_jwt["JWT Service<br/>[JwtService.java]"]
  node_jwt_filter["JWT Request Filter"]
  node_service_api["Service API"]
  node_service_mgmt["Service Management"]
  node_ssrf["SSRF Validator"]
  node_audit["Audit Logging<br/>[AuditService.java]"]
end

subgraph group_operations["Monitoring and Recovery"]
  node_monitor["Health Monitoring"]
  node_health_eval["Health Evaluation"]
  node_anomaly["Anomaly Detection"]
  node_incident["Incident Handling"]
  node_recovery["Controlled Recovery"]
end

subgraph group_records["Domain Records"]
  node_auth_data[("Users and Roles<br/>[UserEntity.java]")]
  node_service_data[("Service Configuration<br/>[ServiceEntity.java]")]
  node_policy_data[("Recovery Policies")]
  node_audit_data[("Audit Records")]
end

subgraph group_infrastructure["Persistence and Targets"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis Coordination")]
  node_socket_proxy["Docker Socket Proxy"]
  node_targets["Monitored Services"]
end

node_operator(("Operator / Client"))

node_operator -->|"logs in"| node_auth_api
node_auth_api -->|"looks up user"| node_auth_data
node_auth_api -->|"issues token"| node_jwt
node_auth_api -->|"records login"| node_audit
node_operator -->|"manages services"| node_service_api
node_service_api -->|"delegates"| node_service_mgmt
node_service_mgmt -->|"validates endpoint"| node_ssrf
node_service_mgmt -->|"persists configuration"| node_service_data
node_service_mgmt -->|"sets recovery policy"| node_policy_data
node_service_mgmt -->|"audits changes"| node_audit
node_audit -->|"saves events"| node_audit_data
node_jwt_filter -->|"validates token"| node_jwt
node_jwt_filter -->|"loads principal"| node_auth_data
node_monitor -.->|"takes monitor locks"| node_redis
node_monitor -.->|"probes health"| node_targets
node_monitor -.->|"evaluates probes"| node_health_eval
node_health_eval -.->|"computes anomalies"| node_anomaly
node_health_eval -.->|"raises incidents"| node_incident
node_health_eval -.->|"dispatches recovery"| node_recovery
node_recovery -.->|"guards attempts"| node_redis
node_recovery -.->|"requests restart"| node_socket_proxy
node_socket_proxy -.->|"restarts container"| node_targets
node_recovery -.->|"verifies recovery"| node_targets
node_service_data -.->|"stored in"| node_postgres
node_policy_data -.->|"stored in"| node_postgres
node_audit_data -.->|"stored in"| node_postgres

click node_auth_api "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/controller/AuthController.java"
click node_jwt "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/JwtService.java"
click node_jwt_filter "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/JwtAuthenticationFilter.java"
click node_service_api "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/controller/ServiceController.java"
click node_service_mgmt "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java"
click node_ssrf "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/SsrfProtectionValidator.java"
click node_audit "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/AuditService.java"
click node_monitor "https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel"
click node_health_eval "https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel"
click node_anomaly "https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel"
click node_incident "https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel"
click node_recovery "https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel"
click node_auth_data "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/UserEntity.java"
click node_service_data "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/ServiceEntity.java"
click node_policy_data "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/RecoveryPolicyEntity.java"
click node_audit_data "https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/AuditLogEntity.java"

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_auth_api,node_jwt,node_jwt_filter,node_service_api,node_service_mgmt,node_ssrf,node_audit,node_operator toneBlue
class node_monitor,node_health_eval,node_anomaly,node_incident,node_recovery toneAmber
class node_auth_data,node_service_data,node_policy_data,node_audit_data toneMint
class node_postgres,node_redis,node_socket_proxy,node_targets toneRose
```

## Components

### API and Identity

- [Authentication API](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/controller/AuthController.java): `backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`
- [JWT Service](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/JwtService.java): `backend/src/main/java/com/redkross/sentinel/security/JwtService.java`
- [JWT Request Filter](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/JwtAuthenticationFilter.java): `backend/src/main/java/com/redkross/sentinel/security/JwtAuthenticationFilter.java`
- [Service API](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/controller/ServiceController.java): `backend/src/main/java/com/redkross/sentinel/controller/ServiceController.java`
- [Service Management](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java): `backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`
- [SSRF Validator](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/security/SsrfProtectionValidator.java): `backend/src/main/java/com/redkross/sentinel/security/SsrfProtectionValidator.java`
- [Audit Logging](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/service/AuditService.java): `backend/src/main/java/com/redkross/sentinel/service/AuditService.java`

### Monitoring and Recovery

- [Health Monitoring](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel): `backend/src/main/java/com/redkross/sentinel`
- [Health Evaluation](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel): `backend/src/main/java/com/redkross/sentinel`
- [Anomaly Detection](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel): `backend/src/main/java/com/redkross/sentinel`
- [Incident Handling](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel): `backend/src/main/java/com/redkross/sentinel`
- [Controlled Recovery](https://github.com/shvetgharework/redkross-sentinel/tree/main/backend/src/main/java/com/redkross/sentinel): `backend/src/main/java/com/redkross/sentinel`

### Domain Records

- [Users and Roles](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/UserEntity.java): `backend/src/main/java/com/redkross/sentinel/entity/UserEntity.java`
- [Service Configuration](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/ServiceEntity.java): `backend/src/main/java/com/redkross/sentinel/entity/ServiceEntity.java`
- [Recovery Policies](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/RecoveryPolicyEntity.java): `backend/src/main/java/com/redkross/sentinel/entity/RecoveryPolicyEntity.java`
- [Audit Records](https://github.com/shvetgharework/redkross-sentinel/blob/main/backend/src/main/java/com/redkross/sentinel/entity/AuditLogEntity.java): `backend/src/main/java/com/redkross/sentinel/entity/AuditLogEntity.java`

### Persistence and Targets

- **PostgreSQL**
- **Redis Coordination**
- **Docker Socket Proxy**
- **Monitored Services**

### Other components

- **Operator / Client**

## Connections

- Operator / Client → Authentication API: logs in (evidence: `backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`)
- Authentication API → Users and Roles: looks up user (evidence: `backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`)
- Authentication API → JWT Service: issues token (evidence: `backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`)
- Authentication API → Audit Logging: records login (evidence: `backend/src/main/java/com/redkross/sentinel/controller/AuthController.java`)
- Operator / Client → Service API: manages services (evidence: `README.md`)
- Service API → Service Management: delegates (evidence: `backend/src/main/java/com/redkross/sentinel/controller/ServiceController.java`)
- Service Management → SSRF Validator: validates endpoint (evidence: `backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`)
- Service Management → Service Configuration: persists configuration (evidence: `backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`)
- Service Management → Recovery Policies: sets recovery policy (evidence: `backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`)
- Service Management → Audit Logging: audits changes (evidence: `backend/src/main/java/com/redkross/sentinel/service/ServiceManagementService.java`)
- Audit Logging → Audit Records: saves events (evidence: `backend/src/main/java/com/redkross/sentinel/service/AuditService.java`)
- JWT Request Filter → JWT Service: validates token (evidence: `backend/src/main/java/com/redkross/sentinel/security/JwtAuthenticationFilter.java`)
- JWT Request Filter → Users and Roles: loads principal (evidence: `backend/src/main/java/com/redkross/sentinel/security/JwtAuthenticationFilter.java`)
- Health Monitoring → Redis Coordination: takes monitor locks (evidence: `README.md`)
- Health Monitoring → Monitored Services: probes health (evidence: `README.md`)
- Health Monitoring → Health Evaluation: evaluates probes (evidence: `README.md`)
- Health Evaluation → Anomaly Detection: computes anomalies (evidence: `README.md`)
- Health Evaluation → Incident Handling: raises incidents (evidence: `README.md`)
- Health Evaluation → Controlled Recovery: dispatches recovery (evidence: `README.md`)
- Controlled Recovery → Redis Coordination: guards attempts (evidence: `README.md`)
- Controlled Recovery → Docker Socket Proxy: requests restart (evidence: `README.md`)
- Docker Socket Proxy → Monitored Services: restarts container (evidence: `README.md`)
- Controlled Recovery → Monitored Services: verifies recovery (evidence: `README.md`)
- Service Configuration → PostgreSQL: stored in (evidence: `README.md`)
- Recovery Policies → PostgreSQL: stored in (evidence: `README.md`)
- Audit Records → PostgreSQL: stored in (evidence: `README.md`)
