# jbroadway/elefant architecture

> Architecture diagram of the GitHub repository jbroadway/elefant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jbroadway/elefant
- Repository: https://github.com/jbroadway/elefant

## Overview

Elefant is a PHP CMS and web framework. A request enters through the front controller, is routed to an app handler, and produces a page rendered through templates. The graph also preserves major documented product capabilities—site editing, design tools, shared apps, API, authentication, and CLI—without implying unsampled implementation calls. Source excerpts show the core dispatch and rendering relationships; optional or unverified integrations are dashed with no evidence path.

Main entry points: [`lib/Controller.php`](https://github.com/jbroadway/elefant/blob/master/lib/Controller.php) (Request controller), [`lib/Page.php`](https://github.com/jbroadway/elefant/blob/master/lib/Page.php) (Page response), [`apps/admin/handlers`](https://github.com/jbroadway/elefant/tree/master/apps/admin/handlers) (CMS administration), [`lib/FrontController.php`](https://github.com/jbroadway/elefant/blob/master/lib/FrontController.php) (Front controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Request Runtime"]
  node_front["Front controller"]
  node_controller["Request controller<br/>[Controller.php]"]
  node_appconf["App configuration<br/>[Appconf.php]"]
  node_page["Page response<br/>[Page.php]"]
  node_template["Template engine<br/>[Template.php]"]
  node_apphandlers["App handlers"]
end

subgraph group_content["CMS Content"]
  node_admin["CMS administration"]
  node_webpages["Webpage content<br/>[Webpage.php]"]
  node_blog["Blog publishing"]
  node_blocks["Content blocks<br/>[Block.php]"]
  node_navigation["Site navigation"]
end

subgraph group_identity["Users and API"]
  node_users["User management<br/>[User.php]"]
  node_oauth["OAuth storage<br/>[DBStorage.php]"]
  node_api["API endpoints"]
end

subgraph group_design["Design and Media"]
  node_designer["Theme designer"]
  node_filemanager["File manager"]
  node_social["Social embeds"]
  node_translator["Translation tools"]
end

subgraph group_platform["Developer Platform"]
  node_model["Data models<br/>[Model.php]"]
  node_extended["Extended models<br/>[ExtendedModel.php]"]
  node_database[("SQL database<br/>[DB.php]")]
  node_cli["CLI commands"]
  node_jobqueue["Background worker<br/>[worker.php]"]
end

node_visitor(("Site visitor"))
node_external(("External services"))

node_visitor -->|"requests"| node_front
node_front -->|"dispatches"| node_controller
node_controller -->|"loads settings"| node_appconf
node_controller -->|"runs handlers"| node_apphandlers
node_front -->|"renders response"| node_page
node_page -->|"renders layout"| node_template
node_template -->|"runs embeds"| node_controller
node_apphandlers -.->|"manages pages"| node_webpages
node_admin -.->|"edits pages"| node_webpages
node_admin -.->|"manages blocks"| node_blocks
node_admin -.->|"offers design tools"| node_designer
node_blog -.->|"fetches feeds"| node_external
node_users -.->|"authenticates clients"| node_oauth
node_api -.->|"serves user APIs"| node_users
node_extended -->|"extends"| node_model
node_users -->|"inherits model behavior"| node_extended
node_oauth -->|"reads and writes"| node_database
node_webpages -->|"uses model base"| node_extended
node_blocks -->|"uses model base"| node_model
node_cli -.->|"runs tasks"| node_external
node_jobqueue -.->|"consumes jobs"| node_external
node_filemanager -.->|"manages media"| node_external
node_social -.->|"embeds services"| node_external
node_translator -.->|"localizes content"| node_page
node_navigation -.->|"provides navigation"| node_page

click node_front "https://github.com/jbroadway/elefant/blob/master/lib/FrontController.php"
click node_controller "https://github.com/jbroadway/elefant/blob/master/lib/Controller.php"
click node_appconf "https://github.com/jbroadway/elefant/blob/master/lib/Appconf.php"
click node_page "https://github.com/jbroadway/elefant/blob/master/lib/Page.php"
click node_template "https://github.com/jbroadway/elefant/blob/master/lib/Template.php"
click node_apphandlers "https://github.com/jbroadway/elefant/tree/master/apps"
click node_admin "https://github.com/jbroadway/elefant/tree/master/apps/admin/handlers"
click node_webpages "https://github.com/jbroadway/elefant/blob/master/apps/admin/models/Webpage.php"
click node_blog "https://github.com/jbroadway/elefant/tree/master/apps/blog/handlers"
click node_blocks "https://github.com/jbroadway/elefant/blob/master/apps/blocks/models/Block.php"
click node_navigation "https://github.com/jbroadway/elefant/tree/master/apps/navigation/handlers"
click node_users "https://github.com/jbroadway/elefant/blob/master/apps/user/models/User.php"
click node_oauth "https://github.com/jbroadway/elefant/blob/master/apps/user/lib/Auth/OAuth/Storage/DBStorage.php"
click node_api "https://github.com/jbroadway/elefant/tree/master/apps/api/handlers"
click node_designer "https://github.com/jbroadway/elefant/tree/master/apps/designer/handlers"
click node_filemanager "https://github.com/jbroadway/elefant/tree/master/apps/filemanager/handlers"
click node_social "https://github.com/jbroadway/elefant/tree/master/apps/social/handlers"
click node_translator "https://github.com/jbroadway/elefant/tree/master/apps/translator/handlers"
click node_model "https://github.com/jbroadway/elefant/blob/master/lib/Model.php"
click node_extended "https://github.com/jbroadway/elefant/blob/master/lib/ExtendedModel.php"
click node_database "https://github.com/jbroadway/elefant/blob/master/lib/DB.php"
click node_cli "https://github.com/jbroadway/elefant/tree/master/apps/cli/handlers"
click node_jobqueue "https://github.com/jbroadway/elefant/blob/master/apps/jobqueue/handlers/worker.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_front,node_controller,node_appconf,node_page,node_template,node_apphandlers toneBlue
class node_admin,node_webpages,node_blog,node_blocks,node_navigation toneAmber
class node_users,node_oauth,node_api toneMint
class node_designer,node_filemanager,node_social,node_translator toneRose
class node_model,node_extended,node_database,node_cli,node_jobqueue,node_visitor,node_external toneIndigo
```

## Components

### Request Runtime

- [Front controller](https://github.com/jbroadway/elefant/blob/master/lib/FrontController.php): `lib/FrontController.php`
- [Request controller](https://github.com/jbroadway/elefant/blob/master/lib/Controller.php): `lib/Controller.php`
- [App configuration](https://github.com/jbroadway/elefant/blob/master/lib/Appconf.php): `lib/Appconf.php`
- [Page response](https://github.com/jbroadway/elefant/blob/master/lib/Page.php): `lib/Page.php`
- [Template engine](https://github.com/jbroadway/elefant/blob/master/lib/Template.php): `lib/Template.php`
- [App handlers](https://github.com/jbroadway/elefant/tree/master/apps): `apps`

### CMS Content

- [CMS administration](https://github.com/jbroadway/elefant/tree/master/apps/admin/handlers): `apps/admin/handlers`
- [Webpage content](https://github.com/jbroadway/elefant/blob/master/apps/admin/models/Webpage.php): `apps/admin/models/Webpage.php`
- [Blog publishing](https://github.com/jbroadway/elefant/tree/master/apps/blog/handlers): `apps/blog/handlers`
- [Content blocks](https://github.com/jbroadway/elefant/blob/master/apps/blocks/models/Block.php): `apps/blocks/models/Block.php`
- [Site navigation](https://github.com/jbroadway/elefant/tree/master/apps/navigation/handlers): `apps/navigation/handlers`

### Users and API

- [User management](https://github.com/jbroadway/elefant/blob/master/apps/user/models/User.php): `apps/user/models/User.php`
- [OAuth storage](https://github.com/jbroadway/elefant/blob/master/apps/user/lib/Auth/OAuth/Storage/DBStorage.php): `apps/user/lib/Auth/OAuth/Storage/DBStorage.php`
- [API endpoints](https://github.com/jbroadway/elefant/tree/master/apps/api/handlers): `apps/api/handlers`

### Design and Media

- [Theme designer](https://github.com/jbroadway/elefant/tree/master/apps/designer/handlers): `apps/designer/handlers`
- [File manager](https://github.com/jbroadway/elefant/tree/master/apps/filemanager/handlers): `apps/filemanager/handlers`
- [Social embeds](https://github.com/jbroadway/elefant/tree/master/apps/social/handlers): `apps/social/handlers`
- [Translation tools](https://github.com/jbroadway/elefant/tree/master/apps/translator/handlers): `apps/translator/handlers`

### Developer Platform

- [Data models](https://github.com/jbroadway/elefant/blob/master/lib/Model.php): `lib/Model.php`
- [Extended models](https://github.com/jbroadway/elefant/blob/master/lib/ExtendedModel.php): `lib/ExtendedModel.php`
- [SQL database](https://github.com/jbroadway/elefant/blob/master/lib/DB.php): `lib/DB.php`
- [CLI commands](https://github.com/jbroadway/elefant/tree/master/apps/cli/handlers): `apps/cli/handlers`
- [Background worker](https://github.com/jbroadway/elefant/blob/master/apps/jobqueue/handlers/worker.php): `apps/jobqueue/handlers/worker.php`

### Other components

- **Site visitor**
- **External services**

## Connections

- Site visitor → Front controller: requests
- Front controller → Request controller: dispatches (evidence: `lib/FrontController.php`)
- Request controller → App configuration: loads settings (evidence: `lib/Controller.php`)
- Request controller → App handlers: runs handlers (evidence: `lib/Controller.php`)
- Front controller → Page response: renders response (evidence: `lib/FrontController.php`)
- Page response → Template engine: renders layout (evidence: `lib/Page.php`)
- Template engine → Request controller: runs embeds (evidence: `lib/Template.php`)
- App handlers → Webpage content: manages pages (evidence: `apps/admin/models/Webpage.php`)
- CMS administration → Webpage content: edits pages
- CMS administration → Content blocks: manages blocks
- CMS administration → Theme designer: offers design tools
- Blog publishing → External services: fetches feeds
- User management → OAuth storage: authenticates clients (evidence: `apps/user/lib/Auth/OAuth/Storage/DBStorage.php`)
- API endpoints → User management: serves user APIs
- Extended models → Data models: extends (evidence: `lib/ExtendedModel.php`)
- User management → Extended models: inherits model behavior (evidence: `apps/user/models/User.php`)
- OAuth storage → SQL database: reads and writes (evidence: `apps/user/lib/Auth/OAuth/Storage/DBStorage.php`)
- Webpage content → Extended models: uses model base (evidence: `apps/admin/models/Webpage.php`)
- Content blocks → Data models: uses model base (evidence: `apps/blocks/models/Block.php`)
- CLI commands → External services: runs tasks
- Background worker → External services: consumes jobs (evidence: `apps/jobqueue/handlers/worker.php`)
- File manager → External services: manages media
- Social embeds → External services: embeds services
- Translation tools → Page response: localizes content
- Site navigation → Page response: provides navigation
