# alamid-xii/japz_mobile_pos architecture

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

- Interactive diagram: https://gitdiagram.com/alamid-xii/japz_mobile_pos
- Repository: https://github.com/alamid-xii/japz_mobile_pos

## Overview

Japz is a restaurant point-of-sale and operations system: cashier staff create and pay for orders, kitchen staff prepare them, and administrators manage operations and review sales and customer feedback. The web app routes role-based screens through a shared API client to the backend; backend routes implement operations over relational models. Feedback analysis and Google Sheets synchronization are distinct capabilities. The graph reflects shown imports, calls, and route setup; some feature links are dashed because their implementations were not sampled.

Main entry points: [`japz-backend/routes/index.js`](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js) (Business API routes), [`japz-web/src/services/api.ts`](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/services/api.ts) (API client), [`japz-web/src/App.tsx`](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/App.tsx) (Role-based routes), [`japz-backend/models/feedbackModel.js`](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/feedbackModel.js) (Feedback records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Role-based routes<br/>[App.tsx]"]
  node_authstate["Authentication state<br/>[useAuth.tsx]"]
  node_client["API client<br/>[api.ts]"]
  node_adminui["Admin operations"]
  node_posui["Cashier POS<br/>[POS.tsx]"]
  node_kitchenui["Kitchen workflow<br/>[Incoming.tsx]"]
  node_feedbackui["Public feedback<br/>[Feedback.tsx]"]
end

subgraph group_api["Backend API"]
  node_server["HTTP server<br/>[index.js]"]
  node_routes["Business API routes<br/>[index.js]"]
  node_auth["Authentication handlers<br/>[authController.js]"]
  node_orders["Orders and payments<br/>[index.js]"]
  node_catalog["Menu and inventory<br/>[index.js]"]
  node_feedback["Feedback handling"]
  node_email["Email verification<br/>[emailService.js]"]
end

subgraph group_data["Operational data"]
  node_database[("MySQL database<br/>[db.js]")]
  node_models["Operational models"]
  node_feedbackmodel["Feedback records<br/>[feedbackModel.js]"]
  node_orderdata["Order records<br/>[orderModel.js]"]
  node_logs["Audit logging<br/>[logModel.js]"]
end

subgraph group_insight["Feedback insights"]
  node_analysis["Sentiment analysis<br/>[gemmaService.js]"]
  node_feedbackservice["Feedback processing<br/>[feedbackService.js]"]
  node_ai["Analysis utilities"]
  node_sheets["Sheets integration"]
end

node_staff(("Restaurant staff"))
node_customer(("Feedback customer"))

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_authstate
node_app -->|"routes admin"| node_adminui
node_app -->|"routes cashier"| node_posui
node_app -->|"routes kitchen"| node_kitchenui
node_authstate -->|"calls auth API"| node_client
node_adminui -->|"calls API"| node_client
node_posui -->|"calls API"| node_client
node_kitchenui -->|"calls API"| node_client
node_customer -->|"submits feedback"| node_feedbackui
node_feedbackui -->|"calls API"| node_client
node_client -.->|"HTTP requests"| node_routes
node_server -->|"mounts routes"| node_routes
node_routes -->|"dispatches auth"| node_auth
node_routes -->|"handles orders"| node_orders
node_routes -->|"handles catalog"| node_catalog
node_routes -.->|"dispatches feedback"| node_feedback
node_auth -->|"queries users"| node_models
node_orders -->|"persists orders"| node_orderdata
node_catalog -->|"uses models"| node_models
node_feedback -->|"queries feedback"| node_feedbackmodel
node_feedback -->|"looks up order"| node_orderdata
node_feedback -->|"analyzes comment"| node_analysis
node_feedbackservice -->|"processes records"| node_feedbackmodel
node_feedbackservice -->|"uses analysis"| node_analysis
node_analysis -.->|"requests model analysis"| node_customer
node_models -->|"uses connection"| node_database
node_feedbackmodel -->|"stores records"| node_database
node_orderdata -->|"stores orders"| node_database
node_routes -->|"writes audit logs"| node_logs
node_sheets -->|"reads feedback"| node_feedbackmodel
node_ai -.->|"supports analysis"| node_feedbackmodel
node_routes -->|"sends verification"| node_email

click node_app "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/App.tsx"
click node_authstate "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/hooks/useAuth.tsx"
click node_client "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/services/api.ts"
click node_adminui "https://github.com/alamid-xii/japz_mobile_pos/tree/main/japz-web/src/pages/admin"
click node_posui "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/cashier/POS.tsx"
click node_kitchenui "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/kitchen/Incoming.tsx"
click node_feedbackui "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/public/Feedback.tsx"
click node_server "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/index.js"
click node_routes "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js"
click node_auth "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/controllers/authController.js"
click node_orders "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js"
click node_catalog "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js"
click node_feedback "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/controllers/feedbackController.js"
click node_database "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/db.js"
click node_models "https://github.com/alamid-xii/japz_mobile_pos/tree/main/japz-backend/models"
click node_feedbackmodel "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/feedbackModel.js"
click node_orderdata "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/orderModel.js"
click node_analysis "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/gemmaService.js"
click node_feedbackservice "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/feedbackService.js"
click node_ai "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/aiAnalysisService.js"
click node_sheets "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/googleSheetsService.js"
click node_email "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/emailService.js"
click node_logs "https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/logModel.js"

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_app,node_authstate,node_client,node_adminui,node_posui,node_kitchenui,node_feedbackui toneBlue
class node_server,node_routes,node_auth,node_orders,node_catalog,node_feedback,node_email toneAmber
class node_database,node_models,node_feedbackmodel,node_orderdata,node_logs toneMint
class node_analysis,node_feedbackservice,node_ai,node_sheets toneRose
class node_staff,node_customer toneIndigo
```

## Components

### Web application

- [Role-based routes](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/App.tsx): `japz-web/src/App.tsx`
- [Authentication state](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/hooks/useAuth.tsx): `japz-web/src/hooks/useAuth.tsx`
- [API client](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/services/api.ts): `japz-web/src/services/api.ts`
- [Admin operations](https://github.com/alamid-xii/japz_mobile_pos/tree/main/japz-web/src/pages/admin): `japz-web/src/pages/admin`
- [Cashier POS](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/cashier/POS.tsx): `japz-web/src/pages/cashier/POS.tsx`
- [Kitchen workflow](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/kitchen/Incoming.tsx): `japz-web/src/pages/kitchen/Incoming.tsx`
- [Public feedback](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-web/src/pages/public/Feedback.tsx): `japz-web/src/pages/public/Feedback.tsx`

### Backend API

- [HTTP server](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/index.js): `japz-backend/index.js`
- [Business API routes](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js): `japz-backend/routes/index.js`
- [Authentication handlers](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/controllers/authController.js): `japz-backend/controllers/authController.js`
- [Orders and payments](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js): `japz-backend/routes/index.js`
- [Menu and inventory](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/routes/index.js): `japz-backend/routes/index.js`
- [Feedback handling](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/controllers/feedbackController.js): `japz-backend/controllers/feedbackController.js`
- [Email verification](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/emailService.js): `japz-backend/services/emailService.js`

### Operational data

- [MySQL database](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/db.js): `japz-backend/models/db.js`
- [Operational models](https://github.com/alamid-xii/japz_mobile_pos/tree/main/japz-backend/models): `japz-backend/models`
- [Feedback records](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/feedbackModel.js): `japz-backend/models/feedbackModel.js`
- [Order records](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/orderModel.js): `japz-backend/models/orderModel.js`
- [Audit logging](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/models/logModel.js): `japz-backend/models/logModel.js`

### Feedback insights

- [Sentiment analysis](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/gemmaService.js): `japz-backend/services/gemmaService.js`
- [Feedback processing](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/feedbackService.js): `japz-backend/services/feedbackService.js`
- [Analysis utilities](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/aiAnalysisService.js): `japz-backend/services/aiAnalysisService.js`
- [Sheets integration](https://github.com/alamid-xii/japz_mobile_pos/blob/main/japz-backend/services/googleSheetsService.js): `japz-backend/services/googleSheetsService.js`

### Other components

- **Restaurant staff**
- **Feedback customer**

## Connections

- Restaurant staff → Role-based routes: uses (evidence: `japz-web/src/App.tsx`)
- Role-based routes → Authentication state: provides auth (evidence: `japz-web/src/App.tsx`)
- Role-based routes → Admin operations: routes admin (evidence: `japz-web/src/App.tsx`)
- Role-based routes → Cashier POS: routes cashier (evidence: `japz-web/src/App.tsx`)
- Role-based routes → Kitchen workflow: routes kitchen (evidence: `japz-web/src/App.tsx`)
- Authentication state → API client: calls auth API (evidence: `japz-web/src/hooks/useAuth.tsx`)
- Admin operations → API client: calls API (evidence: `japz-web/src/pages/admin/MenuInventory.tsx`)
- Cashier POS → API client: calls API (evidence: `japz-web/src/pages/cashier/POS.tsx`)
- Kitchen workflow → API client: calls API (evidence: `japz-web/src/pages/kitchen/Incoming.tsx`)
- Feedback customer → Public feedback: submits feedback (evidence: `japz-web/src/pages/public/Feedback.tsx`)
- Public feedback → API client: calls API (evidence: `japz-web/src/pages/public/Feedback.tsx`)
- API client → Business API routes: HTTP requests
- HTTP server → Business API routes: mounts routes (evidence: `japz-backend/index.js`)
- Business API routes → Authentication handlers: dispatches auth (evidence: `japz-backend/routes/index.js`)
- Business API routes → Orders and payments: handles orders (evidence: `japz-backend/routes/index.js`)
- Business API routes → Menu and inventory: handles catalog (evidence: `japz-backend/routes/index.js`)
- Business API routes → Feedback handling: dispatches feedback
- Authentication handlers → Operational models: queries users (evidence: `japz-backend/controllers/authController.js`)
- Orders and payments → Order records: persists orders (evidence: `japz-backend/routes/index.js`)
- Menu and inventory → Operational models: uses models (evidence: `japz-backend/routes/index.js`)
- Feedback handling → Feedback records: queries feedback (evidence: `japz-backend/controllers/feedbackController.js`)
- Feedback handling → Order records: looks up order (evidence: `japz-backend/controllers/feedbackController.js`)
- Feedback handling → Sentiment analysis: analyzes comment (evidence: `japz-backend/controllers/feedbackController.js`)
- Feedback processing → Feedback records: processes records (evidence: `japz-backend/services/feedbackService.js`)
- Feedback processing → Sentiment analysis: uses analysis (evidence: `japz-backend/services/feedbackService.js`)
- Sentiment analysis → Feedback customer: requests model analysis
- Operational models → MySQL database: uses connection (evidence: `japz-backend/models/db.js`)
- Feedback records → MySQL database: stores records (evidence: `japz-backend/models/feedbackModel.js`)
- Order records → MySQL database: stores orders (evidence: `japz-backend/models/orderModel.js`)
- Business API routes → Audit logging: writes audit logs (evidence: `japz-backend/routes/index.js`)
- Sheets integration → Feedback records: reads feedback (evidence: `japz-backend/services/googleSheetsService.js`)
- Analysis utilities → Feedback records: supports analysis
- Business API routes → Email verification: sends verification (evidence: `japz-backend/routes/index.js`)
