# goprocker/orion-hackathon architecture

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

- Interactive diagram: https://gitdiagram.com/goprocker/orion-hackathon
- Repository: https://github.com/goprocker/orion-hackathon

## Overview

#### Purpose and Entry Points
ORION 1.0 is a full-stack hackathon registration, payment-verification, submission, and organizer-management platform. It runs on Next.js App Router/React/TypeScript, deployed to Vercel. Public entry is `src/app/page.tsx`; team and organizer operational surfaces are `src/app/portal/page.tsx` and `src/app/admin/page.tsx`. Route handlers under `src/app/api/` are the server trust boundary.

#### Public Event and Registration
The landing page composes static event content, themed sections, modals, animation, and 3D presentation. Registration is a client-side six-step wizard that collects roster, consent, and UPI proof before posting a team payload.
- `src/app/page.tsx`
- `src/components/modals/RegisterModal.tsx`
- `src/data/orionData.ts`

Registration is handled by `POST /api/registrations`, with registration telemetry available separately. Server-side validation, duplicate/suspicion handling, identifier/passcode issuance, and persistence belong behind the store/DAL layer.
- `src/app/api/registrations/route.ts`
- `src/app/api/registrations/count/route.ts`
- `src/lib/serverStore.ts`

#### Team Portal Lifecycle
Teams authenticate using registration ID and passcode, then load their roster and progression state. Portal credentials are client-session persisted, but server APIs remain authoritative. Password recovery creates and consumes time-limited, hashed reset tokens and uses email delivery designed to avoid account enumeration.
- `src/app/portal/page.tsx`
- `src/app/api/auth/team/route.ts`
- `src/app/api/auth/team/forgot/route.ts`

After payment verification, teams upload an initial PPT/PDF. Further replacement requires an organizer-approved re-submission request; consuming approval supersedes the existing deck and permits one replacement.
- `src/app/api/team/payment/route.ts`
- `src/app/api/team/submission/route.ts`
- `src/app/api/team/resubmission/route.ts`

#### Organizer Command Center
The admin UI polls and manages registration operations: payment decisions, scoring, advancement, re-upload decisions, notices, audit history, and CSV export. Admin authentication is an HMAC-signed HttpOnly-cookie session, not public Supabase access.
- `src/app/admin/page.tsx`
- `src/app/api/admin/session/route.ts`
- `src/app/api/admin/registrations/route.ts`

Admin actions cross into server-side business logic and may update team/payment/submission state, generate signed file access, send email, and append audit records.
- `src/lib/adminAuth.ts`
- `src/lib/serverStore.ts`
- `src/lib/storage.ts`

#### Persistence and File Boundary
Supabase PostgreSQL is the system of record. The application uses the service-role client server-side; RLS/security migrations prevent anonymous direct access. Relational records model teams, members, payments, submissions, reset tokens, re-submission requests, flags, audit logs, and runtime configuration.
- `src/lib/supabase.ts`
- `src/db/schema.sql`
- `src/db/migrations/013_schema_hardening.sql`

Payment proofs and presentation decks are validated before placement in private Supabase Storage. Stored objects are accessed through signed URLs rather than public exposure.
- `src/lib/fileValidation.ts`
- `src/lib/paymentProof.ts`
- `src/db/migrations/003_private_submissions_bucket.sql`

#### Operations, Messaging, and Security
SMTP/Nodemailer provides registration, reset, decision, reminder, and custom notices; email is centralized in one dispatcher. A Vercel cron finds unpaid teams and sends payment reminders. In-memory rate limiting protects high-abuse public routes.
- `src/lib/email.ts`
- `src/app/api/cron/payment-reminders/route.ts`
- `vercel.json`

Security also includes CSP/HSTS and upload response restrictions in Next configuration. The important deployment secrets are Supabase service-role credentials, admin and cron secrets, site URL, and SMTP credentials.
- `next.config.ts`
- `.env.example`
- `src/lib/rateLimit.ts`

#### Presentation Layer
The visual layer is deliberately separate from transactional operations: reusable landing sections/modals and optional 3D scenes provide the aerospace experience without defining backend state. SEO/PWA metadata is supplied at the app boundary.
- `src/components/3d/SpaceBackground.tsx`
- `src/components/3d/OrionConstellation3D.tsx`
- `src/app/layout.tsx`

