# ranyaserraj/devops_projet architecture

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

- Interactive diagram: https://gitdiagram.com/ranyaserraj/devops_projet
- Repository: https://github.com/ranyaserraj/devops_projet

## Overview

##### Project type and purpose
- This is a full-stack, containerized ERP/CRM application (“IDURAR ERP CRM”) composed of a React-Vite frontend, a Node.js/Express backend, and a MongoDB database.
- It also includes a CI/CD pipeline using Jenkins and a monitoring stack built on Prometheus, Grafana, Alertmanager, cAdvisor, and Node Exporter.

##### File structure
- Top-level folders:
- frontend/ – React app code, public assets, Vite config, Dockerfile
- backend/ – Node.js API, controllers, models, middleware, Dockerfile
- monitoring/ – Prometheus & Grafana configs, dashboards, exporters
- jenkins/ – Jenkins pipeline definitions, Docker Compose for CI/CD
- tests/ – automated tests for backend, frontend, integration, performance
- docker-compose.yml & docker.env – orchestrates all core services
- Presence of separate Dockerfiles and docker-compose.yml indicates container-based deployment.
- Jenkinsfile and monitoring folder show additional infrastructure components beyond the core app.

##### README for additional insights
- Architecture section describes three core services (frontend:3000, backend:5000, mongo:27017) plus a monitoring layer (Prometheus:9090, Grafana:3001).
- CI/CD is managed by Jenkins in its own container.

##### Elements
- Clear, textual labels for each container/service (e.g., “React Frontend (3000)”, “Express API (5000)”, “MongoDB (27017)”).
- Blue rectangles for application components (frontend, backend)
- Orange or yellow parallelograms for CI/CD and monitoring services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main user and application flow
    User["User (Browser/Mobile)"]:::external
    Frontend["React Frontend (3000)"]:::frontend
    Backend["Express API (5000)"]:::backend
    Database["MongoDB (27017)"]:::db
    Email["SMTP/Email Service"]:::external
    Auth["OAuth2/JWT Identity Provider"]:::external
    DockerCompose["Docker Compose Orchestration"]:::infra

    User -->|"HTTP/HTTPS"| Frontend
    Frontend -->|"REST API"| Backend
    Backend -->|"Reads/Writes"| Database
    Backend -->|"Sends Email"| Email
    Frontend -->|"Auth Redirect"| Auth
    DockerCompose -->|-.-| Frontend
    DockerCompose -->|-.-| Backend
    DockerCompose -->|-.-| Database

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        direction TB
        JenkinsPipeline["Jenkins Pipeline"]:::ci
        JenkinsContainer["Jenkins Container"]:::ci
        JenkinsPipeline -->|"Defines Build/Test/Deploy"| JenkinsContainer
        JenkinsContainer -->|"Deploys via"| DockerCompose
    end

    %% Monitoring Stack
    subgraph "Monitoring Stack"
        direction TB
        MonitoringCompose["Monitoring Docker Compose"]:::monitor
        Prometheus["Prometheus (9090)"]:::monitor
        Alertmanager["Alertmanager"]:::monitor
        Grafana["Grafana (3001)"]:::monitor
        cAdvisor["cAdvisor (8081)"]:::monitor
        NodeExporter["Node Exporter (9100)"]:::monitor
        JenkinsExporter["Jenkins Metrics Exporter"]:::monitor

        MonitoringCompose --> Prometheus
        MonitoringCompose --> Grafana
        MonitoringCompose --> Alertmanager
        MonitoringCompose --> cAdvisor
        MonitoringCompose --> NodeExporter

        Prometheus -->|"Scrapes Metrics"| cAdvisor
        Prometheus -->|"Scrapes Metrics"| NodeExporter
        Prometheus -->|"Scrapes /metrics"| Backend
        Prometheus -->|"Sends Alerts"| Alertmanager
        Grafana -->|"Reads From"| Prometheus
        Backend -->|"Executes"| JenkinsExporter
        JenkinsExporter -->|"Exports to"| Prometheus
    end

    %% Click Events
    click Frontend "https://github.com/ranyaserraj/devops_projet/tree/master/frontend/"
    click Backend "https://github.com/ranyaserraj/devops_projet/tree/master/backend/"
    click Database "https://github.com/ranyaserraj/devops_projet/blob/master/docker-compose.yml"
    click DockerCompose "https://github.com/ranyaserraj/devops_projet/blob/master/docker-compose.yml"
    click JenkinsPipeline "https://github.com/ranyaserraj/devops_projet/tree/master/Jenkinsfile"
    click JenkinsContainer "https://github.com/ranyaserraj/devops_projet/tree/master/jenkins/"
    click MonitoringCompose "https://github.com/ranyaserraj/devops_projet/blob/master/monitoring/docker-compose.yml"
    click Prometheus "https://github.com/ranyaserraj/devops_projet/blob/master/monitoring/prometheus/prometheus.yml"
    click Alertmanager "https://github.com/ranyaserraj/devops_projet/blob/master/monitoring/alertmanager/alertmanager.yml"
    click Grafana "https://github.com/ranyaserraj/devops_projet/blob/master/monitoring/grafana/provisioning/datasources/prometheus.yml"
    click JenkinsExporter "https://github.com/ranyaserraj/devops_projet/blob/master/monitoring/scripts/jenkins-metrics-exporter.js"

    %% Styles
    classDef frontend fill:#cff,stroke:#069,stroke-width:1px;
    classDef backend fill:#ccf,stroke:#036,stroke-width:1px;
    classDef db fill:#cfc,stroke:#393,stroke-width:1px,stroke-dasharray: 5 5;
    classDef ci fill:#fec,stroke:#e90,stroke-width:1px;
    classDef monitor fill:#fcf,stroke:#c09,stroke-width:1px;
    classDef external fill:#eee,stroke:#888,stroke-width:1px;
    classDef infra fill:#f2f2f2,stroke:#666,stroke-width:1px,stroke-dasharray: 2 2;
```
