# bandavandhana/distributed_file_system architecture

> Architecture diagram of the GitHub repository bandavandhana/distributed_file_system, 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/bandavandhana/distributed_file_system
- Repository: https://github.com/bandavandhana/distributed_file_system

## Overview

This is a simulated distributed-file-system coordinator with a Flask dashboard and an interactive terminal demo. Users add or fail storage nodes, write and read files, and observe load balancing, dynamic replication, recovery, and system health. The web app coordinates requests; replication and failure detection run as background services over in-memory metadata, node state, and event logs. The excerpts establish these relationships, but do not show the full route set or dashboard rendering details.

Main entry points: [`app.py`](https://github.com/bandavandhana/distributed_file_system/blob/main/app.py) (Web Coordinator), [`coordinator_demo.py`](https://github.com/bandavandhana/distributed_file_system/blob/main/coordinator_demo.py) (Demo Coordinator), [`foundation.py`](https://github.com/bandavandhana/distributed_file_system/blob/main/foundation.py) (Metadata, Nodes & Logs), [`replication.py`](https://github.com/bandavandhana/distributed_file_system/blob/main/replication.py) (Dynamic Replication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_web["Flask API<br/>[app.py]"]
  node_terminal["Terminal Demo"]
end

subgraph group_coordination["Coordinator"]
  node_coord["Web Coordinator<br/>[app.py]"]
  node_demo_coord["Demo Coordinator"]
end

subgraph group_resilience["Cluster Services"]
  node_replication["Dynamic Replication<br/>[replication.py]"]
  node_detector["Failure Detection"]
end

subgraph group_state["In-Memory State"]
  node_foundation[("Metadata, Nodes &amp; Logs<br/>[foundation.py]")]
end

node_user(("Operator"))

node_user -->|"requests operations"| node_web
node_web -->|"routes requests"| node_coord
node_terminal -->|"invokes operations"| node_demo_coord
node_coord -->|"creates and updates state"| node_foundation
node_coord -->|"starts and routes reads"| node_replication
node_coord -->|"starts and signals heartbeats"| node_detector
node_demo_coord -->|"creates and updates state"| node_foundation
node_demo_coord -->|"starts and routes reads"| node_replication
node_demo_coord -->|"starts and signals heartbeats"| node_detector
node_replication -->|"reads and adjusts replicas"| node_foundation
node_detector -->|"tracks nodes and replicas"| node_foundation

click node_web "https://github.com/bandavandhana/distributed_file_system/blob/main/app.py"
click node_terminal "https://github.com/bandavandhana/distributed_file_system/blob/main/coordinator_demo.py"
click node_coord "https://github.com/bandavandhana/distributed_file_system/blob/main/app.py"
click node_demo_coord "https://github.com/bandavandhana/distributed_file_system/blob/main/coordinator_demo.py"
click node_replication "https://github.com/bandavandhana/distributed_file_system/blob/main/replication.py"
click node_detector "https://github.com/bandavandhana/distributed_file_system/blob/main/failure_detector.py"
click node_foundation "https://github.com/bandavandhana/distributed_file_system/blob/main/foundation.py"

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,node_terminal toneBlue
class node_coord,node_demo_coord toneAmber
class node_replication,node_detector toneMint
class node_foundation toneRose
class node_user toneIndigo
```

## Components

### User Interfaces

- [Flask API](https://github.com/bandavandhana/distributed_file_system/blob/main/app.py): `app.py`
- [Terminal Demo](https://github.com/bandavandhana/distributed_file_system/blob/main/coordinator_demo.py): `coordinator_demo.py`

### Coordinator

- [Web Coordinator](https://github.com/bandavandhana/distributed_file_system/blob/main/app.py): `app.py`
- [Demo Coordinator](https://github.com/bandavandhana/distributed_file_system/blob/main/coordinator_demo.py): `coordinator_demo.py`

### Cluster Services

- [Dynamic Replication](https://github.com/bandavandhana/distributed_file_system/blob/main/replication.py): `replication.py`
- [Failure Detection](https://github.com/bandavandhana/distributed_file_system/blob/main/failure_detector.py): `failure_detector.py`

### In-Memory State

- [Metadata, Nodes & Logs](https://github.com/bandavandhana/distributed_file_system/blob/main/foundation.py): `foundation.py`

### Other components

- **Operator**

## Connections

- Operator → Flask API: requests operations (evidence: `app.py`)
- Flask API → Web Coordinator: routes requests (evidence: `app.py`)
- Terminal Demo → Demo Coordinator: invokes operations (evidence: `coordinator_demo.py`)
- Web Coordinator → Metadata, Nodes & Logs: creates and updates state (evidence: `app.py`)
- Web Coordinator → Dynamic Replication: starts and routes reads (evidence: `app.py`)
- Web Coordinator → Failure Detection: starts and signals heartbeats (evidence: `app.py`)
- Demo Coordinator → Metadata, Nodes & Logs: creates and updates state (evidence: `coordinator_demo.py`)
- Demo Coordinator → Dynamic Replication: starts and routes reads (evidence: `coordinator_demo.py`)
- Demo Coordinator → Failure Detection: starts and signals heartbeats (evidence: `coordinator_demo.py`)
- Dynamic Replication → Metadata, Nodes & Logs: reads and adjusts replicas (evidence: `replication.py`)
- Failure Detection → Metadata, Nodes & Logs: tracks nodes and replicas (evidence: `failure_detector.py`)