Main entry points: [`src/lib/serverStore.ts`](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/serverStore.ts) (Store / business logic), [`src/app/api/admin/registrations/route.ts`](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/admin/registrations/route.ts) (Admin registrations API), [`src/app/api/registrations/route.ts`](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/registrations/route.ts) (Registration API), [`src/lib/email.ts`](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/email.ts) (Email dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public experience"]
  node_landing["Landing page<br/>Next.js route<br/>[page.tsx]"]
  node_presentation["Visual presentation<br/>React components<br/>[RegisterModal.tsx]"]
  node_event_data["Event content<br/>Static data<br/>[orionData.ts]"]
end

subgraph group_team["Team lifecycle"]
  node_portal["Team portal<br/>Next.js route<br/>[page.tsx]"]
end

subgraph group_admin["Organizer operations"]
  node_admin_ui["Admin command center<br/>Next.js route<br/>[page.tsx]"]
end

subgraph group_server["Server trust boundary"]
  node_registration_api{{"Registration API<br/>Route handlers<br/>[route.ts]"}}
  node_team_auth{{"Team authentication<br/>Route handlers<br/>[route.ts]"}}
  node_team_lifecycle{{"Payment and submissions<br/>Route handlers<br/>[route.ts]"}}
  node_admin_session{{"Admin session<br/>Route handler<br/>[route.ts]"}}
  node_admin_api{{"Admin registrations API<br/>Route handler<br/>[route.ts]"}}
  node_admin_auth["Admin authorization<br/>Server auth<br/>[adminAuth.ts]"]
  node_store["Store / business logic<br/>Server DAL<br/>[serverStore.ts]"]
  node_rate_limit["Public rate limiting<br/>In-memory protection<br/>[rateLimit.ts]"]
end

subgraph group_platform["Data and operations"]
  node_supabase[("Supabase PostgreSQL<br/>System of record<br/>[supabase.ts]")]
  node_database_schema["Database security schema<br/>SQL migrations"]
  node_file_gate["Private file pipeline<br/>Validation and storage<br/>[fileValidation.ts]"]
  node_storage[("Supabase Storage<br/>Private object storage")]
  node_email["Email dispatcher<br/>SMTP / Nodemailer<br/>[email.ts]"]
  node_reminder_cron{{"Payment reminder cron<br/>Scheduled route<br/>[route.ts]"}}
  node_deployment_security["Deployment security<br/>Next.js and Vercel config<br/>[next.config.ts]"]
end

node_landing -->|"renders"| node_presentation
node_landing -->|"loads"| node_event_data
node_presentation -->|"submits registration"| node_registration_api
node_registration_api -.->|"protected by"| node_rate_limit
node_registration_api -->|"executes workflow"| node_store
node_store -->|"persists state"| node_supabase
node_supabase -.->|"secured by"| node_database_schema
node_registration_api -->|"sends confirmation"| node_email
node_portal -->|"authenticates"| node_team_auth
node_team_auth -->|"reads credentials and tokens"| node_store
node_team_auth -->|"sends reset mail"| node_email
node_portal -->|"manages payment and decks"| node_team_lifecycle
node_team_lifecycle -->|"updates lifecycle"| node_store
node_team_lifecycle -->|"validates uploads"| node_file_gate
node_file_gate -->|"stores private files"| node_storage
node_admin_ui -->|"signs in"| node_admin_session
node_admin_session -->|"verifies session"| node_admin_auth
node_admin_ui -->|"polls and acts"| node_admin_api
node_admin_api -->|"authorizes"| node_admin_auth
node_admin_api -->|"applies decisions"| node_store
node_admin_api -->|"creates signed access"| node_file_gate
node_admin_api -->|"sends notices"| node_email
node_reminder_cron -->|"finds unpaid teams"| node_store
node_reminder_cron -->|"sends reminders"| node_email
node_deployment_security -.->|"schedules"| node_reminder_cron

click node_landing "https://github.com/goprocker/orion-hackathon/blob/main/src/app/page.tsx"
click node_presentation "https://github.com/goprocker/orion-hackathon/blob/main/src/components/modals/RegisterModal.tsx"
click node_event_data "https://github.com/goprocker/orion-hackathon/blob/main/src/data/orionData.ts"
click node_registration_api "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/registrations/route.ts"
click node_portal "https://github.com/goprocker/orion-hackathon/blob/main/src/app/portal/page.tsx"
click node_team_auth "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/auth/team/route.ts"
click node_team_lifecycle "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/team/submission/route.ts"
click node_admin_ui "https://github.com/goprocker/orion-hackathon/blob/main/src/app/admin/page.tsx"
click node_admin_session "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/admin/session/route.ts"
click node_admin_api "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/admin/registrations/route.ts"
click node_admin_auth "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/adminAuth.ts"
click node_store "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/serverStore.ts"
click node_supabase "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/supabase.ts"
click node_database_schema "https://github.com/goprocker/orion-hackathon/blob/main/src/db/migrations/013_schema_hardening.sql"
click node_file_gate "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/fileValidation.ts"
click node_storage "https://github.com/goprocker/orion-hackathon/blob/main/src/db/migrations/003_private_submissions_bucket.sql"
click node_email "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/email.ts"
click node_reminder_cron "https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/cron/payment-reminders/route.ts"
click node_rate_limit "https://github.com/goprocker/orion-hackathon/blob/main/src/lib/rateLimit.ts"
click node_deployment_security "https://github.com/goprocker/orion-hackathon/blob/main/next.config.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_landing,node_presentation,node_event_data toneBlue
class node_portal toneAmber
class node_admin_ui toneMint
class node_registration_api,node_team_auth,node_team_lifecycle,node_admin_session,node_admin_api,node_admin_auth,node_store,node_rate_limit toneRose
class node_supabase,node_database_schema,node_file_gate,node_storage,node_email,node_reminder_cron,node_deployment_security toneIndigo
```

## Components

### Public experience

- [Landing page](https://github.com/goprocker/orion-hackathon/blob/main/src/app/page.tsx): Next.js route · Event content and public entry. · `src/app/page.tsx`
- [Visual presentation](https://github.com/goprocker/orion-hackathon/blob/main/src/components/modals/RegisterModal.tsx): React components · Reusable modals, themed sections, and 3D scenes. · `src/components/modals/RegisterModal.tsx`
- [Event content](https://github.com/goprocker/orion-hackathon/blob/main/src/data/orionData.ts): Static data · `src/data/orionData.ts`

### Team lifecycle

- [Team portal](https://github.com/goprocker/orion-hackathon/blob/main/src/app/portal/page.tsx): Next.js route · Team roster and progression surface. · `src/app/portal/page.tsx`

### Organizer operations

- [Admin command center](https://github.com/goprocker/orion-hackathon/blob/main/src/app/admin/page.tsx): Next.js route · Polling operational interface for decisions, scoring, notices, and export. · `src/app/admin/page.tsx`

### Server trust boundary

- [Registration API](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/registrations/route.ts): Route handlers · Validates teams, detects duplicates, issues credentials, and exposes telemetry. · `src/app/api/registrations/route.ts`
- [Team authentication](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/auth/team/route.ts): Route handlers · Authenticates credentials and handles non-enumerating password recovery. · `src/app/api/auth/team/route.ts`
- [Payment and submissions](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/team/submission/route.ts): Route handlers · Controls payment verification, initial uploads, and approved replacement. · `src/app/api/team/submission/route.ts`
- [Admin session](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/admin/session/route.ts): Route handler · HMAC-signed HttpOnly-cookie authentication. · `src/app/api/admin/session/route.ts`
- [Admin registrations API](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/admin/registrations/route.ts): Route handler · Applies organizer decisions and operational actions. · `src/app/api/admin/registrations/route.ts`
- [Admin authorization](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/adminAuth.ts): Server auth · `src/lib/adminAuth.ts`
- [Store / business logic](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/serverStore.ts): Server DAL · Authoritative registration, team, payment, submission, and audit workflows. · `src/lib/serverStore.ts`
- [Public rate limiting](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/rateLimit.ts): In-memory protection · `src/lib/rateLimit.ts`

### Data and operations

- [Supabase PostgreSQL](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/supabase.ts): System of record · Relational teams, payments, submissions, tokens, flags, audit logs, and configuration. · `src/lib/supabase.ts`
- [Database security schema](https://github.com/goprocker/orion-hackathon/blob/main/src/db/migrations/013_schema_hardening.sql): SQL migrations · RLS and schema hardening restrict anonymous access. · `src/db/migrations/013_schema_hardening.sql`
- [Private file pipeline](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/fileValidation.ts): Validation and storage · Validates proofs/decks and serves stored files through signed URLs. · `src/lib/fileValidation.ts`
- [Supabase Storage](https://github.com/goprocker/orion-hackathon/blob/main/src/db/migrations/003_private_submissions_bucket.sql): Private object storage · `src/db/migrations/003_private_submissions_bucket.sql`
- [Email dispatcher](https://github.com/goprocker/orion-hackathon/blob/main/src/lib/email.ts): SMTP / Nodemailer · Centralizes registration, reset, decision, reminder, and notice delivery. · `src/lib/email.ts`
- [Payment reminder cron](https://github.com/goprocker/orion-hackathon/blob/main/src/app/api/cron/payment-reminders/route.ts): Scheduled route · Finds unpaid teams and dispatches reminders. · `src/app/api/cron/payment-reminders/route.ts`
- [Deployment security](https://github.com/goprocker/orion-hackathon/blob/main/next.config.ts): Next.js and Vercel config · Security headers, upload restrictions, cron schedule, and secrets configuration. · `next.config.ts`

## Connections

- Landing page → Visual presentation: renders
- Landing page → Event content: loads
- Visual presentation → Registration API: submits registration
- Registration API → Public rate limiting: protected by
- Registration API → Store / business logic: executes workflow
- Store / business logic → Supabase PostgreSQL: persists state
- Supabase PostgreSQL → Database security schema: secured by
- Registration API → Email dispatcher: sends confirmation
- Team portal → Team authentication: authenticates
- Team authentication → Store / business logic: reads credentials and tokens
- Team authentication → Email dispatcher: sends reset mail
- Team portal → Payment and submissions: manages payment and decks
- Payment and submissions → Store / business logic: updates lifecycle
- Payment and submissions → Private file pipeline: validates uploads
- Private file pipeline → Supabase Storage: stores private files
- Admin command center → Admin session: signs in
- Admin session → Admin authorization: verifies session
- Admin command center → Admin registrations API: polls and acts
- Admin registrations API → Admin authorization: authorizes
- Admin registrations API → Store / business logic: applies decisions
- Admin registrations API → Private file pipeline: creates signed access
- Admin registrations API → Email dispatcher: sends notices
- Payment reminder cron → Store / business logic: finds unpaid teams
- Payment reminder cron → Email dispatcher: sends reminders
- Deployment security → Payment reminder cron: schedules
