How hasintha-hewage/secret-santa-hq works
Secret Santa HQ manages organizer accounts and gift-exchange events, then creates private participant assignments and supports the exchange through magic-link portals. The main flow is organizer sign-in, event and participant setup, exclusions, fair shuffle, private invitations, participant acknowledgement and wishlist/Q&A, and a guarded reveal. Settings, notifications, and the mailroom are additional capabilities. The graph combines sampled API and library evidence with README-documented features; unsampled page-to-API wiring is not asserted.
Main entry points: db.ts SQLite database · auth.ts Sessions and auth · AppProvider.tsx App state and preferences · route.ts Assignment shuffle
Components 29
Identity and settings
- Sign-in
src/app/auth/page.tsx - Authentication API
src/app/api/auth - Sessions and auth
src/lib/auth.ts - Preferences
src/app/settings/page.tsx - Settings API
src/app/api/settings/route.ts
Exchange organizing
- Event dashboard
src/app/dashboard/page.tsx - Event collection API
src/app/api/events/route.ts - Event management API
src/app/api/events/[id]/route.ts - Event workspace
src/app/events/[id]/page.tsx - Participants and exclusions
src/app/api/events/[id] - Assignment shuffle
src/app/api/events/[id]/shuffle/route.ts - Fair derangement
src/lib/shuffle.ts - Reveal assignments
src/app/api/events/[id]/reveal/route.ts - Grand reveal
src/components/GrandRevealModal.tsx - Pairing matrix
src/components/RevealedPairingsMatrix.tsx
Participant experience
- Magic-link portal
src/app/participant/[token]/page.tsx - Portal data API
src/app/api/participant/[token]/route.ts - Participant actions
src/app/api/participant/[token] - Gift reveal box
src/components/GiftUnwrapBox.tsx
Notifications and mail
- Email dispatch
src/lib/email.ts - Mailroom API
src/app/api/mailroom/route.ts - Mailroom outbox
src/app/mailroom/page.tsx
Shared services and UI
- SQLite database
src/lib/db.ts - App state and preferences
src/components/AppProvider.tsx - Adaptive copy
src/lib/copy.ts - Holiday sounds
src/lib/sounds.ts - Navigation
src/components/Navbar.tsx
Other components
- Organizer
- Participant
Connections 37
- Organizer → Sign-in: signs in
README.md - Organizer → Event dashboard: organizes events
README.md - Organizer → Preferences: sets preferences
README.md - Participant → Magic-link portal: opens magic link
README.md - Authentication API → Sessions and auth: checks sessions
src/app/api/auth/me/route.ts - Sessions and auth → SQLite database: reads user data
src/lib/auth.ts - Settings API → Sessions and auth: checks session
src/app/api/settings/route.ts - Settings API → SQLite database: updates settings
src/app/api/settings/route.ts - Event dashboard → Event collection API: manages events
- Event collection API → Sessions and auth: checks session
src/app/api/events/route.ts - Event collection API → SQLite database: reads and creates
src/app/api/events/route.ts - Event workspace → Event management API: manages event
- Event management API → Sessions and auth: checks session
src/app/api/events/[id]/route.ts - Event management API → SQLite database: reads and updates
src/app/api/events/[id]/route.ts - Participants and exclusions → SQLite database: stores event data
src/app/api/events/[id]/route.ts - Assignment shuffle → Sessions and auth: checks session
src/app/api/events/[id]/shuffle/route.ts - Assignment shuffle → Fair derangement: computes assignments
src/app/api/events/[id]/shuffle/route.ts - Assignment shuffle → SQLite database: stores pairings
src/app/api/events/[id]/shuffle/route.ts - Assignment shuffle → Email dispatch: dispatches invitations
src/app/api/events/[id]/shuffle/route.ts - Email dispatch → SQLite database: records delivery
src/lib/email.ts - Email dispatch → Participant: sends magic link
README.md - Reveal assignments → SQLite database: reveals pairings
src/app/api/events/[id]/reveal/route.ts - Event workspace → Grand reveal: requests reveal
- Grand reveal → Pairing matrix: shows assignments
src/components/GrandRevealModal.tsx - Magic-link portal → Portal data API: loads portal
- Portal data API → SQLite database: reads participant data
src/app/api/participant/[token]/route.ts - Magic-link portal → Gift reveal box: unwraps assignment
README.md - Magic-link portal → Participant actions: updates wishlist and messages
- Participant actions → SQLite database: stores participant updates
src/app/api/participant/[token]/route.ts - Participant actions → Email dispatch: notifies organizer
src/app/api/participant/[token]/acknowledge/route.ts - Mailroom outbox → Mailroom API: views outbox
- Mailroom API → SQLite database: reads delivery records
src/app/api/mailroom/route.ts - App state and preferences → Authentication API: refreshes session
src/components/AppProvider.tsx - App state and preferences → Settings API: saves preferences
src/components/AppProvider.tsx - App state and preferences → Adaptive copy: selects copy
src/components/AppProvider.tsx - App state and preferences → Holiday sounds: plays effects
src/components/AppProvider.tsx - Navigation → App state and preferences: uses app state
src/components/Navbar.tsx