# chily671/eco-web-microservice architecture

> Architecture diagram of the GitHub repository chily671/eco-web-microservice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chily671/eco-web-microservice
- Repository: https://github.com/chily671/eco-web-microservice

## Overview

##### Main Components
- Front-End Client: Found in the “Front-end-e-co” directory; this is your user interface built likely with React (given the structure with JSX files and assets).
- API Gateway / Proxy: Look at the “gateway” and “proxy” directories. The gateway likely acts as a central entry point to route client requests to the appropriate microservices.
- Microservices: There are multiple backend services, each in its own directory:
- Chat-Service (with the README indicating it runs on PORT 5008)
- Order-service
- Pay-service
- Products-service
- Rating-service
- Users-Service
- Recommender-System-Service (Python-based recommender algorithms)
- Search-image-for-web (for image-based search functionality)
- Infrastructure and Orchestration: Notice the “.github/workflows” for CI/CD pipelines, “docker-compose.yml” files in several services, Kubernetes configuration files in “k8s” and Helm charts in “ecommerce-chart.” These files indicate deployment orchestration.
- Supporting Tools: There is a “Tool” directory that holds scripts and data (like CSVs) possibly used for batch processing or additional utility functions.

##### Relationships and Interactions
- The front-end communicates with the API Gateway/Proxy, which then routes requests to the appropriate backend service.
- Each microservice (chat, orders, payment, products, users, ratings) is self-contained, typically with its own database configuration (evidenced by separate “database” or “Database-<service>” folders, models, and repository patterns) and service layers.
- The gateway/proxy (often using Nginx, suggested by configuration files such as “nginx.conf”), handles inbound web requests and may also manage load balancing or request routing.
- Inter-service communication may happen through REST APIs (as seen in the “api” folders); also, some event-based or messaging patterns could be implemented (for instance, “app-events.js” files in several services).

##### Architectural Patterns & Design Principles
- Microservices Architecture: Each service is an independent, containerized component (with its own Dockerfile, deployment configurations).
- Separation of Concerns: Services are separated by business capability (chat, order, payment, product, etc.) and each encapsulates its own “database,” “api,” and “services” layers.
- Containerization & Orchestration: Dockerfiles and docker-compose files per service, along with Kubernetes (“k8s”) and Helm charts (“ecommerce-chart”), indicate a design geared toward portability and scalability.
- CI/CD Pipelines: The GitHub workflows in “.github/workflows” represent the automated build, test, and deploy processes.

##### Technologies, Frameworks, and Libraries
- Backend: Node.js & Express (multiple “index.js” and “express-app.js” files within services)
- Frontend: Likely React (evident from .jsx files and the typical React project structure)
- Database: Likely usage of relational or NoSQL databases (each service has its “connection.js” and “models” directories)
- Containerization: Docker (Dockerfiles and docker-compose usage)
- Orchestration: Kubernetes configurations and Helm charts
- Others: GitHub Actions for CI/CD pipelines, Nginx (proxy configuration), and Python for recommendation and image search services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface Layer"
        FE["Front-End Client"]:::frontend
    end

    %% API Gateway / Proxy Layer
    subgraph "API Gateway / Proxy"
        API["API Gateway/Proxy"]:::gateway
    end

    %% Backend Microservices Layer
    subgraph "Backend Microservices"
        Chat["Chat-Service (PORT 5008)"]:::backend
        Order["Order-service"]:::backend
        Pay["Pay-service"]:::backend
        Products["Products-service"]:::backend
        Rating["Rating-service"]:::backend
        Users["Users-Service"]:::backend
        Recommender["Recommender-System-Service"]:::backend
        Search["Search-image-for-web"]:::backend
    end

    %% Deployment & Infrastructure Layer
    subgraph "Deployment & Infrastructure"
        Infra["Kubernetes & Helm Orchestration"]:::infrastructure
        CICD["CI/CD Pipelines"]:::cicd
    end

    %% Supporting Tools Layer
    subgraph "Supporting Tools"
        Tools["Supporting Tools"]:::tools
    end

    %% Connections
    FE -->|"calls"| API
    API -->|"routesTo"| Chat
    API -->|"routesTo"| Order
    API -->|"routesTo"| Pay
    API -->|"routesTo"| Products
    API -->|"routesTo"| Rating
    API -->|"routesTo"| Users
    API -->|"routesTo"| Recommender
    API -->|"routesTo"| Search
    CICD -->|"deploysTo"| Infra

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef gateway fill:#FAD7A0,stroke:#A04000,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef infrastructure fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef cicd fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef tools fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;

    %% Click Events
    click FE "https://github.com/chily671/eco-web-microservice/tree/main/Front-end-e-co/"
    click API "https://github.com/chily671/eco-web-microservice/tree/main/gateway/"
    click API "https://github.com/chily671/eco-web-microservice/tree/main/proxy/"
    click Chat "https://github.com/chily671/eco-web-microservice/tree/main/Chat-Service/"
    click Order "https://github.com/chily671/eco-web-microservice/tree/main/Order-service/"
    click Pay "https://github.com/chily671/eco-web-microservice/tree/main/Pay-service/"
    click Products "https://github.com/chily671/eco-web-microservice/tree/main/Products-service/"
    click Rating "https://github.com/chily671/eco-web-microservice/tree/main/Rating-service/"
    click Users "https://github.com/chily671/eco-web-microservice/tree/main/Users-Service/"
    click Recommender "https://github.com/chily671/eco-web-microservice/tree/main/Recommender-System-Service/"
    click Search "https://github.com/chily671/eco-web-microservice/tree/main/Search-image-for-web/"
    click Infra "https://github.com/chily671/eco-web-microservice/tree/main/k8s/"
    click Infra "https://github.com/chily671/eco-web-microservice/tree/main/ecommerce-chart/"
    click CICD "https://github.com/chily671/eco-web-microservice/tree/main/.github/workflows/"
    click Tools "https://github.com/chily671/eco-web-microservice/tree/main/Tool/"
```
