# jemcv/lihimboard architecture

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

## Overview

LihimBoard is an anonymous imageboard. A browser request enters through the public front controller, is dispatched by the router to a route callback, and reaches a controller that coordinates models and renders a view; posting and commenting also write user-submitted content. The graph includes documented browsing, category, search, featured-post, tripcode, and theme capabilities. Model internals and several feature implementations were not sampled, so links to their likely storage behavior are omitted.

Main entry points: [`src/Controllers/PostController.php`](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/PostController.php) (Post controller), [`src/ControllerFactory.php`](https://github.com/jemcv/lihimboard/blob/main/src/ControllerFactory.php) (Controller factory), [`src/Controllers/HomeController.php`](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/HomeController.php) (Home controller), [`src/Controllers/CategoryController.php`](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/CategoryController.php) (Category controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request routing"]
  node_front["Front controller<br/>[index.php]"]
  node_router["Router<br/>[Router.php]"]
  node_routes["Route callbacks<br/>[routes.php]"]
  node_factory["Controller factory"]
end

subgraph group_content["Board content"]
  node_home["Home controller<br/>[HomeController.php]"]
  node_posts["Post controller<br/>[PostController.php]"]
  node_categories["Category controller"]
  node_comments["Comment controller"]
end

subgraph group_presentation["Views and themes"]
  node_home_view["Home and featured<br/>[index.php]"]
  node_post_views["Post and search views"]
  node_category_views["Category views"]
  node_add_view["Post form<br/>[add.php]"]
  node_theme["Theme controls<br/>[theme.js]"]
  node_color_theme["Color themes<br/>[colors.js]"]
end

subgraph group_storage["Persistence"]
  node_post_model["Post model<br/>[Post.php]"]
  node_category_model["Category model<br/>[Category.php]"]
  node_comment_model["Comment model<br/>[Comment.php]"]
  node_database["Database access<br/>[Database.php]"]
  node_board_db[("Board tables<br/>[schema.sql]")]
end

node_visitor(("Board visitor"))
node_mysql[("MySQL")]

node_visitor -->|"sends request"| node_front
node_front -->|"dispatches URI"| node_router
node_front -->|"loads routes"| node_routes
node_router -->|"invokes callback"| node_routes
node_routes -->|"requests controller"| node_factory
node_factory -->|"constructs"| node_home
node_factory -->|"constructs"| node_posts
node_factory -->|"constructs"| node_categories
node_factory -->|"constructs"| node_comments
node_home -->|"reads categories"| node_category_model
node_home -->|"reads posts"| node_post_model
node_home -->|"renders"| node_home_view
node_posts -->|"reads and creates"| node_post_model
node_posts -->|"reads categories"| node_category_model
node_posts -->|"reads comments"| node_comment_model
node_posts -->|"renders"| node_post_views
node_posts -->|"renders form"| node_add_view
node_categories -->|"reads category"| node_category_model
node_categories -->|"reads category posts"| node_post_model
node_categories -->|"renders"| node_category_views
node_comments -->|"creates comment"| node_comment_model
node_visitor -->|"toggles mode"| node_theme
node_visitor -->|"selects palette"| node_color_theme
node_database -->|"queries"| node_mysql

click node_front "https://github.com/jemcv/lihimboard/blob/main/public/index.php"
click node_router "https://github.com/jemcv/lihimboard/blob/main/src/Router.php"
click node_routes "https://github.com/jemcv/lihimboard/blob/main/src/routes.php"
click node_factory "https://github.com/jemcv/lihimboard/blob/main/src/ControllerFactory.php"
click node_home "https://github.com/jemcv/lihimboard/blob/main/src/Controllers/HomeController.php"
click node_posts "https://github.com/jemcv/lihimboard/blob/main/src/Controllers/PostController.php"
click node_categories "https://github.com/jemcv/lihimboard/blob/main/src/Controllers/CategoryController.php"
click node_comments "https://github.com/jemcv/lihimboard/blob/main/src/Controllers/CommentController.php"
click node_post_model "https://github.com/jemcv/lihimboard/blob/main/src/Models/Post.php"
click node_category_model "https://github.com/jemcv/lihimboard/blob/main/src/Models/Category.php"
click node_comment_model "https://github.com/jemcv/lihimboard/blob/main/src/Models/Comment.php"
click node_database "https://github.com/jemcv/lihimboard/blob/main/src/Database.php"
click node_board_db "https://github.com/jemcv/lihimboard/blob/main/config/schema.sql"
click node_home_view "https://github.com/jemcv/lihimboard/blob/main/src/Views/index.php"
click node_post_views "https://github.com/jemcv/lihimboard/tree/main/src/Views"
click node_category_views "https://github.com/jemcv/lihimboard/tree/main/src/Views"
click node_add_view "https://github.com/jemcv/lihimboard/blob/main/src/Views/add.php"
click node_theme "https://github.com/jemcv/lihimboard/blob/main/public/assets/js/theme.js"
click node_color_theme "https://github.com/jemcv/lihimboard/blob/main/public/assets/js/colors.js"

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_router,node_routes,node_factory toneBlue
class node_home,node_posts,node_categories,node_comments,node_mysql toneAmber
class node_home_view,node_post_views,node_category_views,node_add_view,node_theme,node_color_theme toneMint
class node_post_model,node_category_model,node_comment_model,node_database,node_board_db toneRose
class node_visitor toneIndigo
```

## Components

### Request routing

- [Front controller](https://github.com/jemcv/lihimboard/blob/main/public/index.php): `public/index.php`
- [Router](https://github.com/jemcv/lihimboard/blob/main/src/Router.php): `src/Router.php`
- [Route callbacks](https://github.com/jemcv/lihimboard/blob/main/src/routes.php): `src/routes.php`
- [Controller factory](https://github.com/jemcv/lihimboard/blob/main/src/ControllerFactory.php): `src/ControllerFactory.php`

### Board content

- [Home controller](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/HomeController.php): `src/Controllers/HomeController.php`
- [Post controller](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/PostController.php): `src/Controllers/PostController.php`
- [Category controller](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/CategoryController.php): `src/Controllers/CategoryController.php`
- [Comment controller](https://github.com/jemcv/lihimboard/blob/main/src/Controllers/CommentController.php): `src/Controllers/CommentController.php`

### Views and themes

- [Home and featured](https://github.com/jemcv/lihimboard/blob/main/src/Views/index.php): `src/Views/index.php`
- [Post and search views](https://github.com/jemcv/lihimboard/tree/main/src/Views): `src/Views`
- [Category views](https://github.com/jemcv/lihimboard/tree/main/src/Views): `src/Views`
- [Post form](https://github.com/jemcv/lihimboard/blob/main/src/Views/add.php): `src/Views/add.php`
- [Theme controls](https://github.com/jemcv/lihimboard/blob/main/public/assets/js/theme.js): `public/assets/js/theme.js`
- [Color themes](https://github.com/jemcv/lihimboard/blob/main/public/assets/js/colors.js): `public/assets/js/colors.js`

### Persistence

- [Post model](https://github.com/jemcv/lihimboard/blob/main/src/Models/Post.php): `src/Models/Post.php`
- [Category model](https://github.com/jemcv/lihimboard/blob/main/src/Models/Category.php): `src/Models/Category.php`
- [Comment model](https://github.com/jemcv/lihimboard/blob/main/src/Models/Comment.php): `src/Models/Comment.php`
- [Database access](https://github.com/jemcv/lihimboard/blob/main/src/Database.php): `src/Database.php`
- [Board tables](https://github.com/jemcv/lihimboard/blob/main/config/schema.sql): `config/schema.sql`

### Other components

- **Board visitor**
- **MySQL**

## Connections

- Board visitor → Front controller: sends request
- Front controller → Router: dispatches URI
- Front controller → Route callbacks: loads routes
- Router → Route callbacks: invokes callback
- Route callbacks → Controller factory: requests controller
- Controller factory → Home controller: constructs
- Controller factory → Post controller: constructs
- Controller factory → Category controller: constructs
- Controller factory → Comment controller: constructs
- Home controller → Category model: reads categories
- Home controller → Post model: reads posts
- Home controller → Home and featured: renders
- Post controller → Post model: reads and creates
- Post controller → Category model: reads categories
- Post controller → Comment model: reads comments
- Post controller → Post and search views: renders
- Post controller → Post form: renders form
- Category controller → Category model: reads category
- Category controller → Post model: reads category posts
- Category controller → Category views: renders
- Comment controller → Comment model: creates comment
- Board visitor → Theme controls: toggles mode
- Board visitor → Color themes: selects palette
- Database access → MySQL: queries
