# jacksonhoran/blog-app architecture

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

- Interactive diagram: https://gitdiagram.com/jacksonhoran/blog-app
- Repository: https://github.com/jacksonhoran/blog-app

## Overview

Blog App is a Vue 3 client backed by a CakePHP JSON API and MySQL. Readers browse public articles; users can register and log in, and authenticated authors can create or edit articles. The frontend routes views, manages session state, and sends API requests; backend controllers handle article and user operations through CakePHP authentication and authorization, with model tables/entities persisting domain data. The README also documents database-backed operation. Edges are limited to relationships shown in the supplied excerpts, SOURCE INDEX references, or README; several frontend views and persistence connections are therefore not asserted.

Main entry points: [`frontend/src/services/api.js`](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/services/api.js) (HTTP API client), [`backend/src/Controller/ArticlesController.php`](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/ArticlesController.php) (Article endpoints), [`backend/src/Controller/UsersController.php`](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/UsersController.php) (User endpoints), [`frontend/src/main.js`](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/main.js) (Client bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Vue client"]
  node_app["App shell<br/>[App.vue]"]
  node_bootstrap["Client bootstrap<br/>[main.js]"]
  node_router["Page routing<br/>[index.js]"]
  node_article_views["Article views"]
  node_article_form["Article form<br/>[ArticleForm.vue]"]
  node_login_view["Login and registration"]
  node_auth_state["Auth state<br/>[useAuth.js]"]
  node_api_client["HTTP API client<br/>[api.js]"]
  node_prefetch["Article prefetch<br/>[prefetch.js]"]
end

subgraph group_api["CakePHP API"]
  node_backend_app["Request middleware<br/>[Application.php]"]
  node_host_check["Host validation"]
  node_article_api["Article endpoints"]
  node_user_api["User endpoints"]
end

subgraph group_domain["Domain and persistence"]
  node_article_store[("Article persistence<br/>[ArticlesTable.php]")]
  node_article_entity["Article entity<br/>[Article.php]"]
  node_user_store[("User persistence<br/>[UsersTable.php]")]
  node_user_entity["User entity<br/>[User.php]"]
end

subgraph group_security["Identity and access"]
  node_auth_middleware["Authentication setup<br/>[Application.php]"]
  node_app_controller["Controller components<br/>[AppController.php]"]
  node_policy["Article policy<br/>[ArticlePolicy.php]"]
end

node_visitor(("Reader or author"))
node_mysql[("MySQL database")]

node_visitor -->|"uses"| node_app
node_app -->|"renders routes"| node_router
node_bootstrap -->|"mounts"| node_app
node_bootstrap -->|"installs"| node_router
node_bootstrap -->|"clears on 401"| node_auth_state
node_article_views -.->|"requests data"| node_api_client
node_article_form -.->|"submits articles"| node_api_client
node_login_view -.->|"requests identity"| node_api_client
node_auth_state -->|"checks status"| node_api_client
node_prefetch -.->|"prefetches data"| node_api_client
node_api_client -.->|"HTTP requests"| node_article_api
node_api_client -.->|"HTTP requests"| node_user_api
node_backend_app -->|"adds middleware"| node_host_check
node_backend_app -->|"configures"| node_auth_middleware
node_article_api -->|"inherits components"| node_app_controller
node_user_api -->|"inherits components"| node_app_controller
node_article_api -->|"reads and saves"| node_article_store
node_article_api -->|"creates entities"| node_article_entity
node_user_api -.->|"reads and saves"| node_user_store
node_user_api -->|"handles users"| node_user_entity
node_article_api -.->|"authorizes edits"| node_policy
node_mysql -.->|"stores records"| node_article_store
node_mysql -.->|"stores records"| node_user_store

click node_app "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/App.vue"
click node_bootstrap "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/main.js"
click node_router "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/router/index.js"
click node_article_views "https://github.com/jacksonhoran/blog-app/tree/main/frontend/src/views"
click node_article_form "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/components/ArticleForm.vue"
click node_login_view "https://github.com/jacksonhoran/blog-app/tree/main/frontend/src/views"
click node_auth_state "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/composables/useAuth.js"
click node_api_client "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/services/api.js"
click node_prefetch "https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/directives/prefetch.js"
click node_backend_app "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Application.php"
click node_host_check "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Middleware/HostHeaderMiddleware.php"
click node_article_api "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/ArticlesController.php"
click node_user_api "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/UsersController.php"
click node_article_store "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Table/ArticlesTable.php"
click node_article_entity "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Entity/Article.php"
click node_user_store "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Table/UsersTable.php"
click node_user_entity "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Entity/User.php"
click node_auth_middleware "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Application.php"
click node_app_controller "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/AppController.php"
click node_policy "https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Policy/ArticlePolicy.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_app,node_bootstrap,node_router,node_article_views,node_article_form,node_login_view,node_auth_state,node_api_client,node_prefetch toneBlue
class node_backend_app,node_host_check,node_article_api,node_user_api,node_mysql toneAmber
class node_article_store,node_article_entity,node_user_store,node_user_entity toneMint
class node_auth_middleware,node_app_controller,node_policy toneRose
class node_visitor toneIndigo
```

## Components

### Vue client

- [App shell](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Client bootstrap](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/main.js): `frontend/src/main.js`
- [Page routing](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/router/index.js): `frontend/src/router/index.js`
- [Article views](https://github.com/jacksonhoran/blog-app/tree/main/frontend/src/views): `frontend/src/views`
- [Article form](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/components/ArticleForm.vue): `frontend/src/components/ArticleForm.vue`
- [Login and registration](https://github.com/jacksonhoran/blog-app/tree/main/frontend/src/views): `frontend/src/views`
- [Auth state](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/composables/useAuth.js): `frontend/src/composables/useAuth.js`
- [HTTP API client](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Article prefetch](https://github.com/jacksonhoran/blog-app/blob/main/frontend/src/directives/prefetch.js): `frontend/src/directives/prefetch.js`

### CakePHP API

- [Request middleware](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Application.php): `backend/src/Application.php`
- [Host validation](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Middleware/HostHeaderMiddleware.php): `backend/src/Middleware/HostHeaderMiddleware.php`
- [Article endpoints](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/ArticlesController.php): `backend/src/Controller/ArticlesController.php`
- [User endpoints](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/UsersController.php): `backend/src/Controller/UsersController.php`

### Domain and persistence

- [Article persistence](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Table/ArticlesTable.php): `backend/src/Model/Table/ArticlesTable.php`
- [Article entity](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Entity/Article.php): `backend/src/Model/Entity/Article.php`
- [User persistence](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Table/UsersTable.php): `backend/src/Model/Table/UsersTable.php`
- [User entity](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Model/Entity/User.php): `backend/src/Model/Entity/User.php`

### Identity and access

- [Authentication setup](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Application.php): `backend/src/Application.php`
- [Controller components](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Controller/AppController.php): `backend/src/Controller/AppController.php`
- [Article policy](https://github.com/jacksonhoran/blog-app/blob/main/backend/src/Policy/ArticlePolicy.php): `backend/src/Policy/ArticlePolicy.php`

### Other components

- **Reader or author**
- **MySQL database**

## Connections

- Reader or author → App shell: uses (evidence: `README.md`)
- App shell → Page routing: renders routes (evidence: `frontend/src/App.vue`)
- Client bootstrap → App shell: mounts (evidence: `frontend/src/main.js`)
- Client bootstrap → Page routing: installs (evidence: `frontend/src/main.js`)
- Client bootstrap → Auth state: clears on 401 (evidence: `frontend/src/main.js`)
- Article views → HTTP API client: requests data
- Article form → HTTP API client: submits articles
- Login and registration → HTTP API client: requests identity
- Auth state → HTTP API client: checks status (evidence: `frontend/src/composables/useAuth.js`)
- Article prefetch → HTTP API client: prefetches data
- HTTP API client → Article endpoints: HTTP requests (evidence: `README.md`)
- HTTP API client → User endpoints: HTTP requests (evidence: `README.md`)
- Request middleware → Host validation: adds middleware (evidence: `backend/src/Application.php`)
- Request middleware → Authentication setup: configures (evidence: `backend/src/Application.php`)
- Article endpoints → Controller components: inherits components (evidence: `backend/src/Controller/ArticlesController.php`)
- User endpoints → Controller components: inherits components (evidence: `backend/src/Controller/UsersController.php`)
- Article endpoints → Article persistence: reads and saves (evidence: `backend/src/Controller/ArticlesController.php`)
- Article endpoints → Article entity: creates entities (evidence: `backend/src/Controller/ArticlesController.php`)
- User endpoints → User persistence: reads and saves
- User endpoints → User entity: handles users (evidence: `backend/src/Controller/UsersController.php`)
- Article endpoints → Article policy: authorizes edits
- MySQL database → Article persistence: stores records (evidence: `README.md`)
- MySQL database → User persistence: stores records (evidence: `README.md`)
