# kritt29/ctf-website-current architecture

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

- Interactive diagram: https://gitdiagram.com/kritt29/ctf-website-current
- Repository: https://github.com/kritt29/ctf-website-current

## Overview

DDC CTF Platform combines a public event website with an authenticated participant portal. The main gameplay workflow is login → protected dashboard or challenge catalogue → server-assigned starting challenge; assignment and participant start time persist in D1. The public site presents the cinematic event journey, including the network globe and Page 02 vector experience. The README identifies submissions, leaderboard, and rules as placeholders, and scoring, challenge execution, and judging as future work. Some page and API internals were not sampled, so only documented or indexed relationships are shown.

Main entry points: [`lib/server/auth.ts`](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/auth.ts) (Session and auth), [`app/(participant)/layout.tsx`](https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/layout.tsx) (Participant routes), [`lib/server/competition.ts`](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/competition.ts) (Competition logic), [`app/page.tsx`](https://github.com/kritt29/ctf-website-current/blob/main/app/page.tsx) (Event landing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public event experience"]
  node_home["Event landing<br/>[page.tsx]"]
  node_highlights["Event highlights"]
  node_hero["Cinematic hero<br/>[HeroScreen.tsx]"]
  node_globe["Network globe<br/>[NetworkGlobe.tsx]"]
  node_hero_motion["Hero choreography<br/>[useHeroMotion.ts]"]
  node_page02["Page 02 vectors"]
end

subgraph group_participant["Participant experience"]
  node_login_page["Login route<br/>[page.tsx]"]
  node_login_ui["Login screen<br/>[LoginScreen.tsx]"]
  node_participant_routes["Participant routes<br/>[layout.tsx]"]
  node_dashboard_ui["Dashboard view<br/>[Dashboard.tsx]"]
  node_challenge_list["Challenge catalogue<br/>[page.tsx]"]
  node_challenge_detail["Challenge detail<br/>[page.tsx]"]
  node_participant_placeholders["Portal placeholders<br/>[page.tsx]"]
end

subgraph group_server["Server platform"]
  node_auth_api["Authentication API<br/>[route.ts]"]
  node_auth_service["Session and auth<br/>[auth.ts]"]
  node_challenge_api["Challenge APIs<br/>[route.ts]"]
  node_dashboard_api["Dashboard API<br/>[route.ts]"]
  node_competition["Competition logic<br/>[competition.ts]"]
  node_http_helpers["HTTP safeguards<br/>[http.ts]"]
  node_database_access["D1 access<br/>[database.ts]"]
end

subgraph group_state["Persistent state"]
  node_d1[("Cloudflare D1")]
  node_schema["Database schema<br/>[schema.ts]"]
end

node_visitor(("Event visitor"))
node_participant_actor(("Participant"))

node_visitor -->|"visits"| node_home
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_highlights
node_home -->|"mounts"| node_page02
node_hero -->|"renders"| node_globe
node_hero -->|"uses"| node_hero_motion
node_hero_motion -.->|"drives motion"| node_globe
node_participant_actor -->|"signs in"| node_login_page
node_login_page -->|"renders"| node_login_ui
node_login_page -->|"checks session"| node_auth_service
node_participant_actor -->|"opens portal"| node_participant_routes
node_participant_routes -.->|"shows"| node_dashboard_ui
node_participant_routes -->|"routes to"| node_challenge_list
node_participant_routes -->|"routes to"| node_challenge_detail
node_participant_routes -->|"routes to"| node_participant_placeholders
node_challenge_list -->|"loads challenges"| node_competition
node_challenge_list -->|"requires participant"| node_auth_service
node_challenge_detail -->|"requires participant"| node_auth_service
node_challenge_detail -->|"loads assignment"| node_competition
node_auth_api -->|"authenticates"| node_auth_service
node_auth_api -->|"uses responses"| node_http_helpers
node_challenge_api -->|"requires participant"| node_auth_service
node_challenge_api -->|"starts challenge"| node_competition
node_challenge_api -->|"checks origin"| node_http_helpers
node_dashboard_api -->|"requires participant"| node_auth_service
node_dashboard_api -->|"builds dashboard"| node_competition
node_auth_service -->|"queries"| node_database_access
node_competition -->|"queries and writes"| node_database_access
node_database_access -.->|"accesses"| node_d1
node_schema -.->|"defines tables"| node_d1

click node_home "https://github.com/kritt29/ctf-website-current/blob/main/app/page.tsx"
click node_highlights "https://github.com/kritt29/ctf-website-current/blob/main/components/highlights/EventHighlights.tsx"
click node_hero "https://github.com/kritt29/ctf-website-current/blob/main/components/hero/HeroScreen.tsx"
click node_globe "https://github.com/kritt29/ctf-website-current/blob/main/components/hero/NetworkGlobe.tsx"
click node_hero_motion "https://github.com/kritt29/ctf-website-current/blob/main/components/hero/motion/useHeroMotion.ts"
click node_page02 "https://github.com/kritt29/ctf-website-current/blob/main/components/vectors/ChallengeVectors.tsx"
click node_login_page "https://github.com/kritt29/ctf-website-current/blob/main/app/login/page.tsx"
click node_login_ui "https://github.com/kritt29/ctf-website-current/blob/main/components/login/LoginScreen.tsx"
click node_participant_routes "https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/layout.tsx"
click node_dashboard_ui "https://github.com/kritt29/ctf-website-current/blob/main/components/participant/Dashboard.tsx"
click node_challenge_list "https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/challenges/page.tsx"
click node_challenge_detail "https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/challenges/%5BchallengeId%5D/page.tsx"
click node_participant_placeholders "https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/submissions/page.tsx"
click node_auth_api "https://github.com/kritt29/ctf-website-current/blob/main/app/api/auth/login/route.ts"
click node_auth_service "https://github.com/kritt29/ctf-website-current/blob/main/lib/server/auth.ts"
click node_challenge_api "https://github.com/kritt29/ctf-website-current/blob/main/app/api/challenges/start/route.ts"
click node_dashboard_api "https://github.com/kritt29/ctf-website-current/blob/main/app/api/dashboard/route.ts"
click node_competition "https://github.com/kritt29/ctf-website-current/blob/main/lib/server/competition.ts"
click node_http_helpers "https://github.com/kritt29/ctf-website-current/blob/main/lib/server/http.ts"
click node_database_access "https://github.com/kritt29/ctf-website-current/blob/main/lib/server/database.ts"
click node_schema "https://github.com/kritt29/ctf-website-current/blob/main/db/schema.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_home,node_highlights,node_hero,node_globe,node_hero_motion,node_page02 toneBlue
class node_login_page,node_login_ui,node_participant_routes,node_dashboard_ui,node_challenge_list,node_challenge_detail,node_participant_placeholders toneAmber
class node_auth_api,node_auth_service,node_challenge_api,node_dashboard_api,node_competition,node_http_helpers,node_database_access toneMint
class node_d1,node_schema toneRose
class node_visitor,node_participant_actor toneIndigo
```

## Components

### Public event experience

- [Event landing](https://github.com/kritt29/ctf-website-current/blob/main/app/page.tsx): `app/page.tsx`
- [Event highlights](https://github.com/kritt29/ctf-website-current/blob/main/components/highlights/EventHighlights.tsx): `components/highlights/EventHighlights.tsx`
- [Cinematic hero](https://github.com/kritt29/ctf-website-current/blob/main/components/hero/HeroScreen.tsx): `components/hero/HeroScreen.tsx`
- [Network globe](https://github.com/kritt29/ctf-website-current/blob/main/components/hero/NetworkGlobe.tsx): `components/hero/NetworkGlobe.tsx`
- [Hero choreography](https://github.com/kritt29/ctf-website-current/blob/main/components/hero/motion/useHeroMotion.ts): `components/hero/motion/useHeroMotion.ts`
- [Page 02 vectors](https://github.com/kritt29/ctf-website-current/blob/main/components/vectors/ChallengeVectors.tsx): `components/vectors/ChallengeVectors.tsx`

### Participant experience

- [Login route](https://github.com/kritt29/ctf-website-current/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Login screen](https://github.com/kritt29/ctf-website-current/blob/main/components/login/LoginScreen.tsx): `components/login/LoginScreen.tsx`
- [Participant routes](https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/layout.tsx): `app/(participant)/layout.tsx`
- [Dashboard view](https://github.com/kritt29/ctf-website-current/blob/main/components/participant/Dashboard.tsx): `components/participant/Dashboard.tsx`
- [Challenge catalogue](https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/challenges/page.tsx): `app/(participant)/challenges/page.tsx`
- [Challenge detail](https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/challenges/%5BchallengeId%5D/page.tsx): `app/(participant)/challenges/[challengeId]/page.tsx`
- [Portal placeholders](https://github.com/kritt29/ctf-website-current/blob/main/app/(participant)/submissions/page.tsx): `app/(participant)/submissions/page.tsx`

### Server platform

- [Authentication API](https://github.com/kritt29/ctf-website-current/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Session and auth](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/auth.ts): `lib/server/auth.ts`
- [Challenge APIs](https://github.com/kritt29/ctf-website-current/blob/main/app/api/challenges/start/route.ts): `app/api/challenges/start/route.ts`
- [Dashboard API](https://github.com/kritt29/ctf-website-current/blob/main/app/api/dashboard/route.ts): `app/api/dashboard/route.ts`
- [Competition logic](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/competition.ts): `lib/server/competition.ts`
- [HTTP safeguards](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/http.ts): `lib/server/http.ts`
- [D1 access](https://github.com/kritt29/ctf-website-current/blob/main/lib/server/database.ts): `lib/server/database.ts`

### Persistent state

- **Cloudflare D1**
- [Database schema](https://github.com/kritt29/ctf-website-current/blob/main/db/schema.ts): `db/schema.ts`

### Other components

- **Event visitor**
- **Participant**

## Connections

- Event visitor → Event landing: visits (evidence: `README.md`)
- Event landing → Cinematic hero: renders (evidence: `app/page.tsx`)
- Event landing → Event highlights: renders (evidence: `app/page.tsx`)
- Event landing → Page 02 vectors: mounts (evidence: `app/page.tsx`)
- Cinematic hero → Network globe: renders (evidence: `components/hero/HeroScreen.tsx`)
- Cinematic hero → Hero choreography: uses (evidence: `components/hero/HeroScreen.tsx`)
- Hero choreography → Network globe: drives motion
- Participant → Login route: signs in (evidence: `README.md`)
- Login route → Login screen: renders (evidence: `app/login/page.tsx`)
- Login route → Session and auth: checks session (evidence: `app/login/page.tsx`)
- Participant → Participant routes: opens portal (evidence: `README.md`)
- Participant routes → Dashboard view: shows
- Participant routes → Challenge catalogue: routes to (evidence: `README.md`)
- Participant routes → Challenge detail: routes to (evidence: `README.md`)
- Participant routes → Portal placeholders: routes to (evidence: `README.md`)
- Challenge catalogue → Competition logic: loads challenges (evidence: `app/(participant)/challenges/page.tsx`)
- Challenge catalogue → Session and auth: requires participant (evidence: `app/(participant)/challenges/page.tsx`)
- Challenge detail → Session and auth: requires participant (evidence: `app/(participant)/challenges/[challengeId]/page.tsx`)
- Challenge detail → Competition logic: loads assignment (evidence: `app/(participant)/challenges/[challengeId]/page.tsx`)
- Authentication API → Session and auth: authenticates (evidence: `app/api/auth/login/route.ts`)
- Authentication API → HTTP safeguards: uses responses (evidence: `app/api/auth/login/route.ts`)
- Challenge APIs → Session and auth: requires participant (evidence: `app/api/challenges/start/route.ts`)
- Challenge APIs → Competition logic: starts challenge (evidence: `app/api/challenges/start/route.ts`)
- Challenge APIs → HTTP safeguards: checks origin (evidence: `app/api/challenges/start/route.ts`)
- Dashboard API → Session and auth: requires participant (evidence: `app/api/dashboard/route.ts`)
- Dashboard API → Competition logic: builds dashboard (evidence: `app/api/dashboard/route.ts`)
- Session and auth → D1 access: queries (evidence: `lib/server/auth.ts`)
- Competition logic → D1 access: queries and writes (evidence: `lib/server/competition.ts`)
- D1 access → Cloudflare D1: accesses
- Database schema → Cloudflare D1: defines tables
