# galih1250/apotek architecture

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

- Interactive diagram: https://gitdiagram.com/galih1250/apotek
- Repository: https://github.com/galih1250/apotek

## Overview

Apotek is a pharmacy storefront with customer accounts, product discovery and administration, and online payment processing. A customer browses or searches the catalog, opens a product, and submits a payment; the store delegates payment creation to the payment controller, which coordinates transaction state and Midtrans. Customers can view payment results and history, while callbacks update transactions and invoice handling stores or serves PDFs. The tree and excerpts support these main flows; several route and view connections are documented only by the source index, so uncertain links are omitted.

Main entry points: [`apotek/app/Http/Controllers/PaymentController.php`](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/PaymentController.php) (Payment workflow), [`apotek/routes/web.php`](https://github.com/galih1250/apotek/blob/main/apotek/routes/web.php) (Web routes), [`apotek/app/Http/Controllers/StoreController.php`](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/StoreController.php) (Store browsing), [`apotek/app/Http/Controllers/ProductController.php`](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/ProductController.php) (Product administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_store["Store browsing"]
  node_store_views["Store views"]
end

subgraph group_commerce["Commerce and payments"]
  node_payment["Payment workflow"]
  node_transactions[("Transactions<br/>[Transaction.php]")]
  node_midtrans_service["Midtrans adapter"]
  node_payment_views["Payment views"]
  node_invoice_storage[("Invoice storage")]
end

subgraph group_identity["Accounts"]
  node_auth_routes["Auth routes<br/>[auth.php]"]
  node_registration["Registration"]
  node_login["Login"]
  node_login_request["Login validation<br/>[LoginRequest.php]"]
  node_recaptcha["reCAPTCHA rule<br/>[RecaptchaV2.php]"]
  node_users[("User accounts<br/>[User.php]")]
  node_profile["Profile management"]
end

subgraph group_catalog_admin["Catalog administration"]
  node_products[("Product catalog<br/>[Product.php]")]
  node_categories[("Categories<br/>[Category.php]")]
  node_product_admin["Product administration"]
  node_admin_views["Admin views"]
end

node_customer(("Customer"))
node_midtrans{{"Midtrans"}}
node_pdf_source{{"Invoice PDF source"}}

node_customer -->|"sends requests"| node_web_routes
node_web_routes -->|"routes to"| node_store
node_store -->|"queries"| node_products
node_store -->|"queries"| node_categories
node_store -->|"renders"| node_store_views
node_web_routes -->|"routes to"| node_product_admin
node_product_admin -->|"creates and updates"| node_products
node_product_admin -->|"queries"| node_categories
node_product_admin -->|"renders"| node_admin_views
node_customer -->|"sends requests"| node_auth_routes
node_auth_routes -->|"routes to"| node_registration
node_auth_routes -->|"routes to"| node_login
node_registration -->|"creates account"| node_users
node_registration -->|"validates with"| node_recaptcha
node_login -->|"authenticates through"| node_login_request
node_login_request -->|"uses rule"| node_recaptcha
node_web_routes -->|"routes to"| node_profile
node_profile -->|"updates"| node_users
node_web_routes -->|"routes to"| node_payment
node_store -->|"delegates payment"| node_payment
node_payment -->|"reads and updates"| node_transactions
node_payment -->|"reads"| node_users
node_payment -->|"requests payment status"| node_midtrans_service
node_midtrans_service -->|"calls payment API"| node_midtrans
node_payment -->|"renders results"| node_payment_views
node_payment -->|"stores and reads PDFs"| node_invoice_storage
node_payment -->|"fetches invoice"| node_pdf_source
node_payment -.->|"receives notifications"| node_midtrans

click node_web_routes "https://github.com/galih1250/apotek/blob/main/apotek/routes/web.php"
click node_store "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/StoreController.php"
click node_store_views "https://github.com/galih1250/apotek/tree/main/apotek/resources/views/store"
click node_products "https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Product.php"
click node_categories "https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Category.php"
click node_product_admin "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/ProductController.php"
click node_admin_views "https://github.com/galih1250/apotek/tree/main/apotek/resources/views/admin"
click node_auth_routes "https://github.com/galih1250/apotek/blob/main/apotek/routes/auth.php"
click node_registration "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_login "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_login_request "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Requests/Auth/LoginRequest.php"
click node_recaptcha "https://github.com/galih1250/apotek/blob/main/apotek/app/Rules/RecaptchaV2.php"
click node_users "https://github.com/galih1250/apotek/blob/main/apotek/app/Models/User.php"
click node_profile "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/ProfileController.php"
click node_payment "https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/PaymentController.php"
click node_transactions "https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Transaction.php"
click node_midtrans_service "https://github.com/galih1250/apotek/blob/main/apotek/app/Services/MidtransService.php"
click node_payment_views "https://github.com/galih1250/apotek/tree/main/apotek/resources/views/payment"

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_routes,node_store,node_store_views toneBlue
class node_payment,node_transactions,node_midtrans_service,node_payment_views,node_invoice_storage toneAmber
class node_auth_routes,node_registration,node_login,node_login_request,node_recaptcha,node_users,node_profile toneMint
class node_products,node_categories,node_product_admin,node_admin_views toneRose
class node_customer,node_midtrans,node_pdf_source toneIndigo
```

## Components

### Storefront

- [Web routes](https://github.com/galih1250/apotek/blob/main/apotek/routes/web.php): `apotek/routes/web.php`
- [Store browsing](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/StoreController.php): `apotek/app/Http/Controllers/StoreController.php`
- [Store views](https://github.com/galih1250/apotek/tree/main/apotek/resources/views/store): `apotek/resources/views/store`

### Commerce and payments

- [Payment workflow](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/PaymentController.php): `apotek/app/Http/Controllers/PaymentController.php`
- [Transactions](https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Transaction.php): `apotek/app/Models/Transaction.php`
- [Midtrans adapter](https://github.com/galih1250/apotek/blob/main/apotek/app/Services/MidtransService.php): `apotek/app/Services/MidtransService.php`
- [Payment views](https://github.com/galih1250/apotek/tree/main/apotek/resources/views/payment): `apotek/resources/views/payment`
- **Invoice storage**

### Accounts

- [Auth routes](https://github.com/galih1250/apotek/blob/main/apotek/routes/auth.php): `apotek/routes/auth.php`
- [Registration](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/Auth/RegisteredUserController.php): `apotek/app/Http/Controllers/Auth/RegisteredUserController.php`
- [Login](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `apotek/app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Login validation](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Requests/Auth/LoginRequest.php): `apotek/app/Http/Requests/Auth/LoginRequest.php`
- [reCAPTCHA rule](https://github.com/galih1250/apotek/blob/main/apotek/app/Rules/RecaptchaV2.php): `apotek/app/Rules/RecaptchaV2.php`
- [User accounts](https://github.com/galih1250/apotek/blob/main/apotek/app/Models/User.php): `apotek/app/Models/User.php`
- [Profile management](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/ProfileController.php): `apotek/app/Http/Controllers/ProfileController.php`

### Catalog administration

- [Product catalog](https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Product.php): `apotek/app/Models/Product.php`
- [Categories](https://github.com/galih1250/apotek/blob/main/apotek/app/Models/Category.php): `apotek/app/Models/Category.php`
- [Product administration](https://github.com/galih1250/apotek/blob/main/apotek/app/Http/Controllers/ProductController.php): `apotek/app/Http/Controllers/ProductController.php`
- [Admin views](https://github.com/galih1250/apotek/tree/main/apotek/resources/views/admin): `apotek/resources/views/admin`

### Other components

- **Customer**
- **Midtrans**
- **Invoice PDF source**

## Connections

- Customer → Web routes: sends requests (evidence: `apotek/routes/web.php`)
- Web routes → Store browsing: routes to (evidence: `apotek/routes/web.php`)
- Store browsing → Product catalog: queries (evidence: `apotek/app/Http/Controllers/StoreController.php`)
- Store browsing → Categories: queries (evidence: `apotek/app/Http/Controllers/StoreController.php`)
- Store browsing → Store views: renders (evidence: `apotek/app/Http/Controllers/StoreController.php`)
- Web routes → Product administration: routes to (evidence: `apotek/routes/web.php`)
- Product administration → Product catalog: creates and updates (evidence: `apotek/app/Http/Controllers/ProductController.php`)
- Product administration → Categories: queries (evidence: `apotek/app/Http/Controllers/ProductController.php`)
- Product administration → Admin views: renders (evidence: `apotek/app/Http/Controllers/ProductController.php`)
- Customer → Auth routes: sends requests (evidence: `apotek/routes/auth.php`)
- Auth routes → Registration: routes to (evidence: `apotek/routes/auth.php`)
- Auth routes → Login: routes to (evidence: `apotek/routes/auth.php`)
- Registration → User accounts: creates account (evidence: `apotek/app/Http/Controllers/Auth/RegisteredUserController.php`)
- Registration → reCAPTCHA rule: validates with (evidence: `apotek/app/Http/Controllers/Auth/RegisteredUserController.php`)
- Login → Login validation: authenticates through (evidence: `apotek/app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Login validation → reCAPTCHA rule: uses rule (evidence: `apotek/app/Http/Requests/Auth/LoginRequest.php`)
- Web routes → Profile management: routes to (evidence: `apotek/routes/web.php`)
- Profile management → User accounts: updates (evidence: `apotek/app/Http/Controllers/ProfileController.php`)
- Web routes → Payment workflow: routes to (evidence: `apotek/routes/web.php`)
- Store browsing → Payment workflow: delegates payment (evidence: `apotek/app/Http/Controllers/StoreController.php`)
- Payment workflow → Transactions: reads and updates (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Payment workflow → User accounts: reads (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Payment workflow → Midtrans adapter: requests payment status (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Midtrans adapter → Midtrans: calls payment API (evidence: `apotek/app/Services/MidtransService.php`)
- Payment workflow → Payment views: renders results (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Payment workflow → Invoice storage: stores and reads PDFs (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Payment workflow → Invoice PDF source: fetches invoice (evidence: `apotek/app/Http/Controllers/PaymentController.php`)
- Payment workflow → Midtrans: receives notifications
