# kunalv04/devops-iot-project architecture

> Architecture diagram of the GitHub repository kunalv04/devops-iot-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kunalv04/devops-iot-project
- Repository: https://github.com/kunalv04/devops-iot-project

## Overview

This repository is organized as three separate task areas around an on-premise deployment theme, rather than a single monolithic application.

1. **Overall shape**
   - The repo models a deployment stack, a CI/CD pipeline, and network hardening as distinct concerns.
   - The top-level README is minimal, so the file tree is the main source of architecture clues.

2. **Task 1: main application stack**
   - `task-1/` is the core runtime environment.
   - It contains three application components: `backend/`, `frontend/`, and `lamp/`, plus `docker-compose.yml`, `nginx.conf`, and `setup.sh`.
   - This strongly suggests a containerized multi-service stack deployed together on a single host or private network.

3. **Backend service**
   - `task-1/backend/` contains `server.js`, `package.json`, and a Dockerfile.
   - This is a Node.js service, likely exposing an API or application logic layer.
   - In the architecture diagram, treat it as one independently built containerized service.

4. **Frontend service**
   - `task-1/frontend/` also has `package.json` and a Dockerfile.
   - This is a separate Node-based frontend app, likely consuming the backend over the internal network.
   - It should be shown as a distinct container/service rather than bundled with the backend.

5. **LAMP service**
   - `task-1/lamp/` contains `index.php` and a Dockerfile.
   - This is a PHP-based web component running in a LAMP-style container.
   - It likely represents an alternate or additional application endpoint inside the same deployment stack.

6. **Reverse proxy / traffic entry**
   - `task-1/nginx.conf` indicates Nginx is used as the front door for the stack.
   - Nginx likely routes incoming requests to the frontend, backend, and/or LAMP service based on path or host rules.
   - For diagram purposes, Nginx is the boundary between external clients and internal containers.

7. **Orchestration and bootstrapping**
   - `task-1/docker-compose.yml` is the main composition layer tying the services together.
   - `task-1/setup.sh` likely automates host setup or stack startup.
   - This means the deployment model is Docker Compose-based rather than Kubernetes or a cloud-managed platform.

8. **Task 2: CI/CD automation**
   - `task-2/ci_cd.yml` and `task-2/README.md` point to a separate pipeline definition.
   - This likely covers build/test/deploy automation for the task-1 stack or one of its services.
   - At repo level, `.github/workflows/ci_cd.yml` shows GitHub Actions is also used for automation, so CI/CD is an explicit subsystem.

9. **Task 3: network policy and flow control**
   - `task-3/iptables.sh` indicates firewall or packet-filtering rules are part of the architecture.
   - `task-3/nginx.conf` suggests another Nginx configuration variant, likely for a different network scenario.
   - `task-3/newtork-flow` appears to document or visualize traffic paths; note the typo in the filename.
   - This task is about constraining and documenting network flow around the deployed services.

10. **Important architectural boundaries**
   - **External client traffic** enters through Nginx.
   - **Internal service communication** happens between frontend, backend, and LAMP containers via Compose-defined networking.
   - **Deployment automation** is separated into CI/CD workflow files.
   - **Host/network security** is handled separately through iptables and Nginx configuration.

11. **What to draw in an architecture diagram**
   - Show the repository as three boxes: application stack, pipeline automation, and network/security controls.
   - Inside the application stack, show Nginx at the edge and three containerized services behind it.
   - Show Docker Compose as the orchestrator connecting those containers.
   - Show GitHub Actions / CI-CD as an external automation lane that builds or deploys the stack.
   - Show iptables as a host-level control plane affecting allowed traffic to the deployment.

12. **Notable constraint**
   - There is no evidence here of cloud services, databases, message brokers, or Kubernetes.
   - The architecture is primarily on-premise, container-based, and network-policy driven.

