# devpanchal02/dental-edge architecture

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

- Interactive diagram: https://gitdiagram.com/devpanchal02/dental-edge
- Repository: https://github.com/devpanchal02/dental-edge

## Overview

Dental-Edge is a dental-study web app for browsing topic content, taking practice tests or question banks, and reviewing performance. The main workflow runs from authenticated topic browsing through quiz initialization, answering and persistence, server finalization, and results/analytics. Separate branches cover sign-in, plans, and backend topic, user, and payment endpoints. Source excerpts clarify quiz state and persistence; some page and controller internals are unsampled, so their links are limited to indexed imports or documented client calls.

Main entry points: [`client/src/App.tsx`](https://github.com/devpanchal02/dental-edge/blob/main/client/src/App.tsx) (Route application), [`functions/src/index.ts`](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/index.ts) (Function entry and routing), [`client/src/services/api.ts`](https://github.com/devpanchal02/dental-edge/blob/main/client/src/services/api.ts) (Client API), [`functions/src/firebase.ts`](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/firebase.ts) (Server Firebase setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_app["Route application<br/>[App.tsx]"]
  node_topic["Topic browsing<br/>[TopicPage.tsx]"]
  node_results["Results review<br/>[ResultsPage.tsx]"]
  node_accounts["Account and plans"]
  node_topicviews["Topic analytics views"]
  node_resultviews["Result visualizations"]
  node_clientapi["Client API<br/>[api.ts]"]
end

subgraph group_quiz["Quiz workflow"]
  node_engine["Quiz engine<br/>[useQuizEngine.ts]"]
  node_initialization["Quiz initialization"]
  node_lifecycle["Quiz lifecycle"]
  node_reducer["Quiz state reducer<br/>[quizReducer.ts]"]
  node_localstate[("Local attempt storage")]
  node_contentloader["Content loading and sanitizing<br/>[loader.ts]"]
  node_quiztypes["Quiz schemas and types<br/>[quiz.schemas.ts]"]
end

subgraph group_backend["Backend services"]
  node_functions["Function entry and routing<br/>[index.ts]"]
  node_quizcontroller["Quiz endpoints<br/>[quizController.ts]"]
  node_topiccontroller["Topic endpoints<br/>[topicController.ts]"]
  node_usercontroller["User endpoints<br/>[userController.ts]"]
  node_stripecontroller["Stripe endpoints"]
  node_quizservice["Quiz service<br/>[quizService.ts]"]
  node_topicservice["Topic service<br/>[topicService.ts]"]
  node_userservice["User service<br/>[userService.ts]"]
end

subgraph group_identity["Identity and data"]
  node_auth["Authentication context<br/>[AuthContext.tsx]"]
  node_clientfirebase["Client Firebase setup<br/>[firebase.ts]"]
  node_serverfirebase["Server Firebase setup<br/>[firebase.ts]"]
end

node_learner(("Learner"))
node_firebaseauth[("Firebase Auth and Firestore")]
node_contentapi["Topic content API"]
node_paymentprovider["Payment provider"]

node_learner -->|"uses"| node_app
node_app -->|"routes to"| node_topic
node_app -->|"routes to"| node_results
node_app -->|"routes to"| node_accounts
node_app -->|"checks session"| node_auth
node_topic -->|"renders"| node_topicviews
node_results -->|"renders"| node_resultviews
node_engine -->|"reads user"| node_auth
node_engine -->|"dispatches state"| node_reducer
node_engine -->|"initializes quiz"| node_initialization
node_engine -->|"manages lifecycle"| node_lifecycle
node_initialization -->|"loads content"| node_contentloader
node_initialization -->|"loads attempts"| node_clientapi
node_initialization -->|"reads and saves"| node_localstate
node_lifecycle -->|"saves and finalizes"| node_clientapi
node_lifecycle -->|"persists results"| node_localstate
node_contentloader -->|"fetches data"| node_clientapi
node_clientapi -->|"requests topic data"| node_contentapi
node_clientapi -.->|"calls functions"| node_functions
node_auth -->|"uses Firebase"| node_clientfirebase
node_auth -->|"authenticates and observes profile"| node_firebaseauth
node_functions -->|"routes to"| node_quizcontroller
node_functions -->|"routes to"| node_topiccontroller
node_functions -->|"routes to"| node_usercontroller
node_functions -->|"routes to"| node_stripecontroller
node_quizcontroller -->|"delegates to"| node_quizservice
node_quizcontroller -->|"looks up attempts"| node_userservice
node_topiccontroller -->|"delegates to"| node_topicservice
node_quizservice -->|"uses Firebase"| node_serverfirebase
node_topicservice -->|"uses Firebase"| node_serverfirebase
node_userservice -->|"uses Firebase"| node_serverfirebase
node_usercontroller -->|"uses Firebase"| node_serverfirebase
node_stripecontroller -->|"uses Firebase"| node_serverfirebase
node_stripecontroller -.->|"payment integration"| node_paymentprovider

click node_app "https://github.com/devpanchal02/dental-edge/blob/main/client/src/App.tsx"
click node_topic "https://github.com/devpanchal02/dental-edge/blob/main/client/src/pages/TopicPage.tsx"
click node_results "https://github.com/devpanchal02/dental-edge/blob/main/client/src/pages/ResultsPage.tsx"
click node_accounts "https://github.com/devpanchal02/dental-edge/tree/main/client/src/pages"
click node_topicviews "https://github.com/devpanchal02/dental-edge/tree/main/client/src/components/topic"
click node_resultviews "https://github.com/devpanchal02/dental-edge/tree/main/client/src/components"
click node_engine "https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/useQuizEngine.ts"
click node_initialization "https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/useQuizInitialization.ts"
click node_lifecycle "https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/useQuizLifecycle.ts"
click node_reducer "https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/quizReducer.ts"
click node_localstate "https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/quizStorageUtils.ts"
click node_contentloader "https://github.com/devpanchal02/dental-edge/blob/main/client/src/services/loader.ts"
click node_clientapi "https://github.com/devpanchal02/dental-edge/blob/main/client/src/services/api.ts"
click node_quiztypes "https://github.com/devpanchal02/dental-edge/blob/main/client/src/schemas/quiz.schemas.ts"
click node_auth "https://github.com/devpanchal02/dental-edge/blob/main/client/src/context/AuthContext.tsx"
click node_clientfirebase "https://github.com/devpanchal02/dental-edge/blob/main/client/src/firebase.ts"
click node_functions "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/index.ts"
click node_quizcontroller "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/quizController.ts"
click node_topiccontroller "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/topicController.ts"
click node_usercontroller "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/userController.ts"
click node_stripecontroller "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/stripeController.ts"
click node_quizservice "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/quizService.ts"
click node_topicservice "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/topicService.ts"
click node_userservice "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/userService.ts"
click node_serverfirebase "https://github.com/devpanchal02/dental-edge/blob/main/functions/src/firebase.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_app,node_topic,node_results,node_accounts,node_topicviews,node_resultviews,node_clientapi toneBlue
class node_engine,node_initialization,node_lifecycle,node_reducer,node_localstate,node_contentloader,node_quiztypes,node_firebaseauth toneAmber
class node_functions,node_quizcontroller,node_topiccontroller,node_usercontroller,node_stripecontroller,node_quizservice,node_topicservice,node_userservice,node_contentapi toneMint
class node_auth,node_clientfirebase,node_serverfirebase toneRose
class node_learner,node_paymentprovider toneIndigo
```

## Components

### Client app

- [Route application](https://github.com/devpanchal02/dental-edge/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Topic browsing](https://github.com/devpanchal02/dental-edge/blob/main/client/src/pages/TopicPage.tsx): `client/src/pages/TopicPage.tsx`
- [Results review](https://github.com/devpanchal02/dental-edge/blob/main/client/src/pages/ResultsPage.tsx): `client/src/pages/ResultsPage.tsx`
- [Account and plans](https://github.com/devpanchal02/dental-edge/tree/main/client/src/pages): `client/src/pages`
- [Topic analytics views](https://github.com/devpanchal02/dental-edge/tree/main/client/src/components/topic): `client/src/components/topic`
- [Result visualizations](https://github.com/devpanchal02/dental-edge/tree/main/client/src/components): `client/src/components`
- [Client API](https://github.com/devpanchal02/dental-edge/blob/main/client/src/services/api.ts): `client/src/services/api.ts`

### Quiz workflow

- [Quiz engine](https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/useQuizEngine.ts): `client/src/hooks/useQuizEngine.ts`
- [Quiz initialization](https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/useQuizInitialization.ts): `client/src/hooks/quiz/useQuizInitialization.ts`
- [Quiz lifecycle](https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/useQuizLifecycle.ts): `client/src/hooks/quiz/useQuizLifecycle.ts`
- [Quiz state reducer](https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/quizReducer.ts): `client/src/hooks/quiz/quizReducer.ts`
- [Local attempt storage](https://github.com/devpanchal02/dental-edge/blob/main/client/src/hooks/quiz/quizStorageUtils.ts): `client/src/hooks/quiz/quizStorageUtils.ts`
- [Content loading and sanitizing](https://github.com/devpanchal02/dental-edge/blob/main/client/src/services/loader.ts): `client/src/services/loader.ts`
- [Quiz schemas and types](https://github.com/devpanchal02/dental-edge/blob/main/client/src/schemas/quiz.schemas.ts): `client/src/schemas/quiz.schemas.ts`

### Backend services

- [Function entry and routing](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Quiz endpoints](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/quizController.ts): `functions/src/controllers/quizController.ts`
- [Topic endpoints](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/topicController.ts): `functions/src/controllers/topicController.ts`
- [User endpoints](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/userController.ts): `functions/src/controllers/userController.ts`
- [Stripe endpoints](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/controllers/stripeController.ts): `functions/src/controllers/stripeController.ts`
- [Quiz service](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/quizService.ts): `functions/src/services/quizService.ts`
- [Topic service](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/topicService.ts): `functions/src/services/topicService.ts`
- [User service](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/services/userService.ts): `functions/src/services/userService.ts`

### Identity and data

- [Authentication context](https://github.com/devpanchal02/dental-edge/blob/main/client/src/context/AuthContext.tsx): `client/src/context/AuthContext.tsx`
- [Client Firebase setup](https://github.com/devpanchal02/dental-edge/blob/main/client/src/firebase.ts): `client/src/firebase.ts`
- [Server Firebase setup](https://github.com/devpanchal02/dental-edge/blob/main/functions/src/firebase.ts): `functions/src/firebase.ts`

### Other components

- **Learner**
- **Firebase Auth and Firestore**
- **Topic content API**
- **Payment provider**

## Connections

- Learner → Route application: uses
- Route application → Topic browsing: routes to (evidence: `client/src/App.tsx`)
- Route application → Results review: routes to (evidence: `client/src/App.tsx`)
- Route application → Account and plans: routes to (evidence: `client/src/App.tsx`)
- Route application → Authentication context: checks session (evidence: `client/src/App.tsx`)
- Topic browsing → Topic analytics views: renders (evidence: `client/src/pages/TopicPage.tsx`)
- Results review → Result visualizations: renders (evidence: `client/src/pages/ResultsPage.tsx`)
- Quiz engine → Authentication context: reads user (evidence: `client/src/hooks/useQuizEngine.ts`)
- Quiz engine → Quiz state reducer: dispatches state (evidence: `client/src/hooks/useQuizEngine.ts`)
- Quiz engine → Quiz initialization: initializes quiz (evidence: `client/src/hooks/useQuizEngine.ts`)
- Quiz engine → Quiz lifecycle: manages lifecycle (evidence: `client/src/hooks/useQuizEngine.ts`)
- Quiz initialization → Content loading and sanitizing: loads content (evidence: `client/src/hooks/quiz/useQuizInitialization.ts`)
- Quiz initialization → Client API: loads attempts (evidence: `client/src/hooks/quiz/useQuizInitialization.ts`)
- Quiz initialization → Local attempt storage: reads and saves (evidence: `client/src/hooks/quiz/useQuizInitialization.ts`)
- Quiz lifecycle → Client API: saves and finalizes (evidence: `client/src/hooks/quiz/useQuizLifecycle.ts`)
- Quiz lifecycle → Local attempt storage: persists results (evidence: `client/src/hooks/quiz/useQuizLifecycle.ts`)
- Content loading and sanitizing → Client API: fetches data (evidence: `client/src/services/loader.ts`)
- Client API → Topic content API: requests topic data (evidence: `client/src/services/api.ts`)
- Client API → Function entry and routing: calls functions
- Authentication context → Client Firebase setup: uses Firebase (evidence: `client/src/context/AuthContext.tsx`)
- Authentication context → Firebase Auth and Firestore: authenticates and observes profile (evidence: `client/src/context/AuthContext.tsx`)
- Function entry and routing → Quiz endpoints: routes to (evidence: `functions/src/index.ts`)
- Function entry and routing → Topic endpoints: routes to (evidence: `functions/src/index.ts`)
- Function entry and routing → User endpoints: routes to (evidence: `functions/src/index.ts`)
- Function entry and routing → Stripe endpoints: routes to (evidence: `functions/src/index.ts`)
- Quiz endpoints → Quiz service: delegates to (evidence: `functions/src/controllers/quizController.ts`)
- Quiz endpoints → User service: looks up attempts (evidence: `functions/src/controllers/quizController.ts`)
- Topic endpoints → Topic service: delegates to (evidence: `functions/src/controllers/topicController.ts`)
- Quiz service → Server Firebase setup: uses Firebase (evidence: `functions/src/services/quizService.ts`)
- Topic service → Server Firebase setup: uses Firebase (evidence: `functions/src/services/topicService.ts`)
- User service → Server Firebase setup: uses Firebase (evidence: `functions/src/services/userService.ts`)
- User endpoints → Server Firebase setup: uses Firebase (evidence: `functions/src/controllers/userController.ts`)
- Stripe endpoints → Server Firebase setup: uses Firebase (evidence: `functions/src/controllers/stripeController.ts`)
- Stripe endpoints → Payment provider: payment integration
