# t-glonk/24ct1-tran_quoc_trung-cnpm architecture

> Architecture diagram of the GitHub repository t-glonk/24ct1-tran_quoc_trung-cnpm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/t-glonk/24ct1-tran_quoc_trung-cnpm
- Repository: https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm

## Overview

Alobo Sport is a badminton-court booking and management system: customers discover venues, select a court and time, confirm add-on services, and pay; staff administer bookings, courts, customers, POS inventory, transactions, and reports. The mobile app centralizes state and calls an Express REST API, whose controllers use a MySQL connection and a persistent JSON cache. Screen-to-API details and some backend internals were not sampled, so documented relationships are cited to the README; uncertain links are omitted.

Main entry points: [`backend/src/routes/index.js`](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/routes/index.js) (API routes), [`backend/src/config/mysql.js`](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/config/mysql.js) (MySQL pool), [`frontend/src/navigation/AppNavigator.js`](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/navigation/AppNavigator.js) (App navigation), [`frontend/App.js`](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/App.js) (App root)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["App root<br/>[App.js]"]
  node_navigator["App navigation<br/>[AppNavigator.js]"]
  node_context["App state<br/>[AppContext.js]"]
  node_authui["Auth screens<br/>[LoginScreen.js]"]
  node_customerui["Customer booking<br/>[BookingScreen.js]"]
  node_mapui["Venue map<br/>[MapScreen.js]"]
  node_adminui["Admin screens<br/>[AdminHomeScreen.js]"]
  node_api["HTTP client<br/>[apiClient.js]"]
  node_authapi["Auth API<br/>[authApi.js]"]
  node_serviceapi["Service API<br/>[serviceApi.js]"]
end

subgraph group_api["REST API"]
  node_server["Express server<br/>[server.js]"]
  node_routes["API routes<br/>[index.js]"]
end

subgraph group_domain["Booking and operations"]
  node_auth["Authentication<br/>[authController.js]"]
  node_courts["Court management<br/>[courtController.js]"]
  node_bookings["Booking management"]
  node_customers["Customer CRM"]
  node_services["POS and services"]
  node_finance["Transactions and reports"]
  node_sync["Sync and health<br/>[syncController.js]"]
end

subgraph group_persistence["Persistence"]
  node_store[("Cache and sync store<br/>[db.js]")]
  node_mysqlpool["MySQL pool<br/>[mysql.js]"]
end

node_customer(("Customer"))
node_staff(("Admin or staff"))
node_mysql[("MySQL database")]

node_customer -->|"uses"| node_app
node_staff -->|"uses"| node_app
node_app -->|"provides state"| node_context
node_app -->|"renders"| node_navigator
node_navigator -->|"routes to"| node_authui
node_navigator -->|"routes to"| node_customerui
node_navigator -->|"routes to"| node_mapui
node_navigator -->|"routes to"| node_adminui
node_context -->|"calls"| node_authapi
node_context -->|"calls"| node_serviceapi
node_authapi -->|"requests through"| node_api
node_serviceapi -->|"requests through"| node_api
node_api -->|"sends HTTP"| node_server
node_server -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_auth
node_routes -->|"dispatches"| node_courts
node_routes -->|"dispatches"| node_bookings
node_routes -->|"dispatches"| node_customers
node_routes -->|"dispatches"| node_services
node_routes -->|"dispatches"| node_finance
node_routes -->|"dispatches"| node_sync
node_auth -->|"queries"| node_mysqlpool
node_courts -->|"queries"| node_mysqlpool
node_bookings -->|"writes bookings"| node_mysqlpool
node_customers -->|"queries"| node_mysqlpool
node_services -->|"records POS"| node_mysqlpool
node_finance -->|"aggregates"| node_mysqlpool
node_sync -->|"syncs"| node_mysqlpool
node_sync -->|"persists cache"| node_store
node_store -->|"syncs or falls back"| node_mysqlpool
node_mysqlpool -->|"executes SQL"| node_mysql

