# elkanajnrmanullang/pos-glorya-motor architecture

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

- Interactive diagram: https://gitdiagram.com/elkanajnrmanullang/pos-glorya-motor
- Repository: https://github.com/elkanajnrmanullang/pos-glorya-motor

## Overview

Glorya Motor POS is a web point-of-sale and workshop-management application for cashier, mechanic, and owner workflows. The main operational path is a cashier opening a session, creating a repair ticket or takeaway sale, recording payment, and closing the session; mechanics handle repair work, while owners manage stock and review performance. The tree and README document these capabilities, and the excerpts confirm dashboard queries and session-closing summaries use Supabase. Most route-level wiring and mutation details were not sampled, so those relationships are shown at subsystem level rather than as invented call chains.

Main entry points: [`app/owner/layout.tsx`](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/layout.tsx) (Owner Workspace), [`app/kasir/layout.tsx`](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/layout.tsx) (Cashier Workspace), [`lib/supabase/client.ts`](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/supabase/client.ts) (Supabase Client), [`app/mekanik/layout.tsx`](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/layout.tsx) (Mechanic Workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Shell"]
  node_login["Login<br/>[page.tsx]"]
  node_auth_actions["Login Actions<br/>[actions.ts]"]
  node_route_guard["Session Guard<br/>[middleware.ts]"]
  node_cashier_layout["Cashier Workspace<br/>[layout.tsx]"]
  node_mechanic_layout["Mechanic Workspace<br/>[layout.tsx]"]
  node_owner_layout["Owner Workspace<br/>[layout.tsx]"]
end

subgraph group_counter["Cashier Operations"]
  node_cashier_home["Cashier Dashboard<br/>[page.tsx]"]
  node_session_close["Close Cash Session<br/>[page.tsx]"]
  node_session_form["Close Session Form<br/>[TutupKasirForm.tsx]"]
  node_customers["Customer Directory<br/>[page.tsx]"]
end

subgraph group_workshop["Workshop Operations"]
  node_repair_ticket["Repair Tickets<br/>[page.tsx]"]
  node_ticket_create["Create Ticket<br/>[page.tsx]"]
  node_active_queue["Active Queue<br/>[page.tsx]"]
  node_takeaway["Takeaway POS<br/>[page.tsx]"]
  node_mechanic_home["Mechanic Dashboard<br/>[page.tsx]"]
  node_mechanic_history["Mechanic History<br/>[page.tsx]"]
end

subgraph group_management["Owner Management"]
  node_owner_dashboard["Sales Dashboard<br/>[page.tsx]"]
  node_owner_stock["Stock Management<br/>[page.tsx]"]
  node_owner_services["Service Catalog<br/>[page.tsx]"]
  node_owner_customers["Customer Management<br/>[page.tsx]"]
  node_owner_staff["Employee Management<br/>[page.tsx]"]
  node_owner_reports["Shift Reports<br/>[page.tsx]"]
  node_owner_performance["Performance<br/>[page.tsx]"]
  node_owner_history["Transaction History<br/>[page.tsx]"]
end

subgraph group_services["Shared Services"]
  node_owner_query["Owner Dashboard Query<br/>[use-owner.ts]"]
  node_cashier_hooks["Cashier Data Hooks<br/>[use-tiket.ts]"]
  node_stock_hooks["Stock Data Hooks<br/>[use-owner-stok.ts]"]
  node_supabase_client["Supabase Client<br/>[client.ts]"]
  node_server_client["Server Supabase Client<br/>[server.ts]"]
  node_database_types["Database Types<br/>[database.types.ts]"]
end

node_staff(("Staff"))
node_supabase[("Supabase Auth and Database")]

node_staff -->|"signs in"| node_login
node_login -->|"submits credentials"| node_auth_actions
node_auth_actions -->|"authenticates"| node_supabase
node_route_guard -->|"validates session"| node_supabase
node_staff -->|"uses cashier role"| node_cashier_layout
node_staff -->|"uses mechanic role"| node_mechanic_layout
node_staff -->|"uses owner role"| node_owner_layout
node_cashier_layout -->|"opens dashboard"| node_cashier_home
node_cashier_layout -->|"closes session"| node_session_close
node_session_close -->|"renders form"| node_session_form
node_session_form -->|"queries summaries"| node_supabase_client
node_supabase_client -->|"reads and writes"| node_supabase
node_cashier_layout -->|"starts repair sale"| node_ticket_create
node_ticket_create -->|"opens ticket"| node_repair_ticket
node_cashier_layout -->|"checks queue"| node_active_queue
node_cashier_layout -->|"starts retail sale"| node_takeaway
node_cashier_layout -->|"manages customers"| node_customers
node_customers -->|"uses data client"| node_supabase_client
node_cashier_hooks -->|"uses data client"| node_supabase_client
node_mechanic_layout -->|"opens dashboard"| node_mechanic_home
node_mechanic_layout -->|"views history"| node_mechanic_history
node_owner_layout -->|"opens dashboard"| node_owner_dashboard
node_owner_dashboard -->|"requests metrics"| node_owner_query
node_owner_query -->|"queries transactions"| node_supabase_client
node_owner_layout -->|"manages inventory"| node_owner_stock
node_owner_stock -->|"uses stock data"| node_stock_hooks
node_stock_hooks -->|"uses data client"| node_supabase_client
node_owner_layout -->|"manages service catalog"| node_owner_services
node_owner_layout -->|"manages customers"| node_owner_customers
node_owner_layout -->|"manages employees"| node_owner_staff
node_owner_layout -->|"reviews shifts"| node_owner_reports
node_owner_layout -->|"reviews performance"| node_owner_performance
node_owner_layout -->|"reviews transactions"| node_owner_history
node_server_client -->|"connects server-side"| node_supabase

click node_login "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/(auth)/login/page.tsx"
click node_auth_actions "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/(auth)/login/actions.ts"
click node_route_guard "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/middleware.ts"
click node_cashier_layout "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/layout.tsx"
click node_mechanic_layout "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/layout.tsx"
click node_owner_layout "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/layout.tsx"
click node_cashier_home "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/dashboard/page.tsx"
click node_session_close "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/sesi/tutup/page.tsx"
click node_session_form "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/components/kasir/TutupKasirForm.tsx"
click node_repair_ticket "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/%5Bid%5D/page.tsx"
click node_ticket_create "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/buat/page.tsx"
click node_active_queue "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/aktif/page.tsx"
click node_takeaway "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/takeaway/page.tsx"
click node_mechanic_home "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/dashboard/page.tsx"
click node_mechanic_history "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/riwayat/page.tsx"
click node_owner_dashboard "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/dashboard/page.tsx"
click node_owner_stock "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/stok/page.tsx"
click node_owner_services "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/master-jasa/page.tsx"
click node_owner_customers "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/customers/page.tsx"
click node_owner_staff "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/karyawan/page.tsx"
click node_owner_reports "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/laporan-shift/page.tsx"
click node_owner_performance "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/performa/page.tsx"
click node_owner_history "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/riwayat/page.tsx"
click node_customers "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/customers/page.tsx"
click node_owner_query "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-owner.ts"
click node_cashier_hooks "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-tiket.ts"
click node_stock_hooks "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-owner-stok.ts"
click node_supabase_client "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/supabase/client.ts"
click node_server_client "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/supabase/server.ts"
click node_database_types "https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/types/database.types.ts"

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_login,node_auth_actions,node_route_guard,node_cashier_layout,node_mechanic_layout,node_owner_layout toneBlue
class node_cashier_home,node_session_close,node_session_form,node_customers,node_supabase toneAmber
class node_repair_ticket,node_ticket_create,node_active_queue,node_takeaway,node_mechanic_home,node_mechanic_history toneMint
class node_owner_dashboard,node_owner_stock,node_owner_services,node_owner_customers,node_owner_staff,node_owner_reports,node_owner_performance,node_owner_history toneRose
class node_owner_query,node_cashier_hooks,node_stock_hooks,node_supabase_client,node_server_client,node_database_types,node_staff toneIndigo
```

## Components

### Access and Shell

- [Login](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Login Actions](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/(auth)/login/actions.ts): `app/(auth)/login/actions.ts`
- [Session Guard](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/middleware.ts): `middleware.ts`
- [Cashier Workspace](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/layout.tsx): `app/kasir/layout.tsx`
- [Mechanic Workspace](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/layout.tsx): `app/mekanik/layout.tsx`
- [Owner Workspace](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/layout.tsx): `app/owner/layout.tsx`

### Cashier Operations

- [Cashier Dashboard](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/dashboard/page.tsx): `app/kasir/dashboard/page.tsx`
- [Close Cash Session](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/sesi/tutup/page.tsx): `app/kasir/sesi/tutup/page.tsx`
- [Close Session Form](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/components/kasir/TutupKasirForm.tsx): `components/kasir/TutupKasirForm.tsx`
- [Customer Directory](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/customers/page.tsx): `app/kasir/customers/page.tsx`

### Workshop Operations

- [Repair Tickets](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/%5Bid%5D/page.tsx): `app/kasir/tiket/[id]/page.tsx`
- [Create Ticket](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/buat/page.tsx): `app/kasir/tiket/buat/page.tsx`
- [Active Queue](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/tiket/aktif/page.tsx): `app/kasir/tiket/aktif/page.tsx`
- [Takeaway POS](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/kasir/takeaway/page.tsx): `app/kasir/takeaway/page.tsx`
- [Mechanic Dashboard](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/dashboard/page.tsx): `app/mekanik/dashboard/page.tsx`
- [Mechanic History](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/mekanik/riwayat/page.tsx): `app/mekanik/riwayat/page.tsx`

### Owner Management

- [Sales Dashboard](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/dashboard/page.tsx): `app/owner/dashboard/page.tsx`
- [Stock Management](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/stok/page.tsx): `app/owner/stok/page.tsx`
- [Service Catalog](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/master-jasa/page.tsx): `app/owner/master-jasa/page.tsx`
- [Customer Management](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/customers/page.tsx): `app/owner/customers/page.tsx`
- [Employee Management](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/karyawan/page.tsx): `app/owner/karyawan/page.tsx`
- [Shift Reports](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/laporan-shift/page.tsx): `app/owner/laporan-shift/page.tsx`
- [Performance](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/performa/page.tsx): `app/owner/performa/page.tsx`
- [Transaction History](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/app/owner/riwayat/page.tsx): `app/owner/riwayat/page.tsx`

### Shared Services

- [Owner Dashboard Query](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-owner.ts): `hooks/use-owner.ts`
- [Cashier Data Hooks](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-tiket.ts): `hooks/use-tiket.ts`
- [Stock Data Hooks](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/hooks/use-owner-stok.ts): `hooks/use-owner-stok.ts`
- [Supabase Client](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/supabase/client.ts): `lib/supabase/client.ts`
- [Server Supabase Client](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/supabase/server.ts): `lib/supabase/server.ts`
- [Database Types](https://github.com/elkanajnrmanullang/pos-glorya-motor/blob/master/lib/types/database.types.ts): `lib/types/database.types.ts`

### Other components

- **Staff**
- **Supabase Auth and Database**

## Connections

- Staff → Login: signs in
- Login → Login Actions: submits credentials
- Login Actions → Supabase Auth and Database: authenticates
- Session Guard → Supabase Auth and Database: validates session
- Staff → Cashier Workspace: uses cashier role
- Staff → Mechanic Workspace: uses mechanic role
- Staff → Owner Workspace: uses owner role
- Cashier Workspace → Cashier Dashboard: opens dashboard
- Cashier Workspace → Close Cash Session: closes session
- Close Cash Session → Close Session Form: renders form
- Close Session Form → Supabase Client: queries summaries
- Supabase Client → Supabase Auth and Database: reads and writes
- Cashier Workspace → Create Ticket: starts repair sale
- Create Ticket → Repair Tickets: opens ticket
- Cashier Workspace → Active Queue: checks queue
- Cashier Workspace → Takeaway POS: starts retail sale
- Cashier Workspace → Customer Directory: manages customers
- Customer Directory → Supabase Client: uses data client
- Cashier Data Hooks → Supabase Client: uses data client
- Mechanic Workspace → Mechanic Dashboard: opens dashboard
- Mechanic Workspace → Mechanic History: views history
- Owner Workspace → Sales Dashboard: opens dashboard
- Sales Dashboard → Owner Dashboard Query: requests metrics
- Owner Dashboard Query → Supabase Client: queries transactions
- Owner Workspace → Stock Management: manages inventory
- Stock Management → Stock Data Hooks: uses stock data
- Stock Data Hooks → Supabase Client: uses data client
- Owner Workspace → Service Catalog: manages service catalog
- Owner Workspace → Customer Management: manages customers
- Owner Workspace → Employee Management: manages employees
- Owner Workspace → Shift Reports: reviews shifts
- Owner Workspace → Performance: reviews performance
- Owner Workspace → Transaction History: reviews transactions
- Server Supabase Client → Supabase Auth and Database: connects server-side
