# cool-team-official/cool-admin-midway-packages architecture

> Architecture diagram of the GitHub repository cool-team-official/cool-admin-midway-packages, 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/cool-team-official/cool-admin-midway-packages
- Repository: https://github.com/cool-team-official/cool-admin-midway-packages

## Overview

##### Project type and purpose
- This is a monorepo of Node.js/TypeScript packages that together form the “cool-admin-midway” ecosystem.
- At the core is the `core` package (providing decorators, controllers, services, configuration, caching, exception handling, eventing, etc.).
- Surrounding modules add specialized features:
- `es`: Elasticsearch enrichment
- `rpc`: RPC decorator and transport support
- `task`: queue/task management
- `mcp`: CLI client-server process manager
- `plugin-cli`: plugin build/release tool
- `typeorm`: bundled TypeORM distribution

##### File structure
- Top-level directories correspond to independent packages.
- Each package follows a similar layout (`src`, `config`, `decorator`, `service`, `bin` where applicable).
- Shared concerns (cache, config, decorators, events) live in `core/src`.
- Build and test configs (`jest.config.js`, `tsconfig.json`, `.eslintrc.json`) are present in every package.
- The `core` package exports a Midway-style module that imports and wires up sub-modules.

##### Key insights from README
- The root README identifies `core` as the heart of the project, providing shared functionality.
- Documentation and website references imply it’s a framework for building admin backends on Midway.

##### Essential elements in detail
- Do not omit the decorator layer (cache, transaction, event), the module loader (Midway), or the bin/CLI entrypoints.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "CLI Tools"
        MCP["MCP CLI Tool"]:::cli
        PluginCLI["Plugin-CLI Tool"]:::cli
    end

    subgraph "Framework Core"
        Core["Core Framework Module"]:::core
    end

    subgraph "Extension Modules"
        Elasticsearch["Elasticsearch Module"]:::extensions
        RPC["RPC Module"]:::extensions
        Task["Task Queue Module"]:::extensions
        TypeORMNode["TypeORM Distribution Module"]:::extensions
    end

    subgraph "External Services"
        ESCluster["Elasticsearch Cluster"]:::external
        MessageBroker["Message Broker\n(Redis/RabbitMQ)"]:::external
        RedisCache["Redis Cache"]:::external
        MySQL["MySQL/Postgres/SQLite"]:::external
        MongoDB["MongoDB"]:::external
    end

    MCP -->|uses| Core
    PluginCLI -->|uses| Core

    Core -->|loads| Elasticsearch
    Core -->|loads| RPC
    Core -->|loads| Task
    Core -->|loads| TypeORMNode

    TypeORMNode -->|connects| MySQL
    TypeORMNode -->|connects| MongoDB

    Elasticsearch -->|indexes/search| ESCluster

    Core -->|caching| RedisCache

    Task -->|queues| MessageBroker

    RPC -->|events/transport| MessageBroker

    click Core "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/core/src"
    click Elasticsearch "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/es/src"
    click RPC "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/rpc/src"
    click Task "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/task/src"
    click MCP "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/mcp/src"
    click PluginCLI "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/plugin-cli/src"
    click TypeORMNode "https://github.com/cool-team-official/cool-admin-midway-packages/tree/8.x/typeorm"

    classDef core fill:#cce5ff,stroke:#004085,color:#004085;
    classDef extensions fill:#d4edda,stroke:#155724,color:#155724;
    classDef cli fill:#ffeeba,stroke:#856404,color:#856404;
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
```
