# u6610909/spacereserve architecture

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

- Interactive diagram: https://gitdiagram.com/u6610909/spacereserve
- Repository: https://github.com/u6610909/spacereserve

## Overview

SpaceReserve is a campus room-booking product with a React client and REST API. Students and faculty sign in through Microsoft Entra ID, discover rooms through browsing or natural-language search, and manage reservations and attendees; facility staff maintain rooms and can override bookings, while admins inspect audit and utilization data. The API also exposes a keyed peer booking lookup and lost-item features. The sampled code establishes key auth, search, room, reservation, and admin paths; some unsampled service wiring is omitted rather than inferred.

Main entry points: [`frontend/src/App.tsx`](https://github.com/u6610909/spacereserve/blob/main/frontend/src/App.tsx) (Page routing), [`backend/src/app.ts`](https://github.com/u6610909/spacereserve/blob/main/backend/src/app.ts) (Express API), [`frontend/src/api/client.ts`](https://github.com/u6610909/spacereserve/blob/main/frontend/src/api/client.ts) (API client), [`backend/src/lib/prisma.ts`](https://github.com/u6610909/spacereserve/blob/main/backend/src/lib/prisma.ts) (Prisma database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Student and Staff App"]
  node_app["Page routing<br/>[App.tsx]"]
  node_signin["Sign-in page<br/>[SignInPage.tsx]"]
  node_browse["Room browsing"]
  node_roomdetail["Room details<br/>[RoomDetailPage.tsx]"]
  node_myreservations["My reservations"]
  node_staffpages["Room management"]
  node_adminpage["Admin dashboard"]
  node_lostpage["Lost and found<br/>[LostFoundPage.tsx]"]
  node_clientapi["API client<br/>[client.ts]"]
end

subgraph group_api["REST API"]
  node_server["Express API<br/>[app.ts]"]
end

subgraph group_domain["Booking Capabilities"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_rooms["Room services<br/>[rooms.service.ts]"]
  node_search["Natural search<br/>[search.service.ts]"]
  node_reservations["Reservations"]
  node_admin["Admin operations<br/>[admin.service.ts]"]
  node_lostitems["Lost-item records"]
  node_peer["Peer booking lookup<br/>[external.routes.ts]"]
end

subgraph group_integration["External Services"]
  node_entra["Microsoft Entra ID"]
  node_gemini["Gemini interpretation<br/>[gemini.ts]"]
  node_finder["FinderAI lookup<br/>[finderai.ts]"]
end

subgraph group_state["Persistent State"]
  node_database[("Prisma database<br/>[prisma.ts]")]
end

node_person(("Campus user"))
node_adminuser(("Admin user"))

node_person -->|"uses"| node_app
node_adminuser -->|"uses"| node_app
node_app -->|"routes to"| node_signin
node_app -->|"routes to"| node_browse
node_app -->|"routes to"| node_roomdetail
node_app -->|"routes to"| node_myreservations
node_app -->|"role-gates"| node_staffpages
node_app -->|"role-gates"| node_adminpage
node_app -->|"routes to"| node_lostpage
node_signin -->|"requests"| node_clientapi
node_browse -->|"requests"| node_clientapi
node_roomdetail -->|"requests"| node_clientapi
node_myreservations -->|"requests"| node_clientapi
node_staffpages -->|"requests"| node_clientapi
node_adminpage -->|"requests"| node_clientapi
node_lostpage -->|"requests"| node_clientapi
node_clientapi -->|"HTTP calls"| node_server
node_server -->|"dispatches"| node_auth
node_server -->|"dispatches"| node_rooms
node_server -->|"dispatches"| node_search
node_server -->|"dispatches"| node_reservations
node_server -->|"dispatches"| node_admin
node_server -->|"dispatches"| node_lostitems
node_server -->|"dispatches"| node_peer
node_auth -->|"OIDC exchange"| node_entra
node_auth -->|"upserts user"| node_database
node_search -->|"interprets query"| node_gemini
node_search -->|"filters rooms"| node_rooms
node_search -->|"reads vocabulary"| node_database
node_rooms -->|"reads/writes"| node_database
node_reservations -->|"reads/writes"| node_database
node_admin -->|"reads/writes"| node_database
node_lostitems -->|"reads records"| node_database
node_peer -->|"booking lookup"| node_database
node_roomdetail -.->|"requests lookup"| node_finder

click node_app "https://github.com/u6610909/spacereserve/blob/main/frontend/src/App.tsx"
click node_signin "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/SignInPage.tsx"
click node_browse "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomsBrowsePage.tsx"
click node_roomdetail "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomDetailPage.tsx"
click node_myreservations "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/MyReservationsPage.tsx"
click node_staffpages "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomManagementPage.tsx"
click node_adminpage "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/AdminDashboardPage.tsx"
click node_lostpage "https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/LostFoundPage.tsx"
click node_clientapi "https://github.com/u6610909/spacereserve/blob/main/frontend/src/api/client.ts"
click node_server "https://github.com/u6610909/spacereserve/blob/main/backend/src/app.ts"
click node_auth "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/auth/auth.service.ts"
click node_rooms "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/rooms/rooms.service.ts"
click node_search "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/search/search.service.ts"
click node_reservations "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/reservations/reservations.service.ts"
click node_admin "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/admin/admin.service.ts"
click node_lostitems "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/lostItems/lostItems.service.ts"
click node_peer "https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/external/external.routes.ts"
click node_gemini "https://github.com/u6610909/spacereserve/blob/main/backend/src/integrations/gemini.ts"
click node_finder "https://github.com/u6610909/spacereserve/blob/main/backend/src/integrations/finderai.ts"
click node_database "https://github.com/u6610909/spacereserve/blob/main/backend/src/lib/prisma.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_signin,node_browse,node_roomdetail,node_myreservations,node_staffpages,node_adminpage,node_lostpage,node_clientapi,node_person,node_adminuser toneBlue
class node_server toneAmber
class node_auth,node_rooms,node_search,node_reservations,node_admin,node_lostitems,node_peer toneMint
class node_entra,node_gemini,node_finder toneRose
class node_database toneIndigo
```

## Components

### Student and Staff App

- [Page routing](https://github.com/u6610909/spacereserve/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in page](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/SignInPage.tsx): `frontend/src/pages/SignInPage.tsx`
- [Room browsing](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomsBrowsePage.tsx): `frontend/src/pages/RoomsBrowsePage.tsx`
- [Room details](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomDetailPage.tsx): `frontend/src/pages/RoomDetailPage.tsx`
- [My reservations](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/MyReservationsPage.tsx): `frontend/src/pages/MyReservationsPage.tsx`
- [Room management](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/RoomManagementPage.tsx): `frontend/src/pages/RoomManagementPage.tsx`
- [Admin dashboard](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/AdminDashboardPage.tsx): `frontend/src/pages/AdminDashboardPage.tsx`
- [Lost and found](https://github.com/u6610909/spacereserve/blob/main/frontend/src/pages/LostFoundPage.tsx): `frontend/src/pages/LostFoundPage.tsx`
- [API client](https://github.com/u6610909/spacereserve/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### REST API

- [Express API](https://github.com/u6610909/spacereserve/blob/main/backend/src/app.ts): `backend/src/app.ts`

### Booking Capabilities

- [Authentication](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/auth/auth.service.ts): `backend/src/modules/auth/auth.service.ts`
- [Room services](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/rooms/rooms.service.ts): `backend/src/modules/rooms/rooms.service.ts`
- [Natural search](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/search/search.service.ts): `backend/src/modules/search/search.service.ts`
- [Reservations](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/reservations/reservations.service.ts): `backend/src/modules/reservations/reservations.service.ts`
- [Admin operations](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/admin/admin.service.ts): `backend/src/modules/admin/admin.service.ts`
- [Lost-item records](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/lostItems/lostItems.service.ts): `backend/src/modules/lostItems/lostItems.service.ts`
- [Peer booking lookup](https://github.com/u6610909/spacereserve/blob/main/backend/src/modules/external/external.routes.ts): `backend/src/modules/external/external.routes.ts`

### External Services

- **Microsoft Entra ID**
- [Gemini interpretation](https://github.com/u6610909/spacereserve/blob/main/backend/src/integrations/gemini.ts): `backend/src/integrations/gemini.ts`
- [FinderAI lookup](https://github.com/u6610909/spacereserve/blob/main/backend/src/integrations/finderai.ts): `backend/src/integrations/finderai.ts`

### Persistent State

- [Prisma database](https://github.com/u6610909/spacereserve/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`

### Other components

- **Campus user**
- **Admin user**

## Connections

- Campus user → Page routing: uses
- Admin user → Page routing: uses
- Page routing → Sign-in page: routes to
- Page routing → Room browsing: routes to
- Page routing → Room details: routes to
- Page routing → My reservations: routes to
- Page routing → Room management: role-gates
- Page routing → Admin dashboard: role-gates
- Page routing → Lost and found: routes to
- Sign-in page → API client: requests
- Room browsing → API client: requests
- Room details → API client: requests
- My reservations → API client: requests
- Room management → API client: requests
- Admin dashboard → API client: requests
- Lost and found → API client: requests
- API client → Express API: HTTP calls
- Express API → Authentication: dispatches
- Express API → Room services: dispatches
- Express API → Natural search: dispatches
- Express API → Reservations: dispatches
- Express API → Admin operations: dispatches
- Express API → Lost-item records: dispatches
- Express API → Peer booking lookup: dispatches
- Authentication → Microsoft Entra ID: OIDC exchange
- Authentication → Prisma database: upserts user
- Natural search → Gemini interpretation: interprets query
- Natural search → Room services: filters rooms
- Natural search → Prisma database: reads vocabulary
- Room services → Prisma database: reads/writes
- Reservations → Prisma database: reads/writes
- Admin operations → Prisma database: reads/writes
- Lost-item records → Prisma database: reads records
- Peer booking lookup → Prisma database: booking lookup
- Room details → FinderAI lookup: requests lookup