Main entry points: [`task-1/nginx.conf`](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/nginx.conf) (Nginx edge), [`task-1/docker-compose.yml`](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/docker-compose.yml) (Compose), [`task-1/backend/server.js`](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/backend/server.js) (Backend), [`task-2/ci_cd.yml`](https://github.com/kunalv04/devops-iot-project/blob/main/task-2/ci_cd.yml) (CI/CD spec)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_task1["Task 1: App stack"]
  node_nginx_edge["Nginx edge<br/>reverse proxy<br/>[nginx.conf]"]
  node_compose_orchestrator["Compose<br/>orchestrator<br/>[docker-compose.yml]"]
  node_setup_script["Setup script<br/>bootstrap<br/>[setup.sh]"]
  node_frontend_service["Frontend<br/>node app"]
  node_backend_service["Backend<br/>node api<br/>[server.js]"]
  node_lamp_service["LAMP app<br/>php service<br/>[index.php]"]
  node_frontend_image["Frontend image<br/>container build"]
  node_backend_image["Backend image<br/>container build"]
  node_lamp_image["LAMP image<br/>container build"]
end

subgraph group_task2["Task 2: CI/CD"]
  node_github_actions["GitHub Actions<br/>automation runner<br/>[ci_cd.yml]"]
  node_ci_cd_def["CI/CD spec<br/>pipeline config<br/>[ci_cd.yml]"]
  node_pipeline_readme["Pipeline notes<br/>docs<br/>[README.md]"]
end

subgraph group_task3["Task 3: Network control"]
  node_iptables_rules["iptables<br/>firewall rules<br/>[iptables.sh]"]
  node_network_nginx["Nginx policy<br/>nginx config<br/>[nginx.conf]"]
  node_network_flow_doc["Flow doc<br/>network diagram"]
end

node_external_client(("External client<br/>consumer"))

node_external_client -->|"HTTP(S)"| node_nginx_edge
node_nginx_edge -->|"routes to"| node_frontend_service
node_nginx_edge -->|"routes to"| node_backend_service
node_nginx_edge -->|"routes to"| node_lamp_service
node_compose_orchestrator -->|"starts"| node_frontend_service
node_compose_orchestrator -->|"starts"| node_backend_service
node_compose_orchestrator -->|"starts"| node_lamp_service
node_setup_script -->|"boots"| node_compose_orchestrator
node_frontend_image -->|"builds"| node_frontend_service
node_backend_image -->|"builds"| node_backend_service
node_lamp_image -->|"builds"| node_lamp_service
node_github_actions -->|"runs"| node_ci_cd_def
node_ci_cd_def -.->|"deploys"| node_compose_orchestrator
node_pipeline_readme -->|"documents"| node_ci_cd_def
node_iptables_rules -->|"filters"| node_nginx_edge
node_iptables_rules -->|"restricts"| node_backend_service
node_network_nginx -->|"configures"| node_nginx_edge
node_network_flow_doc -.->|"describes"| node_nginx_edge

click node_nginx_edge "https://github.com/kunalv04/devops-iot-project/blob/main/task-1/nginx.conf"
click node_compose_orchestrator "https://github.com/kunalv04/devops-iot-project/blob/main/task-1/docker-compose.yml"
click node_setup_script "https://github.com/kunalv04/devops-iot-project/blob/main/task-1/setup.sh"
click node_frontend_service "https://github.com/kunalv04/devops-iot-project/tree/main/task-1/frontend"
click node_backend_service "https://github.com/kunalv04/devops-iot-project/blob/main/task-1/backend/server.js"
click node_lamp_service "https://github.com/kunalv04/devops-iot-project/blob/main/task-1/lamp/index.php"
click node_frontend_image "https://github.com/kunalv04/devops-iot-project/tree/main/task-1/frontend/dockerfile"
click node_backend_image "https://github.com/kunalv04/devops-iot-project/tree/main/task-1/backend/dockerfile"
click node_lamp_image "https://github.com/kunalv04/devops-iot-project/tree/main/task-1/lamp/dockerfile"
click node_github_actions "https://github.com/kunalv04/devops-iot-project/blob/main/.github/workflows/ci_cd.yml"
click node_ci_cd_def "https://github.com/kunalv04/devops-iot-project/blob/main/task-2/ci_cd.yml"
click node_pipeline_readme "https://github.com/kunalv04/devops-iot-project/blob/main/task-2/README.md"
click node_iptables_rules "https://github.com/kunalv04/devops-iot-project/blob/main/task-3/iptables.sh"
click node_network_nginx "https://github.com/kunalv04/devops-iot-project/blob/main/task-3/nginx.conf"
click node_network_flow_doc "https://github.com/kunalv04/devops-iot-project/tree/main/task-3/newtork-flow"

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_nginx_edge,node_compose_orchestrator,node_setup_script,node_frontend_service,node_backend_service,node_lamp_service,node_frontend_image,node_backend_image,node_lamp_image toneBlue
class node_github_actions,node_ci_cd_def,node_pipeline_readme toneAmber
class node_iptables_rules,node_network_nginx,node_network_flow_doc toneMint
class node_external_client toneNeutral
```

## Components

### Task 1: App stack

Containerized on-prem deployment with edge proxy and three application services.

- [Nginx edge](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/nginx.conf): reverse proxy · Front door for incoming requests and internal routing. · `task-1/nginx.conf`
- [Compose](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/docker-compose.yml): orchestrator · Docker Compose stack definition tying the services together. · `task-1/docker-compose.yml`
- [Setup script](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/setup.sh): bootstrap · Host or stack bootstrap automation. · `task-1/setup.sh`
- [Frontend](https://github.com/kunalv04/devops-iot-project/tree/main/task-1/frontend): node app · Separate containerized frontend application. · `task-1/frontend`
- [Backend](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/backend/server.js): node api · Independent Node.js backend service. · `task-1/backend/server.js`
- [LAMP app](https://github.com/kunalv04/devops-iot-project/blob/main/task-1/lamp/index.php): php service · PHP-based application container in the same deployment stack. · `task-1/lamp/index.php`
- [Frontend image](https://github.com/kunalv04/devops-iot-project/tree/main/task-1/frontend/dockerfile): container build · Build definition for the frontend service image. · `task-1/frontend/dockerfile`
- [Backend image](https://github.com/kunalv04/devops-iot-project/tree/main/task-1/backend/dockerfile): container build · Build definition for the backend service image. · `task-1/backend/dockerfile`
- [LAMP image](https://github.com/kunalv04/devops-iot-project/tree/main/task-1/lamp/dockerfile): container build · Build definition for the PHP service image. · `task-1/lamp/dockerfile`

### Task 2: CI/CD

Pipeline automation for building and deploying the stack.

- [GitHub Actions](https://github.com/kunalv04/devops-iot-project/blob/main/.github/workflows/ci_cd.yml): automation runner · Repository-level workflow execution environment. · `.github/workflows/ci_cd.yml`
- [CI/CD spec](https://github.com/kunalv04/devops-iot-project/blob/main/task-2/ci_cd.yml): pipeline config · Pipeline definition for build/test/deploy automation. · `task-2/ci_cd.yml`
- [Pipeline notes](https://github.com/kunalv04/devops-iot-project/blob/main/task-2/README.md): docs · Pipeline-specific guidance and context. · `task-2/README.md`

### Task 3: Network control

Host firewalling, traffic policy, and flow documentation.

- [iptables](https://github.com/kunalv04/devops-iot-project/blob/main/task-3/iptables.sh): firewall rules · Host-level packet filtering and network restriction script. · `task-3/iptables.sh`
- [Nginx policy](https://github.com/kunalv04/devops-iot-project/blob/main/task-3/nginx.conf): nginx config · Alternate Nginx configuration for network-hardening scenarios. · `task-3/nginx.conf`
- [Flow doc](https://github.com/kunalv04/devops-iot-project/tree/main/task-3/newtork-flow): network diagram · Documentation or visualization of traffic paths. · `task-3/newtork-flow`

### Other components

- **External client**: consumer · User or browser traffic entering the deployment boundary.

## Connections

- External client → Nginx edge: HTTP(S) · Inbound traffic terminates at the reverse proxy.
- Nginx edge → Frontend: routes to · Proxy forwards user traffic to the frontend service.
- Nginx edge → Backend: routes to · Proxy exposes backend endpoints through internal routing.
- Nginx edge → LAMP app: routes to · Proxy can expose the PHP application as another target.
- Compose → Frontend: starts · Compose defines and connects the frontend container.
- Compose → Backend: starts · Compose defines and connects the backend container.
- Compose → LAMP app: starts · Compose defines and connects the LAMP container.
- Setup script → Compose: boots · Bootstrap script likely prepares and launches the stack.
- Frontend image → Frontend: builds · Container build artifact for the frontend runtime.
- Backend image → Backend: builds · Container build artifact for the backend runtime.
- LAMP image → LAMP app: builds · Container build artifact for the PHP runtime.
- GitHub Actions → CI/CD spec: runs · GitHub Actions executes the CI/CD workflow definition.
- CI/CD spec → Compose: deploys · Pipeline likely builds or deploys the Compose-based stack.
- Pipeline notes → CI/CD spec: documents · README provides context for the pipeline definition.
- iptables → Nginx edge: filters · Firewall rules constrain access to the exposed edge proxy.
- iptables → Backend: restricts · Network policy can limit direct service reachability.
- Nginx policy → Nginx edge: configures · Alternate Nginx policy informs traffic handling.
- Flow doc → Nginx edge: describes · Traffic-flow documentation centers on the edge proxy.
