# pranitrout07/a-simple-application-using-two-microservices architecture

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

- Interactive diagram: https://gitdiagram.com/pranitrout07/a-simple-application-using-two-microservices
- Repository: https://github.com/pranitrout07/a-simple-application-using-two-microservices

## Overview

##### Main Components
- Modern City Photos Microservice: A backend written in Go that serves city photos on port 3142.
- Mountain Photos Microservice: A backend written in Node.js that serves mountain photos on port 3143.
- The deployment of the client (with environment-specific docker image tags)
- The deployment of the two microservices
- The ingress controller (for production) used to route external traffic.
- External Elements: For production, the Nginx ingress should be clearly shown as the entry point for incoming requests from the outside world.

##### Relationships and Interactions
- In the development environment, show direct port-forward connections – e.g., client on port 3000, city service on port 3142, and mountain service on port 3143.
- Inside the Kubernetes cluster, indicate network flows between the services if desired.

##### Architectural Patterns and Design Principles
- Microservices: Emphasize that the backend functionality is split into two independent services.
- Containerization: Highlight that each component is containerized (Dockerfile present in each service) for deployment.
- Environment Separation: Clearly annotate differences between production and development – such as multiple replicas and the use of an ingress controller in production versus direct port forwarding in development.
- Cloud/Kubernetes Orchestration: Use a block to represent the Kubernetes cluster, and note that manifests (in manifest_files) are used to manage resources.

##### Relevant Technologies
- Frontend: React.js (with Vite, Tailwind, etc.)
- Modern City Photos Microservice: Go (with its module system seen in go.mod)
- Mountain Photos Microservice: Node.js (with package.json, Babel, etc.)
- Deployment & Infrastructure: Docker and Kubernetes (with configuration files in manifest_files and kustomization patches for different environments)
- Networking: Nginx Ingress for production routing.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Internet("Internet"):::external
    K8sManifests("K8s Manifests"):::k8s

    subgraph "Production Environment (Kubernetes Cluster)"
        Ingress("Ingress Controller (Nginx Ingress)"):::ingress
        Frontend("Frontend (React/Vite)"):::client
        City("City Photos Service (Go, port 3142)"):::service
        Mountain("Mountain Photos Service (Node.js, port 3143)"):::service
    end

    subgraph "Development Environment"
        DevClient("Client (Dev: port 3000)"):::dev
        DevCity("City Photos Service (Dev: port3142)"):::dev
        DevMountain("Mountain Photos Service (Dev: port3143)"):::dev
    end

    Internet -->|"routes"| Ingress
    K8sManifests -->|"deploys"| Ingress
    Ingress -->|"forwards"| Frontend
    Frontend -->|"calls_API"| City
    Frontend -->|"calls_API"| Mountain

    DevClient -->|"calls_API"| DevCity
    DevClient -->|"calls_API"| DevMountain

    click Frontend "https://github.com/pranitrout07/a-simple-application-using-two-microservices/tree/main/client/"
    click City "https://github.com/pranitrout07/a-simple-application-using-two-microservices/tree/main/modern-city-photos-microservice/"
    click Mountain "https://github.com/pranitrout07/a-simple-application-using-two-microservices/tree/main/mountain-photos-microservice/"
    click Ingress "https://github.com/pranitrout07/a-simple-application-using-two-microservices/blob/main/manifest_files/env/prod/ingress.yaml"
    click K8sManifests "https://github.com/pranitrout07/a-simple-application-using-two-microservices/tree/main/manifest_files/"

classDef external fill:#ffcccc,stroke:#d62728,stroke-width:2px;
classDef client fill:#ccffcc,stroke:#2ca02c,stroke-width:2px;
classDef service fill:#cce5ff,stroke:#1f77b4,stroke-width:2px;
classDef k8s fill:#fff0b3,stroke:#ff7f0e,stroke-width:2px;
classDef ingress fill:#d9b3ff,stroke:#9467bd,stroke-width:2px;
classDef dev fill:#e6e6e6,stroke:#7f7f7f,stroke-width:2px;
```
