# vrana/adminer architecture

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

- Interactive diagram: https://gitdiagram.com/vrana/adminer
- Repository: https://github.com/vrana/adminer

## Overview

##### Project type and purpose
- **Type**: Monolithic PHP-based web application, shipped as a single deployable file but organized in modular source form.
- **Purpose**: Provide a lightweight, extensible database management UI (Adminer) plus a specialized Editor UI for end-user data manipulation.

##### File structure
- **Core code (“adminer/”)**: All PHP modules under `adminer/include` (authentication, connection, SQL generation, HTML rendering, plugin host, driver loader). Entry point is `adminer/index.php`.
- **Editor variant (“editor/”)**: Similar to core but augmented with editor logic, custom UI JS (`editor/static/editing.js`) and example configuration (`editor/example.php`). Entry point is `editor/index.php`.
- **Plugins (“plugins/”)**: PHP plugin scripts and subfolder drivers to extend Adminer. Loaded at runtime by core.
- **Designs (“designs/”)**: CSS themes and metadata. Swappable view layer.
- **Drivers (“adminer/drivers” and `plugins/drivers`)**: Low-level DB connectors (MySQL, PostgreSQL, SQLite, Mongo, Elastic, etc.).
- **Localization (“adminer/lang”)**: One file per language, plugged in on load.
- **Build/Compile (`compile.php`)**: Bundles modules into one PHP file.
- **External libs (`externals/`)**: JS/CSS minifiers and syntax highlighters used at build time.
- **Tests (“tests/”)**: Katalon Recorder suites verifying functionality across databases.

##### README for additional insights
- Supports multiple SQL and NoSQL engines.
- Single-file deployment is achieved by `compile.php` using externals.
- Editor is a separate mode for end-users with its own entrypoint.
- Encourages plugin ecosystem for extensibility.

