# iflytek/astron-rpa architecture

> Architecture diagram of the GitHub repository iflytek/astron-rpa, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iflytek/astron-rpa
- Repository: https://github.com/iflytek/astron-rpa

## Overview

##### Project Type and Purpose
- AstronRPA is a full-stack, cloud-native RPA platform built on a microservices architecture. It provides a web frontend (Vue 3 + TypeScript), a desktop app (Tauri), multiple backend services (Java Spring Boot, Python FastAPI), an execution engine (Python), shared libraries, and a suite of reusable RPA components. It targets enterprise automation with features like visual process design, AI-powered OCR/chat, scheduling, and real-time monitoring.

##### High-Level Component Inventory
a. Frontend Layer
- Web UI (frontend/packages/web-app)
- UI Component Library (frontend/packages/components)
- Browser extension (frontend/packages/browser-plugin)
- Desktop App (frontend/packages/tauri-app and tauri-app-window)
b. Backend Services (each deployable as a Docker container)
- Robot Service (Java Spring Boot): Authentication, process design, scheduling, execution records
- Resource Service (Java Spring Boot): File storage, S3 config, share links
- AI Service (Python FastAPI): OCR, chat, CAPTCHA, model calls
- OpenAPI Service (Python FastAPI): API gateway, WebSocket streaming, workflow execution endpoints
c. RPA Engine & Execution Kit
- Engine Core (engine/…): FastAPI-based execution orchestrator, component registry, WebSocket hooks
- Execkit (engine/execkit): atomic and executor modules for workflow parsing and running
d. Shared Libraries
- rpaframe, rpawebsocket, locator, table_helper, etc., providing cross-service functionality
e. Infrastructure
- Nginx (docker/…): reverse proxy, load balancer, Lua auth handler
- MySQL & Redis (docker/…): persistence and caching
- Message Queue (implied—for async tasks)
- SkyWalking: distributed tracing and observability

##### Relationships and Data Flows
- Clients (Browser / Electron / Tauri) → Nginx gateway (HTTP/WS) → Backend services
- Web UI ↔ Robot-Service (REST) for CRUD and scheduling
- Web UI ↔ OpenAPI-Service (REST/WebSocket) for real-time execution data
- Web UI ↔ AI-Service (REST) for OCR/chat
- Desktop App communicates similarly over HTTP/WS + local SDK bridges
- Robot-Service publishes tasks/event messages to Message Queue → Engine consumes and executes via Execkit → Reports status back over WebSocket to OpenAPI-Service → UI
- Resource-Service (S3 or local store) is invoked by Robot-Service and Engine for file I/O
- All services read/write MySQL & Redis; tracing data exported to SkyWalking

##### Architectural Patterns and Principles
- Microservices: each domain (auth, resource, AI, openapi, execution) is isolated
- Polyglot: Java for core services, Python for AI & engine
- Monorepo (pnpm workspace): single repo for frontend packages, promoting consistency
- Containerization: Docker Compose orchestration
- Event-driven/asynchronous tasks via MQ
- Real-time feedback via WebSocket

