# arunbhaskar94/streakchamp_server architecture

> Architecture diagram of the GitHub repository arunbhaskar94/streakchamp_server, 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/arunbhaskar94/streakchamp_server
- Repository: https://github.com/arunbhaskar94/streakchamp_server

## Overview

StreakChamp is a Firebase-backed study and gamification API. Clients call the Express server, which exposes account, quiz, mock-test, PYQ, reels, and supporting endpoints; route handlers return results and persist user progress. Internal layers provide authentication guards, question and user-data helpers, Firestore-backed stores, and question-bank maintenance. The README gives no capability details, so the route names and sampled code provide the available product evidence; unsampled route behavior is not expanded beyond those names and references.

Main entry points: [`server.js`](https://github.com/arunbhaskar94/streakchamp_server/blob/main/server.js) (Express server), [`lib/firebase.js`](https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/firebase.js) (Firebase services), [`res/local_file_functions.js`](https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/local_file_functions.js) (Question and user helpers), [`res/Timer_functions.js`](https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/Timer_functions.js) (Question maintenance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_server["Express server<br/>[server.js]"]
  node_ping["Ping and health<br/>[ping.js]"]
  node_admin["Admin API<br/>[admin.js]"]
  node_chat["Chat routes<br/>[chat.js]"]
  node_update["Data updates<br/>[updateData.js]"]
end

subgraph group_study["Study features"]
  node_aiquiz["AI quizzes<br/>[aiQuizRoutes.js]"]
  node_mock["Mock tests<br/>[mock.js]"]
  node_pyqs["Past papers<br/>[pyqs.js]"]
  node_reels["Question reels<br/>[reels.js]"]
  node_bubble["Bubble feature<br/>[bubble.js]"]
  node_chapter["Chapter routes<br/>[chapter.js]"]
end

subgraph group_identity["Identity and safety"]
  node_auth["Account routes<br/>[auth.js]"]
  node_guards["Request guards<br/>[guards.js]"]
end

subgraph group_data["Persistence and maintenance"]
  node_local["Question and user helpers"]
  node_timer["Question maintenance<br/>[Timer_functions.js]"]
  node_file["File store adapter<br/>[fileStore.js]"]
  node_firestore_store["Firestore stores<br/>[firestoreStore.js]"]
  node_firebase["Firebase services<br/>[firebase.js]"]
  node_firestore[("Firestore")]
  node_auth_service["Firebase Auth"]
  node_realtime[("Realtime Database")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"routes to"| node_ping
node_server -->|"routes to"| node_auth
node_server -->|"routes to"| node_admin
node_server -->|"routes to"| node_aiquiz
node_server -->|"routes to"| node_mock
node_server -->|"routes to"| node_pyqs
node_server -->|"routes to"| node_reels
node_server -->|"routes to"| node_bubble
node_server -->|"routes to"| node_chapter
node_server -->|"routes to"| node_chat
node_server -->|"routes to"| node_update
node_server -->|"uses guards"| node_guards
node_server -->|"runs maintenance"| node_timer
node_auth -->|"looks up users"| node_local
node_aiquiz -->|"reads and writes"| node_firestore
node_mock -->|"reads and writes"| node_firestore
node_local -->|"uses stores"| node_firestore_store
node_local -->|"uses services"| node_firebase
node_timer -->|"saves user data"| node_local
node_timer -->|"uses services"| node_firebase
node_file -->|"selects store"| node_firestore_store
node_firestore_store -->|"uses Firestore"| node_firebase
node_firebase -->|"provides client"| node_firestore
node_firebase -->|"provides client"| node_auth_service
node_firebase -->|"provides client"| node_realtime

click node_server "https://github.com/arunbhaskar94/streakchamp_server/blob/main/server.js"
click node_ping "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/ping.js"
click node_admin "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/admin.js"
click node_auth "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/auth.js"
click node_guards "https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/guards.js"
click node_aiquiz "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/aiQuizRoutes.js"
click node_mock "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/mock.js"
click node_pyqs "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/pyqs.js"
click node_reels "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/reels.js"
click node_bubble "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/bubble.js"
click node_chapter "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/chapter.js"
click node_chat "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/chat.js"
click node_update "https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/updateData.js"
click node_local "https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/local_file_functions.js"
click node_timer "https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/Timer_functions.js"
click node_file "https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/fileStore.js"
click node_firestore_store "https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/firestoreStore.js"
click node_firebase "https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/firebase.js"

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_server,node_ping,node_admin,node_chat,node_update,node_client toneBlue
class node_aiquiz,node_mock,node_pyqs,node_reels,node_bubble,node_chapter toneAmber
class node_auth,node_guards toneMint
class node_local,node_timer,node_file,node_firestore_store,node_firebase,node_firestore,node_auth_service,node_realtime toneRose
```

## Components

### API surface

- [Express server](https://github.com/arunbhaskar94/streakchamp_server/blob/main/server.js): `server.js`
- [Ping and health](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/ping.js): `routes/ping.js`
- [Admin API](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/admin.js): `routes/admin.js`
- [Chat routes](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/chat.js): `routes/chat.js`
- [Data updates](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/updateData.js): `routes/updateData.js`

### Study features

- [AI quizzes](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/aiQuizRoutes.js): `routes/aiQuizRoutes.js`
- [Mock tests](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/mock.js): `routes/mock.js`
- [Past papers](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/pyqs.js): `routes/pyqs.js`
- [Question reels](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/reels.js): `routes/reels.js`
- [Bubble feature](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/bubble.js): `routes/bubble.js`
- [Chapter routes](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/chapter.js): `routes/chapter.js`

### Identity and safety

- [Account routes](https://github.com/arunbhaskar94/streakchamp_server/blob/main/routes/auth.js): `routes/auth.js`
- [Request guards](https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/guards.js): `lib/guards.js`

### Persistence and maintenance

- [Question and user helpers](https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/local_file_functions.js): `res/local_file_functions.js`
- [Question maintenance](https://github.com/arunbhaskar94/streakchamp_server/blob/main/res/Timer_functions.js): `res/Timer_functions.js`
- [File store adapter](https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/fileStore.js): `lib/fileStore.js`
- [Firestore stores](https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/firestoreStore.js): `lib/firestoreStore.js`
- [Firebase services](https://github.com/arunbhaskar94/streakchamp_server/blob/main/lib/firebase.js): `lib/firebase.js`
- **Firestore**
- **Firebase Auth**
- **Realtime Database**

### Other components

- **API client**

## Connections

- API client → Express server: sends requests (evidence: `server.js`)
- Express server → Ping and health: routes to (evidence: `server.js`)
- Express server → Account routes: routes to (evidence: `server.js`)
- Express server → Admin API: routes to (evidence: `server.js`)
- Express server → AI quizzes: routes to (evidence: `server.js`)
- Express server → Mock tests: routes to (evidence: `server.js`)
- Express server → Past papers: routes to (evidence: `server.js`)
- Express server → Question reels: routes to (evidence: `server.js`)
- Express server → Bubble feature: routes to (evidence: `server.js`)
- Express server → Chapter routes: routes to (evidence: `server.js`)
- Express server → Chat routes: routes to (evidence: `server.js`)
- Express server → Data updates: routes to (evidence: `server.js`)
- Express server → Request guards: uses guards (evidence: `server.js`)
- Express server → Question maintenance: runs maintenance (evidence: `server.js`)
- Account routes → Question and user helpers: looks up users (evidence: `routes/auth.js`)
- AI quizzes → Firestore: reads and writes (evidence: `routes/aiQuizRoutes.js`)
- Mock tests → Firestore: reads and writes (evidence: `routes/mock.js`)
- Question and user helpers → Firestore stores: uses stores (evidence: `res/local_file_functions.js`)
- Question and user helpers → Firebase services: uses services (evidence: `res/local_file_functions.js`)
- Question maintenance → Question and user helpers: saves user data (evidence: `res/Timer_functions.js`)
- Question maintenance → Firebase services: uses services (evidence: `res/Timer_functions.js`)
- File store adapter → Firestore stores: selects store (evidence: `lib/fileStore.js`)
- Firestore stores → Firebase services: uses Firestore (evidence: `lib/firestoreStore.js`)
- Firebase services → Firestore: provides client (evidence: `lib/firebase.js`)
- Firebase services → Firebase Auth: provides client (evidence: `lib/firebase.js`)
- Firebase services → Realtime Database: provides client (evidence: `lib/firebase.js`)
