# enterprise-system-sarana/360-backend architecture

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

- Interactive diagram: https://gitdiagram.com/enterprise-system-sarana/360-backend
- Repository: https://github.com/enterprise-system-sarana/360-backend

## Overview

Sarana Restaurant System is a Spring-based restaurant operations backend. Staff and administrators use its API to manage products and stock, record purchases and sales, handle customers and quotes, and review reports; authentication and file handling are additional capabilities. Controllers expose the API and delegate domain work to services, with persistence represented by JPA entities and repositories. The excerpts establish the authentication and invoice-number details, but most domain controller-to-service and service-to-repository calls were not sampled, so those links are shown as unverified rather than asserted.

Main entry points: [`src/main/java/com/saranaresturantsystem/repository`](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/repository) (JPA repositories), [`src/main/java/com/saranaresturantsystem/controllers/purchase`](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/purchase) (Purchases and expenses), [`src/main/java/com/saranaresturantsystem/controllers/sales`](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/sales) (Sales and payments), [`src/main/java/com/saranaresturantsystem/common/InvoiceNumberService.java`](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/common/InvoiceNumberService.java) (Invoice numbering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_auth_api["Authentication API"]
  node_auth_logic["Authentication service"]
  node_jwt["JWT service<br/>[JwtService.java]"]
  node_access_admin["Users and permissions"]
end

subgraph group_operations["Restaurant operations"]
  node_catalog["Product catalog"]
  node_customers["Customer management"]
  node_inventory["Inventory and stores"]
  node_purchases["Purchases and expenses"]
  node_sales["Sales and payments"]
  node_quotes["Quotes"]
  node_finance["Banks and currency"]
end

subgraph group_insights["Reports and insights"]
  node_reports["Operational reports"]
  node_dashboard["Dashboard"]
end

subgraph group_platform["Shared platform"]
  node_file_api["File API"]
  node_file_service["S3 file service<br/>[S3FileService.java]"]
  node_invoice["Invoice numbering"]
  node_repositories["JPA repositories"]
  node_database[("PostgreSQL database")]
  node_s3[("Amazon S3")]
end

node_staff(("Staff and admins"))

node_staff -.->|"uses auth"| node_auth_api
node_auth_api -->|"delegates auth"| node_auth_logic
node_auth_logic -->|"creates tokens"| node_jwt
node_staff -.->|"manages products"| node_catalog
node_staff -.->|"manages customers"| node_customers
node_staff -.->|"manages stock"| node_inventory
node_staff -.->|"records purchases"| node_purchases
node_staff -.->|"records sales"| node_sales
node_staff -.->|"manages quotes"| node_quotes
node_staff -.->|"manages finance"| node_finance
node_staff -.->|"requests reports"| node_reports
node_staff -.->|"views dashboard"| node_dashboard
node_staff -.->|"administers access"| node_access_admin
node_staff -.->|"manages files"| node_file_api
node_file_api -->|"delegates files"| node_file_service
node_file_service -.->|"stores files"| node_s3
node_purchases -.->|"numbers purchases"| node_invoice
node_sales -.->|"numbers sales"| node_invoice
node_quotes -.->|"numbers quotes"| node_invoice
node_catalog -.->|"persists catalog"| node_repositories
node_customers -.->|"persists customers"| node_repositories
node_inventory -.->|"persists stock"| node_repositories
node_purchases -.->|"persists purchases"| node_repositories
node_sales -.->|"persists sales"| node_repositories
node_reports -.->|"queries records"| node_repositories
node_dashboard -.->|"queries metrics"| node_repositories
node_repositories -.->|"reads and writes"| node_database

click node_auth_api "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/users/AuthController.java"
click node_auth_logic "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/services/impl/users/AuthServiceImpl.java"
click node_jwt "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/config/security/JwtService.java"
click node_access_admin "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/users"
click node_catalog "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/catalog"
click node_customers "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/customer/CustomerController.java"
click node_inventory "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/inventory"
click node_purchases "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/purchase"
click node_sales "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/sales"
click node_quotes "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/quote/QuoteController.java"
click node_finance "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/finances"
click node_reports "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/reports/controller"
click node_dashboard "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/dashboard/DashboardController.java"
click node_file_api "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/S3FileController.java"
click node_file_service "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/services/file/S3FileService.java"
click node_invoice "https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/common/InvoiceNumberService.java"
click node_repositories "https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/repository"

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_api,node_auth_logic,node_jwt,node_access_admin toneBlue
class node_catalog,node_customers,node_inventory,node_purchases,node_sales,node_quotes,node_finance toneAmber
class node_reports,node_dashboard toneMint
class node_file_api,node_file_service,node_invoice,node_repositories,node_database,node_s3 toneRose
class node_staff toneIndigo
```

## Components

### Identity and access

- [Authentication API](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/users/AuthController.java): `src/main/java/com/saranaresturantsystem/controllers/users/AuthController.java`
- [Authentication service](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/services/impl/users/AuthServiceImpl.java): `src/main/java/com/saranaresturantsystem/services/impl/users/AuthServiceImpl.java`
- [JWT service](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/config/security/JwtService.java): `src/main/java/com/saranaresturantsystem/config/security/JwtService.java`
- [Users and permissions](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/users): `src/main/java/com/saranaresturantsystem/controllers/users`

### Restaurant operations

- [Product catalog](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/catalog): `src/main/java/com/saranaresturantsystem/controllers/catalog`
- [Customer management](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/customer/CustomerController.java): `src/main/java/com/saranaresturantsystem/controllers/customer/CustomerController.java`
- [Inventory and stores](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/inventory): `src/main/java/com/saranaresturantsystem/controllers/inventory`
- [Purchases and expenses](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/purchase): `src/main/java/com/saranaresturantsystem/controllers/purchase`
- [Sales and payments](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/sales): `src/main/java/com/saranaresturantsystem/controllers/sales`
- [Quotes](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/quote/QuoteController.java): `src/main/java/com/saranaresturantsystem/controllers/quote/QuoteController.java`
- [Banks and currency](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/controllers/finances): `src/main/java/com/saranaresturantsystem/controllers/finances`

### Reports and insights

- [Operational reports](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/reports/controller): `src/main/java/com/saranaresturantsystem/reports/controller`
- [Dashboard](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/dashboard/DashboardController.java): `src/main/java/com/saranaresturantsystem/controllers/dashboard/DashboardController.java`

### Shared platform

- [File API](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/controllers/S3FileController.java): `src/main/java/com/saranaresturantsystem/controllers/S3FileController.java`
- [S3 file service](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/services/file/S3FileService.java): `src/main/java/com/saranaresturantsystem/services/file/S3FileService.java`
- [Invoice numbering](https://github.com/enterprise-system-sarana/360-backend/blob/dev/src/main/java/com/saranaresturantsystem/common/InvoiceNumberService.java): `src/main/java/com/saranaresturantsystem/common/InvoiceNumberService.java`
- [JPA repositories](https://github.com/enterprise-system-sarana/360-backend/tree/dev/src/main/java/com/saranaresturantsystem/repository): `src/main/java/com/saranaresturantsystem/repository`
- **PostgreSQL database**
- **Amazon S3**

### Other components

- **Staff and admins**

## Connections

- Staff and admins → Authentication API: uses auth
- Authentication API → Authentication service: delegates auth (evidence: `src/main/java/com/saranaresturantsystem/controllers/users/AuthController.java`)
- Authentication service → JWT service: creates tokens (evidence: `src/main/java/com/saranaresturantsystem/services/impl/users/AuthServiceImpl.java`)
- Staff and admins → Product catalog: manages products
- Staff and admins → Customer management: manages customers
- Staff and admins → Inventory and stores: manages stock
- Staff and admins → Purchases and expenses: records purchases
- Staff and admins → Sales and payments: records sales
- Staff and admins → Quotes: manages quotes
- Staff and admins → Banks and currency: manages finance
- Staff and admins → Operational reports: requests reports
- Staff and admins → Dashboard: views dashboard
- Staff and admins → Users and permissions: administers access
- Staff and admins → File API: manages files
- File API → S3 file service: delegates files (evidence: `src/main/java/com/saranaresturantsystem/controllers/S3FileController.java`)
- S3 file service → Amazon S3: stores files
- Purchases and expenses → Invoice numbering: numbers purchases
- Sales and payments → Invoice numbering: numbers sales
- Quotes → Invoice numbering: numbers quotes
- Product catalog → JPA repositories: persists catalog
- Customer management → JPA repositories: persists customers
- Inventory and stores → JPA repositories: persists stock
- Purchases and expenses → JPA repositories: persists purchases
- Sales and payments → JPA repositories: persists sales
- Operational reports → JPA repositories: queries records
- Dashboard → JPA repositories: queries metrics
- JPA repositories → PostgreSQL database: reads and writes