click node_app "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/App.js"
click node_navigator "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/navigation/AppNavigator.js"
click node_context "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/context/AppContext.js"
click node_authui "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/auth/LoginScreen.js"
click node_customerui "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/customer/BookingScreen.js"
click node_mapui "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/map/MapScreen.js"
click node_adminui "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/admin/AdminHomeScreen.js"
click node_api "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/apiClient.js"
click node_authapi "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/authApi.js"
click node_serviceapi "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/serviceApi.js"
click node_server "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/server.js"
click node_routes "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/routes/index.js"
click node_auth "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/authController.js"
click node_courts "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/courtController.js"
click node_bookings "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/bookingController.js"
click node_customers "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/customerController.js"
click node_services "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/serviceController.js"
click node_finance "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/reportController.js"
click node_sync "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/syncController.js"
click node_store "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/config/db.js"
click node_mysqlpool "https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/config/mysql.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_app,node_navigator,node_context,node_authui,node_customerui,node_mapui,node_adminui,node_api,node_authapi,node_serviceapi toneBlue
class node_server,node_routes,node_mysql toneAmber
class node_auth,node_courts,node_bookings,node_customers,node_services,node_finance,node_sync toneMint
class node_store,node_mysqlpool toneRose
class node_customer,node_staff toneIndigo
```

## Components

### Mobile app

- [App root](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/App.js): `frontend/App.js`
- [App navigation](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/navigation/AppNavigator.js): `frontend/src/navigation/AppNavigator.js`
- [App state](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/context/AppContext.js): `frontend/src/context/AppContext.js`
- [Auth screens](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/auth/LoginScreen.js): `frontend/src/screens/auth/LoginScreen.js`
- [Customer booking](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/customer/BookingScreen.js): `frontend/src/screens/customer/BookingScreen.js`
- [Venue map](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/map/MapScreen.js): `frontend/src/screens/map/MapScreen.js`
- [Admin screens](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/screens/admin/AdminHomeScreen.js): `frontend/src/screens/admin/AdminHomeScreen.js`
- [HTTP client](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/apiClient.js): `frontend/src/api/apiClient.js`
- [Auth API](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/authApi.js): `frontend/src/api/authApi.js`
- [Service API](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/frontend/src/api/serviceApi.js): `frontend/src/api/serviceApi.js`

### REST API

- [Express server](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/server.js): `backend/src/server.js`
- [API routes](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`

### Booking and operations

- [Authentication](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Court management](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/courtController.js): `backend/src/controllers/courtController.js`
- [Booking management](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/bookingController.js): `backend/src/controllers/bookingController.js`
- [Customer CRM](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/customerController.js): `backend/src/controllers/customerController.js`
- [POS and services](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/serviceController.js): `backend/src/controllers/serviceController.js`
- [Transactions and reports](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/reportController.js): `backend/src/controllers/reportController.js`
- [Sync and health](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/controllers/syncController.js): `backend/src/controllers/syncController.js`

### Persistence

- [Cache and sync store](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [MySQL pool](https://github.com/t-glonk/24ct1-tran_quoc_trung-cnpm/blob/main/backend/src/config/mysql.js): `backend/src/config/mysql.js`

### Other components

- **Customer**
- **Admin or staff**
- **MySQL database**

## Connections

- Customer → App root: uses (evidence: `README.md`)
- Admin or staff → App root: uses (evidence: `README.md`)
- App root → App state: provides state (evidence: `frontend/App.js`)
- App root → App navigation: renders (evidence: `frontend/App.js`)
- App navigation → Auth screens: routes to (evidence: `frontend/src/navigation/AppNavigator.js`)
- App navigation → Customer booking: routes to (evidence: `frontend/src/navigation/AppNavigator.js`)
- App navigation → Venue map: routes to (evidence: `frontend/src/navigation/AppNavigator.js`)
- App navigation → Admin screens: routes to (evidence: `frontend/src/navigation/AppNavigator.js`)
- App state → Auth API: calls (evidence: `frontend/src/context/AppContext.js`)
- App state → Service API: calls (evidence: `frontend/src/context/AppContext.js`)
- Auth API → HTTP client: requests through (evidence: `frontend/src/api/authApi.js`)
- Service API → HTTP client: requests through (evidence: `frontend/src/api/serviceApi.js`)
- HTTP client → Express server: sends HTTP (evidence: `README.md`)
- Express server → API routes: mounts (evidence: `backend/src/server.js`)
- API routes → Authentication: dispatches (evidence: `README.md`)
- API routes → Court management: dispatches (evidence: `README.md`)
- API routes → Booking management: dispatches (evidence: `README.md`)
- API routes → Customer CRM: dispatches (evidence: `README.md`)
- API routes → POS and services: dispatches (evidence: `README.md`)
- API routes → Transactions and reports: dispatches (evidence: `README.md`)
- API routes → Sync and health: dispatches (evidence: `README.md`)
- Authentication → MySQL pool: queries (evidence: `README.md`)
- Court management → MySQL pool: queries (evidence: `README.md`)
- Booking management → MySQL pool: writes bookings (evidence: `README.md`)
- Customer CRM → MySQL pool: queries (evidence: `README.md`)
- POS and services → MySQL pool: records POS (evidence: `README.md`)
- Transactions and reports → MySQL pool: aggregates (evidence: `README.md`)
- Sync and health → MySQL pool: syncs (evidence: `README.md`)
- Sync and health → Cache and sync store: persists cache (evidence: `README.md`)
- Cache and sync store → MySQL pool: syncs or falls back (evidence: `README.md`)
- MySQL pool → MySQL database: executes SQL (evidence: `README.md`)
