# ahmednaeim1/stylesphereapis architecture

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

- Interactive diagram: https://gitdiagram.com/ahmednaeim1/stylesphereapis
- Repository: https://github.com/ahmednaeim1/stylesphereapis

## Overview

##### Project type and purpose
- This is a backend-only microservices system (“styleSphereAPIs”) for a graduation project.
- It uses an API Gateway plus seven independent services, each handling a specific business domain (business, checkout, following, order, product, social, user).

##### File structure
- Root: contains an “apiGateway” folder (Node.js) and one folder per microservice.
- apiGateway:
- gateway.js orchestrates routing to downstream services
- routes/… and controllers/… mirror each service’s API endpoints.
- businessService: .NET Core service with Controllers, Models, Repositories, appsettings, launch configurations.
- checkoutSerrvice: Java Spring Boot (pom.xml, src/main/java with controllers, models, repository).
- followingService & orderService: Python Flask apps (app.py, controllers, models, repositories, swagger.json).
- productService, socialService, userService: Node.js/Express apps with api/controllers, api/routes, api/repositories, dbConfig.
- Each microservice likely has its own database (config files), models, and repository layer.

##### Detail without overthinking
- Every service, the gateway, and their databases.
- Client-to-gateway, gateway-to-service, service-to-DB, service-to-external/API flows.
- Do not omit any microservice or data store.

## Diagram (Mermaid)

