# raptamayahya21-prb/tugasweb-p11-ecommerceauth architecture

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

- Interactive diagram: https://gitdiagram.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth
- Repository: https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth

## Overview

GadgetStore is a Laravel e-commerce app for gadget discovery and product administration. The central documented flow is browsing/filtering the catalog, with product operations handled by a controller, service layer, and Eloquent models; role checks and policies protect management actions. Separate branches cover authentication, Filament administration, order data, and the documented eager-loading demo. Source excerpts establish the product controller/service calls and authentication routes; some web-route and Filament wiring is not shown, so those links are omitted or marked unverified.

Main entry points: [`app/Models/Product.php`](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Product.php) (Products), [`app/Http/Controllers/ProductController.php`](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/ProductController.php) (Product Controller), [`app/Models/User.php`](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/User.php) (User Account), [`routes/auth.php`](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/routes/auth.php) (Auth Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog Experience"]
  node_catalog_ui["Catalog UI<br/>[welcome.blade.php]"]
  node_product_api["Product Controller"]
  node_product_service["Product Service<br/>[ProductService.php]"]
  node_product_resource["Product Resource"]
  node_product_requests["Product Requests"]
end

subgraph group_commerce["Commerce Domain"]
  node_product[("Products<br/>[Product.php]")]
  node_category[("Categories<br/>[Category.php]")]
  node_tags[("Tags<br/>[Tag.php]")]
  node_orders[("Orders<br/>[Order.php]")]
  node_order_items[("Order Items<br/>[OrderItem.php]")]
end

subgraph group_security["Identity &amp; Access"]
  node_user[("User Account<br/>[User.php]")]
  node_auth_routes["Auth Routes<br/>[auth.php]"]
  node_auth_session["Login &amp; Logout"]
  node_registration["Registration"]
  node_role_guard["Role Middleware<br/>[RoleMiddleware.php]"]
  node_role_enum["User Roles<br/>[UserRole.php]"]
  node_product_policy["Product Policy<br/>[ProductPolicy.php]"]
end

subgraph group_admin["Administration"]
  node_filament_products["Product Admin"]
  node_filament_tags["Tag Admin<br/>[TagResource.php]"]
end

subgraph group_support["Data &amp; Demo"]
  node_seeders["Demo Data<br/>[DatabaseSeeder.php]"]
  node_eager_demo["Eager-Load Demo"]
end

node_shopper(("Shopper"))

node_shopper -.->|"browses"| node_catalog_ui
node_catalog_ui -->|"shows catalog"| node_product
node_product_api -->|"delegates"| node_product_service
node_product_api -->|"validates with"| node_product_requests
node_product_api -->|"serializes as"| node_product_resource
node_product_service -->|"queries and writes"| node_product
node_product -->|"belongs to"| node_category
node_product -->|"tag relation"| node_tags
node_product -->|"has items"| node_order_items
node_orders -->|"contains"| node_order_items
node_user -->|"places"| node_orders
node_auth_routes -->|"routes login"| node_auth_session
node_auth_routes -->|"routes signup"| node_registration
node_registration -->|"creates account"| node_user
node_user -->|"casts role"| node_role_enum
node_role_guard -->|"checks roles"| node_role_enum
node_product_api -.->|"authorizes"| node_product_policy
node_filament_products -.->|"manages"| node_product
node_filament_tags -.->|"manages"| node_tags
node_seeders -->|"seeds records"| node_product
node_eager_demo -->|"demonstrates loading"| node_product

click node_catalog_ui "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/resources/views/welcome.blade.php"
click node_product_api "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/ProductController.php"
click node_product_service "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Services/ProductService.php"
click node_product_resource "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Resources/ProductApiResource.php"
click node_product_requests "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Requests/UpdateProductRequest.php"
click node_product "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Product.php"
click node_category "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Category.php"
click node_tags "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Tag.php"
click node_orders "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Order.php"
click node_order_items "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/OrderItem.php"
click node_user "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/User.php"
click node_auth_routes "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/routes/auth.php"
click node_auth_session "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_registration "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_role_guard "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Middleware/RoleMiddleware.php"
click node_role_enum "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Enums/UserRole.php"
click node_product_policy "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Policies/ProductPolicy.php"
click node_filament_products "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Filament/Resources/Products/ProductResource.php"
click node_filament_tags "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Filament/Resources/Tags/TagResource.php"
click node_seeders "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/database/seeders/DatabaseSeeder.php"
click node_eager_demo "https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Console/Commands/EagerLoadingDemoCommand.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_catalog_ui,node_product_api,node_product_service,node_product_resource,node_product_requests toneBlue
class node_product,node_category,node_tags,node_orders,node_order_items toneAmber
class node_user,node_auth_routes,node_auth_session,node_registration,node_role_guard,node_role_enum,node_product_policy toneMint
class node_filament_products,node_filament_tags toneRose
class node_seeders,node_eager_demo,node_shopper toneIndigo
```

## Components

### Catalog Experience

- [Catalog UI](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/resources/views/welcome.blade.php): `resources/views/welcome.blade.php`
- [Product Controller](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/ProductController.php): `app/Http/Controllers/ProductController.php`
- [Product Service](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Services/ProductService.php): `app/Services/ProductService.php`
- [Product Resource](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Resources/ProductApiResource.php): `app/Http/Resources/ProductApiResource.php`
- [Product Requests](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Requests/UpdateProductRequest.php): `app/Http/Requests/UpdateProductRequest.php`

### Commerce Domain

- [Products](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Product.php): `app/Models/Product.php`
- [Categories](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Tags](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Tag.php): `app/Models/Tag.php`
- [Orders](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/Order.php): `app/Models/Order.php`
- [Order Items](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/OrderItem.php): `app/Models/OrderItem.php`

### Identity & Access

- [User Account](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Models/User.php): `app/Models/User.php`
- [Auth Routes](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/routes/auth.php): `routes/auth.php`
- [Login & Logout](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Registration](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Role Middleware](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Http/Middleware/RoleMiddleware.php): `app/Http/Middleware/RoleMiddleware.php`
- [User Roles](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Enums/UserRole.php): `app/Enums/UserRole.php`
- [Product Policy](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Policies/ProductPolicy.php): `app/Policies/ProductPolicy.php`

### Administration

- [Product Admin](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Filament/Resources/Products/ProductResource.php): `app/Filament/Resources/Products/ProductResource.php`
- [Tag Admin](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Filament/Resources/Tags/TagResource.php): `app/Filament/Resources/Tags/TagResource.php`

### Data & Demo

- [Demo Data](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/database/seeders/DatabaseSeeder.php): `database/seeders/DatabaseSeeder.php`
- [Eager-Load Demo](https://github.com/raptamayahya21-prb/tugasweb-p11-ecommerceauth/blob/main/app/Console/Commands/EagerLoadingDemoCommand.php): `app/Console/Commands/EagerLoadingDemoCommand.php`

### Other components

- **Shopper**

## Connections

- Shopper → Catalog UI: browses
- Catalog UI → Products: shows catalog (evidence: `README.md`)
- Product Controller → Product Service: delegates (evidence: `app/Http/Controllers/ProductController.php`)
- Product Controller → Product Requests: validates with (evidence: `app/Http/Controllers/ProductController.php`)
- Product Controller → Product Resource: serializes as (evidence: `app/Http/Controllers/ProductController.php`)
- Product Service → Products: queries and writes (evidence: `app/Services/ProductService.php`)
- Products → Categories: belongs to (evidence: `app/Models/Product.php`)
- Products → Tags: tag relation (evidence: `app/Models/Product.php`)
- Products → Order Items: has items (evidence: `app/Models/Product.php`)
- Orders → Order Items: contains (evidence: `README.md`)
- User Account → Orders: places (evidence: `README.md`)
- Auth Routes → Login & Logout: routes login (evidence: `routes/auth.php`)
- Auth Routes → Registration: routes signup (evidence: `routes/auth.php`)
- Registration → User Account: creates account (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- User Account → User Roles: casts role (evidence: `app/Models/User.php`)
- Role Middleware → User Roles: checks roles (evidence: `app/Http/Middleware/RoleMiddleware.php`)
- Product Controller → Product Policy: authorizes
- Product Admin → Products: manages
- Tag Admin → Tags: manages
- Demo Data → Products: seeds records (evidence: `database/seeders/DatabaseSeeder.php`)
- Eager-Load Demo → Products: demonstrates loading (evidence: `app/Console/Commands/EagerLoadingDemoCommand.php`)
