# mengjp810418/dbdiagram architecture

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

- Interactive diagram: https://gitdiagram.com/mengjp810418/dbdiagram
- Repository: https://github.com/mengjp810418/dbdiagram

## Overview

##### Project type and purpose
- This is a static single-page web application (SPA) that provides an open-source alternative to dbdiagram.io.
- There is no traditional “backend” server in the repo—persistence is handled by localStorage in the browser and by direct calls to an S3 bucket or equivalent object store.

##### File structure
- Top-level
– .github/workflows: CI/CD pipeline for building/deploying (GitHub Pages or static hosting).
– api/.gitkeep: placeholder for potential serverless API code.
- web/
– Quasar config & Dockerfile for containerized local dev or Nginx hosting.
– src/
· boot/: initialization scripts (Ace integration, i18n, Pinia store, numeric library).
· components/: Vue components for editor, graph, dialogs, export/import UI.
· i18n/: localization files.
· layouts/, pages/, router/: standard SPA structure.
· store/: Pinia stores (chart data, editor state, file repo).
· utils/: helper modules (storage, math).
– quasar.conf.js, babel.config.js, eslint, postcss, ts shims: build tool configuration.

##### README for additional insights
- Mentions Docker image, GitHub Pages live demo, JointJS and DBML parser dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser Client
    subgraph "Browser (Client)"
        direction TB
        subgraph "UI Layer"
            direction TB
            App["App.vue"]:::ui
            Router["Router & Pages"]:::ui
            Editor["DbmlEditor.vue (Ace)"]:::ui
            Chart["VDbChart + JointJS"]:::ui
        end
        subgraph "Boot Plugins"
            direction TB
            I18nBoot["i18n Boot"]:::ui
            PiniaBoot["Pinia Boot"]:::state
            AceBoot["Ace Boot"]:::ui
            NumBoot["v3num Boot"]:::ui
        end
        subgraph "State Management"
            direction TB
            ChartStore["chart.js"]:::state
            EditorStore["editor.js"]:::state
            FilesStore["files.js"]:::state
            RepoStore["repo.js"]:::state
            PluginStore["plugin.js"]:::state
        end
        subgraph "Persistence"
            direction TB
            StorageUtils["storageUtils.js"]:::state
            RemoteRepoLayer["repo.js (S3)"]:::external
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        LocalStorageBrowser["Browser LocalStorage"]:::external
        S3Bucket["AWS S3 Bucket"]:::external
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        Pipeline[".github/workflows/gh-pages.yaml"]:::external
        DockerNginx["Docker & Nginx"]:::external
        Hosting["GitHub Pages"]:::external
    end

    %% Connections
    App -->|renders| Router
    App -->|includes| Editor
    App -->|includes| Chart

    Editor -->|editDBML| EditorStore
    EditorStore -->|saveDiagram| StorageUtils
    StorageUtils -->|persist| LocalStorageBrowser
    EditorStore -->|pushDiagram| RemoteRepoLayer
    RemoteRepoLayer -->|s3API| S3Bucket

    Editor -->|renderRequest| Chart
    Chart -->|readsModel| ChartStore

    ChartStore -->|updateModel| EditorStore

    %% Boot sequence
    I18nBoot --> App
    AceBoot --> App
    NumBoot --> App
    PiniaBoot --> App

    %% CI/CD Flow
    Pipeline -->|build| DockerNginx
    DockerNginx -->|deploy| Hosting

    %% Click Events
    click App "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/App.vue"
    click Router "https://github.com/mengjp810418/dbdiagram/tree/master/web/src/router/"
    click Editor "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/components/DbmlEditor.vue"
    click AceBoot "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/boot/ace.js"
    click I18nBoot "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/boot/i18n.js"
    click NumBoot "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/boot/v3num.js"
    click PiniaBoot "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/boot/pinia.js"
    click Chart "https://github.com/mengjp810418/dbdiagram/tree/master/web/src/components/VDbChart/"
    click StorageUtils "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/utils/storageUtils.js"
    click ChartStore "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/store/chart.js"
    click EditorStore "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/store/editor.js"
    click FilesStore "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/store/files.js"
    click RepoStore "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/store/repo.js"
    click PluginStore "https://github.com/mengjp810418/dbdiagram/blob/master/web/src/store/plugin.js"
    click Pipeline "https://github.com/mengjp810418/dbdiagram/blob/master/.github/workflows/gh-pages.yaml"
    click DockerNginx "https://github.com/mengjp810418/dbdiagram/tree/master/web/Dockerfile"
    click DockerNginx "https://github.com/mengjp810418/dbdiagram/blob/master/web/.docker/nginx/default.conf"
    click Hosting "https://github.com/mengjp810418/dbdiagram/blob/master/web/quasar.conf.js"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#006064,color:#006064
    classDef state fill:#E8F5E9,stroke:#388E3C,color:#388E3C
    classDef external fill:#FFF3E0,stroke:#FB8C00,color:#E65100
```
