# abdeladim-fadlane/42cursus-inception architecture

> Architecture diagram of the GitHub repository abdeladim-fadlane/42cursus-inception, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdeladim-fadlane/42cursus-inception
- Repository: https://github.com/abdeladim-fadlane/42cursus-inception

## Overview

##### Main Components
- Docker Host / Virtual Machine: As the foundation where all Docker containers run.
- Docker Compose: Managed via the srcs/docker-compose.yml file, orchestrating all the services.
- Service Containers:
- Nginx Container(s): There are multiple Nginx services. One is under srcs/requirements/nginx (which contains its specific Dockerfile and conf), and Nginx is also involved in serving the bonus static website.
- MariaDB Container: Located in srcs/requirements/mariadb with its configuration files, Dockerfile, and auxiliary scripts.
- Wordpress Container: Under srcs/requirements/wordpress, with its configuration, Dockerfile, and setup script.
- Bonus Static Website Container: Found in srcs/requirements/bonus/static website, including its Dockerfile, index.html, and nginx.conf dedicated to serving static content.
- Additional Tools/Scripts: Found in the tools directory and within various script files inside the requirements folders, which support system administration and container setup.

##### Relationships and Interactions
- The Docker Compose file ties all these containers together, implying that container intercommunication (via networks) is essential.
- The Nginx components are likely the frontline (reverse proxy or load balancer) that directs external traffic to the respective application containers (Wordpress or static website) and might also handle static file serving.
- The Wordpress container communicates with the MariaDB container to perform database operations.

##### Architectural Patterns and Design Principles
- Containerized Microservices: Each service runs in its own container, isolating its environment and dependencies.
- Orchestration via Docker Compose: Indicates a modular design where dependencies and service lifecycles are managed centrally.
- Standardized Configuration: With dedicated directories for each service (e.g., configuration for Nginx, MariaDB) and accompanying setup scripts, the project emphasizes maintainability and ease of deployment.
- Separation of Concerns: By isolating each service (web server, database, CMS, static content), the design follows best practices for scalability and simplicity.

##### Relevant Technologies and Frameworks
- Docker and Docker Compose: Core technologies for containerization and orchestration.
- Nginx: Likely used both as a web server and reverse proxy.
- MariaDB: The database service for persisting data.
- Wordpress: The CMS running as an application service.
- Linux-based shell scripts: Used for configuration and automation.

## Diagram (Mermaid)

```mermaid
graph TD
    ExternalClient["External Client"]:::external

    subgraph "Docker Host (Virtual Machine)"
        DC["Docker Compose (Orchestration)"]:::orchestration
        NGINX["Nginx Container (Proxy/Static)"]:::container
        WP["Wordpress Container"]:::container
        MDB["MariaDB Container"]:::database
        BONUS["Bonus Static Website Container"]:::container
        TOOLS["Additional Tools/Scripts"]:::tools
    end

    ExternalClient -->|"HTTP_request"| NGINX

    DC -->|"orchestrates"| NGINX
    DC -->|"orchestrates"| WP
    DC -->|"orchestrates"| MDB
    DC -->|"orchestrates"| BONUS
    DC -->|"manages"| TOOLS

    NGINX -->|"routes_to"| WP
    NGINX -->|"serves_static"| BONUS

    WP -->|"DB_queries"| MDB
    MDB -->|"DB_queries"| WP

    classDef external fill:#F8BBD0,stroke:#c0392b,stroke-width:2px;
    classDef orchestration fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
    classDef container fill:#D6EAF8,stroke:#2980B9,stroke-width:2px;
    classDef database fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef tools fill:#D1C4E9,stroke:#7B1FA2,stroke-width:2px;

    click DC "https://github.com/abdeladim-fadlane/42cursus-inception/blob/main/srcs/docker-compose.yml"
    click NGINX "https://github.com/abdeladim-fadlane/42cursus-inception/tree/main/srcs/requirements/nginx"
    click MDB "https://github.com/abdeladim-fadlane/42cursus-inception/tree/main/srcs/requirements/mariadb"
    click WP "https://github.com/abdeladim-fadlane/42cursus-inception/tree/main/srcs/requirements/wordpress"
    click BONUS "https://github.com/abdeladim-fadlane/42cursus-inception/tree/main/srcs/requirements/bonus/static website"
    click TOOLS "https://github.com/abdeladim-fadlane/42cursus-inception/tree/main/srcs/requirements/tools"
```
