# diogosobral/docker-multi-container-app architecture

> Architecture diagram of the GitHub repository diogosobral/docker-multi-container-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/diogosobral/docker-multi-container-app
- Repository: https://github.com/diogosobral/docker-multi-container-app

## Overview

Project Analysis:
This is a containerized web application that appears to be a Todo list application using Node.js with an EJS template engine and likely includes a database component (based on the volume information and compose.yaml presence).

##### Main Components

a. Container Architecture Layer:
- Docker Compose Environment (outer boundary)
- Application Container
- Database Container (implied by the volume mount)
- Volumes (for persistent data storage)

b. Application Layer:
- Express.js Server (server.js)
- Routes Layer (routes/front.js)
- Models Layer (models/Todo.js)
- View Layer (views/todos.ejs)
- Configuration (config/keys.js)

- [Docker Compose Environment]
- [App Container]
- Express Server
- Routes
- Models
- Views
- Config
- [Database Container]
- [Volumes]
- database_data

##### Additional Details

a. Port Mappings:
- Port 3000 exposed to host (from README)

b. Key Technologies:
- Node.js/Express
- EJS templating
- Docker/Docker Compose

c. Data Flow:
- Client requests → Express Router → Controller → Model → Database
- Database → Model → Controller → View (EJS) → Client

##### Important Notes

- Volume mount path for Windows 11 as mentioned in README
- Development environment access point (localhost:3000)
- Configuration injection points from config/keys.js

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Docker["Docker Compose Environment"]
        direction TB
        subgraph AC["Application Container"]
            direction TB
            ES["Express Server"]
            subgraph AL["Application Layer"]
                direction TB
                RL["Routes Layer"]
                ML["Models Layer"]
                VL["Views Layer (EJS)"]
                CL["Configuration Layer"]
            end
            ES --> RL
            RL --> ML
            ML --> VL
            CL -.-> ES
        end
        
        subgraph DC["Database Container"]
            DB[(Database)]
        end
        
        subgraph VOL["Volumes"]
            DBV[("database_data")]
        end
        
        DB <--> DBV
        ML <--> DB
    end
    
    CLIENT((Client)) --> |"HTTP :3000"| ES
    
    %% Styling
    classDef container fill:#e1f5fe,stroke:#01579b
    classDef application fill:#c8e6c9,stroke:#2e7d32
    classDef database fill:#fff3e0,stroke:#e65100
    classDef volume fill:#f5f5f5,stroke:#616161
    classDef client fill:#f3e5f5,stroke:#4a148c
    classDef config fill:#ffebee,stroke:#b71c1c
    
    class Docker,AC,DC container
    class ES,RL,ML,VL application
    class DB database
    class VOL,DBV volume
    class CLIENT client
    class CL config
    
    %% Click events for component mapping
    click Docker "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/compose.yaml"
    click AC "https://github.com/DiogoSobral/docker-multi-container-app/tree/main/app/Dockerfile"
    click ES "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/server.js"
    click RL "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/routes/front.js"
    click ML "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/models/Todo.js"
    click VL "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/views/todos.ejs"
    click CL "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/config/keys.js"
    click AC "https://github.com/DiogoSobral/docker-multi-container-app/tree/main/app/"
    click AC "https://github.com/DiogoSobral/docker-multi-container-app/blob/main/app/.dockerignore"
```
