# elite-architects/distributed-secure-nas architecture

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

- Interactive diagram: https://gitdiagram.com/elite-architects/distributed-secure-nas
- Repository: https://github.com/elite-architects/distributed-secure-nas

## Overview

Intelligent Secure NAS is a distributed file-storage platform with security detection and centralized monitoring. Users store and share files through Nextcloud; upload events reach the intelligence API through a workflow hook or access-log forwarder, where they are recorded and uploads can be queued for classification. Separately, the security engine watches Nextcloud logs, detects suspicious activity, and can block IPs or report alerts. The README also documents Prometheus-to-Grafana observability. Several infrastructure services are documented but their implementation is not sampled, so those links are shown only where documentation supports them.

Main entry points: [`nas-core/nextcloud/config`](https://github.com/elite-architects/distributed-secure-nas/tree/main/nas-core/nextcloud/config) (Nextcloud storage), [`nas-intel/api/main.py`](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/api/main.py) (Intelligence API), [`nas-intel/workers/tasks.py`](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/workers/tasks.py) (File classifier), [`nas-sec/security_engine/engine.py`](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-sec/security_engine/engine.py) (Security engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storage["File storage"]
  node_nextcloud["Nextcloud storage"]
  node_nginx["Nginx proxy<br/>[nextcloud.conf]"]
  node_ncconfig["Nextcloud configuration<br/>[config.sample.php]"]
  node_objectstore[("Object storage<br/>[s3.config.php]")]
  node_filestore[("NAS file data")]
end

subgraph group_intelligence["Event intelligence"]
  node_eventhook["File event hook<br/>[event_hook.py]"]
  node_logforwarder["Upload log forwarder<br/>[log_forwarder.py]"]
  node_accesslogs["Nginx access logs"]
  node_intelapi["Intelligence API<br/>[main.py]"]
  node_eventdb[("Event database")]
  node_taskqueue["Classification queue"]
  node_classifier["File classifier<br/>[tasks.py]"]
  node_classificationdb[("Classification records")]
end

subgraph group_security["Security response"]
  node_securityengine["Security engine<br/>[engine.py]"]
  node_nextcloudlogs["Nextcloud logs"]
  node_fail2ban["Fail2ban"]
end

subgraph group_observability["Monitoring"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_metrics["Infrastructure metrics"]
  node_grafana["Grafana dashboards"]
end

node_user(("NAS user"))

node_user -->|"uploads files"| node_nextcloud
node_nextcloud -.->|"serves behind"| node_nginx
node_nextcloud -.->|"uses settings"| node_ncconfig
node_nextcloud -.->|"stores objects"| node_objectstore
node_nextcloud -.->|"triggers hook"| node_eventhook
node_eventhook -->|"posts file event"| node_intelapi
node_nextcloud -.->|"writes access logs"| node_accesslogs
node_accesslogs -->|"tails uploads"| node_logforwarder
node_logforwarder -->|"posts file event"| node_intelapi
node_intelapi -->|"records events"| node_eventdb
node_intelapi -->|"queues uploads"| node_taskqueue
node_taskqueue -.->|"dispatches task"| node_classifier
node_classifier -->|"reads file"| node_filestore
node_classifier -->|"writes classification"| node_classificationdb
node_nextcloud -->|"generates security logs"| node_nextcloudlogs
node_nextcloudlogs -->|"watches log file"| node_securityengine
node_securityengine -->|"bans IP"| node_fail2ban
node_securityengine -->|"posts alerts"| node_intelapi
node_metrics -->|"collects metrics"| node_prometheus
node_prometheus -->|"visualizes metrics"| node_grafana

click node_nextcloud "https://github.com/elite-architects/distributed-secure-nas/tree/main/nas-core/nextcloud/config"
click node_nginx "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nginx/conf.d/nextcloud.conf"
click node_ncconfig "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/config.sample.php"
click node_objectstore "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/s3.config.php"
click node_eventhook "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/event_hook.py"
click node_logforwarder "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/log_forwarder.py"
click node_intelapi "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/api/main.py"
click node_classifier "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/workers/tasks.py"
click node_securityengine "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-sec/security_engine/engine.py"
click node_prometheus "https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-sec/prometheus/prometheus.yml"

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_nextcloud,node_nginx,node_ncconfig,node_objectstore,node_filestore,node_user toneBlue
class node_eventhook,node_logforwarder,node_accesslogs,node_intelapi,node_eventdb,node_taskqueue,node_classifier,node_classificationdb toneAmber
class node_securityengine,node_nextcloudlogs,node_fail2ban toneMint
class node_prometheus,node_metrics,node_grafana toneRose
```

## Components

### File storage

- [Nextcloud storage](https://github.com/elite-architects/distributed-secure-nas/tree/main/nas-core/nextcloud/config): `nas-core/nextcloud/config`
- [Nginx proxy](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nginx/conf.d/nextcloud.conf): `nas-core/nginx/conf.d/nextcloud.conf`
- [Nextcloud configuration](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/config.sample.php): `nas-core/nextcloud/config/config.sample.php`
- [Object storage](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/s3.config.php): `nas-core/nextcloud/config/s3.config.php`
- **NAS file data**

### Event intelligence

- [File event hook](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/nextcloud/config/event_hook.py): `nas-core/nextcloud/config/event_hook.py`
- [Upload log forwarder](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-core/log_forwarder.py): `nas-core/log_forwarder.py`
- **Nginx access logs**
- [Intelligence API](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/api/main.py): `nas-intel/api/main.py`
- **Event database**
- **Classification queue**
- [File classifier](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-intel/workers/tasks.py): `nas-intel/workers/tasks.py`
- **Classification records**

### Security response

- [Security engine](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-sec/security_engine/engine.py): `nas-sec/security_engine/engine.py`
- **Nextcloud logs**
- **Fail2ban**

### Monitoring

- [Prometheus](https://github.com/elite-architects/distributed-secure-nas/blob/main/nas-sec/prometheus/prometheus.yml): `nas-sec/prometheus/prometheus.yml`
- **Infrastructure metrics**
- **Grafana dashboards**

### Other components

- **NAS user**

## Connections

- NAS user → Nextcloud storage: uploads files
- Nextcloud storage → Nginx proxy: serves behind
- Nextcloud storage → Nextcloud configuration: uses settings
- Nextcloud storage → Object storage: stores objects
- Nextcloud storage → File event hook: triggers hook (evidence: `nas-core/nextcloud/config/event_hook.py`)
- File event hook → Intelligence API: posts file event (evidence: `nas-core/nextcloud/config/event_hook.py`)
- Nextcloud storage → Nginx access logs: writes access logs
- Nginx access logs → Upload log forwarder: tails uploads (evidence: `nas-core/log_forwarder.py`)
- Upload log forwarder → Intelligence API: posts file event (evidence: `nas-core/log_forwarder.py`)
- Intelligence API → Event database: records events (evidence: `nas-intel/api/main.py`)
- Intelligence API → Classification queue: queues uploads (evidence: `nas-intel/api/main.py`)
- Classification queue → File classifier: dispatches task
- File classifier → NAS file data: reads file (evidence: `nas-intel/workers/tasks.py`)
- File classifier → Classification records: writes classification (evidence: `nas-intel/workers/tasks.py`)
- Nextcloud storage → Nextcloud logs: generates security logs
- Nextcloud logs → Security engine: watches log file (evidence: `nas-sec/security_engine/engine.py`)
- Security engine → Fail2ban: bans IP (evidence: `nas-sec/security_engine/engine.py`)
- Security engine → Intelligence API: posts alerts (evidence: `nas-sec/security_engine/engine.py`)
- Infrastructure metrics → Prometheus: collects metrics
- Prometheus → Grafana dashboards: visualizes metrics
