# madhab-tech-cyber/apisenx architecture

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

- Interactive diagram: https://gitdiagram.com/madhab-tech-cyber/apisenx
- Repository: https://github.com/madhab-tech-cyber/apisenx

## Overview

API-Sentinel is an authorized-lab API security monitoring system: observed API events are normalized, evaluated for route drift and BOLA/BFLA risks, and exposed as protected inventory and alert views. Its Rust collector is intended to forward privacy-minimized batches into local analytics; the README says live sensor-to-analytics integration remains incomplete. The mock API provides the authorized reference application, while the React dashboard currently displays fixture data rather than live status. Edges for unsampled or explicitly unaccepted integrations are omitted or marked unverified.

Main entry points: [`analytics/app.py`](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/app.py) (Analytics API), [`collector/src/pipeline.rs`](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/pipeline.rs) (Batch pipeline), [`mock-api/main.py`](https://github.com/madhab-tech-cyber/apisenx/blob/main/mock-api/main.py) (Mock commerce API), [`analytics/decisions.py`](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/decisions.py) (Signed recommendations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_observe["Observation and collection"]
  node_sensor["eBPF sensor"]
  node_event_contract["Kernel event contract"]
  node_wire_decoder["Wire decoder<br/>[wire.rs]"]
  node_collector_pipeline["Batch pipeline<br/>[pipeline.rs]"]
  node_event_model["Normalized events<br/>[event.rs]"]
  node_delivery["Delivery worker<br/>[delivery.rs]"]
  node_transport["Analytics transport<br/>[transport.rs]"]
  node_collector_metrics["Collector metrics<br/>[metrics.rs]"]
end

subgraph group_analytics["Analytics and decisions"]
  node_analytics_api["Analytics API<br/>[app.py]"]
  node_normalizer["Route normalization<br/>[normalization.py]"]
  node_detection["Risk detection<br/>[detection.py]"]
  node_authorization["Authorization evaluator<br/>[authorization.py]"]
  node_decision_service["Signed recommendations<br/>[decisions.py]"]
  node_memory_store[("Masked volatile store<br/>[store.py]")]
  node_masking["Telemetry masking<br/>[masking.py]"]
  node_management["Protected inventory and alerts<br/>[management.py]"]
  node_audit["Structured audit<br/>[audit.py]"]
  node_ownership["Ownership evaluation<br/>[ownership.py]"]
end

subgraph group_reference["Reference API"]
  node_mock_api["Mock commerce API<br/>[main.py]"]
  node_mock_adapter["Sentinel adapter"]
end

subgraph group_dashboard["Security dashboard"]
  node_dashboard_app["Dashboard workspace<br/>[App.tsx]"]
  node_dashboard_fixtures["Dashboard fixture data<br/>[endpointData.ts]"]
end

node_lab_user(("Authorized lab user"))

node_sensor -.->|"emits records"| node_event_contract
node_event_contract -.->|"decodes contract"| node_wire_decoder
node_collector_pipeline -->|"decodes records"| node_wire_decoder
node_collector_pipeline -->|"normalizes events"| node_event_model
node_collector_pipeline -->|"queues batches"| node_delivery
node_delivery -->|"sends batches"| node_transport
node_transport -.->|"posts batches"| node_analytics_api
node_analytics_api -->|"normalizes routes"| node_normalizer
node_analytics_api -->|"evaluates observations"| node_detection
node_detection -->|"checks access"| node_authorization
node_analytics_api -->|"creates recommendations"| node_decision_service
node_analytics_api -->|"stores observations"| node_memory_store
node_memory_store -->|"masks stored data"| node_masking
node_analytics_api -->|"serves read APIs"| node_management
node_management -->|"reads stored rows"| node_memory_store
node_decision_service -->|"writes audit"| node_audit
node_mock_api -->|"authorizes requests"| node_authorization
node_mock_api -->|"uses adapter"| node_mock_adapter
node_mock_adapter -->|"verifies recommendations"| node_decision_service
node_lab_user -.->|"uses reference API"| node_mock_api
node_lab_user -.->|"queries inventory"| node_analytics_api
node_lab_user -.->|"views security status"| node_dashboard_app
node_dashboard_app -->|"renders fixture data"| node_dashboard_fixtures

click node_sensor "https://github.com/madhab-tech-cyber/apisenx/blob/main/ebpf/src/api_sentinel_sensor.c"
click node_event_contract "https://github.com/madhab-tech-cyber/apisenx/blob/main/ebpf/include/api_sentinel_types.h"
click node_wire_decoder "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/wire.rs"
click node_collector_pipeline "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/pipeline.rs"
click node_event_model "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/event.rs"
click node_delivery "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/delivery.rs"
click node_transport "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/transport.rs"
click node_collector_metrics "https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/metrics.rs"
click node_analytics_api "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/app.py"
click node_normalizer "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/normalization.py"
click node_detection "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/detection.py"
click node_authorization "https://github.com/madhab-tech-cyber/apisenx/blob/main/src/authorization.py"
click node_decision_service "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/decisions.py"
click node_memory_store "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/store.py"
click node_masking "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/masking.py"
click node_management "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/management.py"
click node_audit "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/audit.py"
click node_ownership "https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/ownership.py"
click node_mock_api "https://github.com/madhab-tech-cyber/apisenx/blob/main/mock-api/main.py"
click node_mock_adapter "https://github.com/madhab-tech-cyber/apisenx/blob/main/mock-api/sentinel_adapter.py"
click node_dashboard_app "https://github.com/madhab-tech-cyber/apisenx/blob/main/dashboard/src/App.tsx"
click node_dashboard_fixtures "https://github.com/madhab-tech-cyber/apisenx/blob/main/dashboard/src/endpointData.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_sensor,node_event_contract,node_wire_decoder,node_collector_pipeline,node_event_model,node_delivery,node_transport,node_collector_metrics,node_lab_user toneBlue
class node_analytics_api,node_normalizer,node_detection,node_authorization,node_decision_service,node_memory_store,node_masking,node_management,node_audit,node_ownership toneAmber
class node_mock_api,node_mock_adapter toneMint
class node_dashboard_app,node_dashboard_fixtures toneRose
```

## Components

### Observation and collection

- [eBPF sensor](https://github.com/madhab-tech-cyber/apisenx/blob/main/ebpf/src/api_sentinel_sensor.c): `ebpf/src/api_sentinel_sensor.c`
- [Kernel event contract](https://github.com/madhab-tech-cyber/apisenx/blob/main/ebpf/include/api_sentinel_types.h): `ebpf/include/api_sentinel_types.h`
- [Wire decoder](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/wire.rs): `collector/src/wire.rs`
- [Batch pipeline](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/pipeline.rs): `collector/src/pipeline.rs`
- [Normalized events](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/event.rs): `collector/src/event.rs`
- [Delivery worker](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/delivery.rs): `collector/src/delivery.rs`
- [Analytics transport](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/transport.rs): `collector/src/transport.rs`
- [Collector metrics](https://github.com/madhab-tech-cyber/apisenx/blob/main/collector/src/metrics.rs): `collector/src/metrics.rs`

### Analytics and decisions

- [Analytics API](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/app.py): `analytics/app.py`
- [Route normalization](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/normalization.py): `analytics/normalization.py`
- [Risk detection](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/detection.py): `analytics/detection.py`
- [Authorization evaluator](https://github.com/madhab-tech-cyber/apisenx/blob/main/src/authorization.py): `src/authorization.py`
- [Signed recommendations](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/decisions.py): `analytics/decisions.py`
- [Masked volatile store](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/store.py): `analytics/store.py`
- [Telemetry masking](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/masking.py): `analytics/masking.py`
- [Protected inventory and alerts](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/management.py): `analytics/management.py`
- [Structured audit](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/audit.py): `analytics/audit.py`
- [Ownership evaluation](https://github.com/madhab-tech-cyber/apisenx/blob/main/analytics/ownership.py): `analytics/ownership.py`

### Reference API

- [Mock commerce API](https://github.com/madhab-tech-cyber/apisenx/blob/main/mock-api/main.py): `mock-api/main.py`
- [Sentinel adapter](https://github.com/madhab-tech-cyber/apisenx/blob/main/mock-api/sentinel_adapter.py): `mock-api/sentinel_adapter.py`

### Security dashboard

- [Dashboard workspace](https://github.com/madhab-tech-cyber/apisenx/blob/main/dashboard/src/App.tsx): `dashboard/src/App.tsx`
- [Dashboard fixture data](https://github.com/madhab-tech-cyber/apisenx/blob/main/dashboard/src/endpointData.ts): `dashboard/src/endpointData.ts`

### Other components

- **Authorized lab user**

## Connections

- eBPF sensor → Kernel event contract: emits records (evidence: `ebpf/src/api_sentinel_sensor.c`)
- Kernel event contract → Wire decoder: decodes contract
- Batch pipeline → Wire decoder: decodes records (evidence: `collector/src/pipeline.rs`)
- Batch pipeline → Normalized events: normalizes events (evidence: `collector/src/pipeline.rs`)
- Batch pipeline → Delivery worker: queues batches (evidence: `collector/src/pipeline.rs`)
- Delivery worker → Analytics transport: sends batches (evidence: `collector/src/delivery.rs`)
- Analytics transport → Analytics API: posts batches (evidence: `README.md`)
- Analytics API → Route normalization: normalizes routes (evidence: `analytics/app.py`)
- Analytics API → Risk detection: evaluates observations (evidence: `analytics/app.py`)
- Risk detection → Authorization evaluator: checks access (evidence: `analytics/detection.py`)
- Analytics API → Signed recommendations: creates recommendations (evidence: `analytics/app.py`)
- Analytics API → Masked volatile store: stores observations (evidence: `analytics/app.py`)
- Masked volatile store → Telemetry masking: masks stored data (evidence: `analytics/store.py`)
- Analytics API → Protected inventory and alerts: serves read APIs (evidence: `analytics/app.py`)
- Protected inventory and alerts → Masked volatile store: reads stored rows (evidence: `analytics/management.py`)
- Signed recommendations → Structured audit: writes audit (evidence: `analytics/decisions.py`)
- Mock commerce API → Authorization evaluator: authorizes requests (evidence: `mock-api/main.py`)
- Mock commerce API → Sentinel adapter: uses adapter (evidence: `mock-api/main.py`)
- Sentinel adapter → Signed recommendations: verifies recommendations (evidence: `mock-api/sentinel_adapter.py`)
- Authorized lab user → Mock commerce API: uses reference API (evidence: `README.md`)
- Authorized lab user → Analytics API: queries inventory (evidence: `README.md`)
- Authorized lab user → Dashboard workspace: views security status (evidence: `README.md`)
- Dashboard workspace → Dashboard fixture data: renders fixture data (evidence: `dashboard/src/App.tsx`)
