# team-duiduidui/geniusrank architecture

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

- Interactive diagram: https://gitdiagram.com/team-duiduidui/geniusrank
- Repository: https://github.com/team-duiduidui/geniusrank

## Overview

##### Project type and purpose
- This is a full-stack, microservice-based web application called GeniusRank.
- Purpose: provide GitHub user data viewing, comprehensive ability evaluation (ranking algorithms), nationality guessing via AI, and exportable score cards.

##### File structure
- Top-level folders:
- frontend – Remix.js React/TS web app + SSR/SSG on Cloudflare Pages
- backend – Maven multi-module Spring Cloud microservices
– gateway-service (API gateway)
– user-service (user registration, login, profile, file upload)
– analyze-service (ranking and nationality guessing, AI integration, MQ consumers/producers)
– aggregation-service (data aggregation)
– framework (common Spring Boot auto-configuration, database, web, error handling)
- Shared resources: /backend/resources database DDL and API definitions.
- Config files: application*.yaml, shardingsphere configs, Docker/Maven wrappers.
- docs folder with detailed architecture and algorithm designs.

##### Extracted architecture from README
- Frontend: Remix.js + Tailwind + i18next + Zod + Mantine; SSR/ISSG/SSG; Cloudflare Pages.
- Backend: Spring Boot 3 + SpringCloudAlibaba + Nacos (service registry/discovery) + MyBatis-Plus + Sharding-Sphere + Redis (cache) + MySQL (persistence) + RocketMQ (messaging) + XXL-JOB (scheduled tasks) + Sentinel (circuit breaking/rate limiting) + SkyWalking (tracing/monitoring).
- Interactions:
- Frontend ↔ API Gateway (HTTP/REST)
- API Gateway ↔ Services (REST/RPC via Feign + Nacos)
- Services ↔ MySQL/Redis
- Services ↔ RocketMQ for async decoupling
- XXL-JOB triggers tasks in user-service or analyze-service.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Clients
    Browser["Browser"]:::external
    GitHubAPI["GitHub REST/GraphQL API"]:::external
    ChatGLM["ChatGLM AI API"]:::external

    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        Browser -->|HTTP/SSR/SSG| RemixServer["Remix.js Server"]:::frontend
        RemixServer -->|REST API| API_Gateway
        RemixServer --> StaticAssets["Static Assets (Tailwind, Mantine)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend"
        direction TB
        API_Gateway["API Gateway"]:::gateway
        API_Gateway -->|Feign/HTTP| UserService
        API_Gateway -->|Feign/HTTP| AnalyzeService
        API_Gateway -->|Feign/HTTP| AggregationService

        Nacos["Nacos Registry"]:::registry
        API_Gateway -->|register/discover| Nacos
        UserService -->|register/discover| Nacos
        AnalyzeService -->|register/discover| Nacos
        AggregationService -->|register/discover| Nacos

        subgraph "Microservices"
            direction TB
            UserService["User Service"]:::service
            AnalyzeService["Analyze Service"]:::service
            AggregationService["Aggregation Service"]:::service
            Framework["Shared Framework"]:::framework
            UserService -.-> Framework
            AnalyzeService -.-> Framework
            AggregationService -.-> Framework
        end

        MySQLCluster["MySQL Cluster\n(ShardingSphere)"]:::database
        RedisCache["Redis Cache"]:::cache
        RocketMQ["RocketMQ"]:::mq
        XXL_JOB["XXL-JOB Scheduler"]:::scheduler
        Sentinel["Sentinel"]:::circuit
        SkyWalking["SkyWalking"]:::monitor

        %% Synchronous and Async flows
        UserService -->|JDBC| MySQLCluster
        UserService -->|Cache| RedisCache
        UserService -->|produce events| RocketMQ
        AnalyzeService -.->|consume events| RocketMQ
        AnalyzeService -->|JDBC| MySQLCluster
        AnalyzeService -->|Cache| RedisCache
        AnalyzeService -->|calls AI| ChatGLM
        AggregationService -->|JDBC| MySQLCluster

        XXL_JOB -->|triggers tasks| UserService
        XXL_JOB -->|triggers tasks| AnalyzeService

        %% Observability and Resilience
        UserService -->|traces| SkyWalking
        AnalyzeService -->|traces| SkyWalking
        AggregationService -->|traces| SkyWalking
        API_Gateway -->|traces| SkyWalking

        UserService -.->|circuit/rate-limit| Sentinel
        AnalyzeService -.->|circuit/rate-limit| Sentinel
        AggregationService -.->|circuit/rate-limit| Sentinel
    end

    Browser -->|OAuth Redirect| GitHubAPI

    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef frontend fill:#cfe2ff,stroke:#0d6efd,stroke-width:2px
    classDef gateway fill:#e2e3e5,stroke:#6c757d,stroke-width:2px,stroke-dasharray: 5 5
    classDef service fill:#cff4fc,stroke:#0dcaf0,stroke-width:2px
    classDef framework fill:#e7e6ff,stroke:#6f42c1,stroke-width:2px
    classDef registry fill:#fff3cd,stroke:#ffcd39,stroke-width:2px
    classDef database fill:#d1e7dd,stroke:#198754,stroke-width:2px
    classDef cache fill:#f8d7da,stroke:#dc3545,stroke-width:2px
    classDef mq fill:#ffe5d9,stroke:#ff922b,stroke-width:2px
    classDef scheduler fill:#e2e3e5,stroke:#6c757d,stroke-width:2px
    classDef circuit fill:#f0f0f0,stroke:#adb5bd,stroke-width:2px,stroke-dasharray: 3 3
    classDef monitor fill:#e2f0d9,stroke:#82c91e,stroke-width:2px

    %% Click Events
    click RemixServer "https://github.com/team-duiduidui/geniusrank/tree/main/frontend/"
    click API_Gateway "https://github.com/team-duiduidui/geniusrank/tree/main/backend/gateway-service/"
    click UserService "https://github.com/team-duiduidui/geniusrank/tree/main/backend/user-service/"
    click AnalyzeService "https://github.com/team-duiduidui/geniusrank/tree/main/backend/analyze-service/"
    click AggregationService "https://github.com/team-duiduidui/geniusrank/tree/main/backend/aggregation-service/"
    click Framework "https://github.com/team-duiduidui/geniusrank/tree/main/backend/framework/"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/resources/shardingsphere-config-dev.yaml"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/resources/shardingsphere-config-prod.yaml"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/resources/shardingsphere-config-dev.yaml"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/resources/shardingsphere-config-prod.yaml"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/aggregation-service/src/main/resources/shardingsphere-config-dev.yaml"
    click MySQLCluster "https://github.com/team-duiduidui/geniusrank/blob/main/backend/aggregation-service/src/main/resources/shardingsphere-config-prod.yaml"
    click RedisCache "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/java/com/nine/project/user/common/constant/RedisCacheConstant.java"
    click RedisCache "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/java/com/nine/project/analyze/constant/RedisCacheConstant.java"
    click RedisCache "https://github.com/team-duiduidui/geniusrank/blob/main/backend/gateway-service/src/main/java/com/nine/project/gateway/constant/RedisCacheConstant.java"
    click UserService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/java/com/nine/project/user/mq/produce/VerificationCodeProducer.java"
    click UserService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/java/com/nine/project/user/mq/consumer/SendVerificationCodeCodeConsumer.java"
    click AnalyzeService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/java/com/nine/project/analyze/mq/produce/SaveScoreAndTypeProducer.java"
    click AnalyzeService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/java/com/nine/project/analyze/mq/consumer/SaveDevelopTypeConsumer.java"
    click UserService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/user-service/src/main/java/com/nine/project/user/job/FileJobHandler.java"
    click AnalyzeService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/java/com/nine/project/analyze/config/AiConfig.java"
    click AnalyzeService "https://github.com/team-duiduidui/geniusrank/blob/main/backend/analyze-service/src/main/java/com/nine/project/analyze/toolkit/AiManager.java"
    click Browser "https://github.com/team-duiduidui/geniusrank/tree/main/frontend/app/api/backend/"
    click Browser "https://github.com/team-duiduidui/geniusrank/tree/main/frontend/app/api/github/"
```
