# johnnyalex77/todo-devops architecture

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

- Interactive diagram: https://gitdiagram.com/johnnyalex77/todo-devops
- Repository: https://github.com/johnnyalex77/todo-devops

## Overview

This is a minimal task-management API with a PostgreSQL-backed CRUD workflow and a documented DevOps deployment path. The sampled code shows server startup, route registration, database initialization, and task queries; deployment details are represented only where the README documents them.

Main entry points: [`.github/workflows/ci-cd.yml`](https://github.com/johnnyalex77/todo-devops/blob/main/.github/workflows/ci-cd.yml) (GitHub Actions), [`app/index.js`](https://github.com/johnnyalex77/todo-devops/blob/main/app/index.js) (Express server), [`app/db.js`](https://github.com/johnnyalex77/todo-devops/blob/main/app/db.js) (PostgreSQL), [`docker/docker-compose.yml`](https://github.com/johnnyalex77/todo-devops/blob/main/docker/docker-compose.yml) (Docker Compose)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Task API"]
  node_server["Express server<br/>[index.js]"]
  node_tasks["Task and health routes<br/>[routes.js]"]
end

subgraph group_data["Persistence"]
  node_database[("PostgreSQL<br/>[db.js]")]
end

subgraph group_delivery["DevOps delivery"]
  node_compose["Docker Compose<br/>[docker-compose.yml]"]
  node_image["Container image"]
  node_pipeline["GitHub Actions<br/>[ci-cd.yml]"]
  node_registry["Docker Hub"]
  node_terraform["Terraform infrastructure<br/>[main.tf]"]
  node_ec2["AWS EC2"]
end

node_user(("API user"))

node_user -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_tasks
node_server -->|"initializes schema"| node_database
node_tasks -->|"queries tasks"| node_database
node_compose -.->|"builds image"| node_image
node_compose -.->|"runs PostgreSQL"| node_database
node_pipeline -->|"builds image"| node_image
node_pipeline -->|"publishes image"| node_registry
node_pipeline -->|"deploys via SSH"| node_ec2
node_terraform -->|"provisions"| node_ec2

click node_server "https://github.com/johnnyalex77/todo-devops/blob/main/app/index.js"
click node_tasks "https://github.com/johnnyalex77/todo-devops/blob/main/app/routes.js"
click node_database "https://github.com/johnnyalex77/todo-devops/blob/main/app/db.js"
click node_compose "https://github.com/johnnyalex77/todo-devops/blob/main/docker/docker-compose.yml"
click node_image "https://github.com/johnnyalex77/todo-devops/blob/main/docker/Dockerfile"
click node_pipeline "https://github.com/johnnyalex77/todo-devops/blob/main/.github/workflows/ci-cd.yml"
click node_terraform "https://github.com/johnnyalex77/todo-devops/blob/main/infra/main.tf"

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_server,node_tasks,node_user toneBlue
class node_database toneAmber
class node_compose,node_image,node_pipeline,node_registry,node_terraform,node_ec2 toneMint
```

## Components

### Task API

- [Express server](https://github.com/johnnyalex77/todo-devops/blob/main/app/index.js): `app/index.js`
- [Task and health routes](https://github.com/johnnyalex77/todo-devops/blob/main/app/routes.js): `app/routes.js`

### Persistence

- [PostgreSQL](https://github.com/johnnyalex77/todo-devops/blob/main/app/db.js): `app/db.js`

### DevOps delivery

- [Docker Compose](https://github.com/johnnyalex77/todo-devops/blob/main/docker/docker-compose.yml): `docker/docker-compose.yml`
- [Container image](https://github.com/johnnyalex77/todo-devops/blob/main/docker/Dockerfile): `docker/Dockerfile`
- [GitHub Actions](https://github.com/johnnyalex77/todo-devops/blob/main/.github/workflows/ci-cd.yml): `.github/workflows/ci-cd.yml`
- **Docker Hub**
- [Terraform infrastructure](https://github.com/johnnyalex77/todo-devops/blob/main/infra/main.tf): `infra/main.tf`
- **AWS EC2**

### Other components

- **API user**

## Connections

- API user → Express server: sends requests (evidence: `README.md`)
- Express server → Task and health routes: mounts routes (evidence: `app/index.js`)
- Express server → PostgreSQL: initializes schema (evidence: `app/index.js`)
- Task and health routes → PostgreSQL: queries tasks (evidence: `app/routes.js`)
- Docker Compose → Container image: builds image (evidence: `README.md`)
- Docker Compose → PostgreSQL: runs PostgreSQL (evidence: `README.md`)
- GitHub Actions → Container image: builds image (evidence: `README.md`)
- GitHub Actions → Docker Hub: publishes image (evidence: `README.md`)
- GitHub Actions → AWS EC2: deploys via SSH (evidence: `README.md`)
- Terraform infrastructure → AWS EC2: provisions (evidence: `README.md`)
