# anurag19-eng/simulai architecture

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

- Interactive diagram: https://gitdiagram.com/anurag19-eng/simulai
- Repository: https://github.com/anurag19-eng/simulai

## Overview

SimulAI is a Flask-based interview simulator. Candidates register or log in, choose an interview track, upload a PDF CV, then exchange streamed responses with a Gemini-powered interviewer; interview history and persistent memory are stored in SQLite. The map includes the documented browser voice features and result UI. Source excerpts support the main route, engine, and storage relationships; some frontend and template wiring is documented only at a high level, and evaluation implementation is not established by the sampled source.

Main entry points: [`app.py`](https://github.com/anurag19-eng/simulai/blob/main/app.py) (Flask routes), [`database.py`](https://github.com/anurag19-eng/simulai/blob/main/database.py) (SQLite access), [`engine.py`](https://github.com/anurag19-eng/simulai/blob/main/engine.py) (Interview engine), [`static/js/chat.js`](https://github.com/anurag19-eng/simulai/blob/main/static/js/chat.js) (Chat and voice UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_pages["Login and dashboard"]
  node_loginui["Login interface<br/>[login.js]"]
  node_chatui["Chat and voice UI<br/>[chat.js]"]
  node_cvui["CV uploader<br/>[cv.js]"]
  node_resultui["Interview result UI<br/>[chat.js]"]
end

subgraph group_workflow["Interview workflow"]
  node_flask["Flask routes<br/>[app.py]"]
  node_tracks["Interview tracks"]
  node_pdf["PDF extraction<br/>[app.py]"]
end

subgraph group_intelligence["AI interview"]
  node_engine["Interview engine<br/>[engine.py]"]
  node_prompts["Role prompts"]
  node_gemini{{"Gemini API"}}
  node_memory["Memory summarizer<br/>[engine.py]"]
end

subgraph group_persistence["Persistence"]
  node_dbapi["SQLite access<br/>[database.py]"]
  node_store[("Interview database<br/>[database.py]")]
end

node_candidate(("Candidate"))

node_candidate -->|"enters credentials"| node_loginui
node_loginui -.->|"submits login"| node_flask
node_flask -->|"authenticates and initializes"| node_dbapi
node_candidate -->|"chooses track"| node_pages
node_flask -.->|"selects prompt track"| node_tracks
node_candidate -->|"selects PDF"| node_cvui
node_cvui -->|"uploads CV"| node_flask
node_flask -->|"extracts text"| node_pdf
node_flask -.->|"stores resume"| node_dbapi
node_flask -->|"requests opening response"| node_engine
node_engine -->|"reads resume and context"| node_dbapi
node_engine -->|"selects role prompt"| node_prompts
node_engine -->|"streams generation"| node_gemini
node_candidate -->|"sends answers"| node_chatui
node_chatui -->|"posts chat message"| node_flask
node_flask -->|"records messages"| node_dbapi
node_flask -->|"updates memory"| node_memory
node_memory -->|"reads and updates memory"| node_dbapi
node_engine -->|"loads recent context"| node_dbapi
node_engine -->|"generates interview reply"| node_gemini
node_flask -->|"streams reply"| node_chatui
node_dbapi -->|"reads and writes records"| node_store
node_chatui -.->|"shows result view"| node_resultui
node_chatui -->|"supports browser speech"| node_candidate

click node_pages "https://github.com/anurag19-eng/simulai/tree/main/templates"
click node_loginui "https://github.com/anurag19-eng/simulai/blob/main/static/js/login.js"
click node_chatui "https://github.com/anurag19-eng/simulai/blob/main/static/js/chat.js"
click node_cvui "https://github.com/anurag19-eng/simulai/blob/main/static/js/cv.js"
click node_flask "https://github.com/anurag19-eng/simulai/blob/main/app.py"
click node_tracks "https://github.com/anurag19-eng/simulai/tree/main/interviewers"
click node_pdf "https://github.com/anurag19-eng/simulai/blob/main/app.py"
click node_engine "https://github.com/anurag19-eng/simulai/blob/main/engine.py"
click node_prompts "https://github.com/anurag19-eng/simulai/tree/main/interviewers"
click node_memory "https://github.com/anurag19-eng/simulai/blob/main/engine.py"
click node_dbapi "https://github.com/anurag19-eng/simulai/blob/main/database.py"
click node_store "https://github.com/anurag19-eng/simulai/blob/main/database.py"
click node_resultui "https://github.com/anurag19-eng/simulai/blob/main/static/js/chat.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_pages,node_loginui,node_chatui,node_cvui,node_resultui toneBlue
class node_flask,node_tracks,node_pdf toneAmber
class node_engine,node_prompts,node_gemini,node_memory toneMint
class node_dbapi,node_store toneRose
class node_candidate toneIndigo
```

## Components

### Web experience

- [Login and dashboard](https://github.com/anurag19-eng/simulai/tree/main/templates): `templates`
- [Login interface](https://github.com/anurag19-eng/simulai/blob/main/static/js/login.js): `static/js/login.js`
- [Chat and voice UI](https://github.com/anurag19-eng/simulai/blob/main/static/js/chat.js): `static/js/chat.js`
- [CV uploader](https://github.com/anurag19-eng/simulai/blob/main/static/js/cv.js): `static/js/cv.js`
- [Interview result UI](https://github.com/anurag19-eng/simulai/blob/main/static/js/chat.js): `static/js/chat.js`

### Interview workflow

- [Flask routes](https://github.com/anurag19-eng/simulai/blob/main/app.py): `app.py`
- [Interview tracks](https://github.com/anurag19-eng/simulai/tree/main/interviewers): `interviewers`
- [PDF extraction](https://github.com/anurag19-eng/simulai/blob/main/app.py): `app.py`

### AI interview

- [Interview engine](https://github.com/anurag19-eng/simulai/blob/main/engine.py): `engine.py`
- [Role prompts](https://github.com/anurag19-eng/simulai/tree/main/interviewers): `interviewers`
- **Gemini API**
- [Memory summarizer](https://github.com/anurag19-eng/simulai/blob/main/engine.py): `engine.py`

### Persistence

- [SQLite access](https://github.com/anurag19-eng/simulai/blob/main/database.py): `database.py`
- [Interview database](https://github.com/anurag19-eng/simulai/blob/main/database.py): `database.py`

### Other components

- **Candidate**

## Connections

- Candidate → Login interface: enters credentials (evidence: `README.md`)
- Login interface → Flask routes: submits login (evidence: `README.md`)
- Flask routes → SQLite access: authenticates and initializes (evidence: `app.py`)
- Candidate → Login and dashboard: chooses track (evidence: `README.md`)
- Flask routes → Interview tracks: selects prompt track (evidence: `README.md`)
- Candidate → CV uploader: selects PDF (evidence: `static/js/cv.js`)
- CV uploader → Flask routes: uploads CV (evidence: `static/js/cv.js`)
- Flask routes → PDF extraction: extracts text (evidence: `app.py`)
- Flask routes → SQLite access: stores resume (evidence: `README.md`)
- Flask routes → Interview engine: requests opening response (evidence: `app.py`)
- Interview engine → SQLite access: reads resume and context (evidence: `engine.py`)
- Interview engine → Role prompts: selects role prompt (evidence: `engine.py`)
- Interview engine → Gemini API: streams generation (evidence: `engine.py`)
- Candidate → Chat and voice UI: sends answers (evidence: `README.md`)
- Chat and voice UI → Flask routes: posts chat message (evidence: `static/js/chat.js`)
- Flask routes → SQLite access: records messages (evidence: `app.py`)
- Flask routes → Memory summarizer: updates memory (evidence: `app.py`)
- Memory summarizer → SQLite access: reads and updates memory (evidence: `engine.py`)
- Interview engine → SQLite access: loads recent context (evidence: `engine.py`)
- Interview engine → Gemini API: generates interview reply (evidence: `engine.py`)
- Flask routes → Chat and voice UI: streams reply (evidence: `README.md`)
- SQLite access → Interview database: reads and writes records (evidence: `database.py`)
- Chat and voice UI → Interview result UI: shows result view (evidence: `README.md`)
- Chat and voice UI → Candidate: supports browser speech (evidence: `README.md`)
