# roissyujak/tokoku-laravel12 architecture

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

- Interactive diagram: https://gitdiagram.com/roissyujak/tokoku-laravel12
- Repository: https://github.com/roissyujak/tokoku-laravel12

## Overview

TokoKu is a Laravel online product catalog with role-aware product management. Visitors browse, search, filter, sort and paginate products; admins and sellers can create products, and authorized users can update or delete them. Authentication, profile management and admin access are separate user-facing flows. The README also documents an order-confirmation Mailable, but the supplied tree shows no order or checkout workflow, so no trigger for that email is inferred. Product-controller details are sampled; other feature links reflect the README and repository paths.

Main entry points: [`app/Http/Controllers/ProductController.php`](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/ProductController.php) (Product controller), [`routes/web.php`](https://github.com/roissyujak/tokoku-laravel12/blob/main/routes/web.php) (Web routes), [`app/Models/User.php`](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/User.php) (User model), [`app/Http/Controllers/Auth/AuthenticatedSessionController.php`](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php) (Session controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request routing"]
  node_web["Web routes<br/>[web.php]"]
  node_authroutes["Auth routes<br/>[auth.php]"]
end

subgraph group_catalog["Product catalog"]
  node_productcontroller["Product controller"]
  node_admincontroller["Admin controller"]
  node_product["Product model<br/>[Product.php]"]
  node_category["Category model<br/>[Category.php]"]
  node_tag["Tag model<br/>[Tag.php]"]
  node_productrequest["Product validation"]
  node_updaterequest["Update validation"]
  node_orderconfirmation["Order confirmation mail"]
end

subgraph group_identity["Identity and access"]
  node_policy["Product policy<br/>[ProductPolicy.php]"]
  node_rolemiddleware["Role middleware<br/>[RoleMiddleware.php]"]
  node_sessioncontroller["Session controller"]
  node_registration["Registration controller"]
  node_profile["Profile controller"]
  node_user["User model<br/>[User.php]"]
end

subgraph group_presentation["Web interface"]
  node_listing["Product listing<br/>[index.blade.php]"]
  node_productpages["Product forms and detail"]
  node_dashboard["Admin dashboard"]
  node_mainlayout["Shop layout<br/>[main.blade.php]"]
  node_profileview["Profile page<br/>[edit.blade.php]"]
  node_authviews["Auth pages"]
  node_mailview["Mail template"]
end

node_shopper(("Shopper"))
node_seller(("Seller"))
node_admin(("Admin"))
node_store[("Application database")]
node_storage[("Image storage")]

node_shopper -->|"requests pages"| node_web
node_seller -->|"requests pages"| node_web
node_admin -->|"requests pages"| node_web
node_web -->|"dispatches product routes"| node_productcontroller
node_web -->|"dispatches admin routes"| node_admincontroller
node_web -->|"guards role routes"| node_rolemiddleware
node_authroutes -->|"dispatches sessions"| node_sessioncontroller
node_authroutes -->|"dispatches registration"| node_registration
node_productcontroller -->|"validates creation"| node_productrequest
node_productcontroller -->|"validates updates"| node_updaterequest
node_productcontroller -->|"queries and changes"| node_product
node_productcontroller -->|"loads categories"| node_category
node_productcontroller -->|"syncs tags"| node_tag
node_productcontroller -->|"authorizes actions"| node_policy
node_productcontroller -->|"stores and deletes images"| node_storage
node_productcontroller -->|"renders listing"| node_listing
node_productcontroller -->|"renders product pages"| node_productpages
node_productcontroller -->|"reads and writes"| node_store
node_product -->|"persists products"| node_store
node_category -->|"persists categories"| node_store
node_tag -->|"persists tags"| node_store
node_policy -->|"checks role and ownership"| node_user
node_rolemiddleware -->|"checks role"| node_user
node_admincontroller -->|"renders dashboard"| node_dashboard
node_sessioncontroller -->|"authenticates user"| node_user
node_registration -->|"creates account"| node_user
node_registration -->|"renders registration"| node_authviews
node_sessioncontroller -->|"renders login"| node_authviews
node_profile -->|"updates account"| node_user
node_profile -->|"renders profile"| node_profileview
node_listing -->|"uses layout"| node_mainlayout
node_productpages -->|"uses layout"| node_mainlayout
node_orderconfirmation -->|"renders email"| node_mailview

click node_web "https://github.com/roissyujak/tokoku-laravel12/blob/main/routes/web.php"
click node_authroutes "https://github.com/roissyujak/tokoku-laravel12/blob/main/routes/auth.php"
click node_productcontroller "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/ProductController.php"
click node_admincontroller "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/AdminController.php"
click node_product "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Product.php"
click node_category "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Category.php"
click node_tag "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Tag.php"
click node_productrequest "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Requests/StoreProductRequest.php"
click node_updaterequest "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Requests/UpdateProductRequest.php"
click node_policy "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Policies/ProductPolicy.php"
click node_rolemiddleware "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Middleware/RoleMiddleware.php"
click node_sessioncontroller "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_registration "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_profile "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/ProfileController.php"
click node_user "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/User.php"
click node_listing "https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/products/index.blade.php"
click node_productpages "https://github.com/roissyujak/tokoku-laravel12/tree/main/resources/views/products"
click node_dashboard "https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/admin/dashboard.blade.php"
click node_mainlayout "https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/layouts/main.blade.php"
click node_profileview "https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/profile/edit.blade.php"
click node_authviews "https://github.com/roissyujak/tokoku-laravel12/tree/main/resources/views/auth"
click node_orderconfirmation "https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Mail/OrderConfirmation.php"
click node_mailview "https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/emails/order-confirmation.blade.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_web,node_authroutes toneBlue
class node_productcontroller,node_admincontroller,node_product,node_category,node_tag,node_productrequest,node_updaterequest,node_orderconfirmation,node_store,node_storage toneAmber
class node_policy,node_rolemiddleware,node_sessioncontroller,node_registration,node_profile,node_user toneMint
class node_listing,node_productpages,node_dashboard,node_mainlayout,node_profileview,node_authviews,node_mailview toneRose
class node_shopper,node_seller,node_admin toneIndigo
```

## Components

### Request routing

- [Web routes](https://github.com/roissyujak/tokoku-laravel12/blob/main/routes/web.php): `routes/web.php`
- [Auth routes](https://github.com/roissyujak/tokoku-laravel12/blob/main/routes/auth.php): `routes/auth.php`

### Product catalog

- [Product controller](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/ProductController.php): `app/Http/Controllers/ProductController.php`
- [Admin controller](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/AdminController.php): `app/Http/Controllers/AdminController.php`
- [Product model](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Product.php): `app/Models/Product.php`
- [Category model](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Tag model](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/Tag.php): `app/Models/Tag.php`
- [Product validation](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Requests/StoreProductRequest.php): `app/Http/Requests/StoreProductRequest.php`
- [Update validation](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Requests/UpdateProductRequest.php): `app/Http/Requests/UpdateProductRequest.php`
- [Order confirmation mail](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Mail/OrderConfirmation.php): `app/Mail/OrderConfirmation.php`

### Identity and access

- [Product policy](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Policies/ProductPolicy.php): `app/Policies/ProductPolicy.php`
- [Role middleware](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Middleware/RoleMiddleware.php): `app/Http/Middleware/RoleMiddleware.php`
- [Session controller](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Registration controller](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Profile controller](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Http/Controllers/ProfileController.php): `app/Http/Controllers/ProfileController.php`
- [User model](https://github.com/roissyujak/tokoku-laravel12/blob/main/app/Models/User.php): `app/Models/User.php`

### Web interface

- [Product listing](https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/products/index.blade.php): `resources/views/products/index.blade.php`
- [Product forms and detail](https://github.com/roissyujak/tokoku-laravel12/tree/main/resources/views/products): `resources/views/products`
- [Admin dashboard](https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/admin/dashboard.blade.php): `resources/views/admin/dashboard.blade.php`
- [Shop layout](https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/layouts/main.blade.php): `resources/views/layouts/main.blade.php`
- [Profile page](https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/profile/edit.blade.php): `resources/views/profile/edit.blade.php`
- [Auth pages](https://github.com/roissyujak/tokoku-laravel12/tree/main/resources/views/auth): `resources/views/auth`
- [Mail template](https://github.com/roissyujak/tokoku-laravel12/blob/main/resources/views/emails/order-confirmation.blade.php): `resources/views/emails/order-confirmation.blade.php`

### Other components

- **Shopper**
- **Seller**
- **Admin**
- **Application database**
- **Image storage**

## Connections

- Shopper → Web routes: requests pages
- Seller → Web routes: requests pages
- Admin → Web routes: requests pages
- Web routes → Product controller: dispatches product routes
- Web routes → Admin controller: dispatches admin routes
- Web routes → Role middleware: guards role routes
- Auth routes → Session controller: dispatches sessions
- Auth routes → Registration controller: dispatches registration
- Product controller → Product validation: validates creation
- Product controller → Update validation: validates updates
- Product controller → Product model: queries and changes
- Product controller → Category model: loads categories
- Product controller → Tag model: syncs tags
- Product controller → Product policy: authorizes actions
- Product controller → Image storage: stores and deletes images
- Product controller → Product listing: renders listing
- Product controller → Product forms and detail: renders product pages
- Product controller → Application database: reads and writes
- Product model → Application database: persists products
- Category model → Application database: persists categories
- Tag model → Application database: persists tags
- Product policy → User model: checks role and ownership
- Role middleware → User model: checks role
- Admin controller → Admin dashboard: renders dashboard
- Session controller → User model: authenticates user
- Registration controller → User model: creates account
- Registration controller → Auth pages: renders registration
- Session controller → Auth pages: renders login
- Profile controller → User model: updates account
- Profile controller → Profile page: renders profile
- Product listing → Shop layout: uses layout
- Product forms and detail → Shop layout: uses layout
- Order confirmation mail → Mail template: renders email
