# rodrigorodrigues/microservices-design-patterns architecture

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

- Interactive diagram: https://gitdiagram.com/rodrigorodrigues/microservices-design-patterns
- Repository: https://github.com/rodrigorodrigues/microservices-design-patterns

## Overview

##### Main Components
- Core Services: Represent each microservice as a separate component:
- Java-based services: admin-server, authentication-service, person-service, user-service, edge-server, redis-jackson-security-webauthn-otp.
- Other language-based services: go-service, nodejs-service, kotlin-service, python-service, quarkus-service.
- Shared Libraries/Commons: authentication-common and web-common, which provide common configurations and utilities across services.
- Frontends: react-webapp (web application) and react-native-app (Android/native app).
- Supporting Infrastructure:
- API Gateway / Edge service: The edge-server that routes and filters incoming requests.
- Service Discovery & Configuration: Mark a component representing Consul (for service discovery and configuration management) and Spring Cloud Config.
- Monitoring & Logging: Include monitoring components such as Prometheus, Grafana, Jaeger (for distributed tracing), and logging aggregators (Logstash, Loki).
- Databases: Each microservice uses its own database instance (typically MongoDB for persistence) and a shared Redis instance for session information.

- The frontend applications (React and React Native) call the API Gateway/edge-server.
- The edge-server routes authenticated requests to individual microservices.
- Each microservice communicates with its own dedicated database and may also interact with shared resources (e.g., Redis).
- A centralized configuration component (Consul/Config Server) feeds configuration data to the services.
- Service discovery (also provided by Consul) shows how services locate and communicate with one another.
- CI/CD pipelines (both Travis and GitHub Actions) are used to build, test, and deploy these services; you might illustrate these as external tooling that triggers builds and deployment processes.

##### Architectural Patterns and Technologies
- Microservices Pattern: Show each microservice as an independent deployable unit.
- API Gateway Pattern: Emphasize the edge-server that secures, routes, and aggregates service responses.
- “Database per Service” Pattern: Indicate multiple, independent MongoDB instances.
- Containerization & Orchestration: Illustrate Docker images and the Kubernetes deployment layer.
- CI/CD Integration: Optionally, include a side-panel illustrating CI/CD pipelines targeting multiple platforms (linux/amd64, linux/arm64).

##### Adding Detailed Elements
- Inside it, partition areas for:
- Back-end services (each microservice as an individual block).
- Frontend applications.
- Infrastructure components such as Consul, Redis, and MongoDB.
- CI/CD pipelines (as external systems that are part of the deployment management process).
- Use legends or notes to clarify which services are implemented in which language, so the multi-language nature of the system is highlighted.

