# chutikan489622-star/api_681310006 architecture

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

- Interactive diagram: https://gitdiagram.com/chutikan489622-star/api_681310006
- Repository: https://github.com/chutikan489622-star/api_681310006

## Overview

This is a small Express badminton-court booking API with booking creation, listing, conflict checks, deletion, and health endpoints. The nested `badminton-booking-api/server.js` is the more complete implementation: it reads and writes `db.json` and includes an in-memory fallback. The tree contains a second, divergent root-level server; this graph describes the nested implementation. The HTML is present, but its contents were not sampled, so its interaction with the API is not inferred.

Main entry points: [`badminton-booking-api/server.js`](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js) (Booking storage), [`badminton-booking-api/db.json`](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/db.json) (JSON file)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Booking API"]
  node_server["Express routes<br/>[server.js]"]
  node_health["Health check<br/>[server.js]"]
  node_list["List bookings<br/>[server.js]"]
  node_create["Create booking<br/>[server.js]"]
  node_delete["Delete booking<br/>[server.js]"]
end

subgraph group_rules["Booking Rules"]
  node_validation["Input validation<br/>[server.js]"]
  node_conflict["Overlap check<br/>[server.js]"]
  node_ordering["Date ordering<br/>[server.js]"]
end

subgraph group_state["Booking State"]
  node_storage["Booking storage<br/>[server.js]"]
  node_disk[("JSON file<br/>[db.json]")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"dispatches"| node_health
node_server -->|"dispatches"| node_list
node_server -->|"dispatches"| node_create
node_server -->|"dispatches"| node_delete
node_list -->|"reads bookings"| node_storage
node_list -->|"sorts by date"| node_ordering
node_create -->|"validates input"| node_validation
node_create -->|"reads bookings"| node_storage
node_create -->|"checks overlap"| node_conflict
node_create -->|"writes booking"| node_storage
node_delete -->|"reads bookings"| node_storage
node_delete -->|"writes remaining"| node_storage
node_storage -->|"reads and writes"| node_disk

click node_server "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_health "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_list "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_create "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_delete "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_validation "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_conflict "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_ordering "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_storage "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js"
click node_disk "https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/db.json"

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_health,node_list,node_create,node_delete,node_client toneBlue
class node_validation,node_conflict,node_ordering toneAmber
class node_storage,node_disk toneMint
```

## Components

### Booking API

- [Express routes](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [Health check](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [List bookings](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [Create booking](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [Delete booking](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`

### Booking Rules

- [Input validation](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [Overlap check](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [Date ordering](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`

### Booking State

- [Booking storage](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/server.js): `badminton-booking-api/server.js`
- [JSON file](https://github.com/chutikan489622-star/api_681310006/blob/main/badminton-booking-api/db.json): `badminton-booking-api/db.json`

### Other components

- **API client**

## Connections

- API client → Express routes: sends requests
- Express routes → Health check: dispatches
- Express routes → List bookings: dispatches
- Express routes → Create booking: dispatches
- Express routes → Delete booking: dispatches
- List bookings → Booking storage: reads bookings
- List bookings → Date ordering: sorts by date
- Create booking → Input validation: validates input
- Create booking → Booking storage: reads bookings
- Create booking → Overlap check: checks overlap
- Create booking → Booking storage: writes booking
- Delete booking → Booking storage: reads bookings
- Delete booking → Booking storage: writes remaining
- Booking storage → JSON file: reads and writes
