# html31121940-collab/talanta-sports-city architecture

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

- Interactive diagram: https://gitdiagram.com/html31121940-collab/talanta-sports-city
- Repository: https://github.com/html31121940-collab/talanta-sports-city

## Overview

Talanta Sports City is a stadium and ticketing web application with a Daraja STK Push payment backend. The customer journey is browsing the venue and event, selecting seating or hospitality and quantity, starting checkout, then checking payment status. Internally, the backend creates payment orders and handles callbacks, verification and operational status. The frontend excerpt shows ticket selection and payment-status handling, but not the full request wiring; that frontend-to-backend link is therefore marked unverified. The README notes that database persistence is not configured in this build.

Main entry points: [`server/server.js`](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/server.js) (Express payment API), [`js/script.js`](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js) (Website application), [`server/stkpush.js`](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/stkpush.js) (STK push client), [`server/db.js`](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/db.js) (MySQL connection pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Website application<br/>[script.js]"]
  node_styles["Page styling<br/>[style.css]"]
  node_venue["Venue and events<br/>[script.js]"]
  node_navigation["Navigation and theme<br/>[script.js]"]
end

subgraph group_booking["Ticket booking"]
  node_ticket_ui["Ticket booking view<br/>[script.js]"]
  node_seating["Seating selection<br/>[script.js]"]
  node_hospitality["Hospitality selection<br/>[script.js]"]
  node_checkout["Checkout and status<br/>[script.js]"]
end

subgraph group_payments["Payment services"]
  node_api["Express payment API<br/>[server.js]"]
  node_stk["STK push client<br/>[stkpush.js]"]
  node_daraja_auth["Daraja authentication<br/>[daraja.js]"]
end

subgraph group_state["Payment state"]
  node_order_state["Orders and callbacks<br/>[server.js]"]
  node_database_pool["MySQL connection pool<br/>[db.js]"]
end

node_visitor(("Visitor"))
node_safaricom{{"Safaricom Daraja"}}
node_mysql[("MySQL database")]

node_visitor -->|"browses"| node_frontend
node_frontend -->|"renders"| node_venue
node_frontend -->|"handles"| node_navigation
node_frontend -->|"renders"| node_ticket_ui
node_ticket_ui -->|"selects"| node_seating
node_ticket_ui -->|"selects"| node_hospitality
node_ticket_ui -->|"opens"| node_checkout
node_checkout -.->|"requests payment"| node_api
node_api -->|"creates and updates"| node_order_state
node_api -->|"initiates and queries"| node_stk
node_stk -->|"gets token"| node_daraja_auth
node_stk -->|"sends payment requests"| node_safaricom
node_api -->|"uses pool"| node_database_pool
node_database_pool -->|"connects to"| node_mysql
node_api -->|"receives callbacks"| node_safaricom

click node_frontend "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_styles "https://github.com/html31121940-collab/talanta-sports-city/blob/main/css/style.css"
click node_venue "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_navigation "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_ticket_ui "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_seating "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_hospitality "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_checkout "https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js"
click node_api "https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/server.js"
click node_stk "https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/stkpush.js"
click node_daraja_auth "https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/daraja.js"
click node_order_state "https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/server.js"
click node_database_pool "https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/db.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_frontend,node_styles,node_venue,node_navigation toneBlue
class node_ticket_ui,node_seating,node_hospitality,node_checkout,node_mysql toneAmber
class node_api,node_stk,node_daraja_auth toneMint
class node_order_state,node_database_pool toneRose
class node_visitor,node_safaricom toneIndigo
```

## Components

### Web experience

- [Website application](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`
- [Page styling](https://github.com/html31121940-collab/talanta-sports-city/blob/main/css/style.css): `css/style.css`
- [Venue and events](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`
- [Navigation and theme](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`

### Ticket booking

- [Ticket booking view](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`
- [Seating selection](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`
- [Hospitality selection](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`
- [Checkout and status](https://github.com/html31121940-collab/talanta-sports-city/blob/main/js/script.js): `js/script.js`

### Payment services

- [Express payment API](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/server.js): `server/server.js`
- [STK push client](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/stkpush.js): `server/stkpush.js`
- [Daraja authentication](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/daraja.js): `server/daraja.js`

### Payment state

- [Orders and callbacks](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/server.js): `server/server.js`
- [MySQL connection pool](https://github.com/html31121940-collab/talanta-sports-city/blob/main/server/db.js): `server/db.js`

### Other components

- **Visitor**
- **Safaricom Daraja**
- **MySQL database**

## Connections

- Visitor → Website application: browses (evidence: `README.txt`)
- Website application → Venue and events: renders (evidence: `js/script.js`)
- Website application → Navigation and theme: handles (evidence: `js/script.js`)
- Website application → Ticket booking view: renders (evidence: `js/script.js`)
- Ticket booking view → Seating selection: selects (evidence: `js/script.js`)
- Ticket booking view → Hospitality selection: selects (evidence: `js/script.js`)
- Ticket booking view → Checkout and status: opens (evidence: `js/script.js`)
- Checkout and status → Express payment API: requests payment
- Express payment API → Orders and callbacks: creates and updates (evidence: `server/server.js`)
- Express payment API → STK push client: initiates and queries (evidence: `server/server.js`)
- STK push client → Daraja authentication: gets token (evidence: `server/stkpush.js`)
- STK push client → Safaricom Daraja: sends payment requests (evidence: `server/stkpush.js`)
- Express payment API → MySQL connection pool: uses pool (evidence: `server/server.js`)
- MySQL connection pool → MySQL database: connects to (evidence: `server/db.js`)
- Express payment API → Safaricom Daraja: receives callbacks (evidence: `server/server.js`)
