# hellopalak/code_rash architecture

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

- Interactive diagram: https://gitdiagram.com/hellopalak/code_rash
- Repository: https://github.com/hellopalak/code_rash

## Overview

CODE_RASH is a browser-based contest platform with participant, evaluator, and admin routes. Participants sign in, use the dashboard to enter the active round, and submit round work; shared contest state governs round progression. Admins manage contest settings and user records, while evaluator functionality is present as a separate route. The excerpts show client-side Firebase access and a server endpoint for creating accounts. Several routes are represented from the source index, so their internal behavior is not inferred beyond those references.

Main entry points: [`src/lib/firebase.ts`](https://github.com/hellopalak/code_rash/blob/main/src/lib/firebase.ts) (Firebase client setup), [`src/app/dashboard/page.tsx`](https://github.com/hellopalak/code_rash/blob/main/src/app/dashboard/page.tsx) (Contest dashboard), [`src/context/ContestContext.tsx`](https://github.com/hellopalak/code_rash/blob/main/src/context/ContestContext.tsx) (Round coordination), [`src/app/admin/page.tsx`](https://github.com/hellopalak/code_rash/blob/main/src/app/admin/page.tsx) (Contest admin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_participants["Participant experience"]
  node_login["Sign in<br/>[page.tsx]"]
  node_dashboard["Contest dashboard<br/>[page.tsx]"]
  node_evaluator["Evaluator route<br/>[page.tsx]"]
end

subgraph group_contest["Contest runtime"]
  node_round1["Round 1<br/>[page.tsx]"]
  node_round2["Round 2<br/>[page.tsx]"]
  node_round3["Round 3<br/>[page.tsx]"]
  node_round4["Round 4<br/>[page.tsx]"]
  node_contest_state["Round coordination<br/>[ContestContext.tsx]"]
  node_question_bank["Question bank<br/>[questions.ts]"]
  node_anti_cheat["Anti-cheat guard<br/>[AntiCheatGuard.tsx]"]
end

subgraph group_administration["Administration"]
  node_admin["Contest admin<br/>[page.tsx]"]
  node_user_creation["Create accounts API<br/>[route.ts]"]
  node_allowlist["Role allowlist<br/>[allowlist.ts]"]
end

subgraph group_platform["Firebase platform"]
  node_firebase_client["Firebase client setup<br/>[firebase.ts]"]
  node_firebase_admin["Firebase Admin setup<br/>[firebase-admin.ts]"]
  node_firestore[("Firestore")]
  node_firebase_auth["Firebase Auth"]
end

node_visitor(("Participant"))

node_visitor -->|"signs in"| node_login
node_login -->|"checks role"| node_allowlist
node_login -->|"uses client"| node_firebase_client
node_dashboard -->|"links to"| node_round1
node_dashboard -->|"links to"| node_round2
node_dashboard -->|"links to"| node_round3
node_dashboard -->|"links to"| node_round4
node_dashboard -->|"reads round state"| node_contest_state
node_dashboard -->|"renders guard"| node_anti_cheat
node_round1 -->|"loads defaults"| node_question_bank
node_round3 -->|"loads defaults"| node_question_bank
node_round1 -->|"renders guard"| node_anti_cheat
node_round3 -->|"renders guard"| node_anti_cheat
node_round1 -->|"reads and saves"| node_firebase_client
node_round3 -->|"reads and saves"| node_firebase_client
node_round2 -->|"uses client"| node_firebase_client
node_round2 -->|"uses context"| node_contest_state
node_round4 -->|"uses client"| node_firebase_client
node_round4 -->|"uses context"| node_contest_state
node_contest_state -->|"uses client"| node_firebase_client
node_anti_cheat -->|"records warnings"| node_firebase_client
node_allowlist -->|"checks Firestore"| node_firebase_client
node_admin -->|"checks admin role"| node_allowlist
node_admin -->|"seeds questions"| node_question_bank
node_admin -->|"manages contest data"| node_firebase_client
node_admin -->|"resets contest"| node_contest_state
node_admin -.->|"creates accounts"| node_user_creation
node_user_creation -->|"gets admin auth"| node_firebase_admin
node_user_creation -->|"creates users"| node_firebase_auth
node_dashboard -->|"reads and updates users"| node_firestore
node_contest_state -->|"writes contest state"| node_firestore
node_firebase_client -->|"initializes client"| node_firestore

click node_login "https://github.com/hellopalak/code_rash/blob/main/src/app/login/page.tsx"
click node_dashboard "https://github.com/hellopalak/code_rash/blob/main/src/app/dashboard/page.tsx"
click node_round1 "https://github.com/hellopalak/code_rash/blob/main/src/app/round1/page.tsx"
click node_round2 "https://github.com/hellopalak/code_rash/blob/main/src/app/round2/page.tsx"
click node_round3 "https://github.com/hellopalak/code_rash/blob/main/src/app/round3/page.tsx"
click node_round4 "https://github.com/hellopalak/code_rash/blob/main/src/app/round4/page.tsx"
click node_contest_state "https://github.com/hellopalak/code_rash/blob/main/src/context/ContestContext.tsx"
click node_question_bank "https://github.com/hellopalak/code_rash/blob/main/src/lib/questions.ts"
click node_anti_cheat "https://github.com/hellopalak/code_rash/blob/main/src/components/AntiCheatGuard.tsx"
click node_evaluator "https://github.com/hellopalak/code_rash/blob/main/src/app/evaluator/page.tsx"
click node_admin "https://github.com/hellopalak/code_rash/blob/main/src/app/admin/page.tsx"
click node_user_creation "https://github.com/hellopalak/code_rash/blob/main/src/app/api/admin/create-users/route.ts"
click node_allowlist "https://github.com/hellopalak/code_rash/blob/main/src/lib/allowlist.ts"
click node_firebase_client "https://github.com/hellopalak/code_rash/blob/main/src/lib/firebase.ts"
click node_firebase_admin "https://github.com/hellopalak/code_rash/blob/main/src/lib/firebase-admin.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_login,node_dashboard,node_evaluator toneBlue
class node_round1,node_round2,node_round3,node_round4,node_contest_state,node_question_bank,node_anti_cheat toneAmber
class node_admin,node_user_creation,node_allowlist toneMint
class node_firebase_client,node_firebase_admin,node_firestore,node_firebase_auth toneRose
class node_visitor toneIndigo
```

## Components

### Participant experience

- [Sign in](https://github.com/hellopalak/code_rash/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Contest dashboard](https://github.com/hellopalak/code_rash/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Evaluator route](https://github.com/hellopalak/code_rash/blob/main/src/app/evaluator/page.tsx): `src/app/evaluator/page.tsx`

### Contest runtime

- [Round 1](https://github.com/hellopalak/code_rash/blob/main/src/app/round1/page.tsx): `src/app/round1/page.tsx`
- [Round 2](https://github.com/hellopalak/code_rash/blob/main/src/app/round2/page.tsx): `src/app/round2/page.tsx`
- [Round 3](https://github.com/hellopalak/code_rash/blob/main/src/app/round3/page.tsx): `src/app/round3/page.tsx`
- [Round 4](https://github.com/hellopalak/code_rash/blob/main/src/app/round4/page.tsx): `src/app/round4/page.tsx`
- [Round coordination](https://github.com/hellopalak/code_rash/blob/main/src/context/ContestContext.tsx): `src/context/ContestContext.tsx`
- [Question bank](https://github.com/hellopalak/code_rash/blob/main/src/lib/questions.ts): `src/lib/questions.ts`
- [Anti-cheat guard](https://github.com/hellopalak/code_rash/blob/main/src/components/AntiCheatGuard.tsx): `src/components/AntiCheatGuard.tsx`

### Administration

- [Contest admin](https://github.com/hellopalak/code_rash/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Create accounts API](https://github.com/hellopalak/code_rash/blob/main/src/app/api/admin/create-users/route.ts): `src/app/api/admin/create-users/route.ts`
- [Role allowlist](https://github.com/hellopalak/code_rash/blob/main/src/lib/allowlist.ts): `src/lib/allowlist.ts`

### Firebase platform

- [Firebase client setup](https://github.com/hellopalak/code_rash/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Firebase Admin setup](https://github.com/hellopalak/code_rash/blob/main/src/lib/firebase-admin.ts): `src/lib/firebase-admin.ts`
- **Firestore**
- **Firebase Auth**

### Other components

- **Participant**

## Connections

- Participant → Sign in: signs in (evidence: `src/app/login/page.tsx`)
- Sign in → Role allowlist: checks role (evidence: `src/app/login/page.tsx`)
- Sign in → Firebase client setup: uses client (evidence: `src/app/login/page.tsx`)
- Contest dashboard → Round 1: links to (evidence: `src/app/dashboard/page.tsx`)
- Contest dashboard → Round 2: links to (evidence: `src/app/dashboard/page.tsx`)
- Contest dashboard → Round 3: links to (evidence: `src/app/dashboard/page.tsx`)
- Contest dashboard → Round 4: links to (evidence: `src/app/dashboard/page.tsx`)
- Contest dashboard → Round coordination: reads round state (evidence: `src/app/dashboard/page.tsx`)
- Contest dashboard → Anti-cheat guard: renders guard (evidence: `src/app/dashboard/page.tsx`)
- Round 1 → Question bank: loads defaults (evidence: `src/app/round1/page.tsx`)
- Round 3 → Question bank: loads defaults (evidence: `src/app/round3/page.tsx`)
- Round 1 → Anti-cheat guard: renders guard (evidence: `src/app/round1/page.tsx`)
- Round 3 → Anti-cheat guard: renders guard (evidence: `src/app/round3/page.tsx`)
- Round 1 → Firebase client setup: reads and saves (evidence: `src/app/round1/page.tsx`)
- Round 3 → Firebase client setup: reads and saves (evidence: `src/app/round3/page.tsx`)
- Round 2 → Firebase client setup: uses client (evidence: `src/app/round2/page.tsx`)
- Round 2 → Round coordination: uses context (evidence: `src/app/round2/page.tsx`)
- Round 4 → Firebase client setup: uses client (evidence: `src/app/round4/page.tsx`)
- Round 4 → Round coordination: uses context (evidence: `src/app/round4/page.tsx`)
- Round coordination → Firebase client setup: uses client (evidence: `src/context/ContestContext.tsx`)
- Anti-cheat guard → Firebase client setup: records warnings (evidence: `src/components/AntiCheatGuard.tsx`)
- Role allowlist → Firebase client setup: checks Firestore (evidence: `src/lib/allowlist.ts`)
- Contest admin → Role allowlist: checks admin role (evidence: `src/app/admin/page.tsx`)
- Contest admin → Question bank: seeds questions (evidence: `src/app/admin/page.tsx`)
- Contest admin → Firebase client setup: manages contest data (evidence: `src/app/admin/page.tsx`)
- Contest admin → Round coordination: resets contest (evidence: `src/app/admin/page.tsx`)
- Contest admin → Create accounts API: creates accounts
- Create accounts API → Firebase Admin setup: gets admin auth (evidence: `src/app/api/admin/create-users/route.ts`)
- Create accounts API → Firebase Auth: creates users (evidence: `src/app/api/admin/create-users/route.ts`)
- Contest dashboard → Firestore: reads and updates users (evidence: `src/app/dashboard/page.tsx`)
- Round coordination → Firestore: writes contest state (evidence: `src/context/ContestContext.tsx`)
- Firebase client setup → Firestore: initializes client (evidence: `src/lib/firebase.ts`)
