# rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers architecture

> Architecture diagram of the GitHub repository rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers
- Repository: https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers

## Overview

This is a teacher-facing school-device booking app. Teachers choose a date and lesson or custom time, inspect live device availability, then submit a booking; the server converts Tallinn local times and delegates booking creation to Supabase. The database enforces capacity and access rules and records booking history. The README also documents recurring-date generation and admin-managed school calendars, lessons, devices, and access. Those documented capabilities are included, though their UI or SQL implementations were not sampled; edges are limited to shown or documented relationships.

Main entry points: [`frontend/app/page.tsx`](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/page.tsx) (Availability page), [`frontend/app/broneeringud/actions.ts`](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/actions.ts) (Booking action), [`supabase/migrations`](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations) (Booking database), [`frontend/lib/supabase/server.ts`](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/supabase/server.ts) (Session client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and access"]
  node_login["Login page<br/>[page.tsx]"]
  node_authcallback["Auth callback<br/>[route.ts]"]
  node_sessionclient["Session client<br/>[server.ts]"]
end

subgraph group_availability["Availability browsing"]
  node_home["Availability page<br/>[page.tsx]"]
  node_picker["Device picker<br/>[device-picker.tsx]"]
  node_realtime["Booking refresh"]
  node_supabaseclient["Browser client<br/>[client.ts]"]
end

subgraph group_booking["Booking workflow"]
  node_bookinglist["Booking list<br/>[page.tsx]"]
  node_newpage["New booking page<br/>[page.tsx]"]
  node_form["Booking form<br/>[booking-form.tsx]"]
  node_action["Booking action<br/>[actions.ts]"]
  node_time["Tallinn time<br/>[tallinn-time.ts]"]
  node_series["Series dates<br/>[series-dates.ts]"]
end

subgraph group_operations["Booking operations"]
  node_database[("Booking database")]
  node_adminconfig["Admin configuration"]
  node_audit[("Change history")]
  node_realtimefeed["Realtime feed"]
end

node_teacher(("Teacher"))
node_admin(("Admin"))

node_teacher -->|"signs in"| node_login
node_login -->|"starts auth"| node_authcallback
node_authcallback -->|"exchanges code"| node_sessionclient
node_teacher -->|"chooses range"| node_home
node_home -->|"loads data"| node_sessionclient
node_home -->|"renders"| node_picker
node_picker -->|"updates range"| node_home
node_home -->|"requests availability"| node_database
node_teacher -->|"views bookings"| node_bookinglist
node_teacher -->|"starts booking"| node_newpage
node_newpage -->|"loads choices"| node_sessionclient
node_newpage -->|"renders"| node_form
node_form -->|"submits"| node_action
node_action -->|"checks session"| node_sessionclient
node_action -->|"converts times"| node_time
node_action -->|"calls create_booking"| node_database
node_database -->|"records changes"| node_audit
node_series -->|"converts dates"| node_time
node_admin -->|"manages settings"| node_adminconfig
node_admin -->|"reads history"| node_audit
node_realtime -->|"subscribes"| node_supabaseclient
node_realtimefeed -->|"refreshes page"| node_realtime
node_database -->|"publishes changes"| node_realtimefeed
node_home -->|"renders"| node_realtime

click node_login "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/login/page.tsx"
click node_authcallback "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/auth/callback/route.ts"
click node_sessionclient "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/supabase/server.ts"
click node_home "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/page.tsx"
click node_picker "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/device-picker.tsx"
click node_realtime "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/refresh-on-booking-change.tsx"
click node_supabaseclient "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/supabase/client.ts"
click node_bookinglist "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/page.tsx"
click node_newpage "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/uus/page.tsx"
click node_form "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/uus/booking-form.tsx"
click node_action "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/actions.ts"
click node_time "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/tallinn-time.ts"
click node_series "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/series-dates.ts"
click node_database "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations"
click node_adminconfig "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations"
click node_audit "https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations"

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_login,node_authcallback,node_sessionclient toneBlue
class node_home,node_picker,node_realtime,node_supabaseclient toneAmber
class node_bookinglist,node_newpage,node_form,node_action,node_time,node_series toneMint
class node_database,node_adminconfig,node_audit,node_realtimefeed toneRose
class node_teacher,node_admin toneIndigo
```

## Components

### Identity and access

- [Login page](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/login/page.tsx): `frontend/app/login/page.tsx`
- [Auth callback](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/auth/callback/route.ts): `frontend/app/auth/callback/route.ts`
- [Session client](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/supabase/server.ts): `frontend/lib/supabase/server.ts`

### Availability browsing

- [Availability page](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`
- [Device picker](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/device-picker.tsx): `frontend/app/device-picker.tsx`
- [Booking refresh](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/refresh-on-booking-change.tsx): `frontend/app/refresh-on-booking-change.tsx`
- [Browser client](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/supabase/client.ts): `frontend/lib/supabase/client.ts`

### Booking workflow

- [Booking list](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/page.tsx): `frontend/app/broneeringud/page.tsx`
- [New booking page](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/uus/page.tsx): `frontend/app/broneeringud/uus/page.tsx`
- [Booking form](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/uus/booking-form.tsx): `frontend/app/broneeringud/uus/booking-form.tsx`
- [Booking action](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/app/broneeringud/actions.ts): `frontend/app/broneeringud/actions.ts`
- [Tallinn time](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/tallinn-time.ts): `frontend/lib/tallinn-time.ts`
- [Series dates](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/blob/main/frontend/lib/series-dates.ts): `frontend/lib/series-dates.ts`

### Booking operations

- [Booking database](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations): `supabase/migrations`
- [Admin configuration](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations): `supabase/migrations`
- [Change history](https://github.com/rakenduste-programmeerimine-2026/school-device-booking-app-for-teachers/tree/main/supabase/migrations): `supabase/migrations`
- **Realtime feed**

### Other components

- **Teacher**
- **Admin**

## Connections

- Teacher → Login page: signs in (evidence: `README.md`)
- Login page → Auth callback: starts auth (evidence: `README.md`)
- Auth callback → Session client: exchanges code (evidence: `frontend/app/auth/callback/route.ts`)
- Teacher → Availability page: chooses range (evidence: `frontend/app/page.tsx`)
- Availability page → Session client: loads data (evidence: `frontend/app/page.tsx`)
- Availability page → Device picker: renders (evidence: `frontend/app/page.tsx`)
- Device picker → Availability page: updates range (evidence: `frontend/app/device-picker.tsx`)
- Availability page → Booking database: requests availability (evidence: `frontend/app/page.tsx`)
- Teacher → Booking list: views bookings (evidence: `README.md`)
- Teacher → New booking page: starts booking (evidence: `README.md`)
- New booking page → Session client: loads choices (evidence: `frontend/app/broneeringud/uus/page.tsx`)
- New booking page → Booking form: renders (evidence: `frontend/app/broneeringud/uus/page.tsx`)
- Booking form → Booking action: submits (evidence: `frontend/app/broneeringud/uus/booking-form.tsx`)
- Booking action → Session client: checks session (evidence: `frontend/app/broneeringud/actions.ts`)
- Booking action → Tallinn time: converts times (evidence: `frontend/app/broneeringud/actions.ts`)
- Booking action → Booking database: calls create_booking (evidence: `frontend/app/broneeringud/actions.ts`)
- Booking database → Change history: records changes (evidence: `README.md`)
- Series dates → Tallinn time: converts dates (evidence: `frontend/lib/series-dates.ts`)
- Admin → Admin configuration: manages settings (evidence: `README.md`)
- Admin → Change history: reads history (evidence: `README.md`)
- Booking refresh → Browser client: subscribes (evidence: `frontend/app/refresh-on-booking-change.tsx`)
- Realtime feed → Booking refresh: refreshes page (evidence: `README.md`)
- Booking database → Realtime feed: publishes changes (evidence: `README.md`)
- Availability page → Booking refresh: renders (evidence: `frontend/app/page.tsx`)
