# plainatchapon/tracking-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/plainatchapon/tracking-v2
- Repository: https://github.com/plainatchapon/tracking-v2

## Overview

This is a browser-based order, inventory, warehouse, dispatch, delivery, accounting, and administration system backed by Express and PostgreSQL. Its principal business workflow is represented across distinct backend stages, from product search and order creation through fulfillment, vehicle checking, delivery, and payment verification; the excerpts do not establish direct calls between those stages. The browser pages and scripts are present in the tree, but their API calls were not sampled, so the graph omits unverified UI-to-API edges. Backend route registrations and database use are evidenced in the shown source.

Main entry points: [`server.js`](https://github.com/plainatchapon/tracking-v2/blob/main/server.js) (HTTP and sockets), [`backend/Bsales.js`](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bsales.js) (Product search and orders), [`backend/Border.js`](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Border.js) (Order management), [`backend/Bfulfill.js`](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bfulfill.js) (Warehouse fulfillment)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Web runtime"]
  node_server["HTTP and sockets<br/>[server.js]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_commerce["Orders and inventory"]
  node_sales_ui["Sales page<br/>[sales.js]"]
  node_sales_api["Product search and orders<br/>[Bsales.js]"]
  node_order_ui["Order page<br/>[order.js]"]
  node_order_api["Order management<br/>[Border.js]"]
end

subgraph group_operations["Order operations"]
  node_fulfill_ui["Fulfillment page<br/>[fulfill.js]"]
  node_fulfill_api["Warehouse fulfillment<br/>[Bfulfill.js]"]
  node_checker_ui["Checker page<br/>[checker.js]"]
  node_checker_api["Vehicle checking and dispatch<br/>[Bchecker.js]"]
  node_logistic_ui["Logistics page<br/>[logistic.js]"]
  node_logistic_api["Delivery results<br/>[Blogistic.js]"]
end

subgraph group_administration["Administration"]
  node_accounting_ui["Accounting page<br/>[acc.js]"]
  node_accounting_api["Payment verification<br/>[Bacc.js]"]
  node_admin_ui["Admin page<br/>[ad.js]"]
  node_admin_api["Order status and timeline<br/>[Bsystem.js]"]
  node_reports["Inventory export<br/>[reportRoutes.js]"]
  node_users_api["User management<br/>[Busers.js]"]
  node_login_ui["Login page<br/>[login.js]"]
  node_auth_api["Authentication and sessions<br/>[Blogin.js]"]
end

node_user(("Staff user"))

node_user -->|"uses"| node_server
node_server -->|"mounts routes"| node_sales_api
node_server -->|"mounts routes"| node_order_api
node_server -->|"mounts routes"| node_fulfill_api
node_server -->|"mounts routes"| node_checker_api
node_server -->|"mounts routes"| node_logistic_api
node_server -->|"mounts routes"| node_accounting_api
node_server -->|"mounts routes"| node_admin_api
node_server -->|"mounts routes"| node_reports
node_server -->|"mounts routes"| node_users_api
node_server -->|"mounts routes"| node_auth_api
node_server -->|"configures pool"| node_postgres
node_sales_api -->|"queries"| node_postgres
node_order_api -->|"queries"| node_postgres
node_fulfill_api -->|"queries"| node_postgres
node_checker_api -->|"queries"| node_postgres
node_logistic_api -->|"queries"| node_postgres
node_accounting_api -->|"queries"| node_postgres
node_admin_api -->|"queries"| node_postgres
node_reports -->|"queries"| node_postgres
node_users_api -->|"queries"| node_postgres
node_auth_api -->|"queries"| node_postgres

click node_server "https://github.com/plainatchapon/tracking-v2/blob/main/server.js"
click node_sales_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/sales.js"
click node_sales_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bsales.js"
click node_order_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/order.js"
click node_order_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Border.js"
click node_fulfill_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/fulfill.js"
click node_fulfill_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bfulfill.js"
click node_checker_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/checker.js"
click node_checker_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bchecker.js"
click node_logistic_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/logistic.js"
click node_logistic_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Blogistic.js"
click node_accounting_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/acc.js"
click node_accounting_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bacc.js"
click node_admin_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/ad.js"
click node_admin_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bsystem.js"
click node_reports "https://github.com/plainatchapon/tracking-v2/blob/main/backend/reportRoutes.js"
click node_users_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Busers.js"
click node_login_ui "https://github.com/plainatchapon/tracking-v2/blob/main/js/login.js"
click node_auth_api "https://github.com/plainatchapon/tracking-v2/blob/main/backend/Blogin.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_server,node_postgres,node_user toneBlue
class node_sales_ui,node_sales_api,node_order_ui,node_order_api toneAmber
class node_fulfill_ui,node_fulfill_api,node_checker_ui,node_checker_api,node_logistic_ui,node_logistic_api toneMint
class node_accounting_ui,node_accounting_api,node_admin_ui,node_admin_api,node_reports,node_users_api,node_login_ui,node_auth_api toneRose
```

## Components

### Web runtime

- [HTTP and sockets](https://github.com/plainatchapon/tracking-v2/blob/main/server.js): `server.js`
- **PostgreSQL**

### Orders and inventory

- [Sales page](https://github.com/plainatchapon/tracking-v2/blob/main/js/sales.js): `js/sales.js`
- [Product search and orders](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bsales.js): `backend/Bsales.js`
- [Order page](https://github.com/plainatchapon/tracking-v2/blob/main/js/order.js): `js/order.js`
- [Order management](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Border.js): `backend/Border.js`

### Order operations

- [Fulfillment page](https://github.com/plainatchapon/tracking-v2/blob/main/js/fulfill.js): `js/fulfill.js`
- [Warehouse fulfillment](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bfulfill.js): `backend/Bfulfill.js`
- [Checker page](https://github.com/plainatchapon/tracking-v2/blob/main/js/checker.js): `js/checker.js`
- [Vehicle checking and dispatch](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bchecker.js): `backend/Bchecker.js`
- [Logistics page](https://github.com/plainatchapon/tracking-v2/blob/main/js/logistic.js): `js/logistic.js`
- [Delivery results](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Blogistic.js): `backend/Blogistic.js`

### Administration

- [Accounting page](https://github.com/plainatchapon/tracking-v2/blob/main/js/acc.js): `js/acc.js`
- [Payment verification](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bacc.js): `backend/Bacc.js`
- [Admin page](https://github.com/plainatchapon/tracking-v2/blob/main/js/ad.js): `js/ad.js`
- [Order status and timeline](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Bsystem.js): `backend/Bsystem.js`
- [Inventory export](https://github.com/plainatchapon/tracking-v2/blob/main/backend/reportRoutes.js): `backend/reportRoutes.js`
- [User management](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Busers.js): `backend/Busers.js`
- [Login page](https://github.com/plainatchapon/tracking-v2/blob/main/js/login.js): `js/login.js`
- [Authentication and sessions](https://github.com/plainatchapon/tracking-v2/blob/main/backend/Blogin.js): `backend/Blogin.js`

### Other components

- **Staff user**

## Connections

- Staff user → HTTP and sockets: uses (evidence: `server.js`)
- HTTP and sockets → Product search and orders: mounts routes (evidence: `server.js`)
- HTTP and sockets → Order management: mounts routes (evidence: `server.js`)
- HTTP and sockets → Warehouse fulfillment: mounts routes (evidence: `server.js`)
- HTTP and sockets → Vehicle checking and dispatch: mounts routes (evidence: `server.js`)
- HTTP and sockets → Delivery results: mounts routes (evidence: `server.js`)
- HTTP and sockets → Payment verification: mounts routes (evidence: `server.js`)
- HTTP and sockets → Order status and timeline: mounts routes (evidence: `server.js`)
- HTTP and sockets → Inventory export: mounts routes (evidence: `server.js`)
- HTTP and sockets → User management: mounts routes (evidence: `server.js`)
- HTTP and sockets → Authentication and sessions: mounts routes (evidence: `server.js`)
- HTTP and sockets → PostgreSQL: configures pool (evidence: `server.js`)
- Product search and orders → PostgreSQL: queries (evidence: `backend/Bsales.js`)
- Order management → PostgreSQL: queries (evidence: `backend/Border.js`)
- Warehouse fulfillment → PostgreSQL: queries (evidence: `backend/Bfulfill.js`)
- Vehicle checking and dispatch → PostgreSQL: queries (evidence: `backend/Bchecker.js`)
- Delivery results → PostgreSQL: queries (evidence: `backend/Blogistic.js`)
- Payment verification → PostgreSQL: queries (evidence: `backend/Bacc.js`)
- Order status and timeline → PostgreSQL: queries (evidence: `backend/Bsystem.js`)
- Inventory export → PostgreSQL: queries (evidence: `backend/reportRoutes.js`)
- User management → PostgreSQL: queries (evidence: `backend/Busers.js`)
- Authentication and sessions → PostgreSQL: queries (evidence: `backend/Blogin.js`)
