# johandhana/blog-ci4 architecture

> Architecture diagram of the GitHub repository johandhana/blog-ci4, 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/johandhana/blog-ci4
- Repository: https://github.com/johandhana/blog-ci4

## Overview

This is a CodeIgniter 4 blog app: visitors browse, search, and filter posts; authenticated users manage posts and categories, while users can log in or register. Routes dispatch requests to controllers, which assemble views and use models for content data. The sampled post controller confirms post queries, category associations, and image uploads. User, category, and role details beyond the routes and README are not shown in the sampled source, so their internal wiring is left unspecified.

Main entry points: [`app/Controllers/PostController.php`](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/PostController.php) (Post controller), [`app/Config/Routes.php`](https://github.com/johandhana/blog-ci4/blob/main/app/Config/Routes.php) (Route definitions), [`app/Controllers/Categories.php`](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Categories.php) (Category controller), [`app/Controllers/Users.php`](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Users.php) (Users controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request and access"]
  node_routes["Route definitions<br/>[Routes.php]"]
  node_auth["Auth filter<br/>[Auth.php]"]
end

subgraph group_content["Blog content"]
  node_post_controller["Post controller<br/>[PostController.php]"]
  node_posts["Post model<br/>[Post.php]"]
  node_comment_model["Comment model<br/>[Comment.php]"]
  node_database[("Application database<br/>[Database.php]")]
  node_uploads["Post image uploads<br/>[PostController.php]"]
end

subgraph group_accounts["Users and categories"]
  node_categories_model["Category model<br/>[Category.php]"]
  node_category_controller["Category controller<br/>[Categories.php]"]
  node_users_controller["Users controller<br/>[Users.php]"]
  node_user_model["User model<br/>[User.php]"]
end

subgraph group_presentation["Rendered interface"]
  node_home_view["Home page<br/>[home.php]"]
  node_post_views["Post pages"]
  node_admin_post_views["Post admin forms"]
  node_category_views["Category pages<br/>[categories.php]"]
  node_admin_category_views["Category admin"]
  node_user_views["Login and registration"]
  node_templates["Page templates"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_routes
node_routes -->|"filters admin routes"| node_auth
node_routes -->|"dispatches post routes"| node_post_controller
node_routes -->|"dispatches category routes"| node_category_controller
node_routes -->|"dispatches account routes"| node_users_controller
node_auth -->|"redirects to login"| node_users_controller
node_post_controller -->|"queries and writes"| node_posts
node_post_controller -->|"loads categories"| node_categories_model
node_post_controller -->|"writes category links"| node_database
node_post_controller -->|"moves image files"| node_uploads
node_posts -->|"persists posts"| node_database
node_category_controller -->|"manages categories"| node_categories_model
node_users_controller -->|"manages accounts"| node_user_model
node_post_controller -->|"renders home"| node_home_view
node_post_controller -->|"renders post pages"| node_post_views
node_post_controller -->|"renders admin forms"| node_admin_post_views
node_category_controller -->|"renders category pages"| node_category_views
node_category_controller -->|"renders admin forms"| node_admin_category_views
node_users_controller -->|"renders account pages"| node_user_views
node_post_controller -->|"renders page chrome"| node_templates
node_category_controller -->|"renders page chrome"| node_templates
node_users_controller -->|"renders page chrome"| node_templates

click node_routes "https://github.com/johandhana/blog-ci4/blob/main/app/Config/Routes.php"
click node_auth "https://github.com/johandhana/blog-ci4/blob/main/app/Filters/Auth.php"
click node_post_controller "https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/PostController.php"
click node_posts "https://github.com/johandhana/blog-ci4/blob/main/app/Models/Post.php"
click node_categories_model "https://github.com/johandhana/blog-ci4/blob/main/app/Models/Category.php"
click node_category_controller "https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Categories.php"
click node_users_controller "https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Users.php"
click node_user_model "https://github.com/johandhana/blog-ci4/blob/main/app/Models/User.php"
click node_comment_model "https://github.com/johandhana/blog-ci4/blob/main/app/Models/Comment.php"
click node_database "https://github.com/johandhana/blog-ci4/blob/main/app/Config/Database.php"
click node_uploads "https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/PostController.php"
click node_home_view "https://github.com/johandhana/blog-ci4/blob/main/app/Views/pages/home.php"
click node_post_views "https://github.com/johandhana/blog-ci4/tree/main/app/Views/posts"
click node_admin_post_views "https://github.com/johandhana/blog-ci4/tree/main/app/Views/admin"
click node_category_views "https://github.com/johandhana/blog-ci4/blob/main/app/Views/categories.php"
click node_admin_category_views "https://github.com/johandhana/blog-ci4/tree/main/app/Views/admin/categories"
click node_user_views "https://github.com/johandhana/blog-ci4/tree/main/app/Views/users"
click node_templates "https://github.com/johandhana/blog-ci4/tree/main/app/Views/templates"

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_auth toneBlue
class node_post_controller,node_posts,node_comment_model,node_database,node_uploads toneAmber
class node_categories_model,node_category_controller,node_users_controller,node_user_model toneMint
class node_home_view,node_post_views,node_admin_post_views,node_category_views,node_admin_category_views,node_user_views,node_templates toneRose
class node_visitor toneIndigo
```

## Components

### Request and access

- [Route definitions](https://github.com/johandhana/blog-ci4/blob/main/app/Config/Routes.php): `app/Config/Routes.php`
- [Auth filter](https://github.com/johandhana/blog-ci4/blob/main/app/Filters/Auth.php): `app/Filters/Auth.php`

### Blog content

- [Post controller](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/PostController.php): `app/Controllers/PostController.php`
- [Post model](https://github.com/johandhana/blog-ci4/blob/main/app/Models/Post.php): `app/Models/Post.php`
- [Comment model](https://github.com/johandhana/blog-ci4/blob/main/app/Models/Comment.php): `app/Models/Comment.php`
- [Application database](https://github.com/johandhana/blog-ci4/blob/main/app/Config/Database.php): `app/Config/Database.php`
- [Post image uploads](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/PostController.php): `app/Controllers/PostController.php`

### Users and categories

- [Category model](https://github.com/johandhana/blog-ci4/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Category controller](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Categories.php): `app/Controllers/Categories.php`
- [Users controller](https://github.com/johandhana/blog-ci4/blob/main/app/Controllers/Users.php): `app/Controllers/Users.php`
- [User model](https://github.com/johandhana/blog-ci4/blob/main/app/Models/User.php): `app/Models/User.php`

### Rendered interface

- [Home page](https://github.com/johandhana/blog-ci4/blob/main/app/Views/pages/home.php): `app/Views/pages/home.php`
- [Post pages](https://github.com/johandhana/blog-ci4/tree/main/app/Views/posts): `app/Views/posts`
- [Post admin forms](https://github.com/johandhana/blog-ci4/tree/main/app/Views/admin): `app/Views/admin`
- [Category pages](https://github.com/johandhana/blog-ci4/blob/main/app/Views/categories.php): `app/Views/categories.php`
- [Category admin](https://github.com/johandhana/blog-ci4/tree/main/app/Views/admin/categories): `app/Views/admin/categories`
- [Login and registration](https://github.com/johandhana/blog-ci4/tree/main/app/Views/users): `app/Views/users`
- [Page templates](https://github.com/johandhana/blog-ci4/tree/main/app/Views/templates): `app/Views/templates`

### Other components

- **Visitor**

## Connections

- Visitor → Route definitions: requests pages
- Route definitions → Auth filter: filters admin routes
- Route definitions → Post controller: dispatches post routes
- Route definitions → Category controller: dispatches category routes
- Route definitions → Users controller: dispatches account routes
- Auth filter → Users controller: redirects to login
- Post controller → Post model: queries and writes
- Post controller → Category model: loads categories
- Post controller → Application database: writes category links
- Post controller → Post image uploads: moves image files
- Post model → Application database: persists posts
- Category controller → Category model: manages categories
- Users controller → User model: manages accounts
- Post controller → Home page: renders home
- Post controller → Post pages: renders post pages
- Post controller → Post admin forms: renders admin forms
- Category controller → Category pages: renders category pages
- Category controller → Category admin: renders admin forms
- Users controller → Login and registration: renders account pages
- Post controller → Page templates: renders page chrome
- Category controller → Page templates: renders page chrome
- Users controller → Page templates: renders page chrome
