# newpanjing/simpleui architecture

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

- Interactive diagram: https://gitdiagram.com/newpanjing/simpleui
- Repository: https://github.com/newpanjing/simpleui

## Overview

##### Project type and purpose
- This is an open-source Django application package (a “Django app” or plugin) whose sole purpose is to skin and enhance the built-in Django Admin interface. It replaces or extends default templates with Element-UI + Vue components, ships its own static asset tree (JS/CSS/fonts), and exposes custom template tags for configuration.

##### File structure
- Top-level artifacts:
- setup.py / requirements.txt → Python packaging
- simpleui/ → the Django app
- .github/, LICENSE, README.md → repository metadata
- simpleui/ directories:
- admin.py, apps.py → Django app registration and extension points
- templatetags/ → custom template tags for injecting menus, scripts, theme logic
- templates/admin/… → overrides for every Django Admin template (login, list, change_form, etc.)
- static/admin/simpleui-x/… → Element-UI assets (JS/CSS/theme files, locales, fonts, particles)
- locale/… → translation files for generated UI strings

##### README for additional insights
- Confirms it’s a drop-in replacement: “pip install django-simpleui; add ‘simpleui’ as the first item in INSTALLED_APPS.”
- Describes that >90% of the Django Admin pages are rewritten using Vue + Element-UI.
- Mentions static asset collection (collectstatic) and i18n.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend" 
        direction TB
        Browser(["Browser"]):::frontend
        VueUI(["Vue.js + Element-UI Runtime"]):::frontend
    end

    %% Backend Layer
    subgraph "Backend (Django Server)" 
        direction TB
        Request(["HTTP Request /admin/*"]):::backend
        DjangoCore(["Django Core<br/>(Routing & Admin Views)"]):::backend
        StaticHandler(["Staticfiles Handler<br/>(collectstatic → STATIC_ROOT)"]):::backend
        subgraph "simpleui App" 
            direction TB
            AppsPy(["apps.py (Registration Hooks)"]):::backend
            AdminPy(["admin.py (Extension Points)"]):::backend
            TagsPy(["simpletags.py<br/>(Template Tags)"]):::backend
            Templates(["templates/admin/…<br/>(Override Layer)"]):::backend
            StaticAssets(["static/admin/simpleui-x/…<br/>(Vue, CSS, Fonts)"]):::backend
            LocaleFiles(["locale & JS locale files"]):::backend
        end
    end

    %% External Systems
    subgraph "External Services"
        direction TB
        DB(["Database"]):::external
    end

    %% Repository Metadata & Packaging
    subgraph "Repository & Packaging"
        direction TB
        SetupPy(["setup.py"]):::meta
        Requirements(["requirements.txt"]):::meta
        Manifest(["MANIFEST.in"]):::meta
        Readme(["README.md"]):::meta
        License(["LICENSE"]):::meta
    end

    %% Connections - Frontend to Backend
    Browser -->|"GET /admin/*"| Request
    Request --> DjangoCore
    DjangoCore -->|"uses INSTALLED_APPS order"| AppsPy
    AppsPy --> AdminPy
    DjangoCore --> Templates
    Templates --> StaticAssets
    Templates --> LocaleFiles
    StaticAssets --> StaticHandler
    LocaleFiles --> StaticHandler
    StaticHandler -->|Serves JS/CSS| Browser
    Browser -->|Initializes SPA| VueUI
    VueUI -->|CRUD AJAX| DjangoCore
    DjangoCore -->|DB Queries| DB

    %% Repository connections
    SetupPy --- AppsPy
    Requirements --- AppsPy
    Manifest --- StaticAssets
    Readme --- AppsPy
    License --- Readme

    %% Click Events
    click AppsPy "https://github.com/newpanjing/simpleui/blob/master/simpleui/apps.py"
    click AdminPy "https://github.com/newpanjing/simpleui/blob/master/simpleui/admin.py"
    click TagsPy "https://github.com/newpanjing/simpleui/blob/master/simpleui/templatetags/simpletags.py"
    click Templates "https://github.com/newpanjing/simpleui/tree/master/simpleui/templates/admin/"
    click StaticAssets "https://github.com/newpanjing/simpleui/tree/master/simpleui/static/admin/simpleui-x/"
    click LocaleFiles "https://github.com/newpanjing/simpleui/blob/master/simpleui/locale/zh_Hans/LC_MESSAGES/django.po"
    click LocaleFiles "https://github.com/newpanjing/simpleui/tree/master/simpleui/static/admin/simpleui-x/locale/"
    click SetupPy "https://github.com/newpanjing/simpleui/blob/master/setup.py"
    click Requirements "https://github.com/newpanjing/simpleui/blob/master/requirements.txt"
    click Manifest "https://github.com/newpanjing/simpleui/blob/master/MANIFEST.in"
    click Readme "https://github.com/newpanjing/simpleui/blob/master/README.md"
    click License "https://github.com/newpanjing/simpleui/tree/master/LICENSE"

    %% Styles
    classDef frontend fill:#E8F1FA,stroke:#1F78B4,color:#1F78B4
    classDef backend fill:#F0E6D2,stroke:#B15A34,color:#B15A34
    classDef external fill:#E2F0D9,stroke:#4C9A2A,color:#4C9A2A
    classDef meta fill:#FAF1E6,stroke:#A66D00,color:#A66D00
```
