# hoyirul/gacoan-pos architecture

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

- Interactive diagram: https://gitdiagram.com/hoyirul/gacoan-pos
- Repository: https://github.com/hoyirul/gacoan-pos

## Overview

Gacoan POS is a Next.js point-of-sale application for admin, cashier, and self-service ordering. Customers or cashiers select menu items; order endpoints validate BOM ingredient stock, calculate totals, decrement inventory, record stock mutations, and save transactions. Admin pages manage ingredients, menus, and stock history and review transactions; login supplies a client-side session. The graph reflects documented features and sampled routes; several UI-to-API relationships are supported by direct fetches, while unsampled route wiring is omitted.

Main entry points: [`lib/prisma.ts`](https://github.com/hoyirul/gacoan-pos/blob/development/lib/prisma.ts) (Prisma client), [`app/admin/page.tsx`](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/page.tsx) (Admin dashboard), [`app/admin/menus/page.tsx`](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/menus/page.tsx) (Menu and BOM management), [`components/mainLayout.tsx`](https://github.com/hoyirul/gacoan-pos/blob/development/components/mainLayout.tsx) (Session layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sales["Sales channels"]
  node_orderui["Self-service ordering<br/>[page.tsx]"]
  node_cashierui["Cashier checkout<br/>[cashierForm.tsx]"]
  node_cashierpage["Available menus<br/>[page.tsx]"]
  node_loginui["Login screen<br/>[page.tsx]"]
end

subgraph group_admin["Administration"]
  node_ingredientsui["Ingredient management<br/>[page.tsx]"]
  node_menusui["Menu and BOM management<br/>[page.tsx]"]
  node_stockui["Stock history<br/>[page.tsx]"]
  node_transactionsui["Transaction reports<br/>[page.tsx]"]
  node_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_layout["Session layout<br/>[mainLayout.tsx]"]
end

subgraph group_api["Application routes"]
  node_loginroute["Login endpoint<br/>[route.ts]"]
  node_ordercatalog["Order menu catalog<br/>[route.ts]"]
  node_ordersubmit["Self-service order processing<br/>[route.ts]"]
  node_cashierroute["Cashier transaction processing<br/>[route.ts]"]
  node_ingredientroutes["Ingredient routes"]
  node_menuroutes["Menu routes"]
  node_stockroute["Stock history route<br/>[route.ts]"]
  node_transactionsroute["Transaction history route<br/>[route.ts]"]
end

subgraph group_data["Persistence"]
  node_prisma["Prisma client<br/>[prisma.ts]"]
  node_sqlite[("POS database<br/>[schema.prisma]")]
end

node_guest(("Customer"))
node_cashier(("Cashier"))
node_adminuser(("Administrator"))

node_guest -->|"selects items"| node_orderui
node_orderui -.->|"loads menu"| node_ordercatalog
node_orderui -.->|"submits order"| node_ordersubmit
node_cashier -.->|"enters sale"| node_cashierui
node_cashierpage -->|"renders"| node_cashierui
node_cashierui -.->|"records sale"| node_cashierroute
node_adminuser -->|"signs in"| node_loginui
node_loginui -.->|"authenticates"| node_loginroute
node_loginroute -->|"queries user"| node_prisma
node_prisma -.->|"persists records"| node_sqlite
node_ingredientsui -.->|"manages stock"| node_ingredientroutes
node_menusui -->|"creates menu"| node_menuroutes
node_menusui -->|"loads ingredients"| node_ingredientroutes
node_stockui -.->|"loads history"| node_stockroute
node_transactionsui -.->|"loads sales"| node_transactionsroute
node_dashboard -->|"links to"| node_ingredientsui
node_dashboard -->|"links to"| node_menusui
node_dashboard -->|"links to"| node_stockui
node_dashboard -->|"links to"| node_transactionsui
node_ingredientsui -->|"renders within"| node_layout
node_menusui -->|"renders within"| node_layout
node_stockui -->|"renders within"| node_layout
node_transactionsui -->|"renders within"| node_layout
node_ingredientroutes -->|"uses client"| node_prisma
node_menuroutes -->|"uses client"| node_prisma
node_stockroute -->|"reads mutations"| node_prisma
node_transactionsroute -->|"reads transactions"| node_prisma
node_ordercatalog -->|"reads menus"| node_prisma
node_ordersubmit -->|"updates stock and sales"| node_prisma
node_cashierroute -->|"updates stock and sales"| node_prisma

click node_orderui "https://github.com/hoyirul/gacoan-pos/blob/development/app/order/page.tsx"
click node_cashierui "https://github.com/hoyirul/gacoan-pos/blob/development/app/cashier/cashierForm.tsx"
click node_cashierpage "https://github.com/hoyirul/gacoan-pos/blob/development/app/cashier/page.tsx"
click node_loginui "https://github.com/hoyirul/gacoan-pos/blob/development/app/login/page.tsx"
click node_loginroute "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/login/route.ts"
click node_ordercatalog "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/order/menus/route.ts"
click node_ordersubmit "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/order/submit/route.ts"
click node_cashierroute "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/cashier/transactions/add/route.ts"
click node_ingredientsui "https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/ingredients/page.tsx"
click node_menusui "https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/menus/page.tsx"
click node_stockui "https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/stock-mutations/page.tsx"
click node_transactionsui "https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/transactions/page.tsx"
click node_dashboard "https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/page.tsx"
click node_ingredientroutes "https://github.com/hoyirul/gacoan-pos/tree/development/app/api/admin/ingredients"
click node_menuroutes "https://github.com/hoyirul/gacoan-pos/tree/development/app/api/admin/menus"
click node_stockroute "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/admin/stock-mutations/route.ts"
click node_transactionsroute "https://github.com/hoyirul/gacoan-pos/blob/development/app/api/admin/transactions/route.ts"
click node_layout "https://github.com/hoyirul/gacoan-pos/blob/development/components/mainLayout.tsx"
click node_prisma "https://github.com/hoyirul/gacoan-pos/blob/development/lib/prisma.ts"
click node_sqlite "https://github.com/hoyirul/gacoan-pos/blob/development/prisma/schema.prisma"

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_orderui,node_cashierui,node_cashierpage,node_loginui toneBlue
class node_ingredientsui,node_menusui,node_stockui,node_transactionsui,node_dashboard,node_layout toneAmber
class node_loginroute,node_ordercatalog,node_ordersubmit,node_cashierroute,node_ingredientroutes,node_menuroutes,node_stockroute,node_transactionsroute toneMint
class node_prisma,node_sqlite toneRose
class node_guest,node_cashier,node_adminuser toneIndigo
```

## Components

### Sales channels

- [Self-service ordering](https://github.com/hoyirul/gacoan-pos/blob/development/app/order/page.tsx): `app/order/page.tsx`
- [Cashier checkout](https://github.com/hoyirul/gacoan-pos/blob/development/app/cashier/cashierForm.tsx): `app/cashier/cashierForm.tsx`
- [Available menus](https://github.com/hoyirul/gacoan-pos/blob/development/app/cashier/page.tsx): `app/cashier/page.tsx`
- [Login screen](https://github.com/hoyirul/gacoan-pos/blob/development/app/login/page.tsx): `app/login/page.tsx`

### Administration

- [Ingredient management](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/ingredients/page.tsx): `app/admin/ingredients/page.tsx`
- [Menu and BOM management](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/menus/page.tsx): `app/admin/menus/page.tsx`
- [Stock history](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/stock-mutations/page.tsx): `app/admin/stock-mutations/page.tsx`
- [Transaction reports](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/transactions/page.tsx): `app/admin/transactions/page.tsx`
- [Admin dashboard](https://github.com/hoyirul/gacoan-pos/blob/development/app/admin/page.tsx): `app/admin/page.tsx`
- [Session layout](https://github.com/hoyirul/gacoan-pos/blob/development/components/mainLayout.tsx): `components/mainLayout.tsx`

### Application routes

- [Login endpoint](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/login/route.ts): `app/api/login/route.ts`
- [Order menu catalog](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/order/menus/route.ts): `app/api/order/menus/route.ts`
- [Self-service order processing](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/order/submit/route.ts): `app/api/order/submit/route.ts`
- [Cashier transaction processing](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/cashier/transactions/add/route.ts): `app/api/cashier/transactions/add/route.ts`
- [Ingredient routes](https://github.com/hoyirul/gacoan-pos/tree/development/app/api/admin/ingredients): `app/api/admin/ingredients`
- [Menu routes](https://github.com/hoyirul/gacoan-pos/tree/development/app/api/admin/menus): `app/api/admin/menus`
- [Stock history route](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/admin/stock-mutations/route.ts): `app/api/admin/stock-mutations/route.ts`
- [Transaction history route](https://github.com/hoyirul/gacoan-pos/blob/development/app/api/admin/transactions/route.ts): `app/api/admin/transactions/route.ts`

### Persistence

- [Prisma client](https://github.com/hoyirul/gacoan-pos/blob/development/lib/prisma.ts): `lib/prisma.ts`
- [POS database](https://github.com/hoyirul/gacoan-pos/blob/development/prisma/schema.prisma): `prisma/schema.prisma`

### Other components

- **Customer**
- **Cashier**
- **Administrator**

## Connections

- Customer → Self-service ordering: selects items (evidence: `README.md`)
- Self-service ordering → Order menu catalog: loads menu
- Self-service ordering → Self-service order processing: submits order
- Cashier → Cashier checkout: enters sale
- Available menus → Cashier checkout: renders (evidence: `app/cashier/page.tsx`)
- Cashier checkout → Cashier transaction processing: records sale
- Administrator → Login screen: signs in (evidence: `README.md`)
- Login screen → Login endpoint: authenticates
- Login endpoint → Prisma client: queries user (evidence: `app/api/login/route.ts`)
- Prisma client → POS database: persists records
- Ingredient management → Ingredient routes: manages stock
- Menu and BOM management → Menu routes: creates menu (evidence: `app/admin/menus/page.tsx`)
- Menu and BOM management → Ingredient routes: loads ingredients (evidence: `app/admin/menus/page.tsx`)
- Stock history → Stock history route: loads history
- Transaction reports → Transaction history route: loads sales
- Admin dashboard → Ingredient management: links to (evidence: `app/admin/page.tsx`)
- Admin dashboard → Menu and BOM management: links to (evidence: `app/admin/page.tsx`)
- Admin dashboard → Stock history: links to (evidence: `app/admin/page.tsx`)
- Admin dashboard → Transaction reports: links to (evidence: `app/admin/page.tsx`)
- Ingredient management → Session layout: renders within (evidence: `app/admin/ingredients/page.tsx`)
- Menu and BOM management → Session layout: renders within (evidence: `app/admin/menus/page.tsx`)
- Stock history → Session layout: renders within (evidence: `app/admin/stock-mutations/page.tsx`)
- Transaction reports → Session layout: renders within (evidence: `app/admin/transactions/page.tsx`)
- Ingredient routes → Prisma client: uses client (evidence: `app/api/admin/ingredients/add/route.ts`)
- Menu routes → Prisma client: uses client (evidence: `app/api/admin/menus/add/route.ts`)
- Stock history route → Prisma client: reads mutations (evidence: `app/api/admin/stock-mutations/route.ts`)
- Transaction history route → Prisma client: reads transactions (evidence: `app/api/admin/transactions/route.ts`)
- Order menu catalog → Prisma client: reads menus (evidence: `app/api/order/menus/route.ts`)
- Self-service order processing → Prisma client: updates stock and sales (evidence: `app/api/order/submit/route.ts`)
- Cashier transaction processing → Prisma client: updates stock and sales (evidence: `app/api/cashier/transactions/add/route.ts`)