```mermaid
graph TD
    Client["Client (Web/Mobile)"]:::external

    subgraph "API Gateway"
        GW["API Gateway"]:::gateway
        GWRoutes["Gateway Routes"]:::gateway
        GWControllers["Gateway Controllers"]:::gateway
    end

    subgraph "Business Service (.NET Core)"
        Biz["Business Service"]:::dotnet
        BizControllers["Controllers"]:::dotnet
        BizModels["Models"]:::dotnet
        BizRepos["Repositories"]:::dotnet
        BizDB[(Business DB)]:::db
    end

    subgraph "Checkout Service (Java Spring Boot)"
        CO["Checkout Service"]:::java
        COControllers["Controllers"]:::java
        COModels["Models"]:::java
        CORepos["Repositories"]:::java
        CODB[(Checkout DB)]:::db
    end

    subgraph "Following Service (Python Flask)"
        FLW["Following Service"]:::python
        FLWControllers["Controllers"]:::python
        FLWModels["Models"]:::python
        FLWRepos["Repositories"]:::python
        FLWDB[(Following DB)]:::db
    end

    subgraph "Order Service (Python Flask)"
        ORD["Order Service"]:::python
        ORDControllers["Controllers"]:::python
        ORDModels["Models"]:::python
        ORDRepos["Repositories"]:::python
        ORDDB[(Order DB)]:::db
    end

    subgraph "Product Service (Node.js)"
        PRD["Product Service"]:::nodejs
        PRDControllers["Controllers"]:::nodejs
        PRDModels["Models"]:::nodejs
        PRDRepos["Repositories"]:::nodejs
        PRDDB[(Product DB)]:::db
    end

    subgraph "Social Service (Node.js)"
        SOC["Social Service"]:::nodejs
        SOCControllers["Controllers"]:::nodejs
        SOCRepos["Repositories"]:::nodejs
        SOCDB[(Social DB)]:::db
    end

    subgraph "User Service (Node.js)"
        USR["User Service"]:::nodejs
        USRControllers["Controllers"]:::nodejs
        USRModels["Models"]:::nodejs
        USRRepos["Repositories"]:::nodejs
        USRDB[(User DB)]:::db
    end

    subgraph "External Services"
        Payment["Payment Provider"]:::external
        Shipping["Shipping Provider"]:::external
    end

    %% Client to Gateway
    Client -->|HTTP/REST| GW

    %% Gateway to services
    GW -->|HTTP/REST| Biz
    GW -->|HTTP/REST| CO
    GW -->|HTTP/REST| FLW
    GW -->|HTTP/REST| ORD
    GW -->|HTTP/REST| PRD
    GW -->|HTTP/REST| SOC
    GW -->|HTTP/REST| USR

    %% Service internals
    Biz --> BizControllers --> BizModels --> BizRepos --> BizDB
    CO --> COControllers --> COModels --> CORepos --> CODB
    FLW --> FLWControllers --> FLWModels --> FLWRepos --> FLWDB
    ORD --> ORDControllers --> ORDModels --> ORDRepos --> ORDDB
    PRD --> PRDControllers --> PRDModels --> PRDRepos --> PRDDB
    SOC --> SOCControllers --> SOCRepos --> SOCDB
    USR --> USRControllers --> USRModels --> USRRepos --> USRDB

    %% Inter-service calls
    CO -->|calls Order API| ORD

    %% External API calls
    CO -->|HTTP/REST| Payment
    CO -->|HTTP/REST| Shipping

    %% Click Events
    click GW "https://github.com/ahmednaeim1/stylesphereapis/blob/main/apiGateway/gateway.js"
    click GWRoutes "https://github.com/ahmednaeim1/stylesphereapis/tree/main/apiGateway/routes/"
    click GWControllers "https://github.com/ahmednaeim1/stylesphereapis/tree/main/apiGateway/controllers/"

    click BizControllers "https://github.com/ahmednaeim1/stylesphereapis/blob/main/businessService/businessService/Controllers/businessController.cs"
    click BizModels "https://github.com/ahmednaeim1/stylesphereapis/blob/main/businessService/businessService/Models/businessModel.cs"
    click BizRepos "https://github.com/ahmednaeim1/stylesphereapis/blob/main/businessService/businessService/Repositories/Business/BusinessRepository.cs"

    click CO "https://github.com/ahmednaeim1/stylesphereapis/blob/main/checkoutSerrvice/src/main/java/com/ahmednaeim/checkoutService/checkoutServiceApplication.java"
    click COControllers "https://github.com/ahmednaeim1/stylesphereapis/tree/main/checkoutSerrvice/src/main/java/com/ahmednaeim/checkoutService/controllers/"
    click COModels "https://github.com/ahmednaeim1/stylesphereapis/tree/main/checkoutSerrvice/src/main/java/com/ahmednaeim/checkoutService/models/"
    click CORepos "https://github.com/ahmednaeim1/stylesphereapis/tree/main/checkoutSerrvice/src/main/java/com/ahmednaeim/checkoutService/repository/"

    click FLW "https://github.com/ahmednaeim1/stylesphereapis/blob/main/followingService/app.py"
    click FLWControllers "https://github.com/ahmednaeim1/stylesphereapis/blob/main/followingService/controllers/following_controller.py"
    click FLWModels "https://github.com/ahmednaeim1/stylesphereapis/blob/main/followingService/models/following_model.py"
    click FLWRepos "https://github.com/ahmednaeim1/stylesphereapis/blob/main/followingService/repositories/following_repository.py"

    click ORD "https://github.com/ahmednaeim1/stylesphereapis/blob/main/orderService/app.py"
    click ORDControllers "https://github.com/ahmednaeim1/stylesphereapis/blob/main/orderService/controllers/order_controller.py"
    click ORDModels "https://github.com/ahmednaeim1/stylesphereapis/blob/main/orderService/models/orderModel.py"
    click ORDRepos "https://github.com/ahmednaeim1/stylesphereapis/blob/main/orderService/repositories/order_repository.py"

    click PRD "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/app.js"
    click PRDControllers "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/api/controllers/productController.js"
    click PRDModels "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/api/model/product.js"
    click PRDRepos "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/api/repositories/productRepository.js"
    click PRDDB "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/dbConfig/dbConfig.js"
    click PRDRoutes "https://github.com/ahmednaeim1/stylesphereapis/blob/main/productService/api/routes/productRoute.js"

    click SOC "https://github.com/ahmednaeim1/stylesphereapis/blob/main/socialService/app.js"
    click SOCControllers "https://github.com/ahmednaeim1/stylesphereapis/tree/main/socialService/api/controllers/"
    click SOCRepos "https://github.com/ahmednaeim1/stylesphereapis/tree/main/socialService/api/repositories/"
    click SOCDB "https://github.com/ahmednaeim1/stylesphereapis/blob/main/socialService/dbConfig/dbConfig.js"
    click SOCRoutes "https://github.com/ahmednaeim1/stylesphereapis/tree/main/socialService/api/routes/"

    click USR "https://github.com/ahmednaeim1/stylesphereapis/blob/main/userService/app.js"
    click USRControllers "https://github.com/ahmednaeim1/stylesphereapis/tree/main/userService/api/controllers/"
    click USRModels "https://github.com/ahmednaeim1/stylesphereapis/tree/main/userService/api/model/"
    click USRRepos "https://github.com/ahmednaeim1/stylesphereapis/tree/main/userService/api/repositories/"
    click USRDB "https://github.com/ahmednaeim1/stylesphereapis/blob/main/userService/dbConfig/dbConfig.js"
    click USRRoutes "https://github.com/ahmednaeim1/stylesphereapis/blob/main/userService/api/routes/userRoute.js"

    %% Styles
    classDef nodejs fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef python fill:#7FFFD4,stroke:#000,stroke-width:1px
    classDef java fill:#FFA500,stroke:#000,stroke-width:1px
    classDef dotnet fill:#9370DB,stroke:#000,stroke-width:1px
    classDef gateway fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef db fill:#F4A460,stroke:#000,stroke-width:1px
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px
```
