# nosqlnull/chatgpt-sparkai architecture

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

- Interactive diagram: https://gitdiagram.com/nosqlnull/chatgpt-sparkai
- Repository: https://github.com/nosqlnull/chatgpt-sparkai

## Overview

##### Project type and purpose
- This is a full-stack, modular AIGC (AI-generated content) web platform (“SparkAi系统”) with both B-end (user facing) and C-end (admin) interfaces.
- Purpose: provide one-stop AI services (chat, image/video generation, multimodal analysis, TTS/voice, plugin-based extensions, billing, user/admin management).

##### File structure
- Top-level:
- README.md – project overview, feature list, architecture.
- SystemPreview/ – static screenshots; not code.
- Implied code directories (per README):
- frontend/ – Vite + Vue3 + TypeScript + TailwindCSS for public site.
- admin/ – Vite + Vue3 + Element-Plus for management console.
- backend/ – NestJS (Node.js) monolithic server with multiple modules.
- config/, scripts/, docker/ or deploy files (for Baota/Docker).

##### README for additional insights
- Describes tech stack: Vite, Vue3, NaiveUI, Tailwind; NestJS; MySQL 5.7+; Redis; local or cloud storage (OSS/COS/Chevereto).
- Lists dozens of functional modules (auth, AI model adapters, billing, plugin system, TTS, multimodal, video, admin dashboards, analytics, distribution, card system, menus, notifications, etc.)

##### Final advice
- Network boundaries (e.g., DMZ, internal network).
- Asynchronous flows (e.g., video generation via job queue).
- Keep it detailed but avoid overcrowding—group related modules under a “Backend” umbrella and expand only key modules.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Repository
    subgraph "Code Repository"
        README["README.md"]:::repo
        Screens["SystemPreview/"]:::repo
    end

    %% Clients
    subgraph "Clients"
        PublicUI["Public Web UI"]:::frontend
        AdminUI["Admin Web UI"]:::frontend
    end

    %% Backend
    subgraph "Backend API Layer (NestJS Monolith)"
        Auth["Auth & Session Module"]:::backend
        Orchestrator["AI Service Orchestrator"]:::backend
        Adapter["Model Adapter Layer"]:::backend
        StorageService["Storage Service"]:::backend
        Billing["Billing & Membership"]:::backend
        Plugin["Plugin System"]:::backend
        Analytics["Analytics & Reporting"]:::backend
        AdminModule["Admin Module"]:::backend
    end

    %% Data Stores
    subgraph "Data Stores"
        MySQL["MySQL Cluster"]:::datastore
        Redis["Redis Cache/Queue"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        AIExternal["Third-party AI APIs"]:::external
        CloudStorage["Cloud Storage Providers"]:::external
        Payments["Payment Gateways"]:::external
    end

    %% Connections
    PublicUI -->|"HTTPS"| Auth
    AdminUI -->|"HTTPS"| Auth

    Auth -->|auth requests| Orchestrator
    Orchestrator -->|service orchestration| Adapter
    Adapter -->|model calls| AIExternal
    Orchestrator -->|file operations| StorageService
    StorageService -->|store/retrieve| CloudStorage
    Orchestrator -->|events/logs| Analytics

    Auth -->|read/write| MySQL
    Auth -->|cache/session| Redis
    Billing -->|transactions| MySQL
    Billing -->|rate-limit| Redis
    Billing -->|payments| Payments

    Plugin -->|hooks| Auth
    Plugin -->|extensions| Orchestrator

    AdminModule -->|config/data| MySQL
    Analytics -->|report data| MySQL

    Orchestrator -->|job queue| Redis

    %% Click Events
    click README "https://github.com/nosqlnull/chatgpt-sparkai/blob/main/README.md"
    click Screens "https://github.com/nosqlnull/chatgpt-sparkai/tree/main/SystemPreview/"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1e88e5,color:#0d47a1;
    classDef backend fill:#c8e6c9,stroke:#43a047,color:#1b5e20;
    classDef datastore fill:#ffe0b2,stroke:#fb8c00,color:#e65100;
    classDef external fill:#e1bee7,stroke:#8e24aa,color:#4a148c;
    classDef repo fill:#f5f5f5,stroke:#9e9e9e,color:#212121;
```
