How tahayparker/vacansee works
1. Overall shape
- vacansee is a single Next.js application using the Pages Router, with the frontend, API layer, and auth flows living in one repo.
- The runtime boundary is mostly “browser app” vs “Next.js serverless/API routes” vs “offline/maintenance scripts.”
2. Primary user-facing app
- Pages under src/pages implement the main experience: room availability, room search, timetable graphs, profile, docs, legal/about, and auth screens.
- The app is styled with Tailwind CSS and a local component library in src/components/ui, plus higher-level site components like header/footer, onboarding, loading states, and graph/visualization UI.
3. Client-side state and UX
- Several reusable hooks manage browser concerns such as debouncing, local storage persistence, form persistence, room search, and auth gating.
- TimeFormatContext and preference hooks suggest user settings are handled on the client and persisted locally where appropriate.
4. API boundary
- src/pages/api contains the backend endpoints used by the UI: current/soon availability, availability checks, room listings, schedule data, and auth callback handling.
- These routes form the server-facing contract for the app and are the main bridge between the browser UI and persisted timetable data.
5. Business logic layer
- src/services centralizes room and timetable logic, including room combinations, room lookup/availability logic, and time computations.
- This layer sits between API routes and the database, keeping the route handlers thinner and making room-availability logic reusable across endpoints/pages.
6. Persistence and database
- Prisma is the data access layer (prisma/schema.prisma, migrations, src/lib/prisma.ts), and the database is PostgreSQL hosted on Supabase.
- The repo’s schema/migrations indicate timetable and room data are normalized in the DB, with the app reading that source for live availability and schedule views.
7. Authentication and authorization
- Supabase is also used for auth (src/lib/supabase/client.ts, src/lib/supabase/server.ts), with a login page, callback endpoint, middleware, and a useRequireAuth hook.
- Protected areas appear to include profile-related or user-specific routes, with unauthorized and auth middleware shaping access boundaries.
8. Timetable ingestion pipeline
- The repo includes standalone Python scripts under scripts/ for scraping the timetable site, generating schedule data, updating room data, and uploading updates.
- This is an external data-ingestion subsystem, separate from the web app runtime, and is responsible for turning the source timetable into database-ready data.
9. Automation and operations
- GitHub Actions workflows handle daily timetable updates, Supabase pings, CodeQL scanning, and Next.js-related checks/builds.
- The update workflow is a key operational dependency: scrape latest timetable data, update the DB, generate public/scheduleData.json, and commit the refreshed artifacts.
10. Offline/PWA layer
- The app is configured as a PWA with public/manifest.json, public/sw.js, public/offline.html, install prompt UI, and service-worker caching support.
- This creates a browser-side resilience layer for static assets and fallback behavior, which is architecturally separate from the live API/database path.
11. Static/public assets
- public/classes.csv, public/scheduleData.json, fonts, and icons are part of the deployed asset set and likely used for room/timetable rendering or fallbacks.
- These assets matter because some schedule presentation appears to be pre-generated rather than always computed live.
12. Deployment boundary
- The app is designed for Vercel deployment, so the Next.js app and API routes are expected to run in a serverless/edge-friendly hosting model.
- Long-running or scheduled work is intentionally pushed out of the app runtime into GitHub Actions and scripts, keeping the web tier lean.
Main entry points: pages Pages · api API routes · prisma.ts Prisma client · update-timetable.yml GitHub Actions
Components 18
Browser app
Next.js pages, reusable UI, and client-side state
- Pages · Main user-facing pages for rooms, availability, graphs, auth, docs, and legal content
src/pages - UI kit · Reusable UI primitives and site-level components shared across pages
src/components - Hooks & state · Browser persistence, debouncing, room search, and auth-gating hooks
src/hooks - Prefs context · Time-format and user preference state for the browser experience
src/contexts/TimeFormatContext.tsx - Auth pages · Login, callback, and unauthorized screens for protected access
src/pages/auth/login.tsx
Server API
Route handlers, middleware, and server-side integration points
- API routes · Availability, room, schedule, and auth callback endpoints used by the UI
src/pages/api - Middleware · Request-time access control and route shaping
src/middleware.ts - Services · Room combinations, room lookup, availability, and time calculations
src/services - Config · Next.js, Tailwind, Prisma, and deployment configuration
next.config.ts
Data & auth
Database schema, Prisma access, and Supabase auth
- Prisma client · Shared Prisma client used by server code
src/lib/prisma.ts - Schema · Prisma schema and migrations for timetable and room data
prisma/schema.prisma - Supabase auth · Supabase client and server helpers for login and session handling
src/lib/supabase
Ops & ingestion
Scripts and automation that refresh timetable data
- Scrapers · Timetable scraping and authenticated collection scripts
scripts/scrape_timetable.py - Update jobs · Schedule generation, room updates, and upload scripts
scripts/update_rooms.py - GitHub Actions · Daily updates, checks, and Supabase ping workflows
.github/workflows/update-timetable.yml
Public assets
Prebuilt assets and offline/PWA files served to browsers
- PWA layer · Manifest, service worker, and offline fallback for installable browser use
public/sw.js - Schedule data · Precomputed timetable data consumed by the app and update pipeline
public/scheduleData.json - Static assets · Fonts, CSVs, icons, and other deployed browser assets
public
Connections 21
- Pages → UI kit: renders with · Pages compose reusable site and UI components
- Pages → Hooks & state: uses hooks · Pages depend on client-side state and browser helpers
- Pages → Prefs context: reads prefs · Time display and user preferences flow into pages
- Pages → API routes: calls · Browser pages consume server API endpoints
- Pages → Auth pages: navigates to · Auth-related pages are part of the user flow
- API routes → Services: delegates · Route handlers keep business logic in services
- API routes → Prisma client: queries · API routes access data through Prisma
- Services → Prisma client: reads via · Room and timetable logic is backed by the database layer
- Prisma client → Schema: maps to · Prisma client is generated from the schema and migrations
- Supabase auth → Auth pages: supports · Supabase auth underpins login and callback handling
- Middleware → Supabase auth: guards · Middleware helps enforce auth/session boundaries
- Auth pages → Middleware: is shaped by · Protected routes are controlled at request time
- PWA layer → Static assets: caches · Service worker and offline mode rely on public assets
- PWA layer → Schedule data: serves · Offline and installable app behavior may use generated schedule data
- Scrapers → Schedule data: generates · Scraping pipeline produces timetable data artifacts
- Update jobs → Schedule data: refreshes · Update scripts regenerate schedule data and related outputs
- GitHub Actions → Scrapers: runs · Automated workflows execute scraping and update steps
- GitHub Actions → Update jobs: runs · Workflows also drive room updates and uploads
- GitHub Actions → Prisma client: updates · Automation may push refreshed data through the app stack
- Config → Pages: configures · Framework config shapes how pages are built and deployed
- Config → API routes: configures · Next.js configuration affects serverless route behavior