# deesoft/yii2-inertia architecture

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

- Interactive diagram: https://gitdiagram.com/deesoft/yii2-inertia
- Repository: https://github.com/deesoft/yii2-inertia

## Overview

This repository is a Yii2 adapter for Inertia: server-side Yii routes render page data and the Vue client displays it without a separate API. The documented workflow also covers shared and deferred props, Vite asset registration, and optional Gii CRUD scaffolding. The graph includes those product branches; core PHP implementation excerpts were not provided, so uncertain internal call wiring is left out.

Main entry points: [`resources/client/app.js`](https://github.com/deesoft/yii2-inertia/blob/master/resources/client/app.js) (Vue app entry), [`src/Inertia.php`](https://github.com/deesoft/yii2-inertia/blob/master/src/Inertia.php) (Inertia API), [`src/ResponseFactory.php`](https://github.com/deesoft/yii2-inertia/blob/master/src/ResponseFactory.php) (Response factory), [`resources/client/pages`](https://github.com/deesoft/yii2-inertia/tree/master/resources/client/pages) (Page components)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Yii server adapter"]
  node_routes["Yii routes"]
  node_inertia["Inertia API<br/>[Inertia.php]"]
  node_responses["Response factory"]
  node_props["Prop resolution"]
  node_serializer["Page serializer<br/>[Serializer.php]"]
  node_error["Error handling<br/>[ErrorHandler.php]"]
end

subgraph group_client["Vue client"]
  node_clientapp["Vue app entry<br/>[app.js]"]
  node_mainplugin["Navigation plugin<br/>[main.js]"]
  node_pages["Page components"]
  node_layouts["App layouts"]
  node_components["UI components"]
  node_composables["Client composables"]
end

subgraph group_crud["CRUD scaffolding"]
  node_generator["CRUD generator<br/>[Generator.php]"]
  node_templates["CRUD templates"]
  node_generated["Generated controllers<br/>[controller.php]"]
end

subgraph group_assets["Assets and shell"]
  node_viteasset["Vite asset bundle<br/>[ViteAsset.php]"]
  node_viteplugin["Vite integration<br/>[vite-plugin.js]"]
  node_appview["HTML app shell<br/>[app.php]"]
end

node_browser(("Browser user"))

node_browser -->|"requests pages"| node_routes
node_routes -->|"renders pages"| node_inertia
node_inertia -->|"creates response"| node_responses
node_inertia -->|"resolves props"| node_props
node_props -->|"serializes data"| node_serializer
node_responses -->|"returns page response"| node_browser
node_browser -->|"loads client"| node_clientapp
node_clientapp -->|"resolves page"| node_pages
node_clientapp -->|"installs plugin"| node_mainplugin
node_clientapp -->|"sets default layout"| node_layouts
node_pages -->|"renders within"| node_layouts
node_layouts -->|"uses components"| node_components
node_pages -->|"uses composables"| node_composables
node_mainplugin -->|"visits routes"| node_browser
node_generator -->|"renders templates"| node_templates
node_templates -->|"generates CRUD"| node_generated
node_generated -->|"renders pages"| node_inertia
node_generated -->|"returns CRUD response"| node_browser
node_viteasset -.->|"registers assets"| node_browser
node_viteplugin -.->|"integrates assets"| node_clientapp
node_responses -->|"uses shell"| node_appview
node_error -->|"renders errors"| node_browser

click node_inertia "https://github.com/deesoft/yii2-inertia/blob/master/src/Inertia.php"
click node_responses "https://github.com/deesoft/yii2-inertia/blob/master/src/ResponseFactory.php"
click node_props "https://github.com/deesoft/yii2-inertia/blob/master/src/ResolveDataEvent.php"
click node_serializer "https://github.com/deesoft/yii2-inertia/blob/master/src/Serializer.php"
click node_error "https://github.com/deesoft/yii2-inertia/blob/master/src/ErrorHandler.php"
click node_clientapp "https://github.com/deesoft/yii2-inertia/blob/master/resources/client/app.js"
click node_mainplugin "https://github.com/deesoft/yii2-inertia/blob/master/resources/client/plugins/main.js"
click node_pages "https://github.com/deesoft/yii2-inertia/tree/master/resources/client/pages"
click node_layouts "https://github.com/deesoft/yii2-inertia/tree/master/resources/client/layouts"
click node_components "https://github.com/deesoft/yii2-inertia/tree/master/resources/client/components"
click node_composables "https://github.com/deesoft/yii2-inertia/tree/master/resources/client/composables"
click node_generator "https://github.com/deesoft/yii2-inertia/blob/master/gii/crud/Generator.php"
click node_templates "https://github.com/deesoft/yii2-inertia/tree/master/gii/crud"
click node_generated "https://github.com/deesoft/yii2-inertia/blob/master/gii/crud/default/controller.php"
click node_viteasset "https://github.com/deesoft/yii2-inertia/blob/master/src/ViteAsset.php"
click node_viteplugin "https://github.com/deesoft/yii2-inertia/blob/master/src/vite-plugin.js"
click node_appview "https://github.com/deesoft/yii2-inertia/blob/master/src/views/app.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_routes,node_inertia,node_responses,node_props,node_serializer,node_error,node_browser toneBlue
class node_clientapp,node_mainplugin,node_pages,node_layouts,node_components,node_composables toneAmber
class node_generator,node_templates,node_generated toneMint
class node_viteasset,node_viteplugin,node_appview toneRose
```

## Components

### Yii server adapter

- **Yii routes**
- [Inertia API](https://github.com/deesoft/yii2-inertia/blob/master/src/Inertia.php): `src/Inertia.php`
- [Response factory](https://github.com/deesoft/yii2-inertia/blob/master/src/ResponseFactory.php): `src/ResponseFactory.php`
- [Prop resolution](https://github.com/deesoft/yii2-inertia/blob/master/src/ResolveDataEvent.php): `src/ResolveDataEvent.php`
- [Page serializer](https://github.com/deesoft/yii2-inertia/blob/master/src/Serializer.php): `src/Serializer.php`
- [Error handling](https://github.com/deesoft/yii2-inertia/blob/master/src/ErrorHandler.php): `src/ErrorHandler.php`

### Vue client

- [Vue app entry](https://github.com/deesoft/yii2-inertia/blob/master/resources/client/app.js): `resources/client/app.js`
- [Navigation plugin](https://github.com/deesoft/yii2-inertia/blob/master/resources/client/plugins/main.js): `resources/client/plugins/main.js`
- [Page components](https://github.com/deesoft/yii2-inertia/tree/master/resources/client/pages): `resources/client/pages`
- [App layouts](https://github.com/deesoft/yii2-inertia/tree/master/resources/client/layouts): `resources/client/layouts`
- [UI components](https://github.com/deesoft/yii2-inertia/tree/master/resources/client/components): `resources/client/components`
- [Client composables](https://github.com/deesoft/yii2-inertia/tree/master/resources/client/composables): `resources/client/composables`

### CRUD scaffolding

- [CRUD generator](https://github.com/deesoft/yii2-inertia/blob/master/gii/crud/Generator.php): `gii/crud/Generator.php`
- [CRUD templates](https://github.com/deesoft/yii2-inertia/tree/master/gii/crud): `gii/crud`
- [Generated controllers](https://github.com/deesoft/yii2-inertia/blob/master/gii/crud/default/controller.php): `gii/crud/default/controller.php`

### Assets and shell

- [Vite asset bundle](https://github.com/deesoft/yii2-inertia/blob/master/src/ViteAsset.php): `src/ViteAsset.php`
- [Vite integration](https://github.com/deesoft/yii2-inertia/blob/master/src/vite-plugin.js): `src/vite-plugin.js`
- [HTML app shell](https://github.com/deesoft/yii2-inertia/blob/master/src/views/app.php): `src/views/app.php`

### Other components

- **Browser user**

## Connections

- Browser user → Yii routes: requests pages
- Yii routes → Inertia API: renders pages
- Inertia API → Response factory: creates response
- Inertia API → Prop resolution: resolves props
- Prop resolution → Page serializer: serializes data
- Response factory → Browser user: returns page response
- Browser user → Vue app entry: loads client
- Vue app entry → Page components: resolves page
- Vue app entry → Navigation plugin: installs plugin
- Vue app entry → App layouts: sets default layout
- Page components → App layouts: renders within
- App layouts → UI components: uses components
- Page components → Client composables: uses composables
- Navigation plugin → Browser user: visits routes
- CRUD generator → CRUD templates: renders templates
- CRUD templates → Generated controllers: generates CRUD
- Generated controllers → Inertia API: renders pages
- Generated controllers → Browser user: returns CRUD response
- Vite asset bundle → Browser user: registers assets
- Vite integration → Vue app entry: integrates assets
- Response factory → HTML app shell: uses shell
- Error handling → Browser user: renders errors