##### Be Detailed, But Stay Organized
- Detail deployment artifacts such as Dockerfiles, Kubernetes manifests, and CI/CD configuration files (which are visible in the file tree) to emphasize the modern DevOps approach.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Applications"
        reactWebapp["react-webapp"]:::frontend
        reactNativeApp["react-native-app"]:::frontend
    end

    %% API Gateway Layer
    subgraph "API Gateway"
        edgeServer["API Gateway (edge-server)"]:::service
    end

    %% Backend Microservices Layer
    subgraph "Backend Microservices"
        subgraph "Java-based Services"
            adminService["Admin Microservice (Spring Boot)"]:::service
            authService["Authentication Microservice (Spring Boot)"]:::service
            personService["Person Microservice (Spring Boot)"]:::service
            userService["User Microservice (Spring Boot)"]:::service
            redisService["Redis WebAuthn Service"]:::service
        end
        subgraph "Other Language Services"
            goService["Go-based Service"]:::service
            nodejsService["NodeJS-based Service"]:::service
            kotlinService["Kotlin-based Service"]:::service
            pythonService["Python-based Service"]:::service
            quarkusService["Quarkus-based Service"]:::service
        end
    end

    %% Shared Libraries/Commons
    subgraph "Shared Libraries"
        authCommon["Shared Authentication Library"]:::common
        webCommon["Shared Web Utilities Library"]:::common
    end

    %% Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        configServer["Consul/Config Server"]:::support
        cicd["CI/CD & Kubernetes Deployment"]:::support
        monitoring["Monitoring & Logging"]:::support
        redisDB["Redis (Shared Session)"]:::database
    end

    %% Databases for Microservices
    subgraph "Databases"
        adminDB["MongoDB (Admin)"]:::database
        authDB["MongoDB (Auth)"]:::database
        personDB["MongoDB (Person)"]:::database
        userDB["MongoDB (User)"]:::database
        goDB["MongoDB (Go)"]:::database
        nodejsDB["MongoDB (NodeJS)"]:::database
        kotlinDB["MongoDB (Kotlin)"]:::database
        pythonDB["MongoDB (Python)"]:::database
        quarkusDB["MongoDB (Quarkus)"]:::database
    end

    %% Connections from Frontend to API Gateway
    reactWebapp -->|"calls"| edgeServer
    reactNativeApp -->|"calls"| edgeServer

    %% Connections from API Gateway to Backend Microservices
    edgeServer -->|"routes to"| adminService
    edgeServer -->|"routes to"| authService
    edgeServer -->|"routes to"| personService
    edgeServer -->|"routes to"| userService
    edgeServer -->|"routes to"| redisService
    edgeServer -->|"routes to"| goService
    edgeServer -->|"routes to"| nodejsService
    edgeServer -->|"routes to"| kotlinService
    edgeServer -->|"routes to"| pythonService
    edgeServer -->|"routes to"| quarkusService

    %% Each Microservice uses its dedicated MongoDB instance
    adminService --> adminDB
    authService --> authDB
    personService --> personDB
    userService --> userDB
    goService --> goDB
    nodejsService --> nodejsDB
    kotlinService --> kotlinDB
    pythonService --> pythonDB
    quarkusService --> quarkusDB
    redisService --> redisDB

    %% Microservices get configuration from Config Server
    adminService -->|"config"| configServer
    authService -->|"config"| configServer
    personService -->|"config"| configServer
    userService -->|"config"| configServer
    redisService -->|"config"| configServer
    goService -->|"config"| configServer
    nodejsService -->|"config"| configServer
    kotlinService -->|"config"| configServer
    pythonService -->|"config"| configServer
    quarkusService -->|"config"| configServer

    %% Shared libraries used by microservices (dotted lines)
    authService -.-> authCommon
    userService -.-> webCommon
    personService -.-> webCommon
    adminService -.-> authCommon

    %% CI/CD Deployment Triggers
    cicd -->|"deploys"| edgeServer
    cicd -->|"deploys"| adminService
    cicd -->|"deploys"| authService
    cicd -->|"deploys"| personService
    cicd -->|"deploys"| userService
    cicd -->|"deploys"| redisService
    cicd -->|"deploys"| goService
    cicd -->|"deploys"| nodejsService
    cicd -->|"deploys"| kotlinService
    cicd -->|"deploys"| pythonService
    cicd -->|"deploys"| quarkusService

    %% Monitoring observes key components
    monitoring --> edgeServer
    monitoring --> adminService
    monitoring --> authService
    monitoring --> personService
    monitoring --> userService
    monitoring --> redisService
    monitoring --> goService
    monitoring --> nodejsService
    monitoring --> kotlinService
    monitoring --> pythonService
    monitoring --> quarkusService
    monitoring --> configServer

    %% Click Events
    click adminService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/admin-server"
    click authService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/authentication-service"
    click personService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/person-service"
    click userService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/user-service"
    click edgeServer "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/edge-server"
    click redisService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/redis-jackson-security-webauthn-otp"
    click goService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/go-service"
    click nodejsService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/nodejs-service"
    click kotlinService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/kotlin-service"
    click pythonService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/python-service"
    click quarkusService "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/quarkus-service"
    click authCommon "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/authentication-common"
    click webCommon "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/web-common"
    click reactWebapp "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/react-webapp"
    click reactNativeApp "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/react-native-app"
    click configServer "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/docker/spring-cloud-config"
    click cicd "https://github.com/rodrigorodrigues/microservices-design-patterns/tree/master/.github/workflows"
    click monitoring "https://github.com/rodrigorodrigues/microservices-design-patterns/blob/master/docker/grafana-datasource.yaml"

    %% Styles
    classDef frontend fill:#C7F4D6,stroke:#000,stroke-width:2px;
    classDef service fill:#FFE1A8,stroke:#000,stroke-width:2px;
    classDef common fill:#C3D6E4,stroke:#000,stroke-width:2px;
    classDef support fill:#F9D3E3,stroke:#000,stroke-width:2px;
    classDef database fill:#F7F7A1,stroke:#000,stroke-width:2px;
```
