# totalcms/cms architecture

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

- Interactive diagram: https://gitdiagram.com/totalcms/cms
- Repository: https://github.com/totalcms/cms

## Overview

Total CMS is a PHP flat-file CMS: users manage structured content in an admin or through REST/CLI, content is persisted as JSON/files on disk, then queried and rendered through Twig or exposed to integrations. The graph preserves major README capabilities, but some subsystem connections are documented rather than confirmed in sampled implementation; those branches are shown only at that level.

Main entry points: [`src/Domain/Storage/StorageFilesystemAdapter.php`](https://github.com/totalcms/cms/blob/master/src/Domain/Storage/StorageFilesystemAdapter.php) (Flat-file storage), [`config/routes.php`](https://github.com/totalcms/cms/blob/master/config/routes.php) (Route map), [`src/Domain/Index/Service/IndexQueryService.php`](https://github.com/totalcms/cms/blob/master/src/Domain/Index/Service/IndexQueryService.php) (Query services), [`src/Domain/Twig/Service/TwigEngine.php`](https://github.com/totalcms/cms/blob/master/src/Domain/Twig/Service/TwigEngine.php) (Twig rendering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_http_entry["HTTP application<br/>[index.php]"]
  node_route_map["Route map<br/>[routes.php]"]
  node_admin_ui["Admin interface<br/>[admin.js]"]
  node_cli["CMS CLI<br/>[CliApplication.php]"]
end

subgraph group_content["Content management"]
  node_admin_actions["Admin actions"]
  node_content_actions["Content API actions"]
  node_schema_actions["Schema actions"]
  node_query_services["Query services"]
  node_query_pipeline["Query pipeline<br/>[QueryPipeline.php]"]
  node_dataview_query["DataView queries"]
end

subgraph group_render["Site delivery"]
  node_builder["Site Builder"]
  node_twig["Twig rendering<br/>[TwigEngine.php]"]
end

subgraph group_platform["Platform services"]
  node_storage["Flat-file storage"]
  node_cache["Cache manager<br/>[CacheManager.php]"]
  node_automation["Automations and jobs"]
  node_image_processing["Image processing"]
end

subgraph group_integrations["Extensions and integrations"]
  node_extensions["Extension lifecycle"]
  node_extension_storage["Extension storage"]
  node_mcp["MCP server"]
  node_oauth["OAuth services"]
end

node_editor(("Admin user"))
node_api_client(("API client"))
node_site_visitor(("Site visitor"))
node_cli_operator(("CLI operator"))
node_external_services(("External services"))

node_editor -->|"manages content"| node_http_entry
node_api_client -->|"sends requests"| node_http_entry
node_site_visitor -->|"requests pages"| node_http_entry
node_http_entry -->|"dispatches routes"| node_route_map
node_route_map -->|"routes admin"| node_admin_actions
node_route_map -->|"routes API"| node_content_actions
node_route_map -->|"routes schemas"| node_schema_actions
node_route_map -->|"routes MCP"| node_mcp
node_route_map -->|"routes OAuth"| node_oauth
node_admin_actions -->|"reads and writes"| node_storage
node_content_actions -->|"reads and writes"| node_storage
node_schema_actions -->|"reads and writes"| node_storage
node_content_actions -->|"queries objects"| node_query_services
node_query_services -->|"loads index data"| node_storage
node_query_services -->|"executes query"| node_query_pipeline
node_query_pipeline -->|"gets and stores"| node_cache
node_dataview_query -->|"executes query"| node_query_pipeline
node_dataview_query -->|"loads view data"| node_storage
node_admin_actions -->|"serves interface"| node_admin_ui
node_editor -->|"uses"| node_admin_ui
node_admin_actions -->|"previews pages"| node_builder
node_builder -->|"renders preview"| node_twig
node_site_visitor -->|"receives rendered pages"| node_twig
node_twig -->|"loads templates"| node_storage
node_twig -->|"reads content"| node_query_services
node_cli_operator -->|"runs commands"| node_cli
node_cli -->|"manages content files"| node_storage
node_cli -->|"queries collections"| node_query_services
node_automation -.->|"persists job state"| node_storage
node_route_map -->|"routes automation"| node_automation
node_extensions -->|"provides persistence"| node_extension_storage
node_extensions -->|"registers template paths"| node_twig
node_mcp -.->|"exposes collection search"| node_query_services
node_oauth -->|"issues access tokens"| node_api_client
node_image_processing -->|"reads and writes media"| node_storage
node_extensions -.->|"optional integrations"| node_external_services

click node_http_entry "https://github.com/totalcms/cms/blob/master/public/index.php"
click node_route_map "https://github.com/totalcms/cms/blob/master/config/routes.php"
click node_admin_actions "https://github.com/totalcms/cms/tree/master/src/Action/Admin"
click node_content_actions "https://github.com/totalcms/cms/tree/master/src/Action/Object"
click node_schema_actions "https://github.com/totalcms/cms/tree/master/src/Action/Schema"
click node_storage "https://github.com/totalcms/cms/blob/master/src/Domain/Storage/StorageFilesystemAdapter.php"
click node_query_services "https://github.com/totalcms/cms/blob/master/src/Domain/Index/Service/IndexQueryService.php"
click node_query_pipeline "https://github.com/totalcms/cms/blob/master/src/Domain/Query/Service/QueryPipeline.php"
click node_dataview_query "https://github.com/totalcms/cms/blob/master/src/Domain/DataView/Service/DataViewQueryService.php"
click node_admin_ui "https://github.com/totalcms/cms/blob/master/javascript/admin.js"
click node_builder "https://github.com/totalcms/cms/blob/master/src/Domain/Builder/Service/BuilderPreviewService.php"
click node_twig "https://github.com/totalcms/cms/blob/master/src/Domain/Twig/Service/TwigEngine.php"
click node_cache "https://github.com/totalcms/cms/blob/master/src/Domain/Cache/CacheManager.php"
click node_cli "https://github.com/totalcms/cms/blob/master/src/CLI/CliApplication.php"
click node_automation "https://github.com/totalcms/cms/blob/master/src/Action/Automation/AutomationRunNowAction.php"
click node_extensions "https://github.com/totalcms/cms/blob/master/src/Domain/Extension/Service/ExtensionManager.php"
click node_extension_storage "https://github.com/totalcms/cms/blob/master/src/Domain/Extension/ExtensionStorage.php"
click node_mcp "https://github.com/totalcms/cms/blob/master/src/Action/Mcp/McpEndpointAction.php"
click node_oauth "https://github.com/totalcms/cms/blob/master/src/Action/OAuth/OAuthTokenAction.php"
click node_image_processing "https://github.com/totalcms/cms/tree/master/src/Action/ImageWorks"

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_http_entry,node_route_map,node_admin_ui,node_cli,node_editor,node_api_client toneBlue
class node_admin_actions,node_content_actions,node_schema_actions,node_query_services,node_query_pipeline,node_dataview_query toneAmber
class node_builder,node_twig toneMint
class node_storage,node_cache,node_automation,node_image_processing toneRose
class node_extensions,node_extension_storage,node_mcp,node_oauth,node_site_visitor,node_cli_operator,node_external_services toneIndigo
```

## Components

### Entry points

- [HTTP application](https://github.com/totalcms/cms/blob/master/public/index.php): `public/index.php`
- [Route map](https://github.com/totalcms/cms/blob/master/config/routes.php): `config/routes.php`
- [Admin interface](https://github.com/totalcms/cms/blob/master/javascript/admin.js): `javascript/admin.js`
- [CMS CLI](https://github.com/totalcms/cms/blob/master/src/CLI/CliApplication.php): `src/CLI/CliApplication.php`

### Content management

- [Admin actions](https://github.com/totalcms/cms/tree/master/src/Action/Admin): `src/Action/Admin`
- [Content API actions](https://github.com/totalcms/cms/tree/master/src/Action/Object): `src/Action/Object`
- [Schema actions](https://github.com/totalcms/cms/tree/master/src/Action/Schema): `src/Action/Schema`
- [Query services](https://github.com/totalcms/cms/blob/master/src/Domain/Index/Service/IndexQueryService.php): `src/Domain/Index/Service/IndexQueryService.php`
- [Query pipeline](https://github.com/totalcms/cms/blob/master/src/Domain/Query/Service/QueryPipeline.php): `src/Domain/Query/Service/QueryPipeline.php`
- [DataView queries](https://github.com/totalcms/cms/blob/master/src/Domain/DataView/Service/DataViewQueryService.php): `src/Domain/DataView/Service/DataViewQueryService.php`

### Site delivery

- [Site Builder](https://github.com/totalcms/cms/blob/master/src/Domain/Builder/Service/BuilderPreviewService.php): `src/Domain/Builder/Service/BuilderPreviewService.php`
- [Twig rendering](https://github.com/totalcms/cms/blob/master/src/Domain/Twig/Service/TwigEngine.php): `src/Domain/Twig/Service/TwigEngine.php`

### Platform services

- [Flat-file storage](https://github.com/totalcms/cms/blob/master/src/Domain/Storage/StorageFilesystemAdapter.php): `src/Domain/Storage/StorageFilesystemAdapter.php`
- [Cache manager](https://github.com/totalcms/cms/blob/master/src/Domain/Cache/CacheManager.php): `src/Domain/Cache/CacheManager.php`
- [Automations and jobs](https://github.com/totalcms/cms/blob/master/src/Action/Automation/AutomationRunNowAction.php): `src/Action/Automation/AutomationRunNowAction.php`
- [Image processing](https://github.com/totalcms/cms/tree/master/src/Action/ImageWorks): `src/Action/ImageWorks`

### Extensions and integrations

- [Extension lifecycle](https://github.com/totalcms/cms/blob/master/src/Domain/Extension/Service/ExtensionManager.php): `src/Domain/Extension/Service/ExtensionManager.php`
- [Extension storage](https://github.com/totalcms/cms/blob/master/src/Domain/Extension/ExtensionStorage.php): `src/Domain/Extension/ExtensionStorage.php`
- [MCP server](https://github.com/totalcms/cms/blob/master/src/Action/Mcp/McpEndpointAction.php): `src/Action/Mcp/McpEndpointAction.php`
- [OAuth services](https://github.com/totalcms/cms/blob/master/src/Action/OAuth/OAuthTokenAction.php): `src/Action/OAuth/OAuthTokenAction.php`

### Other components

- **Admin user**
- **API client**
- **Site visitor**
- **CLI operator**
- **External services**

## Connections

- Admin user → HTTP application: manages content
- API client → HTTP application: sends requests
- Site visitor → HTTP application: requests pages
- HTTP application → Route map: dispatches routes
- Route map → Admin actions: routes admin
- Route map → Content API actions: routes API
- Route map → Schema actions: routes schemas
- Route map → MCP server: routes MCP
- Route map → OAuth services: routes OAuth
- Admin actions → Flat-file storage: reads and writes
- Content API actions → Flat-file storage: reads and writes
- Schema actions → Flat-file storage: reads and writes
- Content API actions → Query services: queries objects
- Query services → Flat-file storage: loads index data
- Query services → Query pipeline: executes query
- Query pipeline → Cache manager: gets and stores
- DataView queries → Query pipeline: executes query
- DataView queries → Flat-file storage: loads view data
- Admin actions → Admin interface: serves interface
- Admin user → Admin interface: uses
- Admin actions → Site Builder: previews pages
- Site Builder → Twig rendering: renders preview
- Site visitor → Twig rendering: receives rendered pages
- Twig rendering → Flat-file storage: loads templates
- Twig rendering → Query services: reads content
- CLI operator → CMS CLI: runs commands
- CMS CLI → Flat-file storage: manages content files
- CMS CLI → Query services: queries collections
- Automations and jobs → Flat-file storage: persists job state
- Route map → Automations and jobs: routes automation
- Extension lifecycle → Extension storage: provides persistence
- Extension lifecycle → Twig rendering: registers template paths
- MCP server → Query services: exposes collection search
- OAuth services → API client: issues access tokens
- Image processing → Flat-file storage: reads and writes media
- Extension lifecycle → External services: optional integrations
