# ranggautama47/nightvenue-backend architecture

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

- Interactive diagram: https://gitdiagram.com/ranggautama47/nightvenue-backend
- Repository: https://github.com/ranggautama47/nightvenue-backend

## Overview

NightVenue is a venue-operations backend: staff authenticate, manage catalog and tables, create orders, take payments, track inventory, and close cashier shifts; customers can use bottle-keeping and venue chat features. Forecasting combines the inventory ledger with an internal ML service. The graph includes the major README capabilities and sampled core services. Some controllers, provider wiring, and unsampled feature implementations are represented at their exact tree paths; relationships without direct evidence are omitted.

Main entry points: [`api/src/main/java/com/nightvenue/api/pos/OrderService.java`](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/pos/OrderService.java) (Order lifecycle), [`api/src/main/java/com/nightvenue/api/payment/PaymentService.java`](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/PaymentService.java) (Payment lifecycle), [`api/src/main/java/com/nightvenue/api/auth/AuthService.java`](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/auth/AuthService.java) (Authentication), [`api/src/main/java/com/nightvenue/api/shift/ShiftService.java`](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/shift/ShiftService.java) (Cashier shifts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Venue"]
  node_auth["Authentication<br/>[AuthService.java]"]
  node_venue_access["Venue access"]
  node_business_date["Business date"]
end

subgraph group_commerce["POS and Payments"]
  node_catalog["Catalog and recipes"]
  node_orders["Order lifecycle<br/>[OrderService.java]"]
  node_order_store[("Order records")]
  node_payments["Payment lifecycle"]
  node_xendit["Xendit integration<br/>[XenditClient.java]"]
  node_reconciliation["Payment reconciliation"]
end

subgraph group_operations["Venue Operations"]
  node_tables["Venue tables<br/>[TableService.java]"]
  node_inventory[("Inventory ledger")]
  node_bottles["Bottle keeping"]
  node_shifts["Cashier shifts<br/>[ShiftService.java]"]
end

subgraph group_insights["Forecasting and ML"]
  node_forecast_api["Forecast API"]
  node_forecast_ml["Forecast ML client<br/>[MlClient.java]"]
  node_ml_entry["ML service API<br/>[main.py]"]
  node_ml_forecast["Forecast model<br/>[forecast.py]"]
  node_chat_classifier["Chat classifier<br/>[chat_classify.py]"]
end

subgraph group_engagement["Customer Features"]
  node_chat_api["Venue chat API"]
end

node_staff(("Staff and customers"))
node_postgres[("PostgreSQL")]
node_redis[("Redis")]
node_xendit_service["Xendit provider"]

node_staff -->|"authenticates"| node_auth
node_staff -->|"creates orders"| node_orders
node_staff -->|"takes payment"| node_payments
node_staff -->|"manages stock"| node_inventory
node_staff -->|"submits shifts"| node_shifts
node_staff -->|"redeems bottles"| node_bottles
node_orders -->|"reads and writes"| node_order_store
node_orders -->|"reads products"| node_catalog
node_orders -->|"occupies table"| node_tables
node_orders -->|"deducts stock"| node_inventory
node_orders -->|"computes date"| node_business_date
node_auth -->|"resolves venues"| node_venue_access
node_auth -->|"stores refresh tokens"| node_redis
node_venue_access -->|"reads user venues"| node_postgres
node_payments -->|"creates provider payment"| node_xendit
node_xendit -->|"requests payment"| node_xendit_service
node_payments -->|"settles order"| node_order_store
node_reconciliation -->|"reconciles status"| node_payments
node_forecast_api -->|"requests forecast"| node_forecast_ml
node_forecast_api -->|"uses ledger history"| node_inventory
node_forecast_ml -->|"calls internal service"| node_ml_entry
node_ml_entry -->|"dispatches forecast"| node_ml_forecast
node_ml_entry -->|"dispatches classification"| node_chat_classifier
node_chat_api -->|"answers from venue data"| node_postgres
node_shifts -->|"reads order totals"| node_order_store
node_shifts -->|"computes cutoff date"| node_business_date
node_bottles -->|"checks staff access"| node_venue_access

click node_auth "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/auth/AuthService.java"
click node_venue_access "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/auth/VenueAccessService.java"
click node_business_date "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/businessday/BusinessDateService.java"
click node_catalog "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/catalog/ProductService.java"
click node_tables "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/venue/TableService.java"
click node_orders "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/pos/OrderService.java"
click node_order_store "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/pos/OrderRepository.java"
click node_payments "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/PaymentService.java"
click node_xendit "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/xendit/XenditClient.java"
click node_reconciliation "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/reconciliation/PaymentReconciliationService.java"
click node_inventory "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/inventory/InventoryService.java"
click node_bottles "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/bottle/BottleQueryService.java"
click node_shifts "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/shift/ShiftService.java"
click node_forecast_api "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/forecast/ForecastService.java"
click node_forecast_ml "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/forecast/MlClient.java"
click node_ml_entry "https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/main.py"
click node_ml_forecast "https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/forecast.py"
click node_chat_api "https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/chat/ChatAnswerService.java"
click node_chat_classifier "https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/chat_classify.py"

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_auth,node_venue_access,node_business_date toneBlue
class node_catalog,node_orders,node_order_store,node_payments,node_xendit,node_reconciliation,node_postgres,node_redis toneAmber
class node_tables,node_inventory,node_bottles,node_shifts toneMint
class node_forecast_api,node_forecast_ml,node_ml_entry,node_ml_forecast,node_chat_classifier toneRose
class node_chat_api,node_staff,node_xendit_service toneIndigo
```

## Components

### Access and Venue

- [Authentication](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/auth/AuthService.java): `api/src/main/java/com/nightvenue/api/auth/AuthService.java`
- [Venue access](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/auth/VenueAccessService.java): `api/src/main/java/com/nightvenue/api/auth/VenueAccessService.java`
- [Business date](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/businessday/BusinessDateService.java): `api/src/main/java/com/nightvenue/api/businessday/BusinessDateService.java`

### POS and Payments

- [Catalog and recipes](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/catalog/ProductService.java): `api/src/main/java/com/nightvenue/api/catalog/ProductService.java`
- [Order lifecycle](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/pos/OrderService.java): `api/src/main/java/com/nightvenue/api/pos/OrderService.java`
- [Order records](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/pos/OrderRepository.java): `api/src/main/java/com/nightvenue/api/pos/OrderRepository.java`
- [Payment lifecycle](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/PaymentService.java): `api/src/main/java/com/nightvenue/api/payment/PaymentService.java`
- [Xendit integration](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/xendit/XenditClient.java): `api/src/main/java/com/nightvenue/api/payment/xendit/XenditClient.java`
- [Payment reconciliation](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/payment/reconciliation/PaymentReconciliationService.java): `api/src/main/java/com/nightvenue/api/payment/reconciliation/PaymentReconciliationService.java`

### Venue Operations

- [Venue tables](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/venue/TableService.java): `api/src/main/java/com/nightvenue/api/venue/TableService.java`
- [Inventory ledger](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/inventory/InventoryService.java): `api/src/main/java/com/nightvenue/api/inventory/InventoryService.java`
- [Bottle keeping](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/bottle/BottleQueryService.java): `api/src/main/java/com/nightvenue/api/bottle/BottleQueryService.java`
- [Cashier shifts](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/shift/ShiftService.java): `api/src/main/java/com/nightvenue/api/shift/ShiftService.java`

### Forecasting and ML

- [Forecast API](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/forecast/ForecastService.java): `api/src/main/java/com/nightvenue/api/forecast/ForecastService.java`
- [Forecast ML client](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/forecast/MlClient.java): `api/src/main/java/com/nightvenue/api/forecast/MlClient.java`
- [ML service API](https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/main.py): `ml-service/app/main.py`
- [Forecast model](https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/forecast.py): `ml-service/app/forecast.py`
- [Chat classifier](https://github.com/ranggautama47/nightvenue-backend/blob/main/ml-service/app/chat_classify.py): `ml-service/app/chat_classify.py`

### Customer Features

- [Venue chat API](https://github.com/ranggautama47/nightvenue-backend/blob/main/api/src/main/java/com/nightvenue/api/chat/ChatAnswerService.java): `api/src/main/java/com/nightvenue/api/chat/ChatAnswerService.java`

### Other components

- **Staff and customers**
- **PostgreSQL**
- **Redis**
- **Xendit provider**

## Connections

- Staff and customers → Authentication: authenticates (evidence: `README.md`)
- Staff and customers → Order lifecycle: creates orders (evidence: `README.md`)
- Staff and customers → Payment lifecycle: takes payment (evidence: `README.md`)
- Staff and customers → Inventory ledger: manages stock (evidence: `README.md`)
- Staff and customers → Cashier shifts: submits shifts (evidence: `README.md`)
- Staff and customers → Bottle keeping: redeems bottles (evidence: `README.md`)
- Order lifecycle → Order records: reads and writes (evidence: `api/src/main/java/com/nightvenue/api/pos/OrderService.java`)
- Order lifecycle → Catalog and recipes: reads products (evidence: `api/src/main/java/com/nightvenue/api/pos/OrderService.java`)
- Order lifecycle → Venue tables: occupies table (evidence: `api/src/main/java/com/nightvenue/api/pos/OrderService.java`)
- Order lifecycle → Inventory ledger: deducts stock (evidence: `api/src/main/java/com/nightvenue/api/pos/OrderService.java`)
- Order lifecycle → Business date: computes date (evidence: `api/src/main/java/com/nightvenue/api/pos/OrderService.java`)
- Authentication → Venue access: resolves venues (evidence: `api/src/main/java/com/nightvenue/api/auth/AuthService.java`)
- Authentication → Redis: stores refresh tokens (evidence: `api/src/main/java/com/nightvenue/api/auth/AuthService.java`)
- Venue access → PostgreSQL: reads user venues (evidence: `api/src/main/java/com/nightvenue/api/auth/VenueAccessService.java`)
- Payment lifecycle → Xendit integration: creates provider payment (evidence: `README.md`)
- Xendit integration → Xendit provider: requests payment (evidence: `README.md`)
- Payment lifecycle → Order records: settles order (evidence: `README.md`)
- Payment reconciliation → Payment lifecycle: reconciles status (evidence: `README.md`)
- Forecast API → Forecast ML client: requests forecast (evidence: `api/src/main/java/com/nightvenue/api/forecast/ForecastService.java`)
- Forecast API → Inventory ledger: uses ledger history (evidence: `README.md`)
- Forecast ML client → ML service API: calls internal service (evidence: `README.md`)
- ML service API → Forecast model: dispatches forecast (evidence: `ml-service/app/main.py`)
- ML service API → Chat classifier: dispatches classification (evidence: `ml-service/app/main.py`)
- Venue chat API → PostgreSQL: answers from venue data (evidence: `README.md`)
- Cashier shifts → Order records: reads order totals (evidence: `api/src/main/java/com/nightvenue/api/shift/ShiftService.java`)
- Cashier shifts → Business date: computes cutoff date (evidence: `api/src/main/java/com/nightvenue/api/shift/ShiftService.java`)
- Bottle keeping → Venue access: checks staff access (evidence: `api/src/main/java/com/nightvenue/api/bottle/BottleQueryService.java`)
