# omkar-afk1213/ai_quize architecture

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

## Overview

AI Quiz is a React quiz application with an Express backend. Users choose a topic, difficulty, and question count, request generated questions, answer a multiple-choice quiz, and see a score. The backend uses an OpenAI-compatible provider when configured and falls back to locally generated questions otherwise. The README identifies `server.js` as the backend; `api/generate-quiz.js` provides a separate serverless implementation of the generation endpoint. The sampled excerpts do not establish how deployment selects between them or how account data is persisted.

Main entry points: [`src/App.jsx`](https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx) (Quiz setup), [`server.js`](https://github.com/omkar-afk1213/ai_quize/blob/main/server.js) (Express API), [`src/main.jsx`](https://github.com/omkar-afk1213/ai_quize/blob/main/src/main.jsx) (React entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Quiz client"]
  node_app_entry["React entry<br/>[main.jsx]"]
  node_account_ui["Login and accounts<br/>[App.jsx]"]
  node_quiz_setup["Quiz setup<br/>[App.jsx]"]
  node_quiz_session["Questions and scoring<br/>[App.jsx]"]
end

subgraph group_backend["Quiz backend"]
  node_express_api["Express API<br/>[server.js]"]
  node_fallback["Fallback generator<br/>[server.js]"]
  node_serverless_api["Serverless quiz API<br/>[generate-quiz.js]"]
  node_health_api["Health endpoint<br/>[health.js]"]
end

subgraph group_integrations["External AI"]
  node_ai_provider["OpenAI / OpenRouter"]
end

node_student(("Student or admin"))

node_app_entry -->|"renders"| node_account_ui
node_student -.->|"uses"| node_account_ui
node_account_ui -.->|"continues to"| node_quiz_setup
node_quiz_setup -->|"requests questions"| node_express_api
node_express_api -->|"requests generation"| node_ai_provider
node_express_api -->|"uses when needed"| node_fallback
node_quiz_setup -.->|"shows generated quiz"| node_quiz_session

click node_app_entry "https://github.com/omkar-afk1213/ai_quize/blob/main/src/main.jsx"
click node_account_ui "https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx"
click node_quiz_setup "https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx"
click node_quiz_session "https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx"
click node_express_api "https://github.com/omkar-afk1213/ai_quize/blob/main/server.js"
click node_fallback "https://github.com/omkar-afk1213/ai_quize/blob/main/server.js"
click node_serverless_api "https://github.com/omkar-afk1213/ai_quize/blob/main/api/generate-quiz.js"
click node_health_api "https://github.com/omkar-afk1213/ai_quize/blob/main/api/health.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_app_entry,node_account_ui,node_quiz_setup,node_quiz_session toneBlue
class node_express_api,node_fallback,node_serverless_api,node_health_api toneAmber
class node_ai_provider toneMint
class node_student toneIndigo
```

## Components

### Quiz client

- [React entry](https://github.com/omkar-afk1213/ai_quize/blob/main/src/main.jsx): `src/main.jsx`
- [Login and accounts](https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx): `src/App.jsx`
- [Quiz setup](https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx): `src/App.jsx`
- [Questions and scoring](https://github.com/omkar-afk1213/ai_quize/blob/main/src/App.jsx): `src/App.jsx`

### Quiz backend

- [Express API](https://github.com/omkar-afk1213/ai_quize/blob/main/server.js): `server.js`
- [Fallback generator](https://github.com/omkar-afk1213/ai_quize/blob/main/server.js): `server.js`
- [Serverless quiz API](https://github.com/omkar-afk1213/ai_quize/blob/main/api/generate-quiz.js): `api/generate-quiz.js`
- [Health endpoint](https://github.com/omkar-afk1213/ai_quize/blob/main/api/health.js): `api/health.js`

### External AI

- **OpenAI / OpenRouter**

### Other components

- **Student or admin**

## Connections

- React entry → Login and accounts: renders (evidence: `src/main.jsx`)
- Student or admin → Login and accounts: uses
- Login and accounts → Quiz setup: continues to (evidence: `src/App.jsx`)
- Quiz setup → Express API: requests questions (evidence: `README.md`)
- Express API → OpenAI / OpenRouter: requests generation (evidence: `server.js`)
- Express API → Fallback generator: uses when needed (evidence: `server.js`)
- Quiz setup → Questions and scoring: shows generated quiz (evidence: `src/App.jsx`)