##### Final Checklist
- Clear, human-readable labels on all nodes
- Version or branch indicator (e.g., v1.0) and date for architecture freshness

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    subgraph "Client Layer"
        direction TB
        Browser["Browser (Web UI)"]:::client
        Electron["Electron (Desktop App)"]:::client
        TauriMain["Tauri Main"]:::client
        TauriWindow["Tauri Window"]:::client
        Browser --> Electron
        Electron --> TauriMain
        TauriMain --> TauriWindow
    end

    %% Gateway
    NGINX["Nginx Gateway"]:::service

    %% Backend Services
    subgraph "Backend Microservices"
        direction TB
        RobotSvc["Robot-Service<br/>(Java Spring Boot)"]:::service
        ResourceSvc["Resource-Service<br/>(Java Spring Boot)"]:::service
        AIService["AI-Service<br/>(Python FastAPI)"]:::service
        OpenAPIService["OpenAPI-Service<br/>(Python FastAPI)"]:::service
    end

    %% Execution Engine
    subgraph "Execution Engine"
        direction TB
        EngineCore["Engine Core<br/>(FastAPI Orchestrator)"]:::service
        subgraph Execkit
            direction TB
            Atomic["Atomic Module"]:::service
            Executor["Executor Module"]:::service
        end
        subgraph "Shared Libraries"
            direction TB
            Locator["Locator"]:::external
            RPAFrame["RPA Frame"]:::external
            WSClient["WebSocket Client"]:::external
            WSServer["WebSocket Server"]:::external
            TableHelper["Table Helper"]:::external
        end
    end

    %% Infrastructure
    subgraph "Data & Infra"
        direction TB
        MQ["Message Queue"]:::mq
        MySQL["MySQL"]:::db
        Redis["Redis"]:::db
        SkyWalking["SkyWalking"]:::external
    end

    %% Flows
    Browser -->|"HTTP/WS"| NGINX
    Electron -->|"HTTP/WS"| NGINX
    TauriWindow -->|"SDK Bridge"| NGINX

    NGINX -->|"REST"| RobotSvc
    NGINX -->|"REST/WS"| OpenAPIService
    NGINX -->|"REST"| AIService
    NGINX -->|"REST"| ResourceSvc

    RobotSvc -->|"JDBC/ORM"| MySQL
    RobotSvc -->|"Cache"| Redis
    ResourceSvc -->|"JDBC/ORM"| MySQL
    ResourceSvc -->|"Cache"| Redis
    AIService -->|"Cache"| Redis
    OpenAPIService -->|"Cache"| Redis

    RobotSvc -->|"AMQP Publish"| MQ
    MQ -->|"AMQP Consume"| EngineCore
    EngineCore -->|"Invokes"| Atomic
    EngineCore -->|"Invokes"| Executor

    EngineCore -->|"WebSocket"| OpenAPIService
    OpenAPIService -->|"WS Stream"| Browser

    ResourceSvc -->|"S3/File I/O"| ResourceSvc
    RobotSvc -->|"File I/O"| ResourceSvc
    EngineCore -->|"File I/O"| ResourceSvc

    RobotSvc -->|"Tracing"| SkyWalking
    ResourceSvc -->|"Tracing"| SkyWalking
    AIService -->|"Tracing"| SkyWalking
    OpenAPIService -->|"Tracing"| SkyWalking
    EngineCore -->|"Tracing"| SkyWalking

    %% Click Events
    click Browser "https://github.com/iflytek/astron-rpa/tree/main/frontend/packages/web-app"
    click UICompLib "https://github.com/iflytek/astron-rpa/tree/main/frontend/packages/components"
    click BrowserExt "https://github.com/iflytek/astron-rpa/tree/main/frontend/packages/browser-plugin"
    click TauriMain "https://github.com/iflytek/astron-rpa/tree/main/frontend/packages/tauri-app"
    click TauriWindow "https://github.com/iflytek/astron-rpa/tree/main/frontend/packages/tauri-app-window"
    click RobotSvc "https://github.com/iflytek/astron-rpa/tree/main/backend/robot-service"
    click ResourceSvc "https://github.com/iflytek/astron-rpa/tree/main/backend/resource-service"
    click AIService "https://github.com/iflytek/astron-rpa/tree/main/backend/ai-service"
    click OpenAPIService "https://github.com/iflytek/astron-rpa/tree/main/backend/openapi-service"
    click EngineCore "https://github.com/iflytek/astron-rpa/tree/main/engine/core"
    click Atomic "https://github.com/iflytek/astron-rpa/tree/main/engine/execkit/atomic"
    click Executor "https://github.com/iflytek/astron-rpa/tree/main/engine/execkit/executor"
    click Locator "https://github.com/iflytek/astron-rpa/tree/main/engine/shared/locator"
    click RPAFrame "https://github.com/iflytek/astron-rpa/tree/main/engine/shared/rpaframe"
    click WSClient "https://github.com/iflytek/astron-rpa/tree/main/engine/shared/rpawebsocket-client"
    click WSServer "https://github.com/iflytek/astron-rpa/tree/main/engine/shared/rpawebsocket"
    click TableHelper "https://github.com/iflytek/astron-rpa/tree/main/engine/shared/table_helper"
    click MQ "https://github.com/iflytek/astron-rpa/blob/main/docker/docker-compose.yml"
    click NGINX "https://github.com/iflytek/astron-rpa/tree/main/docker/volumes/nginx"
    click MySQL "https://github.com/iflytek/astron-rpa/tree/main/docker/volumes/mysql"
    click Redis "https://github.com/iflytek/astron-rpa/blob/main/docker/docker-compose.yml"

    %% Styles
    classDef client fill:#d3d3d3,stroke:#333
    classDef service fill:#add8e6,stroke:#333
    classDef db fill:#90ee90,stroke:#333
    classDef mq fill:#ffa500,stroke:#333
    classDef external fill:#dda0dd,stroke:#333
```
