# phunguyen-byte/roncoo-education architecture

> Architecture diagram of the GitHub repository phunguyen-byte/roncoo-education, 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/phunguyen-byte/roncoo-education
- Repository: https://github.com/phunguyen-byte/roncoo-education

## Overview

##### Major components
- Frontend Clients: Although not directly present in the file tree, the README mentions two separate front-end systems – a public portal (roncoo-education-web) and an admin interface (roncoo-education-admin).
- API Gateway: The “roncoo-education-gateway” module is clearly the entry point. It handles routing, security, and global error handling.
- Microservices:
– Service modules under “roncoo-education-service” which include, for example, a course service (roncoo-education-service-course), a system service, and a user service. Each service is built as a separate microservice.
– “roncoo-education-feign” defines Feign clients to allow inter-service communication. There are separate feign modules for course, system, and user.
- Common Libraries: The “roncoo-education-common” module encapsulates shared utilities, base classes, core tools, and common configurations.
- Development Tools: The “roncoo-generator” module is used for code generation, scaffolding repetitive code such as controllers, service interfaces, and DAOs.
- Deployment and Configuration: The “distribution” folder, Dockerfiles, and docker-compose.yml indicate that containerization and orchestration (via Docker Compose) are used. There is also mention of Nacos (in the code, e.g. “NacosConfig.java”) for service discovery and configuration management.

##### Relationships and interconnections
- Users (both end users and admin users) interact with frontend clients.
- The frontend clients send requests to the API Gateway (roncoo-education-gateway).
- The Gateway forwards calls to backend microservices – each service (course, system, user) runs independently.
- Inter-service communication is managed via Feign clients (as defined in the “roncoo-education-feign” modules).
- The “common” module is used by several backend services to share libraries, error handling, DTOs (data transfer objects), tools, etc.
- Centralized configuration and service discovery are likely managed by Nacos.
- Distributed transactions are orchestrated via Seata and possibly a service registry.
- Persistent storage is provided by MySQL (as mentioned in the README) using MyBatis and Druid DataSource.
- The code generator is a utility tool used during development to scaffold new modules according to the project’s conventions.

##### Architectural patterns and design principles
- Microservices Architecture: Each service is isolated (course, system, user), enabling independent development and scaling.
- API Gateway Pattern: The gateway module secures and routes requests effectively.
- Frontend/Backend Separation: Clear boundaries between the presentation layer (Vue/Nuxt3) and the service layer (Spring Cloud-Alibaba).
- Shared Services and Libraries: The “common” module ensures consistency across services.
- Containerization: Docker and docker-compose are used for deployment and orchestration.
- Inter-service Communication: Feign clients and RESTful APIs manage communication between microservices.
- Distributed Configuration and Transaction Management: Nacos for centralized configuration and Seata for managing distributed transactions.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        A1["Public Portal (Nuxt3/Vue3)"]:::frontend
        A2["Admin Interface (Vue3/ElementPlus)"]:::frontend
    end

    %% Users
    U1["User"]:::frontend
    U2["Admin"]:::frontend

    %% API Gateway
    G1["API Gateway"]:::gateway

    %% Backend Microservices Layer
    subgraph "Backend Services"
        S1["Course Service"]:::service
        S2["System Service"]:::service
        S3["User Service"]:::service
    end

    %% Feign Clients for Inter-service Communication
    subgraph "Feign Clients"
        F1["Feign - Course"]:::feign
        F2["Feign - System"]:::feign
        F3["Feign - User"]:::feign
    end

    %% Common Libraries
    C1["Common Library"]:::utility

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        I1["Nacos (Config & Discovery)"]:::infra
        I2["MySQL (Persistence)"]:::infra
        I3["Deployment (Docker Compose & Distribution)"]:::infra
        I4["Seata (Distributed Transaction)"]:::infra
    end

    %% Development Tools
    D1["Code Generator"]:::utility

    %% Connections between Users and Frontend
    U1 -->|"access"| A1
    U2 -->|"access"| A2

    %% Frontend to API Gateway
    A1 -->|"request"| G1
    A2 -->|"request"| G1

    %% API Gateway to Backend Services
    G1 -->|"routes to"| S1
    G1 -->|"routes to"| S2
    G1 -->|"routes to"| S3

    %% Backend Services using Feign Clients
    S1 -->|"calls via"| F1
    S2 -->|"calls via"| F2
    S3 -->|"calls via"| F3

    %% Common Library used by Backend Services
    C1 --> S1
    C1 --> S2
    C1 --> S3

    %% Infrastructure connects to Backend Services
    S1 --> I1
    S2 --> I1
    S3 --> I1

    S1 --> I2
    S2 --> I2
    S3 --> I2

    %% Distributed Transaction Management
    S1 --> I4
    S2 --> I4
    S3 --> I4

    %% Deployment orchestration for all components (implied)
    G1 --> I3
    S1 --> I3
    S2 --> I3
    S3 --> I3

    %% Development Tool (used during build/scaffolding)
    D1 -.-> S1
    D1 -.-> S2
    D1 -.-> S3

    %% Click Events
    click G1 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-gateway"
    click S1 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-service/roncoo-education-service-course"
    click S2 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-service/roncoo-education-service-system"
    click S3 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-service/roncoo-education-service-user"
    click F1 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-feign/roncoo-education-feign-course"
    click F2 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-feign/roncoo-education-feign-system"
    click F3 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-feign/roncoo-education-feign-user"
    click C1 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-education-common"
    click D1 "https://github.com/phunguyen-byte/roncoo-education/tree/master/roncoo-generator"
    click I3 "https://github.com/phunguyen-byte/roncoo-education/tree/master/distribution"
    click I3 "https://github.com/phunguyen-byte/roncoo-education/blob/master/docker-compose.yml"

    %% Styles
    classDef frontend fill:#ffddcc,stroke:#333,stroke-width:2px;
    classDef gateway fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef service fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef feign fill:#e2e3e5,stroke:#333,stroke-width:2px;
    classDef infra fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef utility fill:#d1c4e9,stroke:#333,stroke-width:2px;
```
