# abhiram123897/restobill architecture

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

- Interactive diagram: https://gitdiagram.com/abhiram123897/restobill
- Repository: https://github.com/abhiram123897/restobill

## Overview

RestoBill is a Go/Gin restaurant billing API backed by PostgreSQL, with JWT authentication; the React frontend is described as future work. Its principal workflow is managing menu items and tables, creating orders, generating bills, and recording payments. The graph includes the documented domain areas and the sampled order/authentication behavior. Router wiring and most feature-specific service-to-repository calls were not shown, so those relationships are omitted rather than inferred.

Main entry points: [`internal/service/order_service.go`](https://github.com/abhiram123897/restobill/blob/main/internal/service/order_service.go) (Order workflow), [`internal/router/router.go`](https://github.com/abhiram123897/restobill/blob/main/internal/router/router.go) (API router), [`cmd/server/main.go`](https://github.com/abhiram123897/restobill/blob/main/cmd/server/main.go) (HTTP server), [`internal/handler/auth_handler.go`](https://github.com/abhiram123897/restobill/blob/main/internal/handler/auth_handler.go) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Server runtime"]
  node_server["HTTP server<br/>[main.go]"]
  node_config["Configuration<br/>[config.go]"]
end

subgraph group_access["API and access"]
  node_router["API router<br/>[router.go]"]
  node_authmw["JWT middleware<br/>[auth.go]"]
  node_authapi["Authentication API<br/>[auth_handler.go]"]
  node_authlogic["Authentication logic<br/>[auth_service.go]"]
  node_dto["API data objects"]
end

subgraph group_operations["Restaurant operations"]
  node_ordersapi["Orders API<br/>[order_handler.go]"]
  node_orders["Order workflow<br/>[order_service.go]"]
  node_menus["Menu management"]
  node_menuapi["Menu API"]
  node_categories["Categories"]
  node_tables["Table management"]
  node_bills["Billing<br/>[bill_service.go]"]
  node_payments["Payment handling<br/>[payment_service.go]"]
  node_domain["Domain models"]
end

subgraph group_persistence["Persistence"]
  node_repositories["Data repositories"]
  node_dbclient["PostgreSQL client<br/>[db.go]"]
  node_postgres[("PostgreSQL")]
end

node_staff(("Restaurant staff"))

node_staff -->|"uses API"| node_router
node_server -->|"loads settings"| node_config
node_server -->|"opens connection"| node_dbclient
node_server -->|"sets up"| node_router
node_dbclient -->|"connects to"| node_postgres
node_router -.->|"routes to"| node_authapi
node_router -.->|"routes to"| node_ordersapi
node_authapi -->|"calls"| node_authlogic
node_ordersapi -->|"calls"| node_orders
node_menuapi -->|"calls"| node_menus
node_authlogic -->|"uses user repository"| node_repositories
node_orders -->|"uses order repository"| node_repositories
node_orders -->|"reads menu items"| node_menus
node_orders -->|"updates table status"| node_tables
node_bills -->|"reads and updates orders"| node_orders
node_bills -->|"uses bill repository"| node_repositories
node_authapi -->|"binds requests"| node_dto

click node_server "https://github.com/abhiram123897/restobill/blob/main/cmd/server/main.go"
click node_config "https://github.com/abhiram123897/restobill/blob/main/internal/config/config.go"
click node_router "https://github.com/abhiram123897/restobill/blob/main/internal/router/router.go"
click node_authmw "https://github.com/abhiram123897/restobill/blob/main/internal/middleware/auth.go"
click node_authapi "https://github.com/abhiram123897/restobill/blob/main/internal/handler/auth_handler.go"
click node_authlogic "https://github.com/abhiram123897/restobill/blob/main/internal/service/auth_service.go"
click node_ordersapi "https://github.com/abhiram123897/restobill/blob/main/internal/handler/order_handler.go"
click node_orders "https://github.com/abhiram123897/restobill/blob/main/internal/service/order_service.go"
click node_menus "https://github.com/abhiram123897/restobill/blob/main/internal/service/menu_item_service.go"
click node_menuapi "https://github.com/abhiram123897/restobill/blob/main/internal/handler/menu_item_handler.go"
click node_categories "https://github.com/abhiram123897/restobill/blob/main/internal/service/category_service.go"
click node_tables "https://github.com/abhiram123897/restobill/blob/main/internal/service/restaurant_table_service.go"
click node_bills "https://github.com/abhiram123897/restobill/blob/main/internal/service/bill_service.go"
click node_payments "https://github.com/abhiram123897/restobill/blob/main/internal/service/payment_service.go"
click node_domain "https://github.com/abhiram123897/restobill/tree/main/internal/domain"
click node_dto "https://github.com/abhiram123897/restobill/tree/main/internal/dto"
click node_repositories "https://github.com/abhiram123897/restobill/tree/main/internal/repository"
click node_dbclient "https://github.com/abhiram123897/restobill/blob/main/internal/db/db.go"

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_server,node_config toneBlue
class node_router,node_authmw,node_authapi,node_authlogic,node_dto toneAmber
class node_ordersapi,node_orders,node_menus,node_menuapi,node_categories,node_tables,node_bills,node_payments,node_domain toneMint
class node_repositories,node_dbclient,node_postgres toneRose
class node_staff toneIndigo
```

## Components

### Server runtime

- [HTTP server](https://github.com/abhiram123897/restobill/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [Configuration](https://github.com/abhiram123897/restobill/blob/main/internal/config/config.go): `internal/config/config.go`

### API and access

- [API router](https://github.com/abhiram123897/restobill/blob/main/internal/router/router.go): `internal/router/router.go`
- [JWT middleware](https://github.com/abhiram123897/restobill/blob/main/internal/middleware/auth.go): `internal/middleware/auth.go`
- [Authentication API](https://github.com/abhiram123897/restobill/blob/main/internal/handler/auth_handler.go): `internal/handler/auth_handler.go`
- [Authentication logic](https://github.com/abhiram123897/restobill/blob/main/internal/service/auth_service.go): `internal/service/auth_service.go`
- [API data objects](https://github.com/abhiram123897/restobill/tree/main/internal/dto): `internal/dto`

### Restaurant operations

- [Orders API](https://github.com/abhiram123897/restobill/blob/main/internal/handler/order_handler.go): `internal/handler/order_handler.go`
- [Order workflow](https://github.com/abhiram123897/restobill/blob/main/internal/service/order_service.go): `internal/service/order_service.go`
- [Menu management](https://github.com/abhiram123897/restobill/blob/main/internal/service/menu_item_service.go): `internal/service/menu_item_service.go`
- [Menu API](https://github.com/abhiram123897/restobill/blob/main/internal/handler/menu_item_handler.go): `internal/handler/menu_item_handler.go`
- [Categories](https://github.com/abhiram123897/restobill/blob/main/internal/service/category_service.go): `internal/service/category_service.go`
- [Table management](https://github.com/abhiram123897/restobill/blob/main/internal/service/restaurant_table_service.go): `internal/service/restaurant_table_service.go`
- [Billing](https://github.com/abhiram123897/restobill/blob/main/internal/service/bill_service.go): `internal/service/bill_service.go`
- [Payment handling](https://github.com/abhiram123897/restobill/blob/main/internal/service/payment_service.go): `internal/service/payment_service.go`
- [Domain models](https://github.com/abhiram123897/restobill/tree/main/internal/domain): `internal/domain`

### Persistence

- [Data repositories](https://github.com/abhiram123897/restobill/tree/main/internal/repository): `internal/repository`
- [PostgreSQL client](https://github.com/abhiram123897/restobill/blob/main/internal/db/db.go): `internal/db/db.go`
- **PostgreSQL**

### Other components

- **Restaurant staff**

## Connections

- Restaurant staff → API router: uses API (evidence: `README.md`)
- HTTP server → Configuration: loads settings (evidence: `cmd/server/main.go`)
- HTTP server → PostgreSQL client: opens connection (evidence: `cmd/server/main.go`)
- HTTP server → API router: sets up (evidence: `cmd/server/main.go`)
- PostgreSQL client → PostgreSQL: connects to (evidence: `internal/db/db.go`)
- API router → Authentication API: routes to
- API router → Orders API: routes to
- Authentication API → Authentication logic: calls (evidence: `internal/handler/auth_handler.go`)
- Orders API → Order workflow: calls (evidence: `internal/handler/order_handler.go`)
- Menu API → Menu management: calls (evidence: `internal/handler/menu_item_handler.go`)
- Authentication logic → Data repositories: uses user repository (evidence: `internal/service/auth_service.go`)
- Order workflow → Data repositories: uses order repository (evidence: `internal/service/order_service.go`)
- Order workflow → Menu management: reads menu items (evidence: `internal/service/order_service.go`)
- Order workflow → Table management: updates table status (evidence: `internal/service/order_service.go`)
- Billing → Order workflow: reads and updates orders (evidence: `internal/service/bill_service.go`)
- Billing → Data repositories: uses bill repository (evidence: `internal/service/bill_service.go`)
- Authentication API → API data objects: binds requests (evidence: `internal/handler/auth_handler.go`)
