# kasvith/simple-microservice-example architecture

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

- Interactive diagram: https://gitdiagram.com/kasvith/simple-microservice-example
- Repository: https://github.com/kasvith/simple-microservice-example

## Overview

1. API Gateway (using NodeJS) – this acts as the central routing layer for incoming HTTP requests.
2. Frontend Application – a static/dynamic web client (HTML, jQuery, Bulma) built with webpack that communicates with the API Gateway.
3. Quote Service (using Python) – a microservice responsible for providing quote-related functionality.

- API Gateway: Represented by the “ApiGateway” directory which contains index.js, Dockerfile, and package.json.
- Frontend Application: Represented by the “FrontendApplication” folder, including its Dockerfile, webpack setup, and built assets.
- Quote Service: Represented by the “QuoteService” folder; a Python microservice handling quotes (main.py, quotes.txt).

##### Their interactions
- The Frontend Application makes calls (using REST API requests) to the API Gateway.
- The API Gateway forwards specific routes or requests to the Quote Service.
- All these services are coordinated via Docker-Compose as indicated by docker-compose.yml, facilitating communication between containers.

##### Architectural patterns and design principles
- Microservices: Each component runs as an individual service.
- Containerization: Each of the services is containerized (each having its own Dockerfile) and orchestrated using Docker Compose.
- Separation of Concerns: The project clearly divides responsibilities between API handling (API Gateway), presentation (Frontend), and business logic/service (Quote Service).

##### Incorporate the following technologies and tools
- NodeJS for the API Gateway.
- Python for the Quote Service (note the requirements file and main.py).
- webpack, HTML, jQuery, Bulma for the Frontend.
- Docker and docker-compose for deployment and orchestration.

##### Final detailing
- That the system follows a modular microservices approach with each service independently deployable as Docker containers.
- Specific ports mentioned in the README (e.g., API gateway on port 3000, Frontend exposed on port 8080).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Docker Compose"
        F1["Frontend Application"]:::frontend
        A1["API Gateway"]:::api
        Q1["Quote Service"]:::quote
    end

    F1 -->|"HTTP_requests"| A1
    A1 -->|"internal_calls"| Q1

    click A1 "https://github.com/kasvith/simple-microservice-example/blob/master/ApiGateway/index.js"
    click A1 "https://github.com/kasvith/simple-microservice-example/blob/master/ApiGateway/package.json"
    click A1 "https://github.com/kasvith/simple-microservice-example/blob/master/ApiGateway/app.dockerfile"

    click F1 "https://github.com/kasvith/simple-microservice-example/tree/master/FrontendApplication/"
    click F1 "https://github.com/kasvith/simple-microservice-example/blob/master/FrontendApplication/webpack.config.js"
    click F1 "https://github.com/kasvith/simple-microservice-example/tree/master/FrontendApplication/dist/"
    click F1 "https://github.com/kasvith/simple-microservice-example/tree/master/FrontendApplication/src/"

    click Q1 "https://github.com/kasvith/simple-microservice-example/blob/master/QuoteService/main.py"
    click Q1 "https://github.com/kasvith/simple-microservice-example/blob/master/QuoteService/quotes.txt"
    click Q1 "https://github.com/kasvith/simple-microservice-example/blob/master/QuoteService/app.dockerfile"

    classDef api fill:#ffd966,stroke:#333,stroke-width:2px;
    classDef frontend fill:#a4c2f4,stroke:#333,stroke-width:2px;
    classDef quote fill:#b6d7a8,stroke:#333,stroke-width:2px;
```