##### Detail
- How each design folder is pulled in.
- Demonstrate plugin registration flow: Core → Plugin Loader → Plugin Hook → Core.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Side
    subgraph "Client Side" 
        direction TB
        Browser["Browser"]:::client
        StaticAssets["Static Assets (CSS/JS)"]:::client
    end

    %% Server Runtime
    subgraph "Server Runtime" 
        direction TB
        WebServer["Web Server + PHP Interpreter"]:::runtime

        subgraph "Entry Points"
            direction TB
            AdminerFC["Adminer Front Controller"]:::runtime
            EditorFC["Editor Front Controller"]:::runtime
        end

        subgraph "Adminer Core Engine"
            direction TB
            Auth["Authentication Module"]:::runtime
            Connect["Connection Manager"]:::runtime
            SQLCore["SQL Generator & Executor"]:::runtime
            PluginMgr["Plugin Manager"]:::runtime
            HTMLBuilder["View Layer - HTML Builder"]:::runtime
            DriversCore["Drivers (MySQL, PgSQL, SQLite, Oracle, MSSQL)"]:::runtime
            Lang["Localization Files"]:::runtime
            Themes["Themes/Designs"]:::runtime
            Plugins["Plugins Directory"]:::runtime
        end

        subgraph "Editor Extensions"
            direction TB
            EditorLogic["Editor-specific Logic"]:::runtime
            EditorDB["Editor Connection & DB Logic"]:::runtime
            EditorUI["Editor Static UI Script"]:::client
            EditorExample["Editor Example Configuration"]:::runtime
        end
    end

    %% Databases
    subgraph "Database Servers"
        direction TB
        DBs["MySQL, PostgreSQL, SQLite, Oracle,\nMS SQL, CockroachDB, Elastic, Mongo"]:::runtime
    end

    %% Build System
    subgraph "Build & Tooling"
        direction TB
        BuildScript["Core Build Script"]:::tooling
        Externals["External Minifiers & Syntax Highlighters"]:::tooling
    end

    %% Tests
    subgraph "Tests"
        direction TB
        TestSuites["Automated Test Suites"]:::tooling
    end

    %% Relationships
    Browser -->|"HTTP GET/POST"| WebServer
    StaticAssets -->|"served as static"| Browser

    WebServer -->|"include/adminer"| AdminerFC
    WebServer -->|"include/editor"| EditorFC

    AdminerFC --> Auth
    AdminerFC --> Connect
    AdminerFC --> SQLCore
    AdminerFC --> PluginMgr
    AdminerFC --> HTMLBuilder
    AdminerFC --> DriversCore
    AdminerFC --> Lang
    AdminerFC --> Themes
    AdminerFC --> Plugins

    EditorFC --> EditorLogic
    EditorFC --> EditorDB
    EditorFC --> PluginMgr
    EditorFC --> HTMLBuilder
    EditorFC --> DriversCore
    EditorFC --> Lang
    EditorFC --> Themes
    EditorFC --> Plugins

    Auth --> DriversCore
    Connect --> DriversCore
    SQLCore --> DriversCore
    PluginMgr --> Plugins
    PluginMgr --> SQLCore
    PluginMgr --> HTMLBuilder
    HTMLBuilder --> StaticAssets
    DriversCore --> DBs
    SQLCore --> DBs

    BuildScript --> Externals
    BuildScript --> Plugins
    BuildScript --> DriversCore
    BuildScript --> Lang
    BuildScript --> Themes

    TestSuites --> DBs
    TestSuites --> WebServer

    %% Click events
    click AdminerFC "https://github.com/vrana/adminer/blob/master/adminer/index.php"
    click Auth "https://github.com/vrana/adminer/blob/master/adminer/include/auth.inc.php"
    click Connect "https://github.com/vrana/adminer/blob/master/adminer/include/connect.inc.php"
    click SQLCore "https://github.com/vrana/adminer/blob/master/adminer/include/db.inc.php"
    click DriversCore "https://github.com/vrana/adminer/blob/master/adminer/drivers/mysql.inc.php"
    click DriversCore "https://github.com/vrana/adminer/blob/master/adminer/drivers/pgsql.inc.php"
    click DriversCore "https://github.com/vrana/adminer/blob/master/adminer/drivers/sqlite.inc.php"
    click DriversCore "https://github.com/vrana/adminer/blob/master/adminer/drivers/oracle.inc.php"
    click DriversCore "https://github.com/vrana/adminer/blob/master/adminer/drivers/mssql.inc.php"
    click PluginMgr "https://github.com/vrana/adminer/blob/master/adminer/include/plugin.inc.php"
    click PluginMgr "https://github.com/vrana/adminer/blob/master/adminer/include/plugins.inc.php"
    click HTMLBuilder "https://github.com/vrana/adminer/blob/master/adminer/include/html.inc.php"
    click StaticAssets "https://github.com/vrana/adminer/blob/master/adminer/static/default.css"
    click StaticAssets "https://github.com/vrana/adminer/blob/master/adminer/static/dark.css"
    click StaticAssets "https://github.com/vrana/adminer/blob/master/adminer/static/functions.js"
    click Themes "https://github.com/vrana/adminer/tree/master/designs/"
    click Lang "https://github.com/vrana/adminer/blob/master/adminer/lang/en.inc.php"
    click BuildScript "https://github.com/vrana/adminer/blob/master/compile.php"
    click Externals "https://github.com/vrana/adminer/tree/master/externals/JsShrink"
    click Externals "https://github.com/vrana/adminer/tree/master/externals/PhpShrink"
    click Externals "https://github.com/vrana/adminer/tree/master/externals/jush"
    click EditorFC "https://github.com/vrana/adminer/blob/master/editor/index.php"
    click EditorLogic "https://github.com/vrana/adminer/blob/master/editor/include/editing.inc.php"
    click EditorDB "https://github.com/vrana/adminer/blob/master/editor/include/connect.inc.php"
    click EditorDB "https://github.com/vrana/adminer/blob/master/editor/db.inc.php"
    click EditorUI "https://github.com/vrana/adminer/blob/master/editor/static/editing.js"
    click EditorExample "https://github.com/vrana/adminer/blob/master/editor/example.php"
    click Plugins "https://github.com/vrana/adminer/tree/master/plugins/"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/clickhouse.php"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/elastic.php"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/firebird.php"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/imap.php"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/mongo.php"
    click Plugins "https://github.com/vrana/adminer/blob/master/plugins/drivers/simpledb.php"
    click TestSuites "https://github.com/vrana/adminer/tree/master/tests/"

    %% Styles
    classDef runtime fill:#D0E7FF,stroke:#0366d6,stroke-width:1px
    classDef client fill:#DFFFE0,stroke:#228B22,stroke-width:1px
    classDef tooling fill:#FFE4B5,stroke:#DAA520,stroke-width:1px
```
