# ipasmo-technologies/sportygo-sports-app architecture

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

- Interactive diagram: https://gitdiagram.com/ipasmo-technologies/sportygo-sports-app
- Repository: https://github.com/ipasmo-technologies/sportygo-sports-app

## Overview

SportyGo is a sports-facility booking app: customers select a sport and facility, check date-specific availability, reserve a time, pay, and manage bookings. Admin workflows cover slot blocking and booking/user oversight; account flows include registration, login, and profile management. The backend routes own API actions, with database operations handling availability and durable booking state. The README documents lazy slot generation and block-rule behavior; some frontend screens and backend route implementations are unsampled, so their internal links are omitted where not evidenced.

Main entry points: [`backend/src/index.ts`](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/index.ts) (Express API), [`frontend/src/App.tsx`](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/App.tsx) (App navigation), [`frontend/src/lib/api.ts`](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/lib/api.ts) (API client), [`backend/src/lib/database.ts`](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/database.ts) (Booking and catalog data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer app"]
  node_app["App navigation<br/>[App.tsx]"]
  node_appstate["Booking state<br/>[AppContext.tsx]"]
  node_catalogscreens["Sport selection"]
  node_facilityscreens["Facility selection"]
  node_slotscreen["Slot selection"]
  node_checkout["Checkout<br/>[CheckoutScreen.tsx]"]
  node_bookingviews["Booking management"]
  node_adminviews["Admin views"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_server["Express API<br/>[index.ts]"]
  node_authroutes["Account routes<br/>[auth.ts]"]
  node_authmw["JWT authorization<br/>[authMiddleware.ts]"]
  node_sportsroutes["Sports catalog<br/>[sports.ts]"]
  node_packageroutes["Packages<br/>[packages.ts]"]
  node_configroutes["Configuration<br/>[config.ts]"]
end

subgraph group_booking["Booking operations"]
  node_slotroutes["Slot API<br/>[slots.ts]"]
  node_bookingroutes["Booking API<br/>[bookings.ts]"]
  node_paymentroutes["Payment API<br/>[payments.ts]"]
  node_pricing["Booking pricing<br/>[bookingPricing.ts]"]
  node_database[("Booking and catalog data<br/>[database.ts]")]
end

subgraph group_services["Supporting services"]
  node_crypto["Password encryption<br/>[authCrypto.ts]"]
  node_email["Email notifications<br/>[email.ts]"]
  node_stripe["Stripe integration<br/>[stripe.ts]"]
  node_neon[("Neon PostgreSQL")]
  node_stripe_service["Stripe"]
  node_smtp["SMTP service"]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"uses"| node_app
node_admin -.->|"uses"| node_app
node_app -->|"reads state"| node_appstate
node_app -->|"renders"| node_catalogscreens
node_app -->|"renders"| node_facilityscreens
node_app -->|"renders"| node_slotscreen
node_app -->|"renders"| node_bookingviews
node_app -->|"renders"| node_adminviews
node_appstate -.->|"requests data"| node_api_client
node_catalogscreens -.->|"requests catalog"| node_api_client
node_facilityscreens -.->|"requests facilities"| node_api_client
node_slotscreen -.->|"requests slots"| node_api_client
node_checkout -.->|"submits booking"| node_api_client
node_bookingviews -.->|"manages bookings"| node_api_client
node_adminviews -.->|"manages blocks"| node_api_client
node_api_client -.->|"calls API"| node_server
node_server -->|"routes requests"| node_authroutes
node_server -->|"routes requests"| node_slotroutes
node_server -->|"routes requests"| node_bookingroutes
node_server -->|"routes requests"| node_paymentroutes
node_server -->|"routes requests"| node_sportsroutes
node_server -->|"routes requests"| node_packageroutes
node_server -->|"routes requests"| node_configroutes
node_authroutes -->|"reads and writes"| node_database
node_authroutes -->|"encrypts passwords"| node_crypto
node_authroutes -->|"sends reset email"| node_email
node_authroutes -->|"uses authorization"| node_authmw
node_slotroutes -->|"guards admin actions"| node_authmw
node_slotroutes -->|"reads and changes slots"| node_database
node_slotroutes -->|"sends block notice"| node_email
node_bookingroutes -->|"guards bookings"| node_authmw
node_bookingroutes -->|"saves and manages"| node_database
node_bookingroutes -->|"sends updates"| node_email
node_bookingroutes -->|"uses pricing"| node_pricing
node_bookingroutes -->|"uses payments"| node_stripe
node_paymentroutes -->|"guards payments"| node_authmw
node_paymentroutes -->|"reads booking data"| node_database
node_paymentroutes -->|"uses pricing"| node_pricing
node_paymentroutes -->|"uses payments"| node_stripe
node_sportsroutes -->|"reads catalog"| node_database
node_packageroutes -->|"reads packages"| node_database
node_configroutes -->|"reads configuration"| node_database
node_database -.->|"queries"| node_neon
node_stripe -.->|"connects"| node_stripe_service
node_email -->|"sends mail"| node_smtp

click node_app "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/App.tsx"
click node_appstate "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/context/AppContext.tsx"
click node_catalogscreens "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SportSelectScreen.tsx"
click node_facilityscreens "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SportFacilityScreen.tsx"
click node_slotscreen "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SlotBookingScreen.tsx"
click node_checkout "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/CheckoutScreen.tsx"
click node_bookingviews "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/ViewBookingsScreen.tsx"
click node_adminviews "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/BlockSlotBookingScreen.tsx"
click node_api_client "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/lib/api.ts"
click node_server "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/index.ts"
click node_authroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/auth.ts"
click node_authmw "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/middleware/authMiddleware.ts"
click node_sportsroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/sports.ts"
click node_packageroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/packages.ts"
click node_configroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/config.ts"
click node_slotroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/slots.ts"
click node_bookingroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/bookings.ts"
click node_paymentroutes "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/payments.ts"
click node_pricing "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/bookingPricing.ts"
click node_database "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/database.ts"
click node_crypto "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/authCrypto.ts"
click node_email "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/email.ts"
click node_stripe "https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/stripe.ts"

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_appstate,node_catalogscreens,node_facilityscreens,node_slotscreen,node_checkout,node_bookingviews,node_adminviews,node_api_client toneBlue
class node_server,node_authroutes,node_authmw,node_sportsroutes,node_packageroutes,node_configroutes toneAmber
class node_slotroutes,node_bookingroutes,node_paymentroutes,node_pricing,node_database toneMint
class node_crypto,node_email,node_stripe,node_neon,node_stripe_service,node_smtp toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Customer app

- [App navigation](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Booking state](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/context/AppContext.tsx): `frontend/src/context/AppContext.tsx`
- [Sport selection](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SportSelectScreen.tsx): `frontend/src/screens/SportSelectScreen.tsx`
- [Facility selection](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SportFacilityScreen.tsx): `frontend/src/screens/SportFacilityScreen.tsx`
- [Slot selection](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/SlotBookingScreen.tsx): `frontend/src/screens/SlotBookingScreen.tsx`
- [Checkout](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/CheckoutScreen.tsx): `frontend/src/screens/CheckoutScreen.tsx`
- [Booking management](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/ViewBookingsScreen.tsx): `frontend/src/screens/ViewBookingsScreen.tsx`
- [Admin views](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/screens/BlockSlotBookingScreen.tsx): `frontend/src/screens/BlockSlotBookingScreen.tsx`
- [API client](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### API and identity

- [Express API](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Account routes](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [JWT authorization](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/middleware/authMiddleware.ts): `backend/src/middleware/authMiddleware.ts`
- [Sports catalog](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/sports.ts): `backend/src/routes/sports.ts`
- [Packages](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/packages.ts): `backend/src/routes/packages.ts`
- [Configuration](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/config.ts): `backend/src/routes/config.ts`

### Booking operations

- [Slot API](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/slots.ts): `backend/src/routes/slots.ts`
- [Booking API](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/bookings.ts): `backend/src/routes/bookings.ts`
- [Payment API](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/routes/payments.ts): `backend/src/routes/payments.ts`
- [Booking pricing](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/bookingPricing.ts): `backend/src/lib/bookingPricing.ts`
- [Booking and catalog data](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/database.ts): `backend/src/lib/database.ts`

### Supporting services

- [Password encryption](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/authCrypto.ts): `backend/src/lib/authCrypto.ts`
- [Email notifications](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/email.ts): `backend/src/lib/email.ts`
- [Stripe integration](https://github.com/ipasmo-technologies/sportygo-sports-app/blob/main/backend/src/lib/stripe.ts): `backend/src/lib/stripe.ts`
- **Neon PostgreSQL**
- **Stripe**
- **SMTP service**

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → App navigation: uses
- Administrator → App navigation: uses
- App navigation → Booking state: reads state (evidence: `frontend/src/App.tsx`)
- App navigation → Sport selection: renders (evidence: `frontend/src/App.tsx`)
- App navigation → Facility selection: renders (evidence: `frontend/src/App.tsx`)
- App navigation → Slot selection: renders (evidence: `frontend/src/App.tsx`)
- App navigation → Booking management: renders (evidence: `frontend/src/App.tsx`)
- App navigation → Admin views: renders (evidence: `frontend/src/App.tsx`)
- Booking state → API client: requests data
- Sport selection → API client: requests catalog
- Facility selection → API client: requests facilities
- Slot selection → API client: requests slots
- Checkout → API client: submits booking
- Booking management → API client: manages bookings
- Admin views → API client: manages blocks
- API client → Express API: calls API
- Express API → Account routes: routes requests (evidence: `backend/src/index.ts`)
- Express API → Slot API: routes requests (evidence: `backend/src/index.ts`)
- Express API → Booking API: routes requests (evidence: `backend/src/index.ts`)
- Express API → Payment API: routes requests (evidence: `backend/src/index.ts`)
- Express API → Sports catalog: routes requests (evidence: `backend/src/index.ts`)
- Express API → Packages: routes requests (evidence: `backend/src/index.ts`)
- Express API → Configuration: routes requests (evidence: `backend/src/index.ts`)
- Account routes → Booking and catalog data: reads and writes (evidence: `backend/src/routes/auth.ts`)
- Account routes → Password encryption: encrypts passwords (evidence: `backend/src/routes/auth.ts`)
- Account routes → Email notifications: sends reset email (evidence: `backend/src/routes/auth.ts`)
- Account routes → JWT authorization: uses authorization (evidence: `backend/src/routes/auth.ts`)
- Slot API → JWT authorization: guards admin actions (evidence: `backend/src/routes/slots.ts`)
- Slot API → Booking and catalog data: reads and changes slots (evidence: `backend/src/routes/slots.ts`)
- Slot API → Email notifications: sends block notice (evidence: `backend/src/routes/slots.ts`)
- Booking API → JWT authorization: guards bookings (evidence: `backend/src/routes/bookings.ts`)
- Booking API → Booking and catalog data: saves and manages (evidence: `backend/src/routes/bookings.ts`)
- Booking API → Email notifications: sends updates (evidence: `backend/src/routes/bookings.ts`)
- Booking API → Booking pricing: uses pricing (evidence: `backend/src/routes/bookings.ts`)
- Booking API → Stripe integration: uses payments (evidence: `backend/src/routes/bookings.ts`)
- Payment API → JWT authorization: guards payments (evidence: `backend/src/routes/payments.ts`)
- Payment API → Booking and catalog data: reads booking data (evidence: `backend/src/routes/payments.ts`)
- Payment API → Booking pricing: uses pricing (evidence: `backend/src/routes/payments.ts`)
- Payment API → Stripe integration: uses payments (evidence: `backend/src/routes/payments.ts`)
- Sports catalog → Booking and catalog data: reads catalog (evidence: `backend/src/routes/sports.ts`)
- Packages → Booking and catalog data: reads packages (evidence: `backend/src/routes/packages.ts`)
- Configuration → Booking and catalog data: reads configuration (evidence: `backend/src/routes/config.ts`)
- Booking and catalog data → Neon PostgreSQL: queries
- Stripe integration → Stripe: connects
- Email notifications → SMTP service: sends mail (evidence: `backend/src/lib/email.ts`)
