# tony11montana/expressdelivery-api- architecture

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

- Interactive diagram: https://gitdiagram.com/tony11montana/expressdelivery-api-
- Repository: https://github.com/tony11montana/expressdelivery-api-

## Overview

ExpressDelivery is a small web-based delivery-ordering system: browser pages interact with a Go REST API, which authenticates users and handles products, couriers, and orders backed by MySQL. Order creation selects an employee and courier, allocates warehouse stock, and records order items. The README documents Docker-based startup and service ports, but not additional product behavior. The frontend login and order-creation page implementations were not sampled, so those details and their wiring are omitted.

Main entry points: [`backend/rest/handlers.go`](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/rest/handlers.go) (REST handlers), [`database/mysql-data`](https://github.com/tony11montana/expressdelivery-api-/tree/master/database/mysql-data) (MySQL database), [`backend/main.go`](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/main.go) (HTTP server and routes), [`frontend/js/scriptm.js`](https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/js/scriptm.js) (Page interactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_webpages["Delivery pages<br/>[orders-index.html]"]
  node_webscripts["Page interactions<br/>[scriptm.js]"]
  node_loginpage["Login page<br/>[login.html]"]
end

subgraph group_api["REST API"]
  node_api_server["HTTP server and routes<br/>[main.go]"]
  node_handlers["REST handlers<br/>[handlers.go]"]
end

subgraph group_domain["Delivery domain"]
  node_auth["User authentication<br/>[auth.go]"]
  node_orders["Order processing<br/>[order.go]"]
  node_products["Product catalog<br/>[product.go]"]
  node_couriers["Courier management<br/>[courier.go]"]
end

subgraph group_persistence["Persistence"]
  node_dbconn["Database connection<br/>[db.go]"]
  node_mysql[("MySQL database")]
end

node_browser(("Browser user"))

node_browser -.->|"uses"| node_webpages
node_webscripts -->|"fetches API"| node_api_server
node_api_server -->|"routes requests"| node_handlers
node_handlers -->|"checks credentials"| node_auth
node_handlers -->|"reads and creates"| node_orders
node_handlers -->|"reads and adds"| node_products
node_handlers -->|"reads and adds"| node_couriers
node_api_server -->|"initializes"| node_dbconn
node_auth -->|"queries and writes"| node_mysql
node_orders -->|"queries and writes"| node_mysql
node_products -->|"queries and writes"| node_mysql
node_couriers -->|"queries and writes"| node_mysql
node_loginpage -.->|"uses interactions"| node_webscripts

click node_webpages "https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/orders-index.html"
click node_webscripts "https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/js/scriptm.js"
click node_loginpage "https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/login.html"
click node_api_server "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/main.go"
click node_handlers "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/rest/handlers.go"
click node_auth "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/auth.go"
click node_orders "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/order.go"
click node_products "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/product.go"
click node_couriers "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/courier.go"
click node_dbconn "https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/db.go"
click node_mysql "https://github.com/tony11montana/expressdelivery-api-/tree/master/database/mysql-data"

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_webpages,node_webscripts,node_loginpage,node_browser toneBlue
class node_api_server,node_handlers toneAmber
class node_auth,node_orders,node_products,node_couriers toneMint
class node_dbconn,node_mysql toneRose
```

## Components

### Web interface

- [Delivery pages](https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/orders-index.html): `frontend/orders-index.html`
- [Page interactions](https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/js/scriptm.js): `frontend/js/scriptm.js`
- [Login page](https://github.com/tony11montana/expressdelivery-api-/blob/master/frontend/login.html): `frontend/login.html`

### REST API

- [HTTP server and routes](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/main.go): `backend/main.go`
- [REST handlers](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/rest/handlers.go): `backend/rest/handlers.go`

### Delivery domain

- [User authentication](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/auth.go): `backend/models_db/auth.go`
- [Order processing](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/order.go): `backend/models_db/order.go`
- [Product catalog](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/product.go): `backend/models_db/product.go`
- [Courier management](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/courier.go): `backend/models_db/courier.go`

### Persistence

- [Database connection](https://github.com/tony11montana/expressdelivery-api-/blob/master/backend/models_db/db.go): `backend/models_db/db.go`
- [MySQL database](https://github.com/tony11montana/expressdelivery-api-/tree/master/database/mysql-data): `database/mysql-data`

### Other components

- **Browser user**

## Connections

- Browser user → Delivery pages: uses
- Page interactions → HTTP server and routes: fetches API (evidence: `frontend/js/scriptm.js`)
- HTTP server and routes → REST handlers: routes requests (evidence: `backend/main.go`)
- REST handlers → User authentication: checks credentials (evidence: `backend/rest/handlers.go`)
- REST handlers → Order processing: reads and creates (evidence: `backend/rest/handlers.go`)
- REST handlers → Product catalog: reads and adds (evidence: `backend/rest/handlers.go`)
- REST handlers → Courier management: reads and adds (evidence: `backend/rest/handlers.go`)
- HTTP server and routes → Database connection: initializes (evidence: `backend/main.go`)
- User authentication → MySQL database: queries and writes (evidence: `backend/models_db/auth.go`)
- Order processing → MySQL database: queries and writes (evidence: `backend/models_db/order.go`)
- Product catalog → MySQL database: queries and writes (evidence: `backend/models_db/product.go`)
- Courier management → MySQL database: queries and writes (evidence: `backend/models_db/courier.go`)
- Login page → Page interactions: uses interactions
