# bigtreemin/playedu architecture

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

- Interactive diagram: https://gitdiagram.com/bigtreemin/playedu
- Repository: https://github.com/bigtreemin/playedu

## Overview

##### Project type and purpose
- PlayEdu is a full-stack, front-end/back-end separated e-learning platform.
- It comprises three React-based UIs (Admin, PC, H5/mobile) and a modular Spring Boot 3 monolithic API.
- Uses MySQL for persistence, Redis for caching & locking, Nginx as reverse-proxy/static server, and Docker Compose for container orchestration.

##### File structure
- Top-level “docker” and “compose.yml” define containers: mysql, redis, nginx, and the API/front-ends.
- “playedu-admin”, “playedu-pc”, “playedu-h5”: three independent React apps built with Vite, TypeScript, Less/SCSS.
- “playedu-api”: a multi-module Maven project with submodules:
- playedu-common (shared DTOs, utils, configs, mappers, services)
- playedu-system (system checks, migrations, AOP aspects)
- playedu-course (domain/services/mappers for courses)
- playedu-resource (domain/services/mappers for resource/video uploads)
- playedu-api (SpringBootApplication, controllers, interceptors, event listeners)

##### README
- Confirms stack: Java + MySQL + Spring Boot + React18.
- Describes front-end ports (9800, 9801), API port (9700), and quick start via Docker Compose (port 9900 for admin).

##### Main components
- Front-end UIs
- Admin portal (React18)
- PC student portal (React18)
- H5/mobile portal (React18)
- Reverse proxy / static server: Nginx container routing domains/ports to front-ends and API
- API container: Spring Boot monolith (playedu-api)
- MySQL container (persistent data)
- Redis container (caching, distributed locks, rate-limiting scripts)
- File storage volume: mounted path for uploaded courseware/videos (or S3‐compatible store if configured)

##### Relationships and interactions
- User browsers → HTTP(S) → Nginx → serves static files or proxies API calls
- React UIs ↔ REST API endpoints in Spring Boot (backend controllers → service layer → mappers → MySQL/Redis)
- Spring events (ApplicationEventPublisher) → internal listeners for domain events (e.g., CourseDestroyEvent)
- Redis used by Spring (via RedisConfig) for caching frequently read data (course cache, user-see-course cache) and locks (RedisDistributedLock)
- Docker Compose networks all containers; volumes ensure data persistence

##### Architectural patterns & design principles
- Modular monolith: logically separated Maven modules loaded into one Spring Boot process
- Layered architecture: Controllers → Services → Mappers (MyBatis-Plus) → Database
- Event-driven internals: bus/listener pattern for lifecycle events
- AOP aspects for permissions, logging, locking
- Front-end/back-end separation with well-defined API contracts (JSON)

##### Technologies & frameworks
- Front-end: React18 + Vite + TypeScript + Less/SCSS + Axios-style HTTP client
- Back-end: Spring Boot 3 + MyBatis-Plus + Sa-Token (auth) + Spring Events + SaTokenConfig + RedisConfig
- DB: MySQL 8.x
- Cache: Redis
- Containerization: Docker, Docker Compose, Nginx
- Build: Maven (multi-module)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Users"
        Browser["Browser"]:::infra
    end
    Browser --> Nginx["Nginx (Reverse Proxy)"]:::infra

    subgraph "Front-end UIs"
        ReactAdmin["React Admin Portal"]:::frontend
        ReactPC["React PC Student Portal"]:::frontend
        ReactMobile["React H5/Mobile Portal"]:::frontend
    end
    Nginx --> ReactAdmin
    Nginx --> ReactPC
    Nginx --> ReactMobile
    Nginx --> SpringAPI["Spring Boot API"]:::backend

    subgraph "Back-end API Container"
        SpringAPI
        subgraph "Modules"
            CommonMod["Common Module"]:::backend
            SystemMod["System Module"]:::backend
            CourseMod["Course Module"]:::backend
            ResourceMod["Resource Module"]:::backend
            APIMod["API Module"]:::backend
        end
        SpringAPI --> CommonMod
        SpringAPI --> SystemMod
        SpringAPI --> CourseMod
        SpringAPI --> ResourceMod
        SpringAPI --> APIMod
    end

    subgraph "Infrastructure Datastores"
        MySQL["MySQL"]:::datastore
        Redis["Redis"]:::datastore
        FileStorage["File Storage Volume"]:::datastore
    end
    SpringAPI --> MySQL
    SpringAPI --> Redis
    SpringAPI --> FileStorage

    classDef frontend fill:#D0EBFF,stroke:#333;
    classDef backend fill:#DFFFD0,stroke:#333;
    classDef datastore fill:#FFD8A8,stroke:#333;
    classDef infra fill:#E0E0E0,stroke:#333;

    click ReactAdmin "https://github.com/bigtreemin/playedu/tree/main/playedu-admin/"
    click ReactPC "https://github.com/bigtreemin/playedu/tree/main/playedu-pc/"
    click ReactMobile "https://github.com/bigtreemin/playedu/tree/main/playedu-h5/"
    click Nginx "https://github.com/bigtreemin/playedu/blob/main/docker/nginx/conf/nginx.conf"
    click SpringAPI "https://github.com/bigtreemin/playedu/tree/main/playedu-api/Dockerfile"
    click CommonMod "https://github.com/bigtreemin/playedu/tree/main/playedu-api/playedu-common/"
    click SystemMod "https://github.com/bigtreemin/playedu/tree/main/playedu-api/playedu-system/"
    click CourseMod "https://github.com/bigtreemin/playedu/tree/main/playedu-api/playedu-course/"
    click ResourceMod "https://github.com/bigtreemin/playedu/tree/main/playedu-api/playedu-resource/"
    click APIMod "https://github.com/bigtreemin/playedu/tree/main/playedu-api/playedu-api/"
    click MySQL "https://github.com/bigtreemin/playedu/tree/main/docker/mysql/"
    click Redis "https://github.com/bigtreemin/playedu/tree/main/docker/redis/"
    click FileStorage "https://github.com/bigtreemin/playedu/tree/main/docker/data/"
```
